From 4b123dbcfbfa247db958d6f84e0b7ed85f9db0a9 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 1 May 2021 16:46:35 -0500 Subject: [PATCH] Refactor: Use 'main' instead of 'data'. The original goal of 'data' is to be used as the main store of data for the program. A program using the programs as a library are also expected to get and use this structure. The problem is that the programs are designed such that the caller to the program (as a library) should not have access to internal details. Refactor 'data' to 'main'. This is a more precise name in that it is the structure passed as if it were called from 'main(argc, argv)'. This also frees up 'data' for internal use such that 'data' can now be the more generalized 'data' without exposing anything to 'main'. The Controller program is already using 'main', so that 'main' was refactored to 'global'. There are still more changes to do, such as restructuring the 'main' types to ensure nothing unwanted is exposed to a caller. These additional changes, however, are beyond this scope of this commit. --- level_3/byte_dump/c/byte_dump.c | 294 ++-- level_3/byte_dump/c/byte_dump.h | 30 +- level_3/byte_dump/c/main.c | 6 +- level_3/byte_dump/c/private-byte_dump.c | 490 +++--- level_3/byte_dump/c/private-byte_dump.h | 30 +- level_3/control/c/control.c | 18 +- level_3/control/c/control.h | 24 +- level_3/control/c/main.c | 6 +- level_3/controller/c/controller.c | 240 +-- level_3/controller/c/controller.h | 30 +- level_3/controller/c/main.c | 36 +- level_3/controller/c/private-common.c | 12 +- level_3/controller/c/private-common.h | 36 +- level_3/controller/c/private-controller.c | 692 ++++---- level_3/controller/c/private-controller.h | 42 +- level_3/controller/c/private-entry.c | 330 ++-- level_3/controller/c/private-entry.h | 20 +- level_3/controller/c/private-rule.c | 1684 ++++++++++---------- level_3/controller/c/private-rule.h | 84 +- level_3/controller/c/private-thread.c | 380 ++--- level_3/controller/c/private-thread.h | 34 +- level_3/fake/c/fake.c | 268 ++-- level_3/fake/c/fake.h | 32 +- level_3/fake/c/main.c | 32 +- level_3/fake/c/private-build.c | 974 +++++------ level_3/fake/c/private-build.h | 120 +- level_3/fake/c/private-clean.c | 26 +- level_3/fake/c/private-clean.h | 6 +- level_3/fake/c/private-fake.c | 552 +++---- level_3/fake/c/private-fake.h | 42 +- level_3/fake/c/private-make.c | 956 +++++------ level_3/fake/c/private-make.h | 146 +- level_3/fake/c/private-print.c | 438 ++--- level_3/fake/c/private-print.h | 78 +- level_3/fake/c/private-skeleton.c | 154 +- level_3/fake/c/private-skeleton.h | 18 +- level_3/firewall/c/firewall.c | 60 +- level_3/firewall/c/firewall.h | 24 +- level_3/firewall/c/main.c | 6 +- level_3/firewall/c/private-firewall.c | 258 +-- level_3/firewall/c/private-firewall.h | 40 +- .../fss_basic_list_read/c/fss_basic_list_read.c | 248 +-- .../fss_basic_list_read/c/fss_basic_list_read.h | 32 +- level_3/fss_basic_list_read/c/main.c | 6 +- .../c/private-fss_basic_list_read.c | 360 ++--- .../c/private-fss_basic_list_read.h | 36 +- .../fss_basic_list_write/c/fss_basic_list_write.c | 322 ++-- .../fss_basic_list_write/c/fss_basic_list_write.h | 30 +- level_3/fss_basic_list_write/c/main.c | 6 +- .../c/private-fss_basic_list_write.c | 76 +- .../c/private-fss_basic_list_write.h | 30 +- level_3/fss_basic_read/c/fss_basic_read.c | 224 +-- level_3/fss_basic_read/c/fss_basic_read.h | 32 +- level_3/fss_basic_read/c/main.c | 6 +- level_3/fss_basic_read/c/private-fss_basic_read.c | 248 +-- level_3/fss_basic_read/c/private-fss_basic_read.h | 48 +- level_3/fss_basic_write/c/fss_basic_write.c | 312 ++-- level_3/fss_basic_write/c/fss_basic_write.h | 26 +- level_3/fss_basic_write/c/main.c | 6 +- .../fss_basic_write/c/private-fss_basic_write.c | 78 +- .../fss_basic_write/c/private-fss_basic_write.h | 30 +- .../c/fss_embedded_list_read.c | 234 +-- .../c/fss_embedded_list_read.h | 32 +- level_3/fss_embedded_list_read/c/main.c | 6 +- .../c/private-fss_embedded_list_read.c | 308 ++-- .../c/private-fss_embedded_list_read.h | 66 +- .../c/fss_embedded_list_write.c | 324 ++-- .../c/fss_embedded_list_write.h | 30 +- level_3/fss_embedded_list_write/c/main.c | 6 +- .../c/private-fss_embedded_list_write.c | 98 +- .../c/private-fss_embedded_list_write.h | 36 +- .../c/fss_extended_list_read.c | 248 +-- .../c/fss_extended_list_read.h | 32 +- level_3/fss_extended_list_read/c/main.c | 6 +- .../c/private-fss_extended_list_read.c | 376 ++--- .../c/private-fss_extended_list_read.h | 36 +- .../c/fss_extended_list_write.c | 324 ++-- .../c/fss_extended_list_write.h | 30 +- level_3/fss_extended_list_write/c/main.c | 6 +- .../c/private-fss_extended_list_write.c | 98 +- .../c/private-fss_extended_list_write.h | 36 +- level_3/fss_extended_read/c/fss_extended_read.c | 248 +-- level_3/fss_extended_read/c/fss_extended_read.h | 32 +- level_3/fss_extended_read/c/main.c | 6 +- .../c/private-fss_extended_read.c | 392 ++--- .../c/private-fss_extended_read.h | 36 +- level_3/fss_extended_write/c/fss_extended_write.c | 354 ++-- level_3/fss_extended_write/c/fss_extended_write.h | 30 +- level_3/fss_extended_write/c/main.c | 6 +- .../c/private-fss_extended_write.c | 76 +- .../c/private-fss_extended_write.h | 20 +- level_3/fss_status_code/c/fss_status_code.c | 146 +- level_3/fss_status_code/c/fss_status_code.h | 30 +- level_3/fss_status_code/c/main.c | 6 +- .../fss_status_code/c/private-fss_status_code.c | 38 +- .../fss_status_code/c/private-fss_status_code.h | 24 +- level_3/iki_read/c/iki_read.c | 328 ++-- level_3/iki_read/c/iki_read.h | 32 +- level_3/iki_read/c/main.c | 6 +- level_3/iki_read/c/private-iki_read.c | 180 +-- level_3/iki_read/c/private-iki_read.h | 44 +- level_3/iki_write/c/iki_write.c | 198 +-- level_3/iki_write/c/iki_write.h | 32 +- level_3/iki_write/c/main.c | 6 +- level_3/iki_write/c/private-iki_write.c | 30 +- level_3/iki_write/c/private-iki_write.h | 6 +- level_3/status_code/c/main.c | 6 +- level_3/status_code/c/private-status_code.c | 38 +- level_3/status_code/c/private-status_code.h | 24 +- level_3/status_code/c/status_code.c | 146 +- level_3/status_code/c/status_code.h | 30 +- 111 files changed, 7893 insertions(+), 7893 deletions(-) diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index fca7fcc..b703d74 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -76,33 +76,33 @@ extern "C" { #endif // _di_byte_dump_print_help_ #ifndef _di_byte_dump_main_ - f_status_t byte_dump_main(const f_console_arguments_t arguments, byte_dump_data_t *data) { + f_status_t byte_dump_main(const f_console_arguments_t arguments, byte_dump_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, byte_dump_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, byte_dump_total_parameters); // Identify priority of color parameters. { f_console_parameter_id_t ids[3] = { byte_dump_parameter_no_color, byte_dump_parameter_light, byte_dump_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return F_status_set_error(status); } } @@ -116,23 +116,23 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return status; } if (choice == byte_dump_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == byte_dump_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == byte_dump_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == byte_dump_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } @@ -145,26 +145,26 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return F_status_set_error(status); } if (choice == byte_dump_parameter_hexidecimal) { - data->mode = byte_dump_mode_hexidecimal; + main->mode = byte_dump_mode_hexidecimal; } else if (choice == byte_dump_parameter_duodecimal) { - data->mode = byte_dump_mode_duodecimal; + main->mode = byte_dump_mode_duodecimal; } else if (choice == byte_dump_parameter_octal) { - data->mode = byte_dump_mode_octal; + main->mode = byte_dump_mode_octal; } else if (choice == byte_dump_parameter_binary) { - data->mode = byte_dump_mode_binary; + main->mode = byte_dump_mode_binary; } else if (choice == byte_dump_parameter_decimal) { - data->mode = byte_dump_mode_decimal; + main->mode = byte_dump_mode_decimal; } } @@ -177,51 +177,51 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return F_status_set_error(status); } if (choice == byte_dump_parameter_normal) { - data->presentation = byte_dump_presentation_normal; + main->presentation = byte_dump_presentation_normal; } else if (choice == byte_dump_parameter_simple) { - data->presentation = byte_dump_presentation_simple; + main->presentation = byte_dump_presentation_simple; } else if (choice == byte_dump_parameter_classic) { - data->presentation = byte_dump_presentation_classic; + main->presentation = byte_dump_presentation_classic; } } status = F_none; } - if (data->parameters[byte_dump_parameter_help].result == f_console_result_found) { - byte_dump_print_help(data->output, data->context); + if (main->parameters[byte_dump_parameter_help].result == f_console_result_found) { + byte_dump_print_help(main->output, main->context); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return F_none; } - if (data->parameters[byte_dump_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, byte_dump_version); + if (main->parameters[byte_dump_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, byte_dump_version); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return F_none; } - if (data->remaining.used > 0 || data->process_pipe) { - if (data->parameters[byte_dump_parameter_width].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_width); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + if (main->remaining.used > 0 || main->process_pipe) { + if (main->parameters[byte_dump_parameter_width].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_width); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return F_status_set_error(status); } - else if (data->parameters[byte_dump_parameter_width].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[byte_dump_parameter_width].values.array[data->parameters[byte_dump_parameter_width].values.used - 1]; + else if (main->parameters[byte_dump_parameter_width].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[byte_dump_parameter_width].values.array[main->parameters[byte_dump_parameter_width].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); f_number_unsigned_t number = 0; @@ -229,31 +229,31 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &number); if (F_status_is_error(status) || number < 1 || number >= 0xfb) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_width); - f_color_print(data->error.to.stream, data->context.set.error, "' value can only be a number between "); - f_color_print(data->error.to.stream, data->context.set.notable, "0"); - f_color_print(data->error.to.stream, data->context.set.error, " and "); - f_color_print(data->error.to.stream, data->context.set.notable, "251"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); - - byte_dump_data_delete(data); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_width); + f_color_print(main->error.to.stream, main->context.set.error, "' value can only be a number between "); + f_color_print(main->error.to.stream, main->context.set.notable, "0"); + f_color_print(main->error.to.stream, main->context.set.error, " and "); + f_color_print(main->error.to.stream, main->context.set.notable, "251"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); + + byte_dump_main_delete(main); return F_status_set_error(status); } - data->width = (uint8_t) number; + main->width = (uint8_t) number; } - if (data->parameters[byte_dump_parameter_first].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_first); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + if (main->parameters[byte_dump_parameter_first].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_first); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return F_status_set_error(status); } - else if (data->parameters[byte_dump_parameter_first].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[byte_dump_parameter_first].values.array[data->parameters[byte_dump_parameter_first].values.used - 1]; + else if (main->parameters[byte_dump_parameter_first].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[byte_dump_parameter_first].values.array[main->parameters[byte_dump_parameter_first].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); f_number_unsigned_t number = 0; @@ -261,31 +261,31 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &number); if (F_status_is_error(status) || number > f_number_t_size_unsigned) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_first); - f_color_print(data->error.to.stream, data->context.set.error, "' value can only be a number (inclusively) between "); - f_color_print(data->error.to.stream, data->context.set.notable, "0"); - f_color_print(data->error.to.stream, data->context.set.error, " and "); - f_color_print(data->error.to.stream, data->context.set.notable, "%llu", f_number_t_size_unsigned); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); - - byte_dump_data_delete(data); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_first); + f_color_print(main->error.to.stream, main->context.set.error, "' value can only be a number (inclusively) between "); + f_color_print(main->error.to.stream, main->context.set.notable, "0"); + f_color_print(main->error.to.stream, main->context.set.error, " and "); + f_color_print(main->error.to.stream, main->context.set.notable, "%llu", f_number_t_size_unsigned); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); + + byte_dump_main_delete(main); return F_status_set_error(status); } - data->first = number; + main->first = number; } - if (data->parameters[byte_dump_parameter_last].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_last); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + if (main->parameters[byte_dump_parameter_last].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_last); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return F_status_set_error(status); } - else if (data->parameters[byte_dump_parameter_last].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[byte_dump_parameter_last].values.array[data->parameters[byte_dump_parameter_last].values.used - 1]; + else if (main->parameters[byte_dump_parameter_last].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[byte_dump_parameter_last].values.array[main->parameters[byte_dump_parameter_last].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); f_number_unsigned_t number = 0; @@ -293,144 +293,144 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &number); if (F_status_is_error(status) || number < 0 || number > f_number_t_size_unsigned) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_last); - f_color_print(data->error.to.stream, data->context.set.error, "' value can only be a number (inclusively) between "); - f_color_print(data->error.to.stream, data->context.set.notable, "0"); - f_color_print(data->error.to.stream, data->context.set.error, " and "); - f_color_print(data->error.to.stream, data->context.set.notable, "%llu", f_number_t_size_unsigned); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); - - byte_dump_data_delete(data); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_last); + f_color_print(main->error.to.stream, main->context.set.error, "' value can only be a number (inclusively) between "); + f_color_print(main->error.to.stream, main->context.set.notable, "0"); + f_color_print(main->error.to.stream, main->context.set.error, " and "); + f_color_print(main->error.to.stream, main->context.set.notable, "%llu", f_number_t_size_unsigned); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); + + byte_dump_main_delete(main); return F_status_set_error(status); } - data->last = number; + main->last = number; } - if (data->parameters[byte_dump_parameter_first].result == f_console_result_additional && data->parameters[byte_dump_parameter_last].result == f_console_result_additional) { - if (data->first > data->last) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_first); - f_color_print(data->error.to.stream, data->context.set.error, "' value cannot be greater than the parameter '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_last); - f_color_print(data->error.to.stream, data->context.set.error, "' value.%c", f_string_eol_s[0]); + if (main->parameters[byte_dump_parameter_first].result == f_console_result_additional && main->parameters[byte_dump_parameter_last].result == f_console_result_additional) { + if (main->first > main->last) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_first); + f_color_print(main->error.to.stream, main->context.set.error, "' value cannot be greater than the parameter '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, byte_dump_long_last); + f_color_print(main->error.to.stream, main->context.set.error, "' value.%c", f_string_eol_s[0]); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return F_status_set_error(status); } // store last position as a relative offset from first instead of an absolute position. - data->last = (data->last - data->first) + 1; + main->last = (main->last - main->first) + 1; } - if (data->process_pipe) { + if (main->process_pipe) { f_file_t file = f_file_t_initialize; file.id = f_type_descriptor_input; file.stream = f_type_input; printf("%c", f_string_eol_s[0]); - f_color_print(data->output.stream, data->context.set.title, "Piped Byte Dump: (in "); + f_color_print(main->output.stream, main->context.set.title, "Piped Byte Dump: (in "); - if (data->mode == byte_dump_mode_hexidecimal) { - f_color_print(data->output.stream, data->context.set.title, "Hexidecimal"); + if (main->mode == byte_dump_mode_hexidecimal) { + f_color_print(main->output.stream, main->context.set.title, "Hexidecimal"); } - else if (data->mode == byte_dump_mode_duodecimal) { - f_color_print(data->output.stream, data->context.set.title, "Duodecimal"); + else if (main->mode == byte_dump_mode_duodecimal) { + f_color_print(main->output.stream, main->context.set.title, "Duodecimal"); } - else if (data->mode == byte_dump_mode_octal) { - f_color_print(data->output.stream, data->context.set.title, "Octal"); + else if (main->mode == byte_dump_mode_octal) { + f_color_print(main->output.stream, main->context.set.title, "Octal"); } - else if (data->mode == byte_dump_mode_binary) { - f_color_print(data->output.stream, data->context.set.title, "Binary"); + else if (main->mode == byte_dump_mode_binary) { + f_color_print(main->output.stream, main->context.set.title, "Binary"); } - else if (data->mode == byte_dump_mode_decimal) { - f_color_print(data->output.stream, data->context.set.title, "Decimal"); + else if (main->mode == byte_dump_mode_decimal) { + f_color_print(main->output.stream, main->context.set.title, "Decimal"); } - f_color_print(data->output.stream, data->context.set.title, ")%c", f_string_eol_s[0]); + f_color_print(main->output.stream, main->context.set.title, ")%c", f_string_eol_s[0]); - status = byte_dump_file(*data, 0, file); + status = byte_dump_file(*main, 0, file); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "byte_dump_file", F_true); + fll_error_print(main->error, F_status_set_fine(status), "byte_dump_file", F_true); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return status; } } - if (data->remaining.used > 0) { + if (main->remaining.used > 0) { // pre-process remaining arguments to ensure that they all files exist before processing. { f_status_t missing_files = F_none; - for (f_array_length_t counter = 0; counter < data->remaining.used; counter++) { + for (f_array_length_t counter = 0; counter < main->remaining.used; counter++) { - status = f_file_exists(arguments.argv[data->remaining.array[counter]]); + status = f_file_exists(arguments.argv[main->remaining.array[counter]]); if (status == F_false || F_status_is_error(status)) { if (missing_files == F_none) { missing_files = status; } - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_exists", F_true, arguments.argv[data->remaining.array[counter]], "find", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_exists", F_true, arguments.argv[main->remaining.array[counter]], "find", fll_error_file_type_file); } } // for if (missing_files != F_none) { status = F_status_set_error(missing_files); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return status; } } f_file_t file = f_file_t_initialize; - for (f_array_length_t counter = 0; counter < data->remaining.used; counter++) { + for (f_array_length_t counter = 0; counter < main->remaining.used; counter++) { - status = f_file_stream_open(arguments.argv[data->remaining.array[counter]], 0, &file); + status = f_file_stream_open(arguments.argv[main->remaining.array[counter]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[data->remaining.array[counter]], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[main->remaining.array[counter]], "open", fll_error_file_type_file); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return status; } printf("%c", f_string_eol_s[0]); - f_color_print(data->output.stream, data->context.set.title, "Byte Dump of: "); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.argv[data->remaining.array[counter]]); - f_color_print(data->output.stream, data->context.set.title, " (in "); + f_color_print(main->output.stream, main->context.set.title, "Byte Dump of: "); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.argv[main->remaining.array[counter]]); + f_color_print(main->output.stream, main->context.set.title, " (in "); - if (data->mode == byte_dump_mode_hexidecimal) { - f_color_print(data->output.stream, data->context.set.title, "Hexidecimal"); + if (main->mode == byte_dump_mode_hexidecimal) { + f_color_print(main->output.stream, main->context.set.title, "Hexidecimal"); } - else if (data->mode == byte_dump_mode_duodecimal) { - f_color_print(data->output.stream, data->context.set.title, "Duodecimal"); + else if (main->mode == byte_dump_mode_duodecimal) { + f_color_print(main->output.stream, main->context.set.title, "Duodecimal"); } - else if (data->mode == byte_dump_mode_octal) { - f_color_print(data->output.stream, data->context.set.title, "Octal"); + else if (main->mode == byte_dump_mode_octal) { + f_color_print(main->output.stream, main->context.set.title, "Octal"); } - else if (data->mode == byte_dump_mode_binary) { - f_color_print(data->output.stream, data->context.set.title, "Binary"); + else if (main->mode == byte_dump_mode_binary) { + f_color_print(main->output.stream, main->context.set.title, "Binary"); } - else if (data->mode == byte_dump_mode_decimal) { - f_color_print(data->output.stream, data->context.set.title, "Decimal"); + else if (main->mode == byte_dump_mode_decimal) { + f_color_print(main->output.stream, main->context.set.title, "Decimal"); } - f_color_print(data->output.stream, data->context.set.title, ")%c", f_string_eol_s[0]); + f_color_print(main->output.stream, main->context.set.title, ")%c", f_string_eol_s[0]); - status = byte_dump_file(*data, arguments.argv[data->remaining.array[counter]], file); + status = byte_dump_file(*main, arguments.argv[main->remaining.array[counter]], file); f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "byte_dump_file", F_true, arguments.argv[data->remaining.array[counter]], "process", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "byte_dump_file", F_true, arguments.argv[main->remaining.array[counter]], "process", fll_error_file_type_file); - byte_dump_data_delete(data); + byte_dump_main_delete(main); return status; } } // for @@ -440,31 +440,31 @@ extern "C" { } } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more filenames.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more filenames.%c", fll_error_print_error, f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - byte_dump_data_delete(data); + byte_dump_main_delete(main); return status; } #endif // _di_byte_dump_main_ -#ifndef _di_byte_dump_data_delete_ - f_status_t byte_dump_data_delete(byte_dump_data_t *data) { +#ifndef _di_byte_dump_main_delete_ + f_status_t byte_dump_main_delete(byte_dump_main_t *main) { for (f_array_length_t i = 0; i < byte_dump_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_byte_dump_data_delete_ +#endif // _di_byte_dump_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/byte_dump/c/byte_dump.h b/level_3/byte_dump/c/byte_dump.h index 7988fc9..64ea449 100644 --- a/level_3/byte_dump/c/byte_dump.h +++ b/level_3/byte_dump/c/byte_dump.h @@ -207,7 +207,7 @@ extern "C" { #define byte_dump_total_parameters 22 #endif // _di_byte_dump_defines_ -#ifndef _di_byte_dump_data_t_ +#ifndef _di_byte_dump_main_t_ typedef struct { f_console_parameter_t parameters[byte_dump_total_parameters]; @@ -224,9 +224,9 @@ extern "C" { uint8_t presentation; f_color_context_t context; - } byte_dump_data_t; + } byte_dump_main_t; - #define byte_dump_data_t_initialize \ + #define byte_dump_main_t_initialize \ { \ byte_dump_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -240,7 +240,7 @@ extern "C" { byte_dump_presentation_normal, \ f_color_context_t_initialize, \ } -#endif // _di_byte_dump_data_t_ +#endif // _di_byte_dump_main_t_ /** * Print help. @@ -260,30 +260,30 @@ extern "C" { /** * Execute main program. * - * Be sure to call byte_dump_data_delete() after executing this. + * Be sure to call byte_dump_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * Status codes (with error bit) are returned on any problem. * - * @see byte_dump_data_delete() + * @see byte_dump_main_delete() */ #ifndef _di_byte_dump_main_ - extern f_status_t byte_dump_main(const f_console_arguments_t arguments, byte_dump_data_t *data); + extern f_status_t byte_dump_main(const f_console_arguments_t arguments, byte_dump_main_t *main); #endif // _di_byte_dump_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing byte_dump_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -292,9 +292,9 @@ extern "C" { * * @see byte_dump_main() */ -#ifndef _di_byte_dump_data_delete_ - extern f_status_t byte_dump_data_delete(byte_dump_data_t *data); -#endif // _di_byte_dump_data_delete_ +#ifndef _di_byte_dump_main_delete_ + extern f_status_t byte_dump_main_delete(byte_dump_main_t *main); +#endif // _di_byte_dump_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/byte_dump/c/main.c b/level_3/byte_dump/c/main.c index 21355a1..b6dc21c 100644 --- a/level_3/byte_dump/c/main.c +++ b/level_3/byte_dump/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - byte_dump_data_t data = byte_dump_data_t_initialize; + byte_dump_main_t main = byte_dump_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = byte_dump_main(arguments, &data); + const f_status_t status = byte_dump_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/byte_dump/c/private-byte_dump.c b/level_3/byte_dump/c/private-byte_dump.c index 1e857f1..c5097d3 100644 --- a/level_3/byte_dump/c/private-byte_dump.c +++ b/level_3/byte_dump/c/private-byte_dump.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_byte_dump_file_ - f_status_t byte_dump_file(const byte_dump_data_t data, const f_string_t file_name, const f_file_t file) { + f_status_t byte_dump_file(const byte_dump_main_t main, const f_string_t file_name, const f_file_t file) { f_status_t status = F_none; @@ -25,35 +25,35 @@ extern "C" { bool character_reset = 0; bool found_invalid_utf = F_false; - // Store the current character data until it can be printed. + // Store the current character main until it can be printed. f_utf_string_dynamic_t characters = f_utf_string_dynamic_t_initialize; - f_utf_character_t character_array[data.width]; + f_utf_character_t character_array[main.width]; f_array_length_t character_current = 0; // The row starts based on the first byte starting point and how many columns of bytes are displayed per row. - if (data.first > 0) { - cell.row = data.first / data.width; - offset = data.first % data.width; + if (main.first > 0) { + cell.row = main.first / main.width; + offset = main.first % main.width; // fseek() cannot be used on a PIPE, so read instead of seek. if (file_name) { - byte_get = fseek(file.stream, data.first, SEEK_SET); + byte_get = fseek(file.stream, main.first, SEEK_SET); } else { - char skip[data.first]; + char skip[main.first]; - byte_get = fread(skip, sizeof(char), data.first, file.stream); + byte_get = fread(skip, sizeof(char), main.first, file.stream); } } - memset(&character_array, 0, sizeof(f_utf_character_t) * data.width); + memset(&character_array, 0, sizeof(f_utf_character_t) * main.width); characters.string = character_array; characters.used = 0; - characters.size = data.width; + characters.size = main.width; // Record when a character is invalid. - char invalid[data.width]; - memset(&invalid, 0, sizeof(char) * data.width); + char invalid[main.width]; + memset(&invalid, 0, sizeof(char) * main.width); if (byte_get >= 0) { for (;;) { @@ -73,7 +73,7 @@ extern "C" { if (character_reset) { characters.used = 0; character_reset = F_false; - memset(&invalid, 0, sizeof(uint8_t) * data.width); + memset(&invalid, 0, sizeof(uint8_t) * main.width); } character_current = characters.used; @@ -133,37 +133,37 @@ extern "C" { } } - if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 1, &previous, &cell, &offset) == F_true) { + if (byte_dump_print_character_fragment(main, characters, invalid, width_utf, 1, &previous, &cell, &offset) == F_true) { character_reset = F_true; } if (width_utf > 1) { - if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 2, &previous, &cell, &offset) == F_true) { + if (byte_dump_print_character_fragment(main, characters, invalid, width_utf, 2, &previous, &cell, &offset) == F_true) { character_reset = F_true; } if (width_utf > 2) { - if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 3, &previous, &cell, &offset) == F_true) { + if (byte_dump_print_character_fragment(main, characters, invalid, width_utf, 3, &previous, &cell, &offset) == F_true) { character_reset = F_true; } if (width_utf > 3) { - if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 4, &previous, &cell, &offset) == F_true) { + if (byte_dump_print_character_fragment(main, characters, invalid, width_utf, 4, &previous, &cell, &offset) == F_true) { character_reset = F_true; } } } - if (data.last) { + if (main.last) { position += width_utf; - if (position >= data.last) break; + if (position >= main.last) break; } } - else if (data.last) { + else if (main.last) { ++position; - if (position >= data.last) break; + if (position >= main.last) break; } width_utf = -1; @@ -171,86 +171,86 @@ extern "C" { } // Print placeholders to fill out the remaining line and then optionally print the text block. - if (cell.column > 0 && cell.column < data.width) { + if (cell.column > 0 && cell.column < main.width) { previous.bytes = 0; previous.invalid = 0; - while (cell.column < data.width) { - if (data.mode == byte_dump_mode_hexidecimal) { - fprintf(data.output.stream, " "); + while (cell.column < main.width) { + if (main.mode == byte_dump_mode_hexidecimal) { + fprintf(main.output.stream, " "); } - else if (data.mode == byte_dump_mode_duodecimal) { - fprintf(data.output.stream, " "); + else if (main.mode == byte_dump_mode_duodecimal) { + fprintf(main.output.stream, " "); } - else if (data.mode == byte_dump_mode_octal) { - fprintf(data.output.stream, " "); + else if (main.mode == byte_dump_mode_octal) { + fprintf(main.output.stream, " "); } - else if (data.mode == byte_dump_mode_binary) { - fprintf(data.output.stream, " "); + else if (main.mode == byte_dump_mode_binary) { + fprintf(main.output.stream, " "); } - else if (data.mode == byte_dump_mode_decimal) { - fprintf(data.output.stream, " "); + else if (main.mode == byte_dump_mode_decimal) { + fprintf(main.output.stream, " "); } ++cell.column; - if (cell.column < data.width) { - if (data.mode == byte_dump_mode_hexidecimal && cell.column % 8 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + if (cell.column < main.width) { + if (main.mode == byte_dump_mode_hexidecimal && cell.column % 8 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_duodecimal && cell.column % 6 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_duodecimal && cell.column % 6 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_octal && cell.column % 6 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_octal && cell.column % 6 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_binary && cell.column % 4 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_binary && cell.column % 4 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_decimal && cell.column % 6 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_decimal && cell.column % 6 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } } } // while - if (data.parameters[byte_dump_parameter_text].result == f_console_result_found) { - byte_dump_print_text(data, characters, invalid, &previous, &offset); + if (main.parameters[byte_dump_parameter_text].result == f_console_result_found) { + byte_dump_print_text(main, characters, invalid, &previous, &offset); } else { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } } - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); // make sure to flush standard out to help prevent standard error from causing poblems. - fflush(data.output.stream); + fflush(main.output.stream); if (found_invalid_utf) { - f_color_print(data.error.to.stream, data.context.set.error, "Invalid UTF-8 codes were detected for file '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", file_name ? file_name : "-"); - f_color_print(data.error.to.stream, data.context.set.error, "'."); - fprintf(data.error.to.stream, "%c%c", f_string_eol_s[0], f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "Invalid UTF-8 codes were detected for file '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", file_name ? file_name : "-"); + f_color_print(main.error.to.stream, main.context.set.error, "'."); + fprintf(main.error.to.stream, "%c%c", f_string_eol_s[0], f_string_eol_s[0]); } if (ferror(file.stream)) { // @todo: determine what the error is and display it. - f_color_print(data.error.to.stream, data.context.set.error, "%sread() failed for '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", file_name ? file_name : "-"); - f_color_print(data.error.to.stream, data.context.set.error, "'."); - fprintf(data.error.to.stream, "%c%c", f_string_eol_s[0], f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sread() failed for '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", file_name ? file_name : "-"); + f_color_print(main.error.to.stream, main.context.set.error, "'."); + fprintf(main.error.to.stream, "%c%c", f_string_eol_s[0], f_string_eol_s[0]); status = F_status_set_error(F_failure); } - fflush(data.error.to.stream); + fflush(main.error.to.stream); return status; } #endif // _di_byte_dump_file_ #ifndef _di_byte_dump_print_character_fragment_ - bool byte_dump_print_character_fragment(const byte_dump_data_t data, const f_utf_string_static_t characters, const char invalid[], const uint8_t width_utf, const char byte_current, byte_dump_previous_t *previous, byte_dump_cell_t *cell, uint8_t *offset) { + bool byte_dump_print_character_fragment(const byte_dump_main_t main, const f_utf_string_static_t characters, const char invalid[], const uint8_t width_utf, const char byte_current, byte_dump_previous_t *previous, byte_dump_cell_t *cell, uint8_t *offset) { char byte = 0; bool reset = F_false; @@ -271,106 +271,106 @@ extern "C" { } if (!cell->column) { - f_color_print(data.output.stream, data.context.set.notable, "%016X ", (uint64_t) cell->row); + f_color_print(main.output.stream, main.context.set.notable, "%016X ", (uint64_t) cell->row); if (*offset > 0) { uint8_t offset_to_print = *offset; // Pad the buffer with spaces to hide any skipped bytes (skipped via --first). - while (offset_to_print > 0 && cell->column < data.width) { - if (data.mode == byte_dump_mode_hexidecimal) { - fprintf(data.output.stream, " "); + while (offset_to_print > 0 && cell->column < main.width) { + if (main.mode == byte_dump_mode_hexidecimal) { + fprintf(main.output.stream, " "); } - else if (data.mode == byte_dump_mode_duodecimal) { - fprintf(data.output.stream, " "); + else if (main.mode == byte_dump_mode_duodecimal) { + fprintf(main.output.stream, " "); } - else if (data.mode == byte_dump_mode_octal) { - fprintf(data.output.stream, " "); + else if (main.mode == byte_dump_mode_octal) { + fprintf(main.output.stream, " "); } - else if (data.mode == byte_dump_mode_binary) { - fprintf(data.output.stream, " "); + else if (main.mode == byte_dump_mode_binary) { + fprintf(main.output.stream, " "); } - else if (data.mode == byte_dump_mode_decimal) { - fprintf(data.output.stream, " "); + else if (main.mode == byte_dump_mode_decimal) { + fprintf(main.output.stream, " "); } --offset_to_print; ++cell->column; - if (cell->column < data.width) { - if (data.mode == byte_dump_mode_hexidecimal && cell->column % 8 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + if (cell->column < main.width) { + if (main.mode == byte_dump_mode_hexidecimal && cell->column % 8 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_duodecimal && cell->column % 6 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_duodecimal && cell->column % 6 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_octal && cell->column % 6 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_octal && cell->column % 6 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_binary && cell->column % 4 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_binary && cell->column % 4 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_decimal && cell->column % 6 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_decimal && cell->column % 6 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } } } } } - if (cell->column < data.width) { - if (data.mode == byte_dump_mode_hexidecimal) { + if (cell->column < main.width) { + if (main.mode == byte_dump_mode_hexidecimal) { if (invalid[character_current]) { - f_color_print(data.output.stream, data.context.set.error, " %02x", (uint8_t) byte); + f_color_print(main.output.stream, main.context.set.error, " %02x", (uint8_t) byte); } else { - fprintf(data.output.stream, " %02x", (uint8_t) byte); + fprintf(main.output.stream, " %02x", (uint8_t) byte); } } - else if (data.mode == byte_dump_mode_duodecimal) { + else if (main.mode == byte_dump_mode_duodecimal) { if (invalid[character_current]) { - fprintf(data.output.stream, "%s", data.context.error.string); + fprintf(main.output.stream, "%s", main.context.error.string); } - fprintf(data.output.stream, " %01d", byte / 144); + fprintf(main.output.stream, " %01d", byte / 144); uint8_t current = (byte % 144) / 12; if (current == 11) { - fprintf(data.output.stream, "%s", f_string_ascii_b_s); + fprintf(main.output.stream, "%s", f_string_ascii_b_s); } else if (current == 10) { - fprintf(data.output.stream, "%s", f_string_ascii_a_s); + fprintf(main.output.stream, "%s", f_string_ascii_a_s); } else { - fprintf(data.output.stream, "%01d", current); + fprintf(main.output.stream, "%01d", current); } current = (byte % 144) % 12; if (current == 11) { - fprintf(data.output.stream, "%s", f_string_ascii_b_s); + fprintf(main.output.stream, "%s", f_string_ascii_b_s); } else if (current == 10) { - fprintf(data.output.stream, "%s", f_string_ascii_a_s); + fprintf(main.output.stream, "%s", f_string_ascii_a_s); } else { - fprintf(data.output.stream, "%01d", current); + fprintf(main.output.stream, "%01d", current); } if (invalid[character_current]) { - fprintf(data.output.stream, "%s", data.context.reset.string); + fprintf(main.output.stream, "%s", main.context.reset.string); } } - else if (data.mode == byte_dump_mode_octal) { + else if (main.mode == byte_dump_mode_octal) { if (invalid[character_current]) { - f_color_print(data.output.stream, data.context.set.error, " %03o", (uint8_t) byte); + f_color_print(main.output.stream, main.context.set.error, " %03o", (uint8_t) byte); } else { - fprintf(data.output.stream, " %03o", (uint8_t) byte); + fprintf(main.output.stream, " %03o", (uint8_t) byte); } } - else if (data.mode == byte_dump_mode_binary) { + else if (main.mode == byte_dump_mode_binary) { char binary_string[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; binary_string[0] = ((byte >> 7) & 0x01) ? f_string_ascii_1_s[0] : f_string_ascii_0_s[0]; @@ -383,25 +383,25 @@ extern "C" { binary_string[7] = (byte & 0x01) ? f_string_ascii_1_s[0] : f_string_ascii_0_s[0]; if (invalid[character_current]) { - f_color_print(data.output.stream, data.context.set.error, " %s", binary_string); + f_color_print(main.output.stream, main.context.set.error, " %s", binary_string); } else { - fprintf(data.output.stream, " %s", binary_string); + fprintf(main.output.stream, " %s", binary_string); } } - else if (data.mode == byte_dump_mode_decimal) { + else if (main.mode == byte_dump_mode_decimal) { if (invalid[character_current]) { - f_color_print(data.output.stream, data.context.set.error, " %3d", (uint8_t) byte); + f_color_print(main.output.stream, main.context.set.error, " %3d", (uint8_t) byte); } else { - fprintf(data.output.stream, " %3d", (uint8_t) byte); + fprintf(main.output.stream, " %3d", (uint8_t) byte); } } ++cell->column; } - if (cell->column == data.width) { + if (cell->column == main.width) { uint8_t bytes = 0; if (byte_current < width_utf) { @@ -410,11 +410,11 @@ extern "C" { reset = F_true; - if (data.parameters[byte_dump_parameter_text].result == f_console_result_found) { - byte_dump_print_text(data, characters, invalid, previous, offset); + if (main.parameters[byte_dump_parameter_text].result == f_console_result_found) { + byte_dump_print_text(main, characters, invalid, previous, offset); } else { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } cell->column = 0; @@ -429,20 +429,20 @@ extern "C" { previous->invalid = invalid[character_current]; } } - else if (data.mode == byte_dump_mode_hexidecimal && cell->column % 8 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_hexidecimal && cell->column % 8 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_duodecimal && cell->column % 6 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_duodecimal && cell->column % 6 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_octal && cell->column % 6 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_octal && cell->column % 6 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_binary && cell->column % 4 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_binary && cell->column % 4 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.mode == byte_dump_mode_decimal && cell->column % 6 == 0) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.mode == byte_dump_mode_decimal && cell->column % 6 == 0) { + fprintf(main.output.stream, "%s", f_string_space_s); } return reset; @@ -450,18 +450,18 @@ extern "C" { #endif // _di_byte_dump_print_character_fragment_ #ifndef _di_byte_dump_print_text_ - void byte_dump_print_text(const byte_dump_data_t data, const f_utf_string_static_t characters, const char invalid[], byte_dump_previous_t *previous, uint8_t *offset) { + void byte_dump_print_text(const byte_dump_main_t main, const f_utf_string_static_t characters, const char invalid[], byte_dump_previous_t *previous, uint8_t *offset) { uint8_t j = 0; uint8_t output = 0; uint8_t width_utf = 0; bool printed = F_false; - f_color_print(data.output.stream, data.context.set.notable, " %s ", byte_dump_character_wall); + f_color_print(main.output.stream, main.context.set.notable, " %s ", byte_dump_character_wall); if (*offset > 0) { - if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - while (*offset > 0 && j < data.width) { - fprintf(data.output.stream, "%s", f_string_ascii_period_s); + if (main.parameters[byte_dump_parameter_classic].result == f_console_result_found) { + while (*offset > 0 && j < main.width) { + fprintf(main.output.stream, "%s", f_string_ascii_period_s); --(*offset); ++j; } // while @@ -469,12 +469,12 @@ extern "C" { else { const char *placeholder = f_string_space_s; - if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { + if (main.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { placeholder = byte_dump_character_placeholder; } - while (*offset > 0 && j < data.width) { - f_color_print(data.output.stream, data.context.set.warning, "%s", placeholder); + while (*offset > 0 && j < main.width) { + f_color_print(main.output.stream, main.context.set.warning, "%s", placeholder); --(*offset); ++j; } // while @@ -482,31 +482,31 @@ extern "C" { } // Print placeholders for the remaining fragments of UTF-8 characters printed on previous lines. - if (j < data.width) { + if (j < main.width) { uint8_t bytes_overflow = 0; - if (previous->bytes - 1 > data.width) { - bytes_overflow = previous->bytes - 1 - data.width; + if (previous->bytes - 1 > main.width) { + bytes_overflow = previous->bytes - 1 - main.width; } if (previous->bytes > 0) { - if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { - for (; j < previous->bytes && j < data.width; j++) { + if (main.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { + for (; j < previous->bytes && j < main.width; j++) { if (previous->invalid) { - f_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_placeholder); + f_color_print(main.output.stream, main.context.set.error, "%s", byte_dump_character_placeholder); } - else if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - fprintf(data.output.stream, "%s", f_string_ascii_period_s); + else if (main.parameters[byte_dump_parameter_classic].result == f_console_result_found) { + fprintf(main.output.stream, "%s", f_string_ascii_period_s); } else { - f_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); + f_color_print(main.output.stream, main.context.set.warning, "%s", byte_dump_character_placeholder); } } // for } else { - for (; j < previous->bytes && j < data.width; j++) { - fprintf(data.output.stream, "%s", f_string_space_s); + for (; j < previous->bytes && j < main.width; j++) { + fprintf(main.output.stream, "%s", f_string_space_s); } // for } } @@ -520,206 +520,206 @@ extern "C" { } } - for (uint8_t i = 0; i < characters.used && j < data.width; i++, j++) { + for (uint8_t i = 0; i < characters.used && j < main.width; i++, j++) { output = f_macro_utf_character_t_to_char_1(characters.string[i]); width_utf = f_macro_utf_byte_width_is(output); if (invalid[i]) { - f_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_incomplete); + f_color_print(main.output.stream, main.context.set.error, "%s", byte_dump_character_incomplete); } else if (output >= 0 && output <= 32 || output == 127) { - if (data.presentation == byte_dump_presentation_normal) { + if (main.presentation == byte_dump_presentation_normal) { if (!output) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_null); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_null); } else if (output == 1) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_start_of_header); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_start_of_header); } else if (output == 2) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_start_of_text); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_start_of_text); } else if (output == 3) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_text); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_end_of_text); } else if (output == 4) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_transmission); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_end_of_transmission); } else if (output == 5) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_enquiry); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_end_of_enquiry); } else if (output == 6) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_acknowledge); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_acknowledge); } else if (output == 7) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_bell); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_bell); } else if (output == 8) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_backspace); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_backspace); } else if (output == 9) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_tab); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_tab); } else if (output == 10) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_new_line); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_new_line); } else if (output == 11) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_tab_vertical); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_tab_vertical); } else if (output == 12) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_form_feed); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_form_feed); } else if (output == 13) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_carriage_return); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_carriage_return); } else if (output == 14) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_shift_out); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_shift_out); } else if (output == 15) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_shift_in); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_shift_in); } else if (output == 16) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_data_link_escape); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_data_link_escape); } else if (output == 17) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_1); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_device_control_1); } else if (output == 18) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_2); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_device_control_2); } else if (output == 19) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_3); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_device_control_3); } else if (output == 20) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_4); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_device_control_4); } else if (output == 21) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_negative_acknowledge); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_negative_acknowledge); } else if (output == 22) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_synchronous_idle); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_synchronous_idle); } else if (output == 23) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_transmission_block); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_end_of_transmission_block); } else if (output == 24) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_cancel); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_cancel); } else if (output == 25) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_medium); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_end_of_medium); } else if (output == 26) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_substitute); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_substitute); } else if (output == 27) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_escape); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_escape); } else if (output == 28) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_file_separator); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_file_separator); } else if (output == 29) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_group_separator); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_group_separator); } else if (output == 30) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_record_separator); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_record_separator); } else if (output == 31) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_unit_separator); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_unit_separator); } else if (output == 32) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_space); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_space); } else if (output == 127) { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_delete); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_delete); } } - else if (data.presentation == byte_dump_presentation_simple) { - fprintf(data.output.stream, "%s", f_string_space_s); + else if (main.presentation == byte_dump_presentation_simple) { + fprintf(main.output.stream, "%s", f_string_space_s); } - else if (data.presentation == byte_dump_presentation_classic) { - fprintf(data.output.stream, "%s", f_string_ascii_period_s); + else if (main.presentation == byte_dump_presentation_classic) { + fprintf(main.output.stream, "%s", f_string_ascii_period_s); } } else if (f_utf_character_is_whitespace(characters.string[i]) == F_true) { - if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - fprintf(data.output.stream, "%s", f_string_ascii_period_s); + if (main.parameters[byte_dump_parameter_classic].result == f_console_result_found) { + fprintf(main.output.stream, "%s", f_string_ascii_period_s); } else { - f_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_space); + f_color_print2(main.output.stream, main.context.set.notable, main.context.set.warning, "%s", byte_dump_sequence_space); } } else if (f_utf_character_is_zero_width(characters.string[i]) == F_true) { - if (data.presentation == byte_dump_presentation_classic) { - fprintf(data.output.stream, "%s", f_string_ascii_period_s); + if (main.presentation == byte_dump_presentation_classic) { + fprintf(main.output.stream, "%s", f_string_ascii_period_s); } - else if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { - f_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); + else if (main.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { + f_color_print(main.output.stream, main.context.set.warning, "%s", byte_dump_character_placeholder); } else { - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } } else if (f_utf_character_is_control(characters.string[i]) == F_true) { // print a space (or '.') for control characters. - if (data.presentation == byte_dump_presentation_classic) { - f_color_print(data.output.stream, data.context.set.warning, f_string_ascii_period_s); + if (main.presentation == byte_dump_presentation_classic) { + f_color_print(main.output.stream, main.context.set.warning, f_string_ascii_period_s); } else { - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } } else if (width_utf == 2 && characters.string[i] == 0xd89d0000) { // U+061C - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 3 && characters.string[i] >= 0xefbfb000 && characters.string[i] <= 0xefbfbc00) { // Use space to represent Specials codes. // 0xefbfbd00 is excluded because it is printable (and is the "Replacement Character" code). - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 3 && characters.string[i] >= 0xe290a700 && characters.string[i] <= 0xe290bf00) { // Use space to represent Control Pictues codes that are not currently defined but are reserved. - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 3 && characters.string[i] >= 0xee808000 && characters.string[i] <= 0xefa3bf00) { // Use space to represent Private Use Area codes. - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 4 && characters.string[i] >= 0xf09c80a0 && characters.string[i] <= 0xf09c80bd) { // Use space to represent Vaiation Selectors Supplement codes. - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 4 && characters.string[i] >= 0xf3b08080 && characters.string[i] <= 0xf3bfbfbf) { // Use space to represent Supplemental Private Use Area-A codes. - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 4 && characters.string[i] >= 0xf4808080 && characters.string[i] <= 0xf48fbfbf) { // Use space to represent Supplemental Private Use Area-B codes. - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 1) { // print invalid placeholder for invalid UTF-8 widths. if (invalid[i]) { - f_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_incomplete); + f_color_print(main.output.stream, main.context.set.error, "%s", byte_dump_character_incomplete); } else { - f_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_incomplete); + f_color_print(main.output.stream, main.context.set.warning, "%s", byte_dump_character_incomplete); } } else if (width_utf > 0) { - fprintf(data.output.stream, "%c", (uint8_t) output); + fprintf(main.output.stream, "%c", (uint8_t) output); if (width_utf > 1) { output = f_macro_utf_character_t_to_char_2(characters.string[i]); - fprintf(data.output.stream, "%c", (uint8_t) output); + fprintf(main.output.stream, "%c", (uint8_t) output); if (width_utf > 2) { output = f_macro_utf_character_t_to_char_3(characters.string[i]); - fprintf(data.output.stream, "%c", (uint8_t) output); + fprintf(main.output.stream, "%c", (uint8_t) output); if (width_utf > 3) { output = f_macro_utf_character_t_to_char_4(characters.string[i]); - fprintf(data.output.stream, "%c", (uint8_t) output); + fprintf(main.output.stream, "%c", (uint8_t) output); } } } @@ -728,91 +728,91 @@ extern "C" { // print a space for combining characters to combine into, thereby allowing it to be safely and readably displayed. if (width_utf == 2 && characters.string[i] >= 0xdea60000 && characters.string[i] <= 0xdeb00000) { // Thana combining codes: U+07A6 to U+07B0. - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 2 && characters.string[i] >= 0xcc800000 && characters.string[i] <= 0xcdaf0000) { - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 3 && characters.string[i] >= 0xe1aab000 && characters.string[i] <= 0xe1abbf00) { - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 3 && characters.string[i] >= 0xe1b78000 && characters.string[i] <= 0xe1b7bf00) { - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 3 && characters.string[i] >= 0xe2839000 && characters.string[i] <= 0xe283bf00) { - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 2 && characters.string[i] >= 0xd8900000 && characters.string[i] <= 0xd89a0000) { - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 2 && characters.string[i] >= 0xd98b0000 && characters.string[i] <= 0xd99f0000) { // Arabic, U+064B to U+065F. - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 2 && characters.string[i] >= 0xdb960000 && characters.string[i] <= 0xdb9c0000) { // Arabic, U+06D6 to U+06DC. - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } else if (width_utf == 2 && characters.string[i] >= 0xd6910000 && characters.string[i] <= 0xd6bd0000) { // Hebrew, U+0591 to U+05BD. - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } } else { - fprintf(data.output.stream, "%c", output); + fprintf(main.output.stream, "%c", output); } // When using UTF-8 characters, the character columns will not line up, so print placeholders to simulate the bytes that are not printed, if necessary for alignment. - if (width_utf > 1 && j + 1 < data.width) { - if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { + if (width_utf > 1 && j + 1 < main.width) { + if (main.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { if (invalid[i]) { - f_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_placeholder); + f_color_print(main.output.stream, main.context.set.error, "%s", byte_dump_character_placeholder); } - else if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - fprintf(data.output.stream, "%s", f_string_ascii_period_s); + else if (main.parameters[byte_dump_parameter_classic].result == f_console_result_found) { + fprintf(main.output.stream, "%s", f_string_ascii_period_s); } else { - f_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); + f_color_print(main.output.stream, main.context.set.warning, "%s", byte_dump_character_placeholder); } } else { - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } ++j; - if (width_utf > 2 && j + 1 < data.width) { - if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { + if (width_utf > 2 && j + 1 < main.width) { + if (main.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { if (invalid[i]) { - f_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_placeholder); + f_color_print(main.output.stream, main.context.set.error, "%s", byte_dump_character_placeholder); } - else if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - fprintf(data.output.stream, "%s", f_string_ascii_period_s); + else if (main.parameters[byte_dump_parameter_classic].result == f_console_result_found) { + fprintf(main.output.stream, "%s", f_string_ascii_period_s); } else { - f_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); + f_color_print(main.output.stream, main.context.set.warning, "%s", byte_dump_character_placeholder); } } else { - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } ++j; - if (width_utf > 3 && j + 1 < data.width) { - if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { + if (width_utf > 3 && j + 1 < main.width) { + if (main.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { if (invalid[i]) { - f_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_placeholder); + f_color_print(main.output.stream, main.context.set.error, "%s", byte_dump_character_placeholder); } - else if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - fprintf(data.output.stream, "%s", f_string_ascii_period_s); + else if (main.parameters[byte_dump_parameter_classic].result == f_console_result_found) { + fprintf(main.output.stream, "%s", f_string_ascii_period_s); } else { - f_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); + f_color_print(main.output.stream, main.context.set.warning, "%s", byte_dump_character_placeholder); } } else { - fprintf(data.output.stream, "%s", f_string_space_s); + fprintf(main.output.stream, "%s", f_string_space_s); } ++j; @@ -822,28 +822,28 @@ extern "C" { } // for // Print placeholder for the remaining parts of the line. - if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { - for (; j < data.width; j++) { + if (main.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { + for (; j < main.width; j++) { if (invalid[j]) { - f_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_placeholder); + f_color_print(main.output.stream, main.context.set.error, "%s", byte_dump_character_placeholder); } - else if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - fprintf(data.output.stream, "%s", f_string_ascii_period_s); + else if (main.parameters[byte_dump_parameter_classic].result == f_console_result_found) { + fprintf(main.output.stream, "%s", f_string_ascii_period_s); } else { - f_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); + f_color_print(main.output.stream, main.context.set.warning, "%s", byte_dump_character_placeholder); } } // for } else { - for (; j < data.width; j++) { - fprintf(data.output.stream, "%s", f_string_space_s); + for (; j < main.width; j++) { + fprintf(main.output.stream, "%s", f_string_space_s); } // for } - f_color_print(data.output.stream, data.context.set.notable, " |"); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.notable, " |"); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } #endif // _di_byte_dump_file_ diff --git a/level_3/byte_dump/c/private-byte_dump.h b/level_3/byte_dump/c/private-byte_dump.h index ce3e706..982bd52 100644 --- a/level_3/byte_dump/c/private-byte_dump.h +++ b/level_3/byte_dump/c/private-byte_dump.h @@ -13,7 +13,7 @@ extern "C" { #endif /** - * A data structure for character row and column position (cell). + * A main structure for character row and column position (cell). * * column: The column position associated with the character cell. * row: The row position associated with the character cell. @@ -32,9 +32,9 @@ extern "C" { #endif // _di_byte_dump_cell_t_ /** - * A data structure for character data that overflowed from a previous line. + * A main structure for character main that overflowed from a previous line. * - * UTF-8 Characters bytes may overflow beyond the data.width. + * UTF-8 Characters bytes may overflow beyond the main.width. * These overflowed bytes should still have placeholders printed in the next text-mode print. * * bytes: The number of previous bytes that overflowed from the previous line. @@ -58,8 +58,8 @@ extern "C" { /** * Dump the contents of the file to standard out. * - * @param data - * The program data. + * @param main + * The main data. * @param file_name * The name of the file. * @param file @@ -71,14 +71,14 @@ extern "C" { * F_failure (with error bit) on failure, usually when read() fails. */ #ifndef _di_byte_dump_file_ - extern f_status_t byte_dump_file(const byte_dump_data_t data, const f_string_t file_name, const f_file_t file) f_attribute_visibility_internal; + extern f_status_t byte_dump_file(const byte_dump_main_t main, const f_string_t file_name, const f_file_t file) f_attribute_visibility_internal; #endif // _di_byte_dump_file_ /** * Print a single character hex code and if the width is reached properly terminate the line. * - * @param data - * The program data. + * @param main + * The main data. * @param characters * An array of UTF-8 and ASCII characters. * @param invalid @@ -91,9 +91,9 @@ extern "C" { * The UTF-8 character byte block to print, going from left to right first byte is 1, second byte is 2, etc... * A value of 1 is used for ASCII. * @param previous - * The overflow data from the previous line. + * The overflow main from the previous line. * @param cell - * The data fragment data such that: + * The main fragment main such that: * - column: * The current column that the character is being printed on. * This value is incremented to represent that the character is printed. @@ -112,7 +112,7 @@ extern "C" { * @see byte_dump_print_text() */ #ifndef _di_byte_dump_print_character_fragment_ - extern bool byte_dump_print_character_fragment(const byte_dump_data_t data, const f_utf_string_static_t characters, const char invalid[], const uint8_t width_utf, const char byte_current, byte_dump_previous_t *previous, byte_dump_cell_t *cell, uint8_t *offset) f_attribute_visibility_internal; + extern bool byte_dump_print_character_fragment(const byte_dump_main_t main, const f_utf_string_static_t characters, const char invalid[], const uint8_t width_utf, const char byte_current, byte_dump_previous_t *previous, byte_dump_cell_t *cell, uint8_t *offset) f_attribute_visibility_internal; #endif // _di_byte_dump_print_character_fragment_ /** @@ -120,21 +120,21 @@ extern "C" { * * This should be called only when text mode is enabled. * - * @param data - * The program data. + * @param main + * The main data. * @param characters * An array of UTF-8 and ASCII characters. * @param invalid * An array designating if a given character at the array index is invalid or not. * The values represent the number of bytes in which the invalid character is expected to take up. * @param previous - * The overflow data from the previous line. + * The overflow main from the previous line. * @param offset * The offset to apply before printing column cells for the row. * Will be reduced to 0 once used. */ #ifndef _di_byte_dump_print_text_ - extern void byte_dump_print_text(const byte_dump_data_t data, const f_utf_string_static_t characters, const char invalid[], byte_dump_previous_t *previous, uint8_t *offset) f_attribute_visibility_internal; + extern void byte_dump_print_text(const byte_dump_main_t main, const f_utf_string_static_t characters, const char invalid[], byte_dump_previous_t *previous, uint8_t *offset) f_attribute_visibility_internal; #endif // _di_byte_dump_print_text_ #ifdef __cplusplus diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index 7c4ab1b..6163cf7 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -27,7 +27,7 @@ extern "C" { #endif // _di_control_print_help_ #ifndef _di_control_main_ - f_status_t control_main(const f_console_arguments_t arguments, control_data_t *data) { + f_status_t control_main(const f_console_arguments_t arguments, control_main_t *data) { f_status_t status = F_none; { @@ -58,7 +58,7 @@ extern "C" { fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); } - control_data_delete(data); + control_main_delete(data); return F_status_set_error(status); } } @@ -72,7 +72,7 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - control_data_delete(data); + control_main_delete(data); return status; } @@ -96,14 +96,14 @@ extern "C" { if (data->parameters[control_parameter_help].result == f_console_result_found) { control_print_help(data->output, data->context); - control_data_delete(data); + control_main_delete(data); return F_none; } if (data->parameters[control_parameter_version].result == f_console_result_found) { fll_program_print_version(data->output, control_version); - control_data_delete(data); + control_main_delete(data); return F_none; } @@ -116,13 +116,13 @@ extern "C" { } } - control_data_delete(data); + control_main_delete(data); return status; } #endif // _di_control_main_ -#ifndef _di_control_data_delete_ - f_status_t control_data_delete(control_data_t *data) { +#ifndef _di_control_main_delete_ + f_status_t control_main_delete(control_main_t *data) { for (f_array_length_t i = 0; i < control_total_parameters; i++) { f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); @@ -136,7 +136,7 @@ extern "C" { return F_none; } -#endif // _di_control_data_delete_ +#endif // _di_control_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/control/c/control.h b/level_3/control/c/control.h index cf77085..80fe020 100644 --- a/level_3/control/c/control.h +++ b/level_3/control/c/control.h @@ -94,7 +94,7 @@ extern "C" { fll_error_print_t warning; f_color_context_t context; - } control_data_t; + } control_main_t; #define control_data_initialize \ { \ @@ -126,31 +126,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call control_data_delete() after executing this. + * Be sure to call control_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The program main. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see control_data_delete() + * @see control_main_delete() */ #ifndef _di_control_main_ - extern f_status_t control_main(const f_console_arguments_t arguments, control_data_t *data); + extern f_status_t control_main(const f_console_arguments_t arguments, control_main_t *main); #endif // _di_control_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing control_main(). * - * @param data - * The program data. + * @param main + * The program main. * * @return * F_none on success. @@ -159,9 +159,9 @@ extern "C" { * * @see control_main() */ -#ifndef _di_control_data_delete_ - extern f_status_t control_data_delete(control_data_t *data); -#endif // _di_control_data_delete_ +#ifndef _di_control_main_delete_ + extern f_status_t control_main_delete(control_main_t *main); +#endif // _di_control_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/control/c/main.c b/level_3/control/c/main.c index 3563a28..9095f46 100644 --- a/level_3/control/c/main.c +++ b/level_3/control/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - control_data_t data = control_data_initialize; + control_main_t main = control_data_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = control_main(arguments, &data); + const f_status_t status = control_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index 56970da..4398a1f 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -49,38 +49,38 @@ extern "C" { #endif // _di_controller_print_help_ #ifndef _di_controller_main_ - f_status_t controller_main(const f_console_arguments_t arguments, controller_data_t *data) { + f_status_t controller_main(const f_console_arguments_t arguments, controller_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, controller_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, controller_total_parameters); { f_console_parameter_id_t ids[3] = { controller_parameter_no_color, controller_parameter_light, controller_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; - data->warning.context = data->context.set.warning; - data->warning.notable = data->context.set.notable; + main->warning.context = main->context.set.warning; + main->warning.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, &data->warning.context, &data->warning.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } - controller_data_delete(data); + controller_main_delete(main); return F_status_set_error(status); } } @@ -94,88 +94,88 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - controller_data_delete(data); + controller_main_delete(main); return status; } if (choice == controller_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; - data->warning.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; + main->warning.verbosity = f_console_verbosity_quiet; } else if (choice == controller_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; - data->warning.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; + main->warning.verbosity = f_console_verbosity_normal; } else if (choice == controller_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; - data->warning.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; + main->warning.verbosity = f_console_verbosity_verbose; } else if (choice == controller_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; - data->warning.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; + main->warning.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[controller_parameter_help].result == f_console_result_found) { - controller_print_help(data->output, data->context); + if (main->parameters[controller_parameter_help].result == f_console_result_found) { + controller_print_help(main->output, main->context); - controller_data_delete(data); + controller_main_delete(main); return F_none; } - if (data->parameters[controller_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, controller_version); + if (main->parameters[controller_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, controller_version); - controller_data_delete(data); + controller_main_delete(main); return F_none; } controller_setting_t setting = controller_setting_t_initialize; - if (data->remaining.used) { - status = f_string_append_nulless(arguments.argv[data->remaining.array[0]], strnlen(arguments.argv[data->remaining.array[0]], f_console_parameter_size), &setting.name_entry); + if (main->remaining.used) { + status = f_string_append_nulless(arguments.argv[main->remaining.array[0]], strnlen(arguments.argv[main->remaining.array[0]], f_console_parameter_size), &setting.name_entry); } else { status = f_string_append_nulless(controller_string_default_s, controller_string_default_length, &setting.name_entry); } if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); - controller_data_delete(data); + controller_main_delete(main); return status; } status = f_string_dynamic_terminate_after(&setting.name_entry); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - controller_data_delete(data); + controller_main_delete(main); return status; } - if (data->parameters[controller_parameter_settings].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->error.to.stream, "%s%sThe parameter '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s); - fprintf(data->error.to.stream, "%s%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_settings, data->error.notable.after->string); - fprintf(data->error.to.stream, "%s' was specified, but no value was given.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]); + if (main->parameters[controller_parameter_settings].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%s%sThe parameter '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); + fprintf(main->error.to.stream, "%s%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_settings, main->error.notable.after->string); + fprintf(main->error.to.stream, "%s' was specified, but no value was given.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[controller_parameter_settings].locations.used) { - const f_array_length_t location = data->parameters[controller_parameter_settings].values.array[data->parameters[controller_parameter_settings].values.used - 1]; + else if (main->parameters[controller_parameter_settings].locations.used) { + const f_array_length_t location = main->parameters[controller_parameter_settings].values.array[main->parameters[controller_parameter_settings].values.used - 1]; status = fll_path_canonical(arguments.argv[location], &setting.path_setting); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "fll_path_canonical", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true); } } } @@ -183,40 +183,40 @@ extern "C" { status = f_string_append(controller_path_settings, controller_path_settings_length, &setting.path_setting); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true); } } } - if (data->parameters[controller_parameter_pid].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->error.to.stream, "%s%sThe parameter '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s); - fprintf(data->error.to.stream, "%s%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_pid, data->error.notable.after->string); - fprintf(data->error.to.stream, "%s' was specified, but no value was given.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]); + if (main->parameters[controller_parameter_pid].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%s%sThe parameter '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); + fprintf(main->error.to.stream, "%s%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_pid, main->error.notable.after->string); + fprintf(main->error.to.stream, "%s' was specified, but no value was given.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[controller_parameter_pid].locations.used) { - const f_array_length_t location = data->parameters[controller_parameter_pid].values.array[data->parameters[controller_parameter_pid].values.used - 1]; + else if (main->parameters[controller_parameter_pid].locations.used) { + const f_array_length_t location = main->parameters[controller_parameter_pid].values.array[main->parameters[controller_parameter_pid].values.used - 1]; if (strnlen(arguments.argv[location], f_console_parameter_size)) { status = fll_path_canonical(arguments.argv[location], &setting.path_pid); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "fll_path_canonical", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true); } } } else { - if (data->warning.verbosity == f_console_verbosity_debug) { - fprintf(data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->warning.to.stream, "%s%sThe parameter '", data->warning.context.before->string, data->warning.prefix ? data->warning.prefix : f_string_empty_s); - fprintf(data->warning.to.stream, "%s%s%s%s%s", data->warning.context.after->string, data->warning.notable.before->string, f_console_symbol_long_enable_s, controller_long_pid, data->warning.notable.after->string); - fprintf(data->warning.to.stream, "%s' must be a file path but instead is an empty string, falling back to the default.%s%c", data->warning.context.before->string, data->warning.context.after->string, f_string_eol_s[0]); + if (main->warning.verbosity == f_console_verbosity_debug) { + fprintf(main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->warning.to.stream, "%s%sThe parameter '", main->warning.context.before->string, main->warning.prefix ? main->warning.prefix : f_string_empty_s); + fprintf(main->warning.to.stream, "%s%s%s%s%s", main->warning.context.after->string, main->warning.notable.before->string, f_console_symbol_long_enable_s, controller_long_pid, main->warning.notable.after->string); + fprintf(main->warning.to.stream, "%s' must be a file path but instead is an empty string, falling back to the default.%s%c", main->warning.context.before->string, main->warning.context.after->string, f_string_eol_s[0]); } } } @@ -234,71 +234,71 @@ extern "C" { } if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true); } } } - if (data->parameters[controller_parameter_control].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->error.to.stream, "%s%sThe parameter '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s); - fprintf(data->error.to.stream, "%s%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_control, data->error.notable.after->string); - fprintf(data->error.to.stream, "%s' was specified, but no value was given.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]); + if (main->parameters[controller_parameter_control].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%s%sThe parameter '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); + fprintf(main->error.to.stream, "%s%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_control, main->error.notable.after->string); + fprintf(main->error.to.stream, "%s' was specified, but no value was given.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[controller_parameter_control].locations.used) { - const f_array_length_t location = data->parameters[controller_parameter_control].values.array[data->parameters[controller_parameter_control].values.used - 1]; + else if (main->parameters[controller_parameter_control].locations.used) { + const f_array_length_t location = main->parameters[controller_parameter_control].values.array[main->parameters[controller_parameter_control].values.used - 1]; if (strnlen(arguments.argv[location], f_console_parameter_size)) { status = fll_path_canonical(arguments.argv[location], &setting.path_control); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "fll_path_canonical", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true); } } else { status = f_string_append_assure(f_path_separator, 1, &setting.path_control); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_assure", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true); } } else { status = f_string_dynamic_terminate_after(&setting.path_control); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); } } } } } else { - if (data->warning.verbosity == f_console_verbosity_debug) { - fprintf(data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->warning.to.stream, "%s%sThe parameter '", data->warning.context.before->string, data->warning.prefix ? data->warning.prefix : f_string_empty_s); - fprintf(data->warning.to.stream, "%s%s%s%s%s", data->warning.context.after->string, data->warning.notable.before->string, f_console_symbol_long_enable_s, controller_long_control, data->warning.notable.after->string); - fprintf(data->warning.to.stream, "%s' must be a file directory path but instead is an empty string, falling back to the default.%s%c", data->warning.context.before->string, data->warning.context.after->string, f_string_eol_s[0]); + if (main->warning.verbosity == f_console_verbosity_debug) { + fprintf(main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->warning.to.stream, "%s%sThe parameter '", main->warning.context.before->string, main->warning.prefix ? main->warning.prefix : f_string_empty_s); + fprintf(main->warning.to.stream, "%s%s%s%s%s", main->warning.context.after->string, main->warning.notable.before->string, f_console_symbol_long_enable_s, controller_long_control, main->warning.notable.after->string); + fprintf(main->warning.to.stream, "%s' must be a file directory path but instead is an empty string, falling back to the default.%s%c", main->warning.context.before->string, main->warning.context.after->string, f_string_eol_s[0]); } } } - if (data->parameters[controller_parameter_daemon].result == f_console_result_found) { - if (data->parameters[controller_parameter_validate].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->error.to.stream, "%s%sThe parameter '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s); - fprintf(data->error.to.stream, "%s%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_validate, data->error.notable.after->string); - fprintf(data->error.to.stream, "%s' must not be specified with the parameter '", data->error.context.before->string); - fprintf(data->error.to.stream, "%s%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_daemon, data->error.notable.after->string); - fprintf(data->error.to.stream, "%s'.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]); + if (main->parameters[controller_parameter_daemon].result == f_console_result_found) { + if (main->parameters[controller_parameter_validate].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%s%sThe parameter '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); + fprintf(main->error.to.stream, "%s%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_validate, main->error.notable.after->string); + fprintf(main->error.to.stream, "%s' must not be specified with the parameter '", main->error.context.before->string); + fprintf(main->error.to.stream, "%s%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_daemon, main->error.notable.after->string); + fprintf(main->error.to.stream, "%s'.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -306,18 +306,18 @@ extern "C" { } if (F_status_is_error_not(status)) { - f_signal_set_fill(&data->signal.set); + f_signal_set_fill(&main->signal.set); - status = f_thread_signal_mask(SIG_BLOCK, &data->signal.set, 0); + status = f_thread_signal_mask(SIG_BLOCK, &main->signal.set, 0); if (F_status_is_error_not(status)) { - status = f_signal_open(&data->signal); + status = f_signal_open(&main->signal); } // if there is an error opening a signal descriptor, then do not handle signals. if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data->signal.set, 0); - f_signal_close(&data->signal); + f_signal_mask(SIG_UNBLOCK, &main->signal.set, 0); + f_signal_close(&main->signal); } // a control file path is required. @@ -329,24 +329,24 @@ extern "C" { } if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); } } else { status = f_string_append_assure(f_path_separator, 1, &setting.path_control); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_assure", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true); } } else { status = f_string_dynamic_terminate_after(&setting.path_control); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); } } } @@ -355,33 +355,33 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = controller_thread_main(data, &setting); + status = controller_thread_main(main, &setting); } // ensure a newline is always put at the end of the program execution, unless in quiet mode. if (!(status == F_child || status == F_signal)) { - if (F_status_is_error(status) && data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + if (F_status_is_error(status) && main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } } - f_signal_close(&data->signal); + f_signal_close(&main->signal); if (status != F_child && setting.pid_created) { - f_status_t status_delete = controller_file_pid_delete(data->pid, setting.path_pid); + f_status_t status_delete = controller_file_pid_delete(main->pid, setting.path_pid); - if (F_status_is_error(status_delete) && data->warning.verbosity == f_console_verbosity_debug) { + if (F_status_is_error(status_delete) && main->warning.verbosity == f_console_verbosity_debug) { if (F_status_set_fine(status_delete) == F_number_not) { - controller_error_pid_bad_match_print(data->warning, setting.path_pid.string, 0); + controller_error_pid_bad_match_print(main->warning, setting.path_pid.string, 0); } else { - fll_error_file_print(data->warning, F_status_set_fine(status_delete), "controller_file_pid_delete", F_true, setting.path_pid.string, "delete", fll_error_file_type_file); + fll_error_file_print(main->warning, F_status_set_fine(status_delete), "controller_file_pid_delete", F_true, setting.path_pid.string, "delete", fll_error_file_type_file); } } } controller_setting_delete_simple(&setting); - controller_data_delete(data); + controller_main_delete(main); if (status == F_child || status == F_signal) { return status; @@ -391,21 +391,21 @@ extern "C" { } #endif // _di_controller_main_ -#ifndef _di_controller_data_delete_ - f_status_t controller_data_delete(controller_data_t *data) { +#ifndef _di_controller_main_delete_ + f_status_t controller_main_delete(controller_main_t *main) { for (f_array_length_t i = 0; i < controller_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_array_lengths_t_delete_simple(main->remaining); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_controller_data_delete_ +#endif // _di_controller_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/controller/c/controller.h b/level_3/controller/c/controller.h index 4a6d16b..67a1a1f 100644 --- a/level_3/controller/c/controller.h +++ b/level_3/controller/c/controller.h @@ -168,7 +168,7 @@ extern "C" { #define controller_total_parameters 16 #endif // _di_controller_defines_ -#ifndef _di_controller_data_t_ +#ifndef _di_controller_main_t_ typedef struct { f_console_parameter_t parameters[controller_total_parameters]; @@ -185,9 +185,9 @@ extern "C" { f_signal_t signal; f_color_context_t context; - } controller_data_t; + } controller_main_t; - #define controller_data_t_initialize \ + #define controller_main_t_initialize \ { \ controller_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -201,7 +201,7 @@ extern "C" { f_signal_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_controller_data_t_ +#endif // _di_controller_main_t_ /** * Print help. @@ -221,31 +221,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call controller_data_delete() after executing this. + * Be sure to call controller_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The program main. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see controller_data_delete() + * @see controller_main_delete() */ #ifndef _di_controller_main_ - extern f_status_t controller_main(const f_console_arguments_t arguments, controller_data_t *data); + extern f_status_t controller_main(const f_console_arguments_t arguments, controller_main_t *main); #endif // _di_controller_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing controller_main(). * - * @param data - * The program data. + * @param main + * The program main. * * @return * F_none on success. @@ -254,9 +254,9 @@ extern "C" { * * @see controller_main() */ -#ifndef _di_controller_data_delete_ - extern f_status_t controller_data_delete(controller_data_t *data); -#endif // _di_controller_data_delete_ +#ifndef _di_controller_main_delete_ + extern f_status_t controller_main_delete(controller_main_t *main); +#endif // _di_controller_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/controller/c/main.c b/level_3/controller/c/main.c index 2524468..a9cb379 100644 --- a/level_3/controller/c/main.c +++ b/level_3/controller/c/main.c @@ -2,38 +2,38 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - controller_data_t data = controller_data_t_initialize; + controller_main_t main = controller_main_t_initialize; f_status_t status = F_none; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - data.pid = getpid(); + main.pid = getpid(); - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - f_signal_mask(SIG_BLOCK, &data.signal.set, 0); + f_signal_set_empty(&main.signal.set); + f_signal_set_add(F_signal_abort, &main.signal.set); + f_signal_set_add(F_signal_hangup, &main.signal.set); + f_signal_set_add(F_signal_interrupt, &main.signal.set); + f_signal_set_add(F_signal_quit, &main.signal.set); + f_signal_set_add(F_signal_termination, &main.signal.set); + f_signal_mask(SIG_BLOCK, &main.signal.set, 0); - status = f_signal_open(&data.signal); + status = f_signal_open(&main.signal); // if there is an error opening a signal descriptor, then do not handle signals. if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); + f_signal_mask(SIG_UNBLOCK, &main.signal.set, 0); + f_signal_close(&main.signal); } // @fixme: bad design in POSIX where there is no get umask without setting it. - data.umask = umask(0); + main.umask = umask(0); // restore umask. - umask(data.umask); + umask(main.umask); - status = controller_main(arguments, &data); + status = controller_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); @@ -44,10 +44,10 @@ int main(const int argc, const f_string_t *argv) { close(f_type_descriptor_input); close(f_type_descriptor_error); - f_signal_close(&data.signal); + f_signal_close(&main.signal); if (status == F_child) { - exit(data.child); + exit(main.child); } if (F_status_is_error(status)) { diff --git a/level_3/controller/c/private-common.c b/level_3/controller/c/private-common.c index 8af66f2..68ec39c 100644 --- a/level_3/controller/c/private-common.c +++ b/level_3/controller/c/private-common.c @@ -490,9 +490,9 @@ extern "C" { #endif // _di_controller_process_delete_simple_ #ifndef _di_controller_process_wait_ - f_status_t controller_process_wait(const controller_main_t main, controller_process_t *process) { + f_status_t controller_process_wait(const controller_global_t global, controller_process_t *process) { - if (!controller_thread_is_enabled_process(process, main.thread)) { + if (!controller_thread_is_enabled_process(process, global.thread)) { return F_signal; } @@ -523,7 +523,7 @@ extern "C" { f_thread_mutex_unlock(&process->wait_lock); - if (!controller_thread_is_enabled_process(process, main.thread)) { + if (!controller_thread_is_enabled_process(process, global.thread)) { return F_signal; } @@ -531,10 +531,10 @@ extern "C" { break; } - status_lock = controller_lock_read_process(process, main.thread, &process->lock); + status_lock = controller_lock_read_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); break; } @@ -564,7 +564,7 @@ extern "C" { count++; } - } while (status == F_time && controller_thread_is_enabled_process(process, main.thread)); + } while (status == F_time && controller_thread_is_enabled_process(process, global.thread)); return status; } diff --git a/level_3/controller/c/private-common.h b/level_3/controller/c/private-common.h index a216220..9d401a7 100644 --- a/level_3/controller/c/private-common.h +++ b/level_3/controller/c/private-common.h @@ -449,8 +449,8 @@ extern "C" { fl_execute_as_t_initialize \ } - #define controller_macro_execute_set_t_initialize(option, wait, environment, signals, data, as) { \ - fl_macro_execute_parameter_t_initialize(option, wait, environment, signals, data), \ + #define controller_macro_execute_set_t_initialize(option, wait, environment, signals, main, as) { \ + fl_macro_execute_parameter_t_initialize(option, wait, environment, signals, main), \ as, \ } #endif // _di_controller_execute_set_t_ @@ -932,9 +932,9 @@ extern "C" { * cache: The cache used in this process. * stack: A stack used to represent dependencies as Rule ID's to avoid circular rule dependencies (If Rule A waits on Rule B, then Rule B must not wait on Rule A). * rule: A copy of the rule actively being executed. - * main_data: Used for passing the controller_data_t data to the process thread (to populate controller_main_t). - * main_setting: Used for passing the controller_setting_t data to the process thread (to populate controller_main_t). - * main_thread: Used for passing the controller_thread_t data to the process thread (to populate controller_main_t). + * main_data: Used for passing the controller_main_t data to the process thread (to populate controller_global_t). + * main_setting: Used for passing the controller_setting_t data to the process thread (to populate controller_global_t). + * main_thread: Used for passing the controller_thread_t data to the process thread (to populate controller_global_t). */ #ifndef _di_controller_process_t_ #define controller_process_option_asynchronous 0x1 @@ -1414,21 +1414,21 @@ extern "C" { /** * A wrapper used for passing a common set of all data, particularly for sharing between threads. * - * data: All standard program data. + * main: The main program data. * setting: All loaded settings. * thread: All thread related data. */ #ifndef _di_controller_main_t_ typedef struct { - controller_data_t *data; + controller_main_t *main; controller_setting_t *setting; controller_thread_t *thread; - } controller_main_t; + } controller_global_t; - #define controller_main_t_initialize { 0, 0, 0 } + #define controller_global_t_initialize { 0, 0, 0 } - #define controller_macro_main_t_initialize(data, setting, thread) { \ - data, \ + #define controller_macro_global_t_initialize(main, setting, thread) { \ + main, \ setting, \ thread, \ } @@ -1437,19 +1437,19 @@ extern "C" { /** * A wrapper used for passing a set of entry processing and execution related data. * - * main: The main data. + * global: All data globally shared. * setting: The setting data. */ #ifndef _di_controller_main_entry_t_ typedef struct { - controller_main_t *main; + controller_global_t *global; controller_setting_t *setting; } controller_main_entry_t; #define controller_main_entry_t_initialize { 0, 0 } - #define controller_macro_main_entry_t_initialize(main, setting) { \ - main, \ + #define controller_macro_main_entry_t_initialize(global, setting) { \ + global, \ setting, \ } #endif // _di_controller_main_entry_t_ @@ -1909,8 +1909,8 @@ extern "C" { /*** * Safely wait for a process, periodically checking to see if process completed or check if exiting. * - * @param main - * The main data. + * @param global + * The global data. * @param process * The process to wait on. * @@ -1925,7 +1925,7 @@ extern "C" { * @see f_thread_condition_wait_timed() */ #ifndef _di_controller_process_wait_ - extern f_status_t controller_process_wait(const controller_main_t main, controller_process_t *process) f_attribute_visibility_internal; + extern f_status_t controller_process_wait(const controller_global_t global, controller_process_t *process) f_attribute_visibility_internal; #endif // _di_controller_process_wait_ /** diff --git a/level_3/controller/c/private-controller.c b/level_3/controller/c/private-controller.c index 84595af..49982f2 100644 --- a/level_3/controller/c/private-controller.c +++ b/level_3/controller/c/private-controller.c @@ -41,7 +41,7 @@ extern "C" { #endif // _di_controller_string_dynamic_partial_append_terminated_ #ifndef _di_controller_file_load_ - f_status_t controller_file_load(const bool required, const f_string_t path_prefix, const f_string_static_t path_name, const f_string_t path_suffix, const f_array_length_t path_prefix_length, const f_array_length_t path_suffix_length, controller_main_t main, controller_cache_t *cache) { + f_status_t controller_file_load(const bool required, const f_string_t path_prefix, const f_string_static_t path_name, const f_string_t path_suffix, const f_array_length_t path_prefix_length, const f_array_length_t path_suffix_length, controller_global_t global, controller_cache_t *cache) { f_status_t status = F_none; f_file_t file = f_file_t_initialize; @@ -70,8 +70,8 @@ extern "C" { } if (F_status_is_error(status)) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_append", F_true, main.thread); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_append", F_true, global.thread); } return status; @@ -80,21 +80,21 @@ extern "C" { status = f_string_dynamic_terminate_after(&cache->action.name_file); if (F_status_is_error(status)) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); } return status; } - const f_array_length_t path_length = main.setting->path_setting.used ? main.setting->path_setting.used + f_path_separator_length + cache->action.name_file.used : cache->action.name_file.used; + const f_array_length_t path_length = global.setting->path_setting.used ? global.setting->path_setting.used + f_path_separator_length + cache->action.name_file.used : cache->action.name_file.used; char path[path_length + 1]; - if (main.setting->path_setting.used) { - memcpy(path, main.setting->path_setting.string, main.setting->path_setting.used); - memcpy(path + main.setting->path_setting.used + f_path_separator_length, cache->action.name_file.string, cache->action.name_file.used); + if (global.setting->path_setting.used) { + memcpy(path, global.setting->path_setting.string, global.setting->path_setting.used); + memcpy(path + global.setting->path_setting.used + f_path_separator_length, cache->action.name_file.string, cache->action.name_file.used); - path[main.setting->path_setting.used] = f_path_separator_s[0]; + path[global.setting->path_setting.used] = f_path_separator_s[0]; } path[path_length] = 0; @@ -108,24 +108,24 @@ extern "C" { return F_file_found_not; } - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fll_error_file_print(main.data->error, F_status_set_fine(status), "f_file_stream_open", F_true, path, "open", fll_error_file_type_file); + fll_error_file_print(global.main->error, F_status_set_fine(status), "f_file_stream_open", F_true, path, "open", fll_error_file_type_file); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } } else { status = f_file_stream_read(file, 1, &cache->buffer_file); if (F_status_is_error(status)) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fll_error_file_print(main.data->error, F_status_set_fine(status), "f_file_stream_read", F_true, path, "read", fll_error_file_type_file); + fll_error_file_print(global.main->error, F_status_set_fine(status), "f_file_stream_read", F_true, path, "read", fll_error_file_type_file); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } } } @@ -138,12 +138,12 @@ extern "C" { status = f_file_stat(path, F_true, &stat_file); if (F_status_is_error(status)) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fll_error_file_print(main.data->error, F_status_set_fine(status), "f_file_stat", F_true, path, "stat", fll_error_file_type_file); + fll_error_file_print(global.main->error, F_status_set_fine(status), "f_file_stat", F_true, path, "stat", fll_error_file_type_file); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } } else { @@ -404,46 +404,46 @@ extern "C" { #endif // _di_controller_get_id_group_ #ifndef _di_controller_perform_ready_ - f_status_t controller_perform_ready(const bool is_entry, controller_main_t main, controller_cache_t *cache) { + f_status_t controller_perform_ready(const bool is_entry, controller_global_t global, controller_cache_t *cache) { f_status_t status = F_none; // only create pid file when not in validate mode. - if (is_entry && main.data->parameters[controller_parameter_validate].result == f_console_result_none) { + if (is_entry && global.main->parameters[controller_parameter_validate].result == f_console_result_none) { - status = controller_file_pid_create(main.data->pid, main.setting->path_pid); + status = controller_file_pid_create(global.main->pid, global.setting->path_pid); // report pid file error but because this could be an "init" program, consider the pid file as optional and continue on. if (F_status_is_error(status)) { // always return immediately on memory errors. if (F_status_set_fine(status) == F_memory_not) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fll_error_file_print(main.data->error, F_status_set_fine(status), "controller_file_pid_create", F_true, main.setting->path_pid.string, "create", fll_error_file_type_file); + fll_error_file_print(global.main->error, F_status_set_fine(status), "controller_file_pid_create", F_true, global.setting->path_pid.string, "create", fll_error_file_type_file); - controller_entry_error_print_cache(is_entry, main.data->error, cache->action); + controller_entry_error_print_cache(is_entry, global.main->error, cache->action); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } return status; } - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - fll_error_file_print(main.data->warning, F_status_set_fine(status), "controller_file_pid_create", F_true, main.setting->path_pid.string, "create", fll_error_file_type_file); + fll_error_file_print(global.main->warning, F_status_set_fine(status), "controller_file_pid_create", F_true, global.setting->path_pid.string, "create", fll_error_file_type_file); - controller_entry_error_print_cache(is_entry, main.data->warning, cache->action); + controller_entry_error_print_cache(is_entry, global.main->warning, cache->action); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } status = F_none; } else { - main.setting->pid_created = F_true; + global.setting->pid_created = F_true; } } @@ -452,7 +452,7 @@ extern "C" { #endif // _di_controller_perform_ready_ #ifndef _di_controller_preprocess_entry_ - f_status_t controller_preprocess_entry(const bool is_entry, controller_main_t main, controller_cache_t *cache) { + f_status_t controller_preprocess_entry(const bool is_entry, controller_global_t global, controller_cache_t *cache) { f_status_t status = F_none; f_status_t status2 = F_none; @@ -462,15 +462,15 @@ extern "C" { f_array_length_t at_i = 0; f_array_length_t at_j = 1; - controller_entry_t *entry = is_entry ? &main.setting->entry : &main.setting->exit; + controller_entry_t *entry = is_entry ? &global.setting->entry : &global.setting->exit; controller_entry_actions_t *actions = 0; uint8_t error_has = F_false; // this effectively sets the read for an entry and resets the ready for an exit. // @todo should there be a ready_exit instead? - // @todo the main.setting->ready in this function may need mutex lock protection. - main.setting->ready = controller_setting_ready_no; + // @todo the global.setting->ready in this function may need mutex lock protection. + global.setting->ready = controller_setting_ready_no; cache->ats.used = 0; @@ -482,7 +482,7 @@ extern "C" { f_macro_array_lengths_t_increase_by(status, cache->ats, controller_default_allocation_step) if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, global.thread); return status; } @@ -498,16 +498,16 @@ extern "C" { status = controller_string_dynamic_append_terminated(entry->items.array[0].name, &cache->action.name_item); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, global.thread); return status; } - while (controller_thread_is_enabled(is_entry, main.thread)) { + while (controller_thread_is_enabled(is_entry, global.thread)) { actions = &entry->items.array[cache->ats.array[at_i]].actions; - for (; cache->ats.array[at_j] < actions->used && controller_thread_is_enabled(is_entry, main.thread); ++cache->ats.array[at_j]) { + for (; cache->ats.array[at_j] < actions->used && controller_thread_is_enabled(is_entry, global.thread); ++cache->ats.array[at_j]) { cache->action.line_action = actions->array[cache->ats.array[at_j]].line; cache->action.name_action.used = 0; @@ -515,29 +515,29 @@ extern "C" { status2 = controller_string_dynamic_append_terminated(controller_entry_action_type_name(actions->array[cache->ats.array[at_j]].type), &cache->action.name_action); if (F_status_is_error(status2)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, global.thread); return status2; } if (actions->array[cache->ats.array[at_j]].type == controller_entry_action_type_ready) { - if (main.setting->ready == controller_setting_ready_wait) { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.setting->ready == controller_setting_ready_wait) { + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->warning.to.stream, "%s%sMultiple '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s); - fprintf(main.data->warning.to.stream, "%s%s%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string, controller_string_ready_s, main.data->warning.notable.after->string); - fprintf(main.data->warning.to.stream, "%s' %s item actions detected; only the first will be used.%s%c", main.data->warning.context.before->string, is_entry ? controller_string_entry_s : controller_string_exit_s, main.data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%s%sMultiple '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s); + fprintf(global.main->warning.to.stream, "%s%s%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string, controller_string_ready_s, global.main->warning.notable.after->string); + fprintf(global.main->warning.to.stream, "%s' %s item actions detected; only the first will be used.%s%c", global.main->warning.context.before->string, is_entry ? controller_string_entry_s : controller_string_exit_s, global.main->warning.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main.data->warning, cache->action); + controller_entry_error_print_cache(is_entry, global.main->warning, cache->action); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } } - main.setting->ready = controller_setting_ready_wait; + global.setting->ready = controller_setting_ready_wait; } else if (actions->array[cache->ats.array[at_j]].type == controller_entry_action_type_item) { error_has = F_false; @@ -551,7 +551,7 @@ extern "C" { } // walk though each items and check to see if the item actually exists. - for (i = 1; i < entry->items.used && controller_thread_is_enabled(is_entry, main.thread); ++i) { + for (i = 1; i < entry->items.used && controller_thread_is_enabled(is_entry, global.thread); ++i) { if (fl_string_dynamic_compare(entry->items.array[i].name, actions->array[cache->ats.array[at_j]].parameters.array[0]) == F_equal_to) { @@ -559,17 +559,17 @@ extern "C" { for (j = 2; j < cache->ats.used; j += 2) { if (cache->ats.array[j] == i) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item named '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, entry->items.array[i].name.string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' cannot be executed because recursion is not allowed.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item named '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, entry->items.array[i].name.string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' cannot be executed because recursion is not allowed.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main.data->error, cache->action); + controller_entry_error_print_cache(is_entry, global.main->error, cache->action); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status)) { @@ -586,7 +586,7 @@ extern "C" { f_macro_array_lengths_t_increase_by(status2, cache->ats, controller_default_allocation_step) if (F_status_is_error(status2)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status2), "f_macro_array_lengths_t_increase_by", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status2), "f_macro_array_lengths_t_increase_by", F_true, global.thread); return status2; } @@ -611,7 +611,7 @@ extern "C" { status2 = controller_string_dynamic_append_terminated(entry->items.array[i].name, &cache->action.name_item); if (F_status_is_error(status2)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, global.thread); return status2; } @@ -622,17 +622,17 @@ extern "C" { if (error_has || i >= entry->items.used) { if (i >= entry->items.used) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item named '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, actions->array[cache->ats.array[at_j]].parameters.array[0].string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' does not exist.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item named '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, actions->array[cache->ats.array[at_j]].parameters.array[0].string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' does not exist.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main.data->error, cache->action); + controller_entry_error_print_cache(is_entry, global.main->error, cache->action); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status)) { @@ -667,20 +667,20 @@ extern "C" { status2 = controller_string_dynamic_append_terminated(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item); if (F_status_is_error(status2)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, global.thread); return status2; } } } // while - if (!controller_thread_is_enabled(is_entry, main.thread)) { + if (!controller_thread_is_enabled(is_entry, global.thread)) { return F_signal; } // if ready was never found in the entry, then default to always ready. - if (main.setting->ready == controller_setting_ready_no) { - main.setting->ready = controller_setting_ready_yes; + if (global.setting->ready == controller_setting_ready_no) { + global.setting->ready = controller_setting_ready_yes; } return status; @@ -688,7 +688,7 @@ extern "C" { #endif // _di_controller_preprocess_entry_ #ifndef _di_controller_process_entry_ - f_status_t controller_process_entry(const bool failsafe, const bool is_entry, controller_main_t *main, controller_cache_t *cache) { + f_status_t controller_process_entry(const bool failsafe, const bool is_entry, controller_global_t *global, controller_cache_t *cache) { f_status_t status = F_none; f_status_t status_lock = F_none; @@ -702,7 +702,7 @@ extern "C" { uint8_t options_force = 0; uint8_t options_process = 0; - controller_entry_t *entry = is_entry ? &main->setting->entry : &main->setting->exit; + controller_entry_t *entry = is_entry ? &global->setting->entry : &global->setting->exit; controller_entry_action_t *entry_action = 0; controller_entry_actions_t *entry_actions = 0; controller_process_t *process = 0; @@ -718,21 +718,21 @@ extern "C" { cache->action.name_action.used = 0; cache->action.name_item.used = 0; - if (main->setting->ready == controller_setting_ready_yes) { - status = controller_perform_ready(is_entry, *main, cache); + if (global->setting->ready == controller_setting_ready_yes) { + status = controller_perform_ready(is_entry, *global, cache); if (F_status_is_error(status)) return status; } f_macro_array_lengths_t_increase_by(status, cache->ats, controller_default_allocation_step) if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, main->thread); + controller_entry_error_print(is_entry, global->main->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, global->thread); return status; } // utilize the ats cache as an item execution stack (at_i is for item index, and at_j (at_i + 1) is for action index). - cache->ats.array[0] = failsafe ? main->setting->failsafe_item_id : 0; + cache->ats.array[0] = failsafe ? global->setting->failsafe_item_id : 0; cache->ats.array[1] = 0; cache->ats.used = 2; @@ -742,29 +742,29 @@ extern "C" { status = controller_string_dynamic_append_terminated(entry->items.array[cache->ats.array[0]].name, &cache->action.name_item); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread); + controller_entry_error_print(is_entry, global->main->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, global->thread); return status; } - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found || global->main->error.verbosity == f_console_verbosity_verbose) { + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "Processing %s%s item '", (failsafe ? "failsafe " : ""), is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, cache->action.name_item.string, main->data->context.set.title.after->string); - fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "Processing %s%s item '", (failsafe ? "failsafe " : ""), is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, cache->action.name_item.string, global->main->context.set.title.after->string); + fprintf(global->main->output.stream, "'.%c", f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } - while (controller_thread_is_enabled(is_entry, main->thread)) { + while (controller_thread_is_enabled(is_entry, global->thread)) { entry_actions = &entry->items.array[cache->ats.array[at_i]].actions; - for (; cache->ats.array[at_j] < entry_actions->used && controller_thread_is_enabled(is_entry, main->thread); ++cache->ats.array[at_j]) { + for (; cache->ats.array[at_j] < entry_actions->used && controller_thread_is_enabled(is_entry, global->thread); ++cache->ats.array[at_j]) { entry_action = &entry_actions->array[cache->ats.array[at_j]]; @@ -774,122 +774,122 @@ extern "C" { status = controller_string_dynamic_append_terminated(controller_entry_action_type_name(entry_action->type), &cache->action.name_action); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread); + controller_entry_error_print(is_entry, global->main->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, global->thread); return status; } if (F_status_is_error(entry_action->status)) { if (controller_entry_action_type_is_rule(entry_action->type)) { - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found) { + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "The %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, cache->action.name_action.string, main->data->context.set.title.after->string); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "The %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, cache->action.name_action.string, global->main->context.set.title.after->string); if (entry_action->parameters.used) { - fprintf(main->data->output.stream, "%s", f_string_space_s); - fprintf(main->data->output.stream, "%s", main->data->context.set.notable.before->string); - controller_entry_action_parameters_print(main->data->output.stream, entry_actions->array[cache->ats.array[at_j]]); - fprintf(main->data->output.stream, "%s", main->data->context.set.notable.after->string); + fprintf(global->main->output.stream, "%s", f_string_space_s); + fprintf(global->main->output.stream, "%s", global->main->context.set.notable.before->string); + controller_entry_action_parameters_print(global->main->output.stream, entry_actions->array[cache->ats.array[at_j]]); + fprintf(global->main->output.stream, "%s", global->main->context.set.notable.after->string); } - fprintf(main->data->output.stream, "' is %s and is in a %sfailed%s state, skipping execution.%c", entry_action->code & controller_entry_rule_code_require ? "required" : "optional", main->data->error.context.before->string, main->data->error.context.after->string, f_string_eol_s[0]); + fprintf(global->main->output.stream, "' is %s and is in a %sfailed%s state, skipping execution.%c", entry_action->code & controller_entry_rule_code_require ? "required" : "optional", global->main->error.context.before->string, global->main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } else if (entry_action->code & controller_entry_rule_code_require) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->error.to.stream, "%s%sThe %s item action '", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->error.to.stream, "%s%s%s", main->data->error.context.after->string, main->data->error.notable.before->string, cache->action.name_action.string); + fprintf(global->main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->error.to.stream, "%s%sThe %s item action '", global->main->error.context.before->string, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->error.to.stream, "%s%s%s", global->main->error.context.after->string, global->main->error.notable.before->string, cache->action.name_action.string); if (entry_action->parameters.used) { - fprintf(main->data->error.to.stream, "%s", f_string_space_s); - controller_entry_action_parameters_print(main->data->error.to.stream, entry_actions->array[cache->ats.array[at_j]]); + fprintf(global->main->error.to.stream, "%s", f_string_space_s); + controller_entry_action_parameters_print(global->main->error.to.stream, entry_actions->array[cache->ats.array[at_j]]); } - fprintf(main->data->error.to.stream, "%s%s' is ", main->data->error.notable.after->string, main->data->error.context.before->string); - fprintf(main->data->error.to.stream, "%s%srequired%s", main->data->error.context.after->string, main->data->error.notable.before->string, main->data->error.notable.after->string); - fprintf(main->data->error.to.stream, "%s and is in a ", main->data->error.context.before->string); - fprintf(main->data->error.to.stream, "%s%sfailed%s", main->data->error.context.after->string, main->data->error.notable.before->string, main->data->error.notable.after->string); - fprintf(main->data->error.to.stream, "%s state, skipping execution.%s%c", main->data->error.context.before->string, main->data->error.context.after->string, f_string_eol_s[0]); + fprintf(global->main->error.to.stream, "%s%s' is ", global->main->error.notable.after->string, global->main->error.context.before->string); + fprintf(global->main->error.to.stream, "%s%srequired%s", global->main->error.context.after->string, global->main->error.notable.before->string, global->main->error.notable.after->string); + fprintf(global->main->error.to.stream, "%s and is in a ", global->main->error.context.before->string); + fprintf(global->main->error.to.stream, "%s%sfailed%s", global->main->error.context.after->string, global->main->error.notable.before->string, global->main->error.notable.after->string); + fprintf(global->main->error.to.stream, "%s state, skipping execution.%s%c", global->main->error.context.before->string, global->main->error.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main->data->error, cache->action); + controller_entry_error_print_cache(is_entry, global->main->error, cache->action); - controller_print_unlock_flush(main->data->error.to.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->error.to.stream, &global->thread->lock.print); } return F_status_is_error(F_require); } - else if (main->data->warning.verbosity == f_console_verbosity_verbose || main->data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main->thread->lock.print); + else if (global->main->warning.verbosity == f_console_verbosity_verbose || global->main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->warning.to.stream, "%s%sThe %s item action '", main->data->warning.context.before->string, main->data->warning.prefix ? main->data->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->warning.to.stream, "%s%s%s", main->data->warning.context.after->string, main->data->warning.notable.before->string, cache->action.name_action.string); + fprintf(global->main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->warning.to.stream, "%s%sThe %s item action '", global->main->warning.context.before->string, global->main->warning.prefix ? global->main->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->warning.to.stream, "%s%s%s", global->main->warning.context.after->string, global->main->warning.notable.before->string, cache->action.name_action.string); if (entry_action->parameters.used) { - fprintf(main->data->warning.to.stream, "%s", f_string_space_s); - controller_entry_action_parameters_print(main->data->warning.to.stream, entry_actions->array[cache->ats.array[at_j]]); + fprintf(global->main->warning.to.stream, "%s", f_string_space_s); + controller_entry_action_parameters_print(global->main->warning.to.stream, entry_actions->array[cache->ats.array[at_j]]); } - fprintf(main->data->warning.to.stream, "%s%s' is ", main->data->warning.notable.after->string, main->data->warning.context.before->string); - fprintf(main->data->warning.to.stream, "%s%srequired%s", main->data->warning.context.after->string, main->data->warning.notable.before->string, main->data->warning.notable.after->string); - fprintf(main->data->warning.to.stream, "%s and is in a ", main->data->warning.context.before->string); - fprintf(main->data->warning.to.stream, "%s%sfailed%s", main->data->warning.context.after->string, main->data->warning.notable.before->string, main->data->warning.notable.after->string); - fprintf(main->data->warning.to.stream, "%s state, skipping execution.%s%c", main->data->warning.context.before->string, main->data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global->main->warning.to.stream, "%s%s' is ", global->main->warning.notable.after->string, global->main->warning.context.before->string); + fprintf(global->main->warning.to.stream, "%s%srequired%s", global->main->warning.context.after->string, global->main->warning.notable.before->string, global->main->warning.notable.after->string); + fprintf(global->main->warning.to.stream, "%s and is in a ", global->main->warning.context.before->string); + fprintf(global->main->warning.to.stream, "%s%sfailed%s", global->main->warning.context.after->string, global->main->warning.notable.before->string, global->main->warning.notable.after->string); + fprintf(global->main->warning.to.stream, "%s state, skipping execution.%s%c", global->main->warning.context.before->string, global->main->warning.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main->data->warning, cache->action); + controller_entry_error_print_cache(is_entry, global->main->warning, cache->action); - controller_print_unlock_flush(main->data->warning.to.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->warning.to.stream, &global->thread->lock.print); } } else { - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found) { + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "The %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, cache->action.name_action.string, main->data->context.set.title.after->string); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "The %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, cache->action.name_action.string, global->main->context.set.title.after->string); if (entry_action->parameters.used) { - fprintf(main->data->output.stream, "%s", f_string_space_s); - fprintf(main->data->output.stream, "%s", main->data->context.set.notable.before->string); - controller_entry_action_parameters_print(main->data->output.stream, entry_actions->array[cache->ats.array[at_j]]); - fprintf(main->data->output.stream, "%s", main->data->context.set.notable.after->string); + fprintf(global->main->output.stream, "%s", f_string_space_s); + fprintf(global->main->output.stream, "%s", global->main->context.set.notable.before->string); + controller_entry_action_parameters_print(global->main->output.stream, entry_actions->array[cache->ats.array[at_j]]); + fprintf(global->main->output.stream, "%s", global->main->context.set.notable.after->string); } - fprintf(main->data->output.stream, "' is in a %sfailed%s state, skipping.%c", main->data->error.context.before->string, main->data->error.context.after->string, f_string_eol_s[0]); + fprintf(global->main->output.stream, "' is in a %sfailed%s state, skipping.%c", global->main->error.context.before->string, global->main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } - else if (main->data->warning.verbosity == f_console_verbosity_debug || main->data->error.verbosity == f_console_verbosity_verbose) { - f_thread_mutex_lock(&main->thread->lock.print); + else if (global->main->warning.verbosity == f_console_verbosity_debug || global->main->error.verbosity == f_console_verbosity_verbose) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->warning.to.stream, "%s%sThe %s item action '", main->data->warning.context.before->string, main->data->warning.prefix ? main->data->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->warning.to.stream, "%s%s", main->data->warning.notable.before->string, cache->action.name_action.string); + fprintf(global->main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->warning.to.stream, "%s%sThe %s item action '", global->main->warning.context.before->string, global->main->warning.prefix ? global->main->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->warning.to.stream, "%s%s", global->main->warning.notable.before->string, cache->action.name_action.string); if (entry_action->parameters.used) { - fprintf(main->data->warning.to.stream, "%s", f_string_space_s); - controller_entry_action_parameters_print(main->data->warning.to.stream, entry_actions->array[cache->ats.array[at_j]]); + fprintf(global->main->warning.to.stream, "%s", f_string_space_s); + controller_entry_action_parameters_print(global->main->warning.to.stream, entry_actions->array[cache->ats.array[at_j]]); } - fprintf(main->data->warning.to.stream, "%s' is in a ", main->data->warning.notable.after->string); - fprintf(main->data->warning.to.stream, "%s%sfailed%s", main->data->warning.context.after->string, main->data->warning.notable.before->string, main->data->warning.notable.after->string); - fprintf(main->data->warning.to.stream, "%s state, skipping.%s%c", main->data->warning.context.before->string, main->data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global->main->warning.to.stream, "%s' is in a ", global->main->warning.notable.after->string); + fprintf(global->main->warning.to.stream, "%s%sfailed%s", global->main->warning.context.after->string, global->main->warning.notable.before->string, global->main->warning.notable.after->string); + fprintf(global->main->warning.to.stream, "%s state, skipping.%s%c", global->main->warning.context.before->string, global->main->warning.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main->data->warning, cache->action); + controller_entry_error_print_cache(is_entry, global->main->warning, cache->action); - controller_print_unlock_flush(main->data->warning.to.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->warning.to.stream, &global->thread->lock.print); } } @@ -898,74 +898,74 @@ extern "C" { if (entry_action->type == controller_entry_action_type_ready) { if (entry_action->code & controller_entry_rule_code_wait) { - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found || global->main->error.verbosity == f_console_verbosity_verbose) { + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "Waiting before processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_ready_s, main->data->context.set.title.after->string); - fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "Waiting before processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, controller_string_ready_s, global->main->context.set.title.after->string); + fprintf(global->main->output.stream, "'.%c", f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } - if (main->data->parameters[controller_parameter_validate].result == f_console_result_none) { - controller_rule_wait_all(is_entry, *main, F_false, process); + if (global->main->parameters[controller_parameter_validate].result == f_console_result_none) { + controller_rule_wait_all(is_entry, *global, F_false, process); } } - if (main->setting->ready == controller_setting_ready_wait) { - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->setting->ready == controller_setting_ready_wait) { + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found || global->main->error.verbosity == f_console_verbosity_verbose) { + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "Processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_ready_s, main->data->context.set.title.after->string); - fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "Processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, controller_string_ready_s, global->main->context.set.title.after->string); + fprintf(global->main->output.stream, "'.%c", f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_none) { - status = controller_perform_ready(is_entry, *main, cache); + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_none) { + status = controller_perform_ready(is_entry, *global, cache); if (F_status_is_error(status)) return status; } - main->setting->ready = controller_setting_ready_yes; + global->setting->ready = controller_setting_ready_yes; } - else if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + else if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found || global->main->error.verbosity == f_console_verbosity_verbose) { + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "Ignoring %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_ready_s, main->data->context.set.title.after->string); - fprintf(main->data->output.stream, "', state already is ready.%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "Ignoring %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, controller_string_ready_s, global->main->context.set.title.after->string); + fprintf(global->main->output.stream, "', state already is ready.%c", f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } } else if (entry_action->type == controller_entry_action_type_item) { - if (entry_action->number == 0 || entry_action->number >= entry->items.used || failsafe && entry_action->number == main->setting->failsafe_item_id) { + if (entry_action->number == 0 || entry_action->number >= entry->items.used || failsafe && entry_action->number == global->setting->failsafe_item_id) { // This should not happen if the pre-process is working as designed, but in case it doesn't, return a critical error to prevent infinite recursion and similar errors. - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->error.to.stream, "%s%sInvalid %s item index ", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->error.to.stream, "%s%s%llu%s", main->data->error.context.after->string, main->data->error.notable.before->string, entry_action->number, main->data->error.notable.after->string); - fprintf(main->data->error.to.stream, "%s detected.%s%c", main->data->error.context.before->string, main->data->error.context.after->string, f_string_eol_s[0]); + fprintf(global->main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->error.to.stream, "%s%sInvalid %s item index ", global->main->error.context.before->string, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->error.to.stream, "%s%s%llu%s", global->main->error.context.after->string, global->main->error.notable.before->string, entry_action->number, global->main->error.notable.after->string); + fprintf(global->main->error.to.stream, "%s detected.%s%c", global->main->error.context.before->string, global->main->error.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main->data->error, cache->action); + controller_entry_error_print_cache(is_entry, global->main->error, cache->action); - controller_print_unlock_flush(main->data->error.to.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->error.to.stream, &global->thread->lock.print); } return F_status_is_error(F_critical); @@ -974,7 +974,7 @@ extern "C" { f_macro_array_lengths_t_increase_by(status, cache->ats, controller_default_allocation_step) if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, main->thread); + controller_entry_error_print(is_entry, global->main->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, global->thread); return status; } @@ -997,21 +997,21 @@ extern "C" { status = controller_string_dynamic_append_terminated(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread); + controller_entry_error_print(is_entry, global->main->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, global->thread); return status; } - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found || global->main->error.verbosity == f_console_verbosity_verbose) { + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "Processing %s item '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, cache->action.name_item.string, main->data->context.set.title.after->string); - fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "Processing %s item '", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, cache->action.name_item.string, global->main->context.set.title.after->string); + fprintf(global->main->output.stream, "'.%c", f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } @@ -1020,19 +1020,19 @@ extern "C" { } else if (entry_action->type == controller_entry_action_type_consider || controller_entry_action_type_is_rule(entry_action->type)) { - status_lock = controller_lock_write(is_entry, main->thread, &main->thread->lock.rule); + status_lock = controller_lock_write(is_entry, global->thread, &global->thread->lock.rule); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main->data->error, F_status_set_fine(status_lock), F_false, main->thread); + controller_lock_error_critical_print(global->main->error, F_status_set_fine(status_lock), F_false, global->thread); break; } - status = controller_rules_increase(&main->setting->rules); + status = controller_rules_increase(&global->setting->rules); - f_thread_unlock(&main->thread->lock.rule); + f_thread_unlock(&global->thread->lock.rule); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "controller_rules_increase", F_true, main->thread); + controller_entry_error_print(is_entry, global->main->error, cache->action, F_status_set_fine(status), "controller_rules_increase", F_true, global->thread); return status; } @@ -1047,32 +1047,32 @@ extern "C" { id_rule_name[entry_action->parameters.array[0].used] = f_path_separator_s[0]; id_rule_name[id_rule_length] = 0; - status_lock = controller_lock_read(is_entry, main->thread, &main->thread->lock.rule); + status_lock = controller_lock_read(is_entry, global->thread, &global->thread->lock.rule); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main->data->error, F_status_set_fine(status_lock), F_true, main->thread); + controller_lock_error_critical_print(global->main->error, F_status_set_fine(status_lock), F_true, global->thread); break; } - status = controller_rule_find(alias_rule, main->setting->rules, 0); + status = controller_rule_find(alias_rule, global->setting->rules, 0); - f_thread_unlock(&main->thread->lock.rule); + f_thread_unlock(&global->thread->lock.rule); - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found || global->main->error.verbosity == f_console_verbosity_verbose) { + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "%s %s item rule '", entry_action->type == controller_entry_action_type_consider ? "Considering" : "Processing", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, alias_rule.string, main->data->context.set.title.after->string); - fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%s %s item rule '", entry_action->type == controller_entry_action_type_consider ? "Considering" : "Processing", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, alias_rule.string, global->main->context.set.title.after->string); + fprintf(global->main->output.stream, "'.%c", f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } - if (!controller_thread_is_enabled(is_entry, main->thread)) break; + if (!controller_thread_is_enabled(is_entry, global->thread)) break; // the rule is not yet loaded, ensure that it is loaded. if (status != F_true) { @@ -1093,10 +1093,10 @@ extern "C" { memcpy(cache_name_item, cache->action.name_item.string, cache->action.name_item.used); memcpy(cache_name_file, cache->action.name_file.string, cache->action.name_file.used); - status_lock = controller_lock_write(is_entry, main->thread, &main->thread->lock.rule); + status_lock = controller_lock_write(is_entry, global->thread, &global->thread->lock.rule); if (!(status_lock == F_signal || F_status_is_error(status_lock))) { - status = controller_rule_read(is_entry, alias_rule, *main, cache, &main->setting->rules.array[main->setting->rules.used]); + status = controller_rule_read(is_entry, alias_rule, *global, cache, &global->setting->rules.array[global->setting->rules.used]); } // restore cache. @@ -1116,45 +1116,45 @@ extern "C" { cache->action.line_item = cache_line_item; if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main->data->error, F_status_set_fine(status_lock), F_false, main->thread); + controller_lock_error_critical_print(global->main->error, F_status_set_fine(status_lock), F_false, global->thread); break; } - if (status == F_signal || !controller_thread_is_enabled(is_entry, main->thread)) { - f_thread_unlock(&main->thread->lock.rule); + if (status == F_signal || !controller_thread_is_enabled(is_entry, global->thread)) { + f_thread_unlock(&global->thread->lock.rule); break; } if (F_status_is_error(status)) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - controller_entry_error_print_cache(is_entry, main->data->error, cache->action); + controller_entry_error_print_cache(is_entry, global->main->error, cache->action); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_none) { - f_thread_unlock(&main->thread->lock.rule); + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_none) { + f_thread_unlock(&global->thread->lock.rule); break; } } else { - main->setting->rules.used++; + global->setting->rules.used++; } - f_thread_unlock(&main->thread->lock.rule); + f_thread_unlock(&global->thread->lock.rule); } if (F_status_is_error_not(status)) { options_force = 0; options_process = 0; - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found) { + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found) { options_process |= controller_process_option_simulate; } @@ -1166,57 +1166,57 @@ extern "C" { options_process |= controller_process_option_wait; } - if (main->data->parameters[controller_parameter_validate].result == f_console_result_found) { + if (global->main->parameters[controller_parameter_validate].result == f_console_result_found) { options_process |= controller_process_option_validate; } if (entry_action->code & controller_entry_rule_code_asynchronous) { - if (main->data->parameters[controller_parameter_validate].result == f_console_result_none) { + if (global->main->parameters[controller_parameter_validate].result == f_console_result_none) { options_force |= controller_process_option_asynchronous; } options_process |= controller_process_option_asynchronous; } - status = controller_rule_process_begin(options_force, alias_rule, controller_entry_action_type_to_rule_action_type(entry_action->type), options_process, is_entry ? controller_process_type_entry : controller_process_type_exit, stack, *main, *cache); + status = controller_rule_process_begin(options_force, alias_rule, controller_entry_action_type_to_rule_action_type(entry_action->type), options_process, is_entry ? controller_process_type_entry : controller_process_type_exit, stack, *global, *cache); if (F_status_set_fine(status) == F_memory_not || status == F_child || status == F_signal) { break; } - if (F_status_is_error(status) && main->data->parameters[controller_parameter_simulate].result == f_console_result_none && (entry_action->code & controller_entry_rule_code_require)) { + if (F_status_is_error(status) && global->main->parameters[controller_parameter_simulate].result == f_console_result_none && (entry_action->code & controller_entry_rule_code_require)) { return F_status_set_error(F_require); } } } else if (entry_action->type == controller_entry_action_type_execute) { - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found || global->main->error.verbosity == f_console_verbosity_verbose) { + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "%s is executing '", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%s is executing '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s", main->data->context.set.title.before->string); + fprintf(global->main->output.stream, "%s", global->main->context.set.title.before->string); for (f_array_length_t k = 0; k < entry_action->parameters.used; ++k) { - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, entry_action->parameters.array[k].string, main->data->context.set.title.after->string); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, entry_action->parameters.array[k].string, global->main->context.set.title.after->string); if (k + 1 < entry_action->parameters.used) { - fprintf(main->data->output.stream, " "); + fprintf(global->main->output.stream, " "); } } // for - fprintf(main->data->output.stream, "%s'.%c", main->data->context.set.title.after->string, f_string_eol_s[0]); + fprintf(global->main->output.stream, "%s'.%c", global->main->context.set.title.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found) { + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found) { return F_execute; } - controller_thread_process_cancel(is_entry, is_entry ? controller_thread_cancel_execute : controller_thread_cancel_exit_execute, main, process); + controller_thread_process_cancel(is_entry, is_entry ? controller_thread_cancel_execute : controller_thread_cancel_exit_execute, global, process); int result = 0; @@ -1224,37 +1224,37 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->error.to.stream, "%s%sExecution failed, unable to find program or script ", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s); - fprintf(main->data->error.to.stream, "%s%s%s%s", main->data->error.context.after->string, main->data->error.notable.before->string, entry_action->parameters.array[0].string, main->data->error.notable.after->string); - fprintf(main->data->error.to.stream, "%s.%s%c", main->data->error.context.before->string, main->data->error.context.after->string, f_string_eol_s[0]); + fprintf(global->main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->error.to.stream, "%s%sExecution failed, unable to find program or script ", global->main->error.context.before->string, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s); + fprintf(global->main->error.to.stream, "%s%s%s%s", global->main->error.context.after->string, global->main->error.notable.before->string, entry_action->parameters.array[0].string, global->main->error.notable.after->string); + fprintf(global->main->error.to.stream, "%s.%s%c", global->main->error.context.before->string, global->main->error.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main->data->error, cache->action); + controller_entry_error_print_cache(is_entry, global->main->error, cache->action); - controller_print_unlock_flush(main->data->error.to.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->error.to.stream, &global->thread->lock.print); } } else { - controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "fll_execute_into", F_true, main->thread); + controller_entry_error_print(is_entry, global->main->error, cache->action, F_status_set_fine(status), "fll_execute_into", F_true, global->thread); } return F_status_set_error(F_execute); } else if (result != 0) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->error.to.stream, "%s%sExecution failed with return value of ", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s); - fprintf(main->data->error.to.stream, "%s%s%d%s", main->data->error.context.after->string, main->data->error.notable.before->string, result, main->data->error.notable.after->string); - fprintf(main->data->error.to.stream, "%s.%s%c", main->data->error.context.before->string, main->data->error.context.after->string, f_string_eol_s[0]); + fprintf(global->main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->error.to.stream, "%s%sExecution failed with return value of ", global->main->error.context.before->string, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s); + fprintf(global->main->error.to.stream, "%s%s%d%s", global->main->error.context.after->string, global->main->error.notable.before->string, result, global->main->error.notable.after->string); + fprintf(global->main->error.to.stream, "%s.%s%c", global->main->error.context.before->string, global->main->error.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main->data->error, cache->action); + controller_entry_error_print_cache(is_entry, global->main->error, cache->action); - controller_print_unlock_flush(main->data->error.to.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->error.to.stream, &global->thread->lock.print); } return F_status_set_error(F_execute); @@ -1264,7 +1264,7 @@ extern "C" { } else if (entry_action->type == controller_entry_action_type_timeout) { - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) { + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found || global->main->error.verbosity == f_console_verbosity_verbose) { f_string_t code = ""; if (entry_action->code == controller_entry_timeout_code_kill) { @@ -1277,81 +1277,81 @@ extern "C" { code = controller_string_stop_s; } - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "Processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_timeout_s, main->data->context.set.title.after->string); - fprintf(main->data->output.stream, "' setting '"); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.important.before->string, code, main->data->context.set.important.after->string); - fprintf(main->data->output.stream, "' to '"); - fprintf(main->data->output.stream, "%s%llu%s", main->data->context.set.important.before->string, entry_action->number, main->data->context.set.important.after->string); - fprintf(main->data->output.stream, "' MegaTime (milliseconds).%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "Processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, controller_string_timeout_s, global->main->context.set.title.after->string); + fprintf(global->main->output.stream, "' setting '"); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.important.before->string, code, global->main->context.set.important.after->string); + fprintf(global->main->output.stream, "' to '"); + fprintf(global->main->output.stream, "%s%llu%s", global->main->context.set.important.before->string, entry_action->number, global->main->context.set.important.after->string); + fprintf(global->main->output.stream, "' MegaTime (milliseconds).%c", f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } if (entry_action->code == controller_entry_timeout_code_kill) { - main->setting->timeout_kill = entry_action->number; + global->setting->timeout_kill = entry_action->number; } else if (entry_action->code == controller_entry_timeout_code_start) { - main->setting->timeout_start = entry_action->number; + global->setting->timeout_start = entry_action->number; } else if (entry_action->code == controller_entry_timeout_code_stop) { - main->setting->timeout_stop = entry_action->number; + global->setting->timeout_stop = entry_action->number; } } else if (entry_action->type == controller_entry_action_type_failsafe) { if (failsafe) { - if (main->data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->warning.to.stream, "%s%sFailsafe may not be specified when running in failsafe, ignoring.%s%c", main->data->warning.context.before->string, main->data->warning.prefix ? main->data->warning.prefix : f_string_empty_s, main->data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global->main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->warning.to.stream, "%s%sFailsafe may not be specified when running in failsafe, ignoring.%s%c", global->main->warning.context.before->string, global->main->warning.prefix ? global->main->warning.prefix : f_string_empty_s, global->main->warning.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main->data->warning, cache->action); + controller_entry_error_print_cache(is_entry, global->main->warning, cache->action); - controller_print_unlock_flush(main->data->warning.to.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->warning.to.stream, &global->thread->lock.print); } } else { if (entry_action->number == 0 || entry_action->number >= entry->items.used) { // This should not happen if the pre-process is working as designed, but in case it doesn't, return a critical error to prevent infinite recursion and similar errors. - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->error.to.stream, "%s%sInvalid %s item index ", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->error.to.stream, "%s%s%llu%s", main->data->error.context.after->string, main->data->error.notable.before->string, entry_action->number, main->data->error.notable.after->string); - fprintf(main->data->error.to.stream, "%s detected.%s%c", main->data->error.context.before->string, main->data->error.context.after->string, f_string_eol_s[0]); + fprintf(global->main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->error.to.stream, "%s%sInvalid %s item index ", global->main->error.context.before->string, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->error.to.stream, "%s%s%llu%s", global->main->error.context.after->string, global->main->error.notable.before->string, entry_action->number, global->main->error.notable.after->string); + fprintf(global->main->error.to.stream, "%s detected.%s%c", global->main->error.context.before->string, global->main->error.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main->data->error, cache->action); + controller_entry_error_print_cache(is_entry, global->main->error, cache->action); - controller_print_unlock_flush(main->data->error.to.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->error.to.stream, &global->thread->lock.print); } return F_status_is_error(F_critical); } else { - main->setting->failsafe_enabled = F_true; - main->setting->failsafe_item_id = entry_action->number; + global->setting->failsafe_enabled = F_true; + global->setting->failsafe_item_id = entry_action->number; - if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main->thread->lock.print); + if (global->main->parameters[controller_parameter_simulate].result == f_console_result_found || global->main->error.verbosity == f_console_verbosity_verbose) { + if (global->main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "Processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_failsafe_s, main->data->context.set.title.after->string); - fprintf(main->data->output.stream, "' setting value to '"); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.important.before->string, entry->items.array[main->setting->failsafe_item_id].name.string, main->data->context.set.important.after->string); - fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "Processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, controller_string_failsafe_s, global->main->context.set.title.after->string); + fprintf(global->main->output.stream, "' setting value to '"); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.important.before->string, entry->items.array[global->setting->failsafe_item_id].name.string, global->main->context.set.important.after->string); + fprintf(global->main->output.stream, "'.%c", f_string_eol_s[0]); - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } } } @@ -1388,14 +1388,14 @@ extern "C" { status = controller_string_dynamic_append_terminated(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread); + controller_entry_error_print(is_entry, global->main->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, global->thread); break; } } } // while - if (!controller_thread_is_enabled(is_entry, main->thread)) { + if (!controller_thread_is_enabled(is_entry, global->thread)) { return F_signal; } @@ -1408,8 +1408,8 @@ extern "C" { } // check to see if any required processes failed, but do not do this if already operating in failsafe. - if (F_status_is_error_not(status) && !failsafe && main->data->parameters[controller_parameter_validate].result == f_console_result_none) { - const f_status_t status_wait = controller_rule_wait_all(is_entry, *main, F_true, 0); + if (F_status_is_error_not(status) && !failsafe && global->main->parameters[controller_parameter_validate].result == f_console_result_none) { + const f_status_t status_wait = controller_rule_wait_all(is_entry, *global, F_true, 0); if (status_wait == F_signal || F_status_is_error(status_wait)) { return status_wait; @@ -1420,20 +1420,20 @@ extern "C" { } } - if ((main->data->parameters[controller_parameter_simulate].result == f_console_result_found && main->data->error.verbosity != f_console_verbosity_quiet) || main->data->error.verbosity == f_console_verbosity_verbose) { - f_thread_mutex_lock(&main->thread->lock.print); + if ((global->main->parameters[controller_parameter_simulate].result == f_console_result_found && global->main->error.verbosity != f_console_verbosity_quiet) || global->main->error.verbosity == f_console_verbosity_verbose) { + f_thread_mutex_lock(&global->thread->lock.print); - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main->data->output.stream, "Done processing %s item '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_main_s, main->data->context.set.title.after->string); - fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "Done processing %s item '", is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, controller_string_main_s, global->main->context.set.title.after->string); + fprintf(global->main->output.stream, "'.%c", f_string_eol_s[0]); // failsafe should not print the extra newline because the failure exit from controller_main should handle this. if (!failsafe) { - fprintf(main->data->output.stream, "%c", f_string_eol_s[0]); + fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); } - controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print); + controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); } return status; @@ -1441,25 +1441,25 @@ extern "C" { #endif // _di_controller_process_entry_ #ifndef _di_controller_process_prepare_ - f_status_t controller_process_prepare(const bool is_normal, const uint8_t action, const f_string_static_t alias, const controller_main_t main, f_array_length_t *id) { + f_status_t controller_process_prepare(const bool is_normal, const uint8_t action, const f_string_static_t alias, const controller_global_t global, f_array_length_t *id) { f_status_t status = F_none; if (status == F_signal || F_status_is_error(status)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status), F_true, global.thread); return status; } - if (controller_find_process(action, alias, main.thread->processs, id) == F_false) { - f_thread_unlock(&main.thread->lock.process); + if (controller_find_process(action, alias, global.thread->processs, id) == F_false) { + f_thread_unlock(&global.thread->lock.process); - status = controller_lock_write(is_normal, main.thread, &main.thread->lock.process); + status = controller_lock_write(is_normal, global.thread, &global.thread->lock.process); if (status == F_signal || F_status_is_error(status)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status), F_false, global.thread); - const f_status_t status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process); + const f_status_t status_lock = controller_lock_read(is_normal, global.thread, &global.thread->lock.process); if (status_lock == F_signal || F_status_is_error(status_lock)) { return F_status_set_error(F_lock); @@ -1468,20 +1468,20 @@ extern "C" { return status; } - status = controller_processs_increase(&main.thread->processs); + status = controller_processs_increase(&global.thread->processs); - if (F_status_is_error_not(status) && main.thread->processs.array[main.thread->processs.used]) { + if (F_status_is_error_not(status) && global.thread->processs.array[global.thread->processs.used]) { - controller_process_t *process = main.thread->processs.array[main.thread->processs.used]; + controller_process_t *process = global.thread->processs.array[global.thread->processs.used]; - status = controller_lock_write(is_normal, main.thread, &process->lock); + status = controller_lock_write(is_normal, global.thread, &process->lock); if (status == F_signal || F_status_is_error(status)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status), F_false, global.thread); - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); - const f_status_t status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process); + const f_status_t status_lock = controller_lock_read(is_normal, global.thread, &global.thread->lock.process); if (status_lock == F_signal || F_status_is_error(status_lock)) { return F_status_set_error(F_lock); @@ -1499,7 +1499,7 @@ extern "C" { status = f_string_dynamic_terminate_after(&process->rule.alias); if (F_status_is_error_not(status)) { - process->id = main.thread->processs.used++; + process->id = global.thread->processs.used++; status = F_none; if (id) { @@ -1511,9 +1511,9 @@ extern "C" { f_thread_unlock(&process->lock); } - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); - const f_status_t status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process); + const f_status_t status_lock = controller_lock_read(is_normal, global.thread, &global.thread->lock.process); if (status_lock == F_signal || F_status_is_error(status_lock)) { return F_status_set_error(F_lock); @@ -1528,9 +1528,9 @@ extern "C" { #endif // _di_controller_process_prepare_ #ifndef _di_controller_process_prepare_process_type_ - f_status_t controller_process_prepare_process_type(const uint8_t type, const uint8_t action, const f_string_static_t alias, const controller_main_t main, f_array_length_t *id) { + f_status_t controller_process_prepare_process_type(const uint8_t type, const uint8_t action, const f_string_static_t alias, const controller_global_t global, f_array_length_t *id) { - return controller_process_prepare(type != controller_process_type_exit, action, alias, main, id); + return controller_process_prepare(type != controller_process_type_exit, action, alias, global, id); } #endif // _di_controller_process_prepare_process_type_ diff --git a/level_3/controller/c/private-controller.h b/level_3/controller/c/private-controller.h index 691b620..19c4062 100644 --- a/level_3/controller/c/private-controller.h +++ b/level_3/controller/c/private-controller.h @@ -93,8 +93,8 @@ extern "C" { * The length of the prefix path. * @param path_suffix_length * The length of the suffix path. - * @param main - * The main data. + * @param global + * The global data. * @param cache * The following within the cache is updated: * - name_file: The partial path of the file is inserted. @@ -118,7 +118,7 @@ extern "C" { * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_file_load_ - extern f_status_t controller_file_load(const bool required, const f_string_t path_prefix, const f_string_static_t path_name, const f_string_t path_suffix, const f_array_length_t path_prefix_length, const f_array_length_t path_suffix_length, controller_main_t main, controller_cache_t *cache) f_attribute_visibility_internal; + extern f_status_t controller_file_load(const bool required, const f_string_t path_prefix, const f_string_static_t path_name, const f_string_t path_suffix, const f_array_length_t path_prefix_length, const f_array_length_t path_suffix_length, controller_global_t global, controller_cache_t *cache) f_attribute_visibility_internal; #endif // _di_controller_file_load_ /** @@ -281,8 +281,8 @@ extern "C" { * @param is_entry * If TRUE, then this operate as an entry. * If FALSE, then this operate as an exit. - * @param main - * The main data. + * @param global + * The global data. * @param cache * The cache. * @@ -294,7 +294,7 @@ extern "C" { * @see controller_file_pid_create() */ #ifndef _di_controller_perform_ready_ - extern f_status_t controller_perform_ready(const bool is_entry, controller_main_t main, controller_cache_t *cache) f_attribute_visibility_internal; + extern f_status_t controller_perform_ready(const bool is_entry, controller_global_t global, controller_cache_t *cache) f_attribute_visibility_internal; #endif // _di_controller_perform_ready_ /** @@ -303,8 +303,8 @@ extern "C" { * @param is_entry * If TRUE, then this operate as an entry. * If FALSE, then this operate as an exit. - * @param main - * The main data. + * @param global + * The global data. * @param cache * The main/global cache to use. * @@ -325,7 +325,7 @@ extern "C" { * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_preprocess_entry_ - extern f_status_t controller_preprocess_entry(const bool is_entry, controller_main_t main, controller_cache_t *cache) f_attribute_visibility_internal; + extern f_status_t controller_preprocess_entry(const bool is_entry, controller_global_t global, controller_cache_t *cache) f_attribute_visibility_internal; #endif // _di_controller_preprocess_entry_ /** @@ -337,8 +337,8 @@ extern "C" { * @param is_entry * If TRUE, then this operate as an entry. * If FALSE, then this operate as an exit. - * @param main - * The main data. + * @param global + * The global data. * @param cache * The main/global cache to use. * @@ -359,7 +359,7 @@ extern "C" { * @see controller_string_dynamic_append_terminated() */ #ifndef _di_controller_process_entry_ - extern f_status_t controller_process_entry(const bool failsafe, const bool is_entry, controller_main_t *main, controller_cache_t *cache) f_attribute_visibility_internal; + extern f_status_t controller_process_entry(const bool failsafe, const bool is_entry, controller_global_t *global, controller_cache_t *cache) f_attribute_visibility_internal; #endif // _di_controller_process_entry_ /** @@ -370,7 +370,7 @@ extern "C" { * * If a process by the given Rule alias and Rule Action already exists, then nothing is done. * - * This requires that a main.thread->lock.process lock be set on process->lock before being called. + * This requires that a global.thread->lock.process lock be set on process->lock before being called. * * @param is_normal * If TRUE, then process as if this operates during a normal operation (entry and control). @@ -379,8 +379,8 @@ extern "C" { * The Rule Action to use. * @param alias * The Rule alias to use. - * @param main - * The main data. + * @param global + * The global data. * @param id * (optional) The process ID when found or created. * Set to NULL to not use. @@ -389,7 +389,7 @@ extern "C" { * F_none on success. * F_found on success, but nothing was done because an existing process was found. * - * F_lock (with error bit) if failed to re-establish read lock on main.thread->lock.process while returning. + * F_lock (with error bit) if failed to re-establish read lock on global.thread->lock.process while returning. * * Errors (with error bit) from: f_string_dynamic_append(). * Errors (with error bit) from: f_string_dynamic_terminate_after(). @@ -403,7 +403,7 @@ extern "C" { * @see controller_lock_write() */ #ifndef _di_controller_process_prepare_ - extern f_status_t controller_process_prepare(const bool is_normal, const uint8_t action, const f_string_static_t alias, const controller_main_t main, f_array_length_t *id) f_attribute_visibility_internal; + extern f_status_t controller_process_prepare(const bool is_normal, const uint8_t action, const f_string_static_t alias, const controller_global_t global, f_array_length_t *id) f_attribute_visibility_internal; #endif // _di_controller_process_prepare_ /** @@ -414,7 +414,7 @@ extern "C" { * * If a process by the given Rule alias and Rule Action already exists, then nothing is done. * - * This requires that a main.thread->lock.process lock be set on process->lock before being called. + * This requires that a global.thread->lock.process lock be set on process->lock before being called. * * @param type * The process type to use when checking if thread is enabled. @@ -422,8 +422,8 @@ extern "C" { * The Rule Action to use. * @param alias * The Rule alias to use. - * @param main - * The main data. + * @param global + * The global data. * @param id * (optional) The process ID when found or created. * Set to NULL to not use. @@ -436,7 +436,7 @@ extern "C" { * @see controller_process_prepare() */ #ifndef _di_controller_process_prepare_process_type_ - extern f_status_t controller_process_prepare_process_type(const uint8_t type, const uint8_t action, const f_string_static_t alias, const controller_main_t main, f_array_length_t *id) f_attribute_visibility_internal; + extern f_status_t controller_process_prepare_process_type(const uint8_t type, const uint8_t action, const f_string_static_t alias, const controller_global_t global, f_array_length_t *id) f_attribute_visibility_internal; #endif // _di_controller_process_prepare_process_type_ /** diff --git a/level_3/controller/c/private-entry.c b/level_3/controller/c/private-entry.c index d57f66e..2ed8974 100644 --- a/level_3/controller/c/private-entry.c +++ b/level_3/controller/c/private-entry.c @@ -192,7 +192,7 @@ extern "C" { #endif // _di_controller_entry_actions_increase_by_ #ifndef _di_controller_entry_actions_read_ - f_status_t controller_entry_actions_read(const bool is_entry, const f_string_range_t content_range, controller_main_t main, controller_cache_t *cache, controller_entry_actions_t *actions) { + f_status_t controller_entry_actions_read(const bool is_entry, const f_string_range_t content_range, controller_global_t global, controller_cache_t *cache, controller_entry_actions_t *actions) { f_status_t status = F_none; f_status_t status_action = F_none; @@ -220,7 +220,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, global.thread); return status; } @@ -228,7 +228,7 @@ extern "C" { status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); return status; } @@ -238,7 +238,7 @@ extern "C" { status = controller_entry_actions_increase_by(cache->object_actions.used, actions); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_entry_actions_increase_by", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_entry_actions_increase_by", F_true, global.thread); return status; } @@ -268,7 +268,7 @@ extern "C" { status = f_fss_count_lines(cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread); break; } @@ -277,7 +277,7 @@ extern "C" { status = controller_string_dynamic_rip_nulless_terminated(cache->buffer_file, cache->object_actions.array[i], &cache->action.name_action); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, global.thread); break; } @@ -327,14 +327,14 @@ extern "C" { actions->array[actions->used].type = controller_entry_action_type_timeout; } else { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - fprintf(main.data->warning.to.stream, "%s%sUnknown %s item action '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->warning.to.stream, "%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string); - f_print_dynamic(main.data->warning.to.stream, cache->action.name_action); - fprintf(main.data->warning.to.stream, "%s", main.data->warning.notable.after->string); - fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]); - - controller_entry_error_print_cache(is_entry, main.data->warning, cache->action); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + fprintf(global.main->warning.to.stream, "%s%sUnknown %s item action '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); + f_print_dynamic(global.main->warning.to.stream, cache->action.name_action); + fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); + fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); + + controller_entry_error_print_cache(is_entry, global.main->warning, cache->action); } continue; @@ -369,29 +369,29 @@ extern "C" { if (cache->content_actions.array[i].used < at_least || cache->content_actions.array[i].used > at_most) { action->status = F_status_set_error(F_parameter); - if (main.data->error.verbosity != f_console_verbosity_quiet) { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item action '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, cache->action.name_action.string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' requires ", main.data->error.context.before->string); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item action '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, cache->action.name_action.string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' requires ", global.main->error.context.before->string); if (at_least == at_most) { - fprintf(main.data->error.to.stream, "exactly "); + fprintf(global.main->error.to.stream, "exactly "); } - fprintf(main.data->error.to.stream, "%s%s%llu%s", main.data->error.context.after->string, main.data->error.notable.before->string, at_least, main.data->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s%s%llu%s", global.main->error.context.after->string, global.main->error.notable.before->string, at_least, global.main->error.notable.after->string); if (action->type == controller_entry_action_type_consider || controller_entry_action_type_is_rule(action->type)) { - fprintf(main.data->error.to.stream, "%s or more parameters.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s or more parameters.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } else { if (at_least == at_most) { - fprintf(main.data->error.to.stream, "%s parameters.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s parameters.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } else { - fprintf(main.data->error.to.stream, "%s to ", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%llu%s", main.data->error.context.after->string, main.data->error.notable.before->string, at_most, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s parameters.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s to ", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%llu%s", global.main->error.context.after->string, global.main->error.notable.before->string, at_most, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s parameters.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } } } @@ -412,7 +412,7 @@ extern "C" { status = f_string_dynamics_increase_by(allocate, &action->parameters); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true, global.thread); action->status = status; @@ -430,7 +430,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_file, cache->content_actions.array[i].array[j], &action->parameters.array[j]); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread); action->status = status; @@ -452,7 +452,7 @@ extern "C" { status = fll_path_canonical(action->parameters.array[0].string, &cache->buffer_path); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fll_path_canonical", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fll_path_canonical", F_true, global.thread); action->status = status; @@ -473,9 +473,9 @@ extern "C" { status_action = action->status; } - if (main.data->error.verbosity != f_console_verbosity_quiet) { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item action must not have an empty string for a path (the first parameter).%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s, main.data->error.context.after->string, f_string_eol_s[0]); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item action must not have an empty string for a path (the first parameter).%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s, global.main->error.context.after->string, f_string_eol_s[0]); } } @@ -485,7 +485,7 @@ extern "C" { status = f_file_name_base(action->parameters.array[1].string, action->parameters.array[1].used, &cache->buffer_path); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, global.thread); if (F_status_set_fine(status) == F_memory_not) { status_action = status; @@ -501,11 +501,11 @@ extern "C" { else { if (fl_string_dynamic_compare(action->parameters.array[1], cache->buffer_path) == F_equal_to_not) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { + if (global.main->error.verbosity != f_console_verbosity_quiet) { status = f_string_dynamic_terminate_after(&cache->buffer_path); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); action->status = status; @@ -516,12 +516,12 @@ extern "C" { break; } - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item action second parameter '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, action->parameters.array[1].string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' must be a base path name, such as '", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, cache->buffer_path.string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item action second parameter '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[1].string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' must be a base path name, such as '", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, cache->buffer_path.string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } action->status = F_status_set_error(F_parameter); @@ -539,9 +539,9 @@ extern "C" { status_action = action->status; } - if (main.data->error.verbosity != f_console_verbosity_quiet) { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item action must not have an empty string for a rule name (the second parameter).%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s, main.data->error.context.after->string, f_string_eol_s[0]); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item action must not have an empty string for a rule name (the second parameter).%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s, global.main->error.context.after->string, f_string_eol_s[0]); } } @@ -565,17 +565,17 @@ extern "C" { } } - if (main.data->error.verbosity != f_console_verbosity_quiet) { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item action third parameter (and beyond) must be one of '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_asynchronous_s, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s', '", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_require_s, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s', or '", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_wait_s, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' but instead has '", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, action->parameters.array[j].string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item action third parameter (and beyond) must be one of '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_asynchronous_s, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s', '", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_require_s, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s', or '", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_wait_s, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' but instead has '", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[j].string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } } } // for @@ -588,11 +588,11 @@ extern "C" { status_action = action->status; } - if (main.data->error.verbosity != f_console_verbosity_quiet) { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item action may not specify the reserved item '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_main_s, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item action may not specify the reserved item '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_main_s, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } } } @@ -614,17 +614,17 @@ extern "C" { status_action = action->status; } - if (main.data->error.verbosity != f_console_verbosity_quiet) { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item action must have one of '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_kill_s, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s', '", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_start_s, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s', or '", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_stop_s, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' but instead has '", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, action->parameters.array[0].string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item action must have one of '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_kill_s, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s', '", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_start_s, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s', or '", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_stop_s, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' but instead has '", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[0].string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } } @@ -644,17 +644,17 @@ extern "C" { } if (F_status_set_fine(status) == F_memory_not) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, global.thread); status_action = status; break; } - if (main.data->error.verbosity != f_console_verbosity_quiet) { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item action parameter '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, action->parameters.array[1].string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' is not a valid supported number.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item action parameter '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[1].string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' is not a valid supported number.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } } } @@ -667,13 +667,13 @@ extern "C" { else { action->status = F_status_set_error(F_supported_not); - if (main.data->error.verbosity != f_console_verbosity_quiet) { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item action may only have '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_wait_s, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' but instead has '", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, action->parameters.array[0].string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item action may only have '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_wait_s, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' but instead has '", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[0].string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } } } @@ -758,11 +758,11 @@ extern "C" { #endif // _di_controller_entry_items_increase_by_ #ifndef _di_controller_entry_read_ - f_status_t controller_entry_read(const bool is_entry, controller_main_t main, controller_cache_t *cache) { + f_status_t controller_entry_read(const bool is_entry, controller_global_t global, controller_cache_t *cache) { f_status_t status = F_none; - controller_entry_t *entry = is_entry ? &main.setting->entry : &main.setting->exit; + controller_entry_t *entry = is_entry ? &global.setting->entry : &global.setting->exit; entry->status = F_known_not; entry->items.used = 0; @@ -803,10 +803,10 @@ extern "C" { cache->action.name_item.used = 0; if (is_entry) { - status = controller_file_load(F_true, controller_string_entries_s, main.setting->name_entry, controller_string_entry_s, controller_string_entries_length, controller_string_entry_length, main, cache); + status = controller_file_load(F_true, controller_string_entries_s, global.setting->name_entry, controller_string_entry_s, controller_string_entries_length, controller_string_entry_length, global, cache); } else { - status = controller_file_load(F_false, controller_string_exits_s, main.setting->name_entry, controller_string_exit_s, controller_string_exits_length, controller_string_exit_length, main, cache); + status = controller_file_load(F_false, controller_string_exits_s, global.setting->name_entry, controller_string_exit_s, controller_string_exits_length, controller_string_exit_length, global, cache); if (status == F_file_found_not) { return F_file_found_not; @@ -820,24 +820,24 @@ extern "C" { status = fll_fss_basic_list_read(cache->buffer_file, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, global.thread); } else { status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); } } } else { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s file is empty.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s file is empty.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } status = F_status_set_error(F_data_not); @@ -848,7 +848,7 @@ extern "C" { status = controller_entry_items_increase_by(cache->object_items.used, &entry->items); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_entry_items_increase_by", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_entry_items_increase_by", F_true, global.thread); } else { @@ -861,7 +861,7 @@ extern "C" { f_array_length_t i = 0; f_array_length_t j = 0; - for (; i < cache->object_items.used && controller_thread_is_enabled(is_entry, main.thread); ++i) { + for (; i < cache->object_items.used && controller_thread_is_enabled(is_entry, global.thread); ++i) { if (code & 0x2) { code -= 0x2; @@ -889,21 +889,21 @@ extern "C" { status = controller_entry_items_increase_by(controller_default_allocation_step, &entry->items); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_entry_items_increase_by", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_entry_items_increase_by", F_true, global.thread); break; } status = controller_string_dynamic_partial_append_terminated(cache->buffer_file, cache->object_items.array[i], &cache->action.name_item); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_partial_append_terminated", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_partial_append_terminated", F_true, global.thread); break; } status = f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread); break; } @@ -912,17 +912,17 @@ extern "C" { for (j = (code & 0x1) ? 1 : 0; j < entry->items.used; ++j) { if (fl_string_dynamic_compare(entry->items.array[j].name, cache->action.name_item) == F_equal_to) { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->warning.to.stream, "%s%sIgnoring duplicate %s item '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->warning.to.stream, "%s%s%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string, cache->action.name_file.string, main.data->warning.notable.after->string); - fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%s%sIgnoring duplicate %s item '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->warning.to.stream, "%s%s%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string, cache->action.name_file.string, global.main->warning.notable.after->string); + fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main.data->warning, cache->action); + controller_entry_error_print_cache(is_entry, global.main->warning, cache->action); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } code |= 0x2; @@ -944,7 +944,7 @@ extern "C" { } } else if (fl_string_dynamic_compare_string(controller_string_setting_s, cache->action.name_item, controller_string_setting_length) == F_equal_to) { - status = controller_entry_settings_read(is_entry, *range, main, cache); + status = controller_entry_settings_read(is_entry, *range, global, cache); continue; } @@ -965,19 +965,19 @@ extern "C" { status = controller_string_dynamic_append_terminated(cache->action.name_item, &entry->items.array[at].name); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, global.thread); break; } - status = controller_entry_actions_read(is_entry, *range, main, cache, &entry->items.array[at].actions); + status = controller_entry_actions_read(is_entry, *range, global, cache, &entry->items.array[at].actions); if (F_status_is_error(status)) { - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - controller_entry_error_print_cache(is_entry, main.data->error, cache->action); + controller_entry_error_print_cache(is_entry, global.main->error, cache->action); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); if (F_status_set_fine(status) == F_memory_not) { break; @@ -994,15 +994,15 @@ extern "C" { cache->action.name_item.used = 0; if (!(code & 0x1)) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe required %s item '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_main_s, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' was not found.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe required %s item '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_main_s, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' was not found.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } status = F_status_set_error(F_found_not); @@ -1020,7 +1020,7 @@ extern "C" { for (j = 0; j < entry->items.array[i].actions.used; ++j) { - if (!controller_thread_is_enabled(is_entry, main.thread)) { + if (!controller_thread_is_enabled(is_entry, global.thread)) { return F_signal; } @@ -1052,21 +1052,21 @@ extern "C" { status = controller_string_dynamic_append_terminated(entry->items.array[i].name, &cache->action.name_item); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, global.thread); break; } - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe required %s item '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, action->parameters.array[0].string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' does not exist.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe required %s item '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[0].string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' does not exist.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_entry_error_print_cache(is_entry, main.data->error, cache->action); + controller_entry_error_print_cache(is_entry, global.main->error, cache->action); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } action->number = 0; @@ -1087,7 +1087,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_entry_error_print_cache(is_entry, main.data->error, cache->action); + controller_entry_error_print_cache(is_entry, global.main->error, cache->action); entry->status = controller_status_simplify_error(F_status_set_fine(status)); } @@ -1100,7 +1100,7 @@ extern "C" { #endif // _di_controller_entry_read_ #ifndef _di_controller_entry_settings_read_ - f_status_t controller_entry_settings_read(const bool is_entry, const f_string_range_t content_range, controller_main_t main, controller_cache_t *cache) { + f_status_t controller_entry_settings_read(const bool is_entry, const f_string_range_t content_range, controller_global_t global, controller_cache_t *cache) { f_status_t status = F_none; { @@ -1110,7 +1110,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, global.thread); return status; } @@ -1118,7 +1118,7 @@ extern "C" { status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); return status; } @@ -1134,7 +1134,7 @@ extern "C" { status = f_fss_count_lines(cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread); break; } @@ -1143,56 +1143,56 @@ extern "C" { status = controller_string_dynamic_rip_nulless_terminated(cache->buffer_file, cache->object_actions.array[i], &cache->action.name_action); if (F_status_is_error(status)) { - controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, main.thread); + controller_entry_error_print(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, global.thread); break; } if (is_entry && fl_string_dynamic_compare_string(controller_string_mode_s, cache->action.name_action, controller_string_mode_length) == F_equal_to) { if (cache->content_actions.array[i].used < 0 || cache->content_actions.array[i].used > 1) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe %s item setting '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, cache->action.name_action.string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' requires exactly ", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%d%s", main.data->error.context.after->string, main.data->error.notable.before->string, 1, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s parameter.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe %s item setting '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, cache->action.name_action.string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' requires exactly ", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%d%s", global.main->error.context.after->string, global.main->error.notable.before->string, 1, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s parameter.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } continue; } if (fl_string_dynamic_partial_compare_string(controller_string_service_s, cache->buffer_file, controller_string_service_length, cache->content_actions.array[i].array[0]) == F_equal_to) { - main.setting->mode = controller_setting_mode_service; + global.setting->mode = controller_setting_mode_service; } else if (fl_string_dynamic_partial_compare_string(controller_string_program_s, cache->buffer_file, controller_string_program_length, cache->content_actions.array[i].array[0]) == F_equal_to) { - main.setting->mode = controller_setting_mode_program; + global.setting->mode = controller_setting_mode_program; } else { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - fprintf(main.data->warning.to.stream, "%s%sUnknown %s item setting value '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->warning.to.stream, "%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string); - f_print_dynamic_partial(main.data->warning.to.stream, cache->buffer_file, cache->content_actions.array[i].array[0]); - fprintf(main.data->warning.to.stream, "%s%s for %s item setting '", main.data->warning.notable.after->string, main.data->warning.context.before->string, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->warning.to.stream, "%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string); - f_print_dynamic(main.data->warning.to.stream, cache->action.name_action); - fprintf(main.data->warning.to.stream, "%s", main.data->warning.notable.after->string); - fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]); - - controller_entry_error_print_cache(is_entry, main.data->warning, cache->action); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + fprintf(global.main->warning.to.stream, "%s%sUnknown %s item setting value '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); + f_print_dynamic_partial(global.main->warning.to.stream, cache->buffer_file, cache->content_actions.array[i].array[0]); + fprintf(global.main->warning.to.stream, "%s%s for %s item setting '", global.main->warning.notable.after->string, global.main->warning.context.before->string, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); + f_print_dynamic(global.main->warning.to.stream, cache->action.name_action); + fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); + fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); + + controller_entry_error_print_cache(is_entry, global.main->warning, cache->action); } continue; } } else { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - fprintf(main.data->warning.to.stream, "%s%sUnknown %s item setting '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(main.data->warning.to.stream, "%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string); - f_print_dynamic(main.data->warning.to.stream, cache->action.name_action); - fprintf(main.data->warning.to.stream, "%s", main.data->warning.notable.after->string); - fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]); - - controller_entry_error_print_cache(is_entry, main.data->warning, cache->action); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + fprintf(global.main->warning.to.stream, "%s%sUnknown %s item setting '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); + fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); + f_print_dynamic(global.main->warning.to.stream, cache->action.name_action); + fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); + fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); + + controller_entry_error_print_cache(is_entry, global.main->warning, cache->action); } continue; diff --git a/level_3/controller/c/private-entry.h b/level_3/controller/c/private-entry.h index 8e25b11..0b73982 100644 --- a/level_3/controller/c/private-entry.h +++ b/level_3/controller/c/private-entry.h @@ -96,8 +96,8 @@ extern "C" { * If FALSE, then this loads as an exit. * @param content_range * The range in the list buffer representing the content. - * @param main - * The main data. + * @param global + * The global data. * @param cache * A structure for containing and caching relevant data. * @param actions @@ -125,7 +125,7 @@ extern "C" { * @see fll_fss_extended_read() */ #ifndef _di_controller_entry_actions_read_ - extern f_status_t controller_entry_actions_read(const bool is_entry, const f_string_range_t content_range, controller_main_t main, controller_cache_t *cache, controller_entry_actions_t *actions) f_attribute_visibility_internal; + extern f_status_t controller_entry_actions_read(const bool is_entry, const f_string_range_t content_range, controller_global_t global, controller_cache_t *cache, controller_entry_actions_t *actions) f_attribute_visibility_internal; #endif // _di_controller_entry_actions_read_ /** @@ -206,11 +206,11 @@ extern "C" { * @param is_entry * If TRUE, then this loads as an entry. * If FALSE, then this loads as an exit. - * @param main - * The main data. + * @param global + * The global data. * @param cache * The cache for the specific thread. - * This should be the cache main.thread->asynchronouss.array[main.id].cache. + * This should be the cache global.thread->asynchronouss.array[global.id].cache. * * @return * F_none on success. @@ -243,7 +243,7 @@ extern "C" { * @see fll_fss_basic_list_read() */ #ifndef _di_controller_entry_read_ - extern f_status_t controller_entry_read(const bool is_entry, controller_main_t main, controller_cache_t *cache) f_attribute_visibility_internal; + extern f_status_t controller_entry_read(const bool is_entry, controller_global_t global, controller_cache_t *cache) f_attribute_visibility_internal; #endif // _di_controller_entry_read_ /** @@ -254,13 +254,13 @@ extern "C" { * If FALSE, then this loads as an exit. * @param content_range * The range in the list buffer representing the content. - * @param main - * The main data. + * @param global + * The global data. * @param cache * A structure for containing and caching relevant data. */ #ifndef _di_controller_entry_settings_read_ - extern f_status_t controller_entry_settings_read(const bool is_entry, const f_string_range_t content_range, controller_main_t main, controller_cache_t *cache) f_attribute_visibility_internal; + extern f_status_t controller_entry_settings_read(const bool is_entry, const f_string_range_t content_range, controller_global_t global, controller_cache_t *cache) f_attribute_visibility_internal; #endif // _di_controller_entry_settings_read_ #ifdef __cplusplus diff --git a/level_3/controller/c/private-rule.c b/level_3/controller/c/private-rule.c index c1ce227..8f627c5 100644 --- a/level_3/controller/c/private-rule.c +++ b/level_3/controller/c/private-rule.c @@ -52,7 +52,7 @@ extern "C" { #endif // _di_controller_rule_find_ #ifndef _di_controller_rule_parameters_read_ - f_status_t controller_rule_parameters_read(const controller_main_t main, const f_string_static_t buffer, f_fss_object_t *object, f_fss_content_t *content, f_string_dynamics_t *parameters) { + f_status_t controller_rule_parameters_read(const controller_global_t global, const f_string_static_t buffer, f_fss_object_t *object, f_fss_content_t *content, f_string_dynamics_t *parameters) { f_status_t status = F_none; @@ -63,7 +63,7 @@ extern "C" { status = f_string_dynamics_increase(parameters); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread); return status; } @@ -73,7 +73,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, *object, ¶meters->array[0]); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread); return status; } @@ -81,7 +81,7 @@ extern "C" { status = f_string_dynamic_terminate_after(¶meters->array[0]); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); return status; } @@ -98,7 +98,7 @@ extern "C" { status = f_string_dynamics_increase(parameters); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread); return status; } @@ -108,7 +108,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, content->array[i], ¶meters->array[parameters->used]); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread); return status; } @@ -116,7 +116,7 @@ extern "C" { status = f_string_dynamic_terminate_after(¶meters->array[parameters->used]); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); return status; } @@ -229,7 +229,7 @@ extern "C" { #endif // _di_controller_rule_actions_increase_by_ #ifndef _di_controller_rule_action_read_ - f_status_t controller_rule_action_read(const controller_main_t main, const uint8_t type, const uint8_t method, controller_cache_t *cache, controller_rule_item_t *item, controller_rule_actions_t *actions, f_string_range_t *range) { + f_status_t controller_rule_action_read(const controller_global_t global, const uint8_t type, const uint8_t method, controller_cache_t *cache, controller_rule_item_t *item, controller_rule_actions_t *actions, f_string_range_t *range) { f_status_t status = F_none; @@ -247,13 +247,13 @@ extern "C" { status = fl_fss_extended_list_content_read(cache->buffer_item, range, &cache->content_action, &cache->delimits, &cache->comments); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fl_fss_extended_list_content_read", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_extended_list_content_read", F_true, global.thread); } else if (status == FL_fss_found_content) { status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); } else { @@ -264,7 +264,7 @@ extern "C" { status = f_string_dynamics_increase(&actions->array[actions->used].parameters); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread); } else { @@ -276,13 +276,13 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_action.array[0], &actions->array[actions->used].parameters.array[0]); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true, global.thread); } status = f_string_dynamic_terminate_after(&actions->array[actions->used].parameters.array[0]); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); } else { actions->array[actions->used].parameters.used = 1; @@ -297,14 +297,14 @@ extern "C" { status = fll_fss_extended_read(cache->buffer_item, &cache->content_action.array[0], &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fll_fss_extended_read", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fll_fss_extended_read", F_true, global.thread); } else { status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); } else { @@ -315,14 +315,14 @@ extern "C" { status = controller_rule_actions_increase_by(controller_default_allocation_step, actions); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true, global.thread); break; } status = f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &actions->array[actions->used].line); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread); break; } @@ -334,13 +334,13 @@ extern "C" { status = f_string_dynamics_increase(&actions->array[actions->used].parameters); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread); actions->array[actions->used].status = controller_status_simplify_error(F_status_set_fine(status)); break; } - status = controller_rule_parameters_read(main, cache->buffer_item, &cache->object_actions.array[i], &cache->content_actions.array[i], &actions->array[actions->used].parameters); + status = controller_rule_parameters_read(global, cache->buffer_item, &cache->object_actions.array[i], &cache->content_actions.array[i], &actions->array[actions->used].parameters); actions->array[actions->used].status = controller_status_simplify_error(F_status_set_fine(status)); actions->used++; @@ -363,19 +363,19 @@ extern "C" { status = fl_fss_extended_content_read(cache->buffer_item, range, &cache->content_action, 0, &cache->delimits); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fll_fss_extended_content_read", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fll_fss_extended_content_read", F_true, global.thread); } else if (status == FL_fss_found_content) { status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); } else if (item->type == controller_rule_item_type_script || item->type == controller_rule_item_type_utility) { status = f_string_dynamics_increase(&actions->array[actions->used].parameters); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread); } else { @@ -394,7 +394,7 @@ extern "C" { status = f_string_dynamic_terminate_after(&actions->array[actions->used].parameters.array[0]); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); } else { actions->array[actions->used].parameters.used = 1; @@ -409,7 +409,7 @@ extern "C" { status = f_fss_count_lines(cache->buffer_item, range->start, &actions->array[actions->used].line); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread); } else { @@ -418,10 +418,10 @@ extern "C" { actions->array[actions->used].parameters.used = 0; actions->array[actions->used].status = F_known_not; - status = controller_rule_parameters_read(main, cache->buffer_item, 0, &cache->content_action, &actions->array[actions->used].parameters); + status = controller_rule_parameters_read(global, cache->buffer_item, 0, &cache->content_action, &actions->array[actions->used].parameters); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "controller_rule_parameters_read", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "controller_rule_parameters_read", F_true, global.thread); actions->array[actions->used].status = controller_status_simplify_error(F_status_set_fine(status)); } @@ -439,15 +439,15 @@ extern "C" { } if (F_status_is_error_not(status) && status == F_data_not) { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->warning.to.stream, "%s%sAction is empty, nothing to do.%s%c", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s, main.data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%s%sAction is empty, nothing to do.%s%c", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, global.main->warning.context.after->string, f_string_eol_s[0]); - controller_rule_error_print_cache(main.data->warning, cache->action, F_true); + controller_rule_error_print_cache(global.main->warning, cache->action, F_true); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } } @@ -803,7 +803,7 @@ extern "C" { #endif // _di_controller_rule_action_error_missing_pid_ #ifndef _di_controller_rule_execute_ - f_status_t controller_rule_execute(const uint8_t action, const uint8_t options, const controller_main_t main, controller_process_t *process) { + f_status_t controller_rule_execute(const uint8_t action, const uint8_t options, const controller_global_t global, controller_process_t *process) { f_status_t status = F_none; f_status_t success = F_false; @@ -843,7 +843,7 @@ extern "C" { status = fll_control_group_prepare(process->rule.control_group); if (F_status_is_error(status)) { - controller_error_file_print(main.data->error, F_status_set_fine(status), "fll_control_group_prepare", F_true, process->rule.control_group.path.string, "prepare control groups for", fll_error_file_type_directory, main.thread); + controller_error_file_print(global.main->error, F_status_set_fine(status), "fll_control_group_prepare", F_true, process->rule.control_group.path.string, "prepare control groups for", fll_error_file_type_directory, global.thread); return status; } @@ -877,12 +877,12 @@ extern "C" { status = fl_environment_load_names(process->rule.environment, &environment); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fl_environment_load_names", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fl_environment_load_names", F_true, global.thread); return status; } - for (i = 0; i < process->rule.items.used && controller_thread_is_enabled_process(process, main.thread); ++i) { + for (i = 0; i < process->rule.items.used && controller_thread_is_enabled_process(process, global.thread); ++i) { if (process->rule.items.array[i].type == controller_rule_item_type_setting) continue; @@ -902,7 +902,7 @@ extern "C" { for (j = 0; j < process->rule.items.array[i].actions.used; ++j) { - if (!controller_thread_is_enabled_process(process, main.thread)) { + if (!controller_thread_is_enabled_process(process, global.thread)) { status = F_signal; break; @@ -918,7 +918,7 @@ extern "C" { } if (process->rule.items.array[i].type == controller_rule_item_type_command) { - status = controller_rule_execute_foreground(process->rule.items.array[i].type, process->rule.items.array[i].actions.array[j], 0, process->rule.items.array[i].actions.array[j].parameters, options, main, &execute_set, process); + status = controller_rule_execute_foreground(process->rule.items.array[i].type, process->rule.items.array[i].actions.array[j], 0, process->rule.items.array[i].actions.array[j].parameters, options, global, &execute_set, process); if (status == F_child || status == F_signal || F_status_set_fine(status) == F_lock) break; @@ -936,7 +936,7 @@ extern "C" { else if (process->rule.items.array[i].type == controller_rule_item_type_script) { execute_set.parameter.data = &process->rule.items.array[i].actions.array[j].parameters.array[0]; - status = controller_rule_execute_foreground(process->rule.items.array[i].type, process->rule.items.array[i].actions.array[j], process->rule.script.used ? process->rule.script.string : controller_default_program_script, arguments_none, options, main, &execute_set, process); + status = controller_rule_execute_foreground(process->rule.items.array[i].type, process->rule.items.array[i].actions.array[j], process->rule.script.used ? process->rule.script.string : controller_default_program_script, arguments_none, options, global, &execute_set, process); if (status == F_child || status == F_signal || F_status_set_fine(status) == F_lock) break; @@ -968,7 +968,7 @@ extern "C" { } // for if (pid_file) { - status = controller_rule_execute_pid_with(*pid_file, process->rule.items.array[i].type, process->rule.items.array[i].actions.array[j], 0, process->rule.items.array[i].actions.array[j].parameters, options, with, main, &execute_set, process); + status = controller_rule_execute_pid_with(*pid_file, process->rule.items.array[i].type, process->rule.items.array[i].actions.array[j], 0, process->rule.items.array[i].actions.array[j].parameters, options, with, global, &execute_set, process); if (status == F_child || status == F_signal || F_status_set_fine(status) == F_lock) break; @@ -987,7 +987,7 @@ extern "C" { success = F_status_set_error(F_failure); // @todo make this more specific. - controller_rule_action_error_missing_pid(main.data->error, process->rule.alias.string); + controller_rule_action_error_missing_pid(global.main->error, process->rule.alias.string); } } else if (process->rule.items.array[i].type == controller_rule_item_type_utility) { @@ -1009,7 +1009,7 @@ extern "C" { if (pid_file) { execute_set.parameter.data = &process->rule.items.array[i].actions.array[j].parameters.array[0]; - status = controller_rule_execute_pid_with(*pid_file, process->rule.items.array[i].type, process->rule.items.array[i].actions.array[j], process->rule.script.used ? process->rule.script.string : controller_default_program_script, arguments_none, options, with, main, &execute_set, process); + status = controller_rule_execute_pid_with(*pid_file, process->rule.items.array[i].type, process->rule.items.array[i].actions.array[j], process->rule.script.used ? process->rule.script.string : controller_default_program_script, arguments_none, options, with, global, &execute_set, process); if (status == F_child || status == F_signal || F_status_set_fine(status) == F_lock) break; @@ -1028,19 +1028,19 @@ extern "C" { success = F_status_set_error(F_failure); // @todo make this more specific. - controller_rule_action_error_missing_pid(main.data->error, process->rule.alias.string); + controller_rule_action_error_missing_pid(global.main->error, process->rule.alias.string); } } else { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->warning.to.stream, "%s%sAction type is unknown, ignoring.%s%c", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s, main.data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%s%sAction type is unknown, ignoring.%s%c", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, global.main->warning.context.after->string, f_string_eol_s[0]); - controller_rule_error_print_cache(main.data->warning, process->cache.action, F_true); + controller_rule_error_print_cache(global.main->warning, process->cache.action, F_true); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } if (success == F_false) { @@ -1060,7 +1060,7 @@ extern "C" { // lock failed, attempt to re-establish lock before returning. if (F_status_set_fine(status) == F_lock) { - status = controller_lock_read(process, main.thread, &process->lock); + status = controller_lock_read(process, global.thread, &process->lock); if (status == F_signal || F_status_is_error(status)) { return F_status_set_error(F_lock); @@ -1069,7 +1069,7 @@ extern "C" { success = F_false; } - if (!controller_thread_is_enabled_process(process, main.thread)) { + if (!controller_thread_is_enabled_process(process, global.thread)) { return F_signal; } @@ -1090,7 +1090,7 @@ extern "C" { #endif // _di_controller_rule_execute_ #ifndef _di_controller_rule_execute_foreground_ - f_status_t controller_rule_execute_foreground(const uint8_t type, const controller_rule_action_t action, const f_string_t program, const f_string_dynamics_t arguments, const uint8_t options, const controller_main_t main, controller_execute_set_t * const execute_set, controller_process_t *process) { + f_status_t controller_rule_execute_foreground(const uint8_t type, const controller_rule_action_t action, const f_string_t program, const f_string_dynamics_t arguments, const uint8_t options, const controller_global_t global, controller_execute_set_t * const execute_set, controller_process_t *process) { f_status_t status = F_none; f_status_t status_lock = F_none; @@ -1101,7 +1101,7 @@ extern "C" { status = controller_pids_increase(&process->childs); if (F_status_is_error(status)) { - fll_error_print(main.data->error, F_status_set_fine(status), "controller_pids_increase", F_true); + fll_error_print(global.main->error, F_status_set_fine(status), "controller_pids_increase", F_true); return status; } @@ -1124,23 +1124,23 @@ extern "C" { } if (options & controller_process_option_simulate) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->output.stream, "Simulating execution of '"); - fprintf(main.data->output.stream, "%s%s%s", main.data->context.title.string, program ? program : arguments.used && arguments.array[0].used ? arguments.array[0].string : f_string_empty_s, main.data->context.reset.string); - fprintf(main.data->output.stream, "' with the arguments: '%s", main.data->context.important.string); + fprintf(global.main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->output.stream, "Simulating execution of '"); + fprintf(global.main->output.stream, "%s%s%s", global.main->context.title.string, program ? program : arguments.used && arguments.array[0].used ? arguments.array[0].string : f_string_empty_s, global.main->context.reset.string); + fprintf(global.main->output.stream, "' with the arguments: '%s", global.main->context.important.string); for (f_array_length_t i = program ? 0 : 1; i < arguments.used; ++i) { - fprintf(main.data->output.stream, "%s%s", (program && i || !program && i > 1) ? f_string_space_s : "", arguments.array[i].string); + fprintf(global.main->output.stream, "%s%s", (program && i || !program && i > 1) ? f_string_space_s : "", arguments.array[i].string); } // for - fprintf(main.data->output.stream, "%s' from '", main.data->context.reset.string); - fprintf(main.data->output.stream, "%s%s%s", main.data->context.notable.string, process->rule.name.used ? process->rule.name.string : f_string_empty_s, main.data->context.reset.string); - fprintf(main.data->output.stream, "%s'.%c", main.data->context.reset.string, f_string_eol_s[0]); + fprintf(global.main->output.stream, "%s' from '", global.main->context.reset.string); + fprintf(global.main->output.stream, "%s%s%s", global.main->context.notable.string, process->rule.name.used ? process->rule.name.string : f_string_empty_s, global.main->context.reset.string); + fprintf(global.main->output.stream, "%s'.%c", global.main->context.reset.string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->output.stream, &global.thread->lock.print); } // sleep for less than a second to better show simulation of synchronous vs asynchronous. @@ -1161,13 +1161,13 @@ extern "C" { f_thread_unlock(&process->lock); - status_lock = controller_lock_write_process(process, main.thread, &process->lock); + status_lock = controller_lock_write_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); if (status_lock != F_signal) { - status = controller_lock_read_process(process, main.thread, &process->lock); + status = controller_lock_read_process(process, global.thread, &process->lock); if (status == F_none) { return status_lock; @@ -1182,10 +1182,10 @@ extern "C" { f_thread_unlock(&process->lock); - status_lock = controller_lock_read_process(process, main.thread, &process->lock); + status_lock = controller_lock_read_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); } if (status_lock != F_signal) { @@ -1194,7 +1194,7 @@ extern "C" { waitpid(id_child, &result, 0); } - if (status_lock == F_signal || !controller_thread_is_enabled_process(process, main.thread)) { + if (status_lock == F_signal || !controller_thread_is_enabled_process(process, global.thread)) { if (status_lock == F_none) { return F_signal; } @@ -1206,13 +1206,13 @@ extern "C" { f_thread_unlock(&process->lock); } - status_lock = controller_lock_write_process(process, main.thread, &process->lock); + status_lock = controller_lock_write_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); if (status_lock != F_signal) { - status = controller_lock_read_process(process, main.thread, &process->lock); + status = controller_lock_read_process(process, global.thread, &process->lock); if (status == F_none) { return status_lock; @@ -1227,10 +1227,10 @@ extern "C" { f_thread_unlock(&process->lock); - status_lock = controller_lock_read_process(process, main.thread, &process->lock); + status_lock = controller_lock_read_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); return F_status_set_error(F_lock); } @@ -1244,7 +1244,7 @@ extern "C" { } } else { - if (!controller_thread_is_enabled_process(process, main.thread)) { + if (!controller_thread_is_enabled_process(process, global.thread)) { return F_signal; } } @@ -1271,19 +1271,19 @@ extern "C" { if (F_status_is_error(status)) { status = F_status_set_fine(status); - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); if (status == F_control_group || status == F_failure || status == F_limit || status == F_processor || status == F_schedule) { - controller_rule_item_error_print_execute(main.data->error, type == controller_rule_item_type_script, program ? program : arguments.used ? arguments.array[0].string : f_string_empty_s, result, status); + controller_rule_item_error_print_execute(global.main->error, type == controller_rule_item_type_script, program ? program : arguments.used ? arguments.array[0].string : f_string_empty_s, result, status); } else if (status == F_file_found_not) { - controller_rule_item_error_print_execute_not_found(main.data->error, F_false, program); + controller_rule_item_error_print_execute_not_found(global.main->error, F_false, program); } else { - controller_error_print(main.data->error, F_status_set_fine(status), "fll_execute_program", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fll_execute_program", F_true, global.thread); } - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); status = F_status_set_error(status); } @@ -1293,7 +1293,7 @@ extern "C" { #endif // _di_controller_rule_execute_foreground_ #ifndef _di_controller_rule_execute_pid_with_ - f_status_t controller_rule_execute_pid_with(const f_string_dynamic_t pid_file, const uint8_t type, const controller_rule_action_t action, const f_string_t program, const f_string_dynamics_t arguments, const uint8_t options, const uint8_t with, const controller_main_t main, controller_execute_set_t * const execute_set, controller_process_t *process) { + f_status_t controller_rule_execute_pid_with(const f_string_dynamic_t pid_file, const uint8_t type, const controller_rule_action_t action, const f_string_t program, const f_string_dynamics_t arguments, const uint8_t options, const uint8_t with, const controller_global_t global, controller_execute_set_t * const execute_set, controller_process_t *process) { f_status_t status = F_none; f_status_t status_lock = F_none; @@ -1304,7 +1304,7 @@ extern "C" { status = controller_pids_increase(&process->childs); if (F_status_is_error(status)) { - fll_error_print(main.data->error, F_status_set_fine(status), "controller_pids_increase", F_true); + fll_error_print(global.main->error, F_status_set_fine(status), "controller_pids_increase", F_true); return status; } @@ -1312,7 +1312,7 @@ extern "C" { status = f_string_dynamics_increase(&process->path_pids); if (F_status_is_error(status)) { - fll_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true); + fll_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true); return status; } @@ -1347,13 +1347,13 @@ extern "C" { status = f_file_exists(pid_file.string); if (F_status_is_error(status)) { - fll_error_file_print(main.data->error, F_status_set_fine(status), "f_file_exists", F_true, pid_file.string, "find", fll_error_file_type_file); + fll_error_file_print(global.main->error, F_status_set_fine(status), "f_file_exists", F_true, pid_file.string, "find", fll_error_file_type_file); return status; } if (status == F_true) { - fll_error_file_print(main.data->error, F_file_found, "f_file_exists", F_true, pid_file.string, "find", fll_error_file_type_file); + fll_error_file_print(global.main->error, F_file_found, "f_file_exists", F_true, pid_file.string, "find", fll_error_file_type_file); return F_status_set_error(F_file_found); } @@ -1361,29 +1361,29 @@ extern "C" { status = controller_string_dynamic_append_terminated(pid_file, child_pid_file); if (F_status_is_error(status)) { - fll_error_print(main.data->error, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true); + fll_error_print(global.main->error, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true); return status; } if (options & controller_process_option_simulate) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->output.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->output.stream, "Simulating execution of '"); - fprintf(main.data->output.stream, "%s%s%s", main.data->context.title.string, program ? program : arguments.used && arguments.array[0].used ? arguments.array[0].string : f_string_empty_s, main.data->context.reset.string); - fprintf(main.data->output.stream, "' with the arguments: '%s", main.data->context.important.string); + fprintf(global.main->output.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->output.stream, "Simulating execution of '"); + fprintf(global.main->output.stream, "%s%s%s", global.main->context.title.string, program ? program : arguments.used && arguments.array[0].used ? arguments.array[0].string : f_string_empty_s, global.main->context.reset.string); + fprintf(global.main->output.stream, "' with the arguments: '%s", global.main->context.important.string); for (f_array_length_t i = program ? 0 : 1; i < arguments.used; ++i) { - fprintf(main.data->output.stream, "%s%s", (program && i || !program && i > 1) ? f_string_space_s : "", arguments.array[i].string); + fprintf(global.main->output.stream, "%s%s", (program && i || !program && i > 1) ? f_string_space_s : "", arguments.array[i].string); } // for - fprintf(main.data->output.stream, "%s' from '", main.data->context.reset.string); - fprintf(main.data->output.stream, "%s%s%s", main.data->context.notable.string, process->rule.name.used ? process->rule.name.string : f_string_empty_s, main.data->context.reset.string); - fprintf(main.data->output.stream, "%s'.%c", main.data->context.reset.string, f_string_eol_s[0]); + fprintf(global.main->output.stream, "%s' from '", global.main->context.reset.string); + fprintf(global.main->output.stream, "%s%s%s", global.main->context.notable.string, process->rule.name.used ? process->rule.name.string : f_string_empty_s, global.main->context.reset.string); + fprintf(global.main->output.stream, "%s'.%c", global.main->context.reset.string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->output.stream, &global.thread->lock.print); } // sleep for less than a second to better show simulation of synchronous vs asynchronous. @@ -1404,13 +1404,13 @@ extern "C" { f_thread_unlock(&process->lock); - status_lock = controller_lock_write_process(process, main.thread, &process->lock); + status_lock = controller_lock_write_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); if (status_lock != F_signal) { - status = controller_lock_read_process(process, main.thread, &process->lock); + status = controller_lock_read_process(process, global.thread, &process->lock); if (status == F_none) { return status_lock; @@ -1425,10 +1425,10 @@ extern "C" { f_thread_unlock(&process->lock); - status_lock = controller_lock_read_process(process, main.thread, &process->lock); + status_lock = controller_lock_read_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); } if (status_lock != F_signal) { @@ -1437,7 +1437,7 @@ extern "C" { waitpid(id_child, &result, 0); } - if (!controller_thread_is_enabled_process(process, main.thread)) { + if (!controller_thread_is_enabled_process(process, global.thread)) { if (status_lock == F_none) { return F_signal; } @@ -1449,13 +1449,13 @@ extern "C" { f_thread_unlock(&process->lock); } - status_lock = controller_lock_write_process(process, main.thread, &process->lock); + status_lock = controller_lock_write_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); if (status_lock != F_signal) { - status = controller_lock_read_process(process, main.thread, &process->lock); + status = controller_lock_read_process(process, global.thread, &process->lock); if (status == F_none) { return status_lock; @@ -1470,10 +1470,10 @@ extern "C" { f_thread_unlock(&process->lock); - status_lock = controller_lock_read_process(process, main.thread, &process->lock); + status_lock = controller_lock_read_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); return F_status_set_error(F_lock); } @@ -1488,7 +1488,7 @@ extern "C" { } } else { - if (!controller_thread_is_enabled_process(process, main.thread)) { + if (!controller_thread_is_enabled_process(process, global.thread)) { return F_signal; } } @@ -1515,19 +1515,19 @@ extern "C" { if (F_status_is_error(status)) { status = F_status_set_fine(status); - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); if (status == F_control_group || status == F_failure || status == F_limit || status == F_processor || status == F_schedule) { - controller_rule_item_error_print_execute(main.data->error, type == controller_rule_item_type_utility, program ? program : arguments.used ? arguments.array[0].string : f_string_empty_s, result, status); + controller_rule_item_error_print_execute(global.main->error, type == controller_rule_item_type_utility, program ? program : arguments.used ? arguments.array[0].string : f_string_empty_s, result, status); } else if (status == F_file_found_not) { - controller_rule_item_error_print_execute_not_found(main.data->error, F_false, program); + controller_rule_item_error_print_execute_not_found(global.main->error, F_false, program); } else { - controller_error_print(main.data->error, F_status_set_fine(status), "fll_execute_program", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fll_execute_program", F_true, global.thread); } - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); return F_status_set_error(status); } @@ -1537,7 +1537,7 @@ extern "C" { #endif // _di_controller_rule_execute_pid_with_ #ifndef _di_controller_rule_id_construct_ - f_status_t controller_rule_id_construct(const controller_main_t main, const f_string_static_t source, const f_string_range_t directory, const f_string_range_t basename, f_string_dynamic_t *alias) { + f_status_t controller_rule_id_construct(const controller_global_t global, const f_string_static_t source, const f_string_range_t directory, const f_string_range_t basename, f_string_dynamic_t *alias) { f_status_t status = F_none; @@ -1546,7 +1546,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(source, directory, alias); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread); return status; } @@ -1554,7 +1554,7 @@ extern "C" { status = f_string_append(f_path_separator_s, f_path_separator_length, alias); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_append", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_append", F_true, global.thread); return status; } @@ -1562,7 +1562,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(source, basename, alias); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread); return status; } @@ -1570,7 +1570,7 @@ extern "C" { status = f_string_dynamic_terminate_after(alias); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); } return status; @@ -1592,7 +1592,7 @@ extern "C" { #endif // _di_controller_rule_status_is_error_ #ifndef _di_controller_rule_item_read_ - f_status_t controller_rule_item_read(const controller_main_t main, controller_cache_t *cache, controller_rule_item_t *item) { + f_status_t controller_rule_item_read(const controller_global_t global, controller_cache_t *cache, controller_rule_item_t *item) { f_status_t status = F_none; @@ -1610,7 +1610,7 @@ extern "C" { status = fl_fss_extended_list_object_read(cache->buffer_item, &range, &cache->range_action, &cache->delimits); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fl_fss_extended_list_object_read", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_extended_list_object_read", F_true, global.thread); break; } @@ -1626,7 +1626,7 @@ extern "C" { status = fl_fss_extended_object_read(cache->buffer_item, &range, &cache->range_action, 0, &cache->delimits); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fl_fss_extended_object_read", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_extended_object_read", F_true, global.thread); break; } @@ -1638,14 +1638,14 @@ extern "C" { status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); break; } status = f_fss_count_lines(cache->buffer_item, cache->range_action.start, &cache->action.line_action); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread); break; } @@ -1655,7 +1655,7 @@ extern "C" { status = controller_string_dynamic_rip_nulless_terminated(cache->buffer_item, cache->range_action, &cache->action.name_action); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, global.thread); break; } @@ -1693,19 +1693,19 @@ extern "C" { type = controller_rule_action_type_with; } else { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->warning.to.stream, "%s%sUnknown rule item action '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s); - fprintf(main.data->warning.to.stream, "%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string); - f_print_dynamic(main.data->warning.to.stream, cache->action.name_action); - fprintf(main.data->warning.to.stream, "%s", main.data->warning.notable.after->string); - fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%s%sUnknown rule item action '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s); + fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); + f_print_dynamic(global.main->warning.to.stream, cache->action.name_action); + fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); + fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); - controller_rule_error_print_cache(main.data->warning, cache->action, F_true); + controller_rule_error_print_cache(global.main->warning, cache->action, F_true); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } continue; @@ -1714,17 +1714,17 @@ extern "C" { if (multiple) { if (type == controller_rule_action_type_group || type == controller_rule_action_type_pid_file || type == controller_rule_action_type_user) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sFSS Extended List is not allowed for the rule item action '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic(main.data->error.to.stream, cache->action.name_action); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sFSS Extended List is not allowed for the rule item action '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic(global.main->error.to.stream, cache->action.name_action); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } status = F_status_set_error(F_supported_not); @@ -1740,11 +1740,11 @@ extern "C" { status = controller_rule_actions_increase_by(controller_default_allocation_step, &item->actions); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true, global.thread); break; } - status = controller_rule_action_read(main, type, method, cache, item, &item->actions, &range); + status = controller_rule_action_read(global, type, method, cache, item, &item->actions, &range); if (F_status_is_error(status)) break; } // for @@ -1905,7 +1905,7 @@ extern "C" { #endif // _di_controller_rule_setting_limit_type_name_ #ifndef _di_controller_rule_process_ - f_status_t controller_rule_process(const controller_main_t main, controller_process_t *process) { + f_status_t controller_rule_process(const controller_global_t global, controller_process_t *process) { switch (process->action) { case controller_rule_action_type_freeze: @@ -1920,17 +1920,17 @@ extern "C" { break; default: - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sUnsupported action type '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_rule_action_type_name(process->action), main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' while attempting to execute rule.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sUnsupported action type '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_rule_action_type_name(process->action), global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' while attempting to execute rule.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_rule_error_print_cache(main.data->error, process->cache.action, F_true); + controller_rule_error_print_cache(global.main->error, process->cache.action, F_true); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } return F_status_set_error(F_parameter); @@ -1950,7 +1950,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, process->cache.action, F_status_set_fine(status), "f_string_append", F_true, F_true, main.thread); + controller_rule_error_print(global.main->error, process->cache.action, F_status_set_fine(status), "f_string_append", F_true, F_true, global.thread); return status; } @@ -1958,7 +1958,7 @@ extern "C" { status = f_string_dynamic_append(process->rule.alias, &process->cache.action.name_file); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true, main.thread); + controller_rule_error_print(global.main->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true, global.thread); return status; } @@ -1970,7 +1970,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, process->cache.action, F_status_set_fine(status), "f_string_append", F_true, F_true, main.thread); + controller_rule_error_print(global.main->error, process->cache.action, F_status_set_fine(status), "f_string_append", F_true, F_true, global.thread); return status; } @@ -1978,13 +1978,13 @@ extern "C" { status = f_string_dynamic_terminate_after(&process->cache.action.name_file); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_true, main.thread); + controller_rule_error_print(global.main->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_true, global.thread); return status; } if ((process->options & controller_process_option_simulate) && (process->options & controller_process_option_validate)) { - controller_rule_validate(process->rule, process->action, process->options, main, &process->cache); + controller_rule_validate(process->rule, process->action, process->options, global, &process->cache); } f_array_length_t i = 0; @@ -2026,25 +2026,25 @@ extern "C" { // i==0 is need, i==1 is want, i==2 is wish. // loop through all dependencies: wait for depedency, execute dependency, fail due to missing required dependency, or skip unrequired missing dependencies. - for (i = 0; i < 3 && controller_thread_is_enabled_process(process, main.thread); ++i) { + for (i = 0; i < 3 && controller_thread_is_enabled_process(process, global.thread); ++i) { - for (j = 0; j < dynamics[i]->used && controller_thread_is_enabled_process(process, main.thread); ++j) { + for (j = 0; j < dynamics[i]->used && controller_thread_is_enabled_process(process, global.thread); ++j) { id_dependency = 0; dependency = 0; found = F_false; - status_lock = controller_lock_read_process(process, main.thread, &main.thread->lock.process); + status_lock = controller_lock_read_process(process, global.thread, &global.thread->lock.process); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); } else { - status = controller_process_prepare_process_type(process->type, process->action, dynamics[i]->array[j], main, &id_dependency); + status = controller_process_prepare_process_type(process->type, process->action, dynamics[i]->array[j], global, &id_dependency); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_lock) { - if (!controller_thread_is_enabled_process_type(process->type, main.thread)) { + if (!controller_thread_is_enabled_process_type(process->type, global.thread)) { return F_signal; } } @@ -2052,13 +2052,13 @@ extern "C" { } - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_item_error_print_rule_not_loaded(main.data->error, dynamics[i]->array[j].string); - controller_rule_error_print_cache(main.data->error, process->cache.action, F_false); + controller_rule_item_error_print_rule_not_loaded(global.main->error, dynamics[i]->array[j].string); + controller_rule_error_print_cache(global.main->error, process->cache.action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } return status; @@ -2070,37 +2070,37 @@ extern "C" { if (status == F_true) { found = F_true; - dependency = main.thread->processs.array[id_dependency]; + dependency = global.thread->processs.array[id_dependency]; - status_lock = controller_lock_read_process(process, main.thread, &dependency->active); + status_lock = controller_lock_read_process(process, global.thread, &dependency->active); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); status = F_false; dependency = 0; - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); } else { - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); - status_lock = controller_lock_read_process(process, main.thread, &main.thread->lock.rule); + status_lock = controller_lock_read_process(process, global.thread, &global.thread->lock.rule); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); status = F_false; } else { - status = controller_rule_find(dynamics[i]->array[j], main.setting->rules, &id_rule); + status = controller_rule_find(dynamics[i]->array[j], global.setting->rules, &id_rule); - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); } } } else { - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); } if (status != F_true) { @@ -2108,12 +2108,12 @@ extern "C" { id_rule = 0; if (i == 0) { - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_item_error_print_need_want_wish(main.data->error, strings[i], dynamics[i]->array[j].string, "was not found"); - controller_rule_error_print_cache(main.data->error, process->cache.action, F_true); + controller_rule_item_error_print_need_want_wish(global.main->error, strings[i], dynamics[i]->array[j].string, "was not found"); + controller_rule_error_print_cache(global.main->error, process->cache.action, F_true); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); status = F_status_set_error(F_found_not); @@ -2126,21 +2126,21 @@ extern "C" { } } else { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_item_error_print_need_want_wish(main.data->warning, strings[i], dynamics[i]->array[j].string, "was not found"); - controller_rule_error_print_cache(main.data->warning, process->cache.action, F_true); + controller_rule_item_error_print_need_want_wish(global.main->warning, strings[i], dynamics[i]->array[j].string, "was not found"); + controller_rule_error_print_cache(global.main->warning, process->cache.action, F_true); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } } } else if (found) { - status_lock = controller_lock_read_process(process, main.thread, &main.thread->lock.rule); + status_lock = controller_lock_read_process(process, global.thread, &global.thread->lock.rule); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); found = F_false; status = status_lock; @@ -2150,48 +2150,48 @@ extern "C" { if (found) { // the dependency may have write locks, which needs to be avoided, so copy the alias from the rule. - char alias_other_buffer[main.setting->rules.array[id_rule].alias.used + 1]; + char alias_other_buffer[global.setting->rules.array[id_rule].alias.used + 1]; - memcpy(alias_other_buffer, main.setting->rules.array[id_rule].alias.string, sizeof(char) * main.setting->rules.array[id_rule].alias.used); - alias_other_buffer[main.setting->rules.array[id_rule].alias.used] = 0; + memcpy(alias_other_buffer, global.setting->rules.array[id_rule].alias.string, sizeof(char) * global.setting->rules.array[id_rule].alias.used); + alias_other_buffer[global.setting->rules.array[id_rule].alias.used] = 0; - const f_string_static_t alias_other = f_macro_string_static_t_initialize(alias_other_buffer, main.setting->rules.array[id_rule].alias.used); + const f_string_static_t alias_other = f_macro_string_static_t_initialize(alias_other_buffer, global.setting->rules.array[id_rule].alias.used); - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); - status_lock = controller_lock_read_process(process, main.thread, &dependency->lock); + status_lock = controller_lock_read_process(process, global.thread, &dependency->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); status = status_lock; } else if (dependency->state == controller_process_state_active || dependency->state == controller_process_state_busy) { f_thread_unlock(&dependency->lock); - status = controller_process_wait(main, dependency); + status = controller_process_wait(global, dependency); if (F_status_is_error(status) && !(process->options & controller_process_option_simulate)) break; status = dependency->rule.status[process->action]; } else { - status_lock = controller_lock_read_process(process, main.thread, &main.thread->lock.rule); + status_lock = controller_lock_read_process(process, global.thread, &global.thread->lock.rule); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); f_thread_unlock(&dependency->lock); status = status_lock; } - else if (controller_rule_status_is_available(process->action, main.setting->rules.array[id_rule])) { - f_thread_unlock(&main.thread->lock.rule); + else if (controller_rule_status_is_available(process->action, global.setting->rules.array[id_rule])) { + f_thread_unlock(&global.thread->lock.rule); f_thread_unlock(&dependency->lock); options_process = 0; - if (main.data->parameters[controller_parameter_simulate].result == f_console_result_found) { + if (global.main->parameters[controller_parameter_simulate].result == f_console_result_found) { options_process |= controller_process_option_simulate; } @@ -2200,7 +2200,7 @@ extern "C" { } // synchronously execute dependency. - status = controller_rule_process_begin(0, alias_other, process->action, options_process, process->type, process->stack, main, dependency->cache); + status = controller_rule_process_begin(0, alias_other, process->action, options_process, process->type, process->stack, global, dependency->cache); if (status == F_child || status == F_signal) { f_thread_unlock(&dependency->active); @@ -2210,12 +2210,12 @@ extern "C" { if (F_status_is_error(status)) { if (i == 0 || i == 1 || F_status_set_fine(status) == F_memory_not) { - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_item_error_print_need_want_wish(main.data->error, strings[i], alias_other_buffer, "failed during execution"); - controller_rule_error_print_cache(main.data->error, process->cache.action, F_true); + controller_rule_item_error_print_need_want_wish(global.main->error, strings[i], alias_other_buffer, "failed during execution"); + controller_rule_error_print_cache(global.main->error, process->cache.action, F_true); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); if (!(dependency->options & controller_process_option_simulate) || F_status_set_fine(status) == F_memory_not) { f_thread_unlock(&dependency->active); @@ -2224,58 +2224,58 @@ extern "C" { } } else { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_item_error_print_need_want_wish(main.data->warning, strings[i], alias_other_buffer, "failed during execution"); - controller_rule_error_print_cache(main.data->warning, process->cache.action, F_true); + controller_rule_item_error_print_need_want_wish(global.main->warning, strings[i], alias_other_buffer, "failed during execution"); + controller_rule_error_print_cache(global.main->warning, process->cache.action, F_true); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } } } } else { - status = main.setting->rules.array[id_rule].status[process->action]; + status = global.setting->rules.array[id_rule].status[process->action]; - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); f_thread_unlock(&dependency->lock); } } - if (!controller_thread_is_enabled_process(process, main.thread)) { + if (!controller_thread_is_enabled_process(process, global.thread)) { f_thread_unlock(&dependency->active); break; } if (status_lock != F_signal && F_status_is_error_not(status_lock)) { - status_lock = controller_lock_read_process(process, main.thread, &main.thread->lock.rule); + status_lock = controller_lock_read_process(process, global.thread, &global.thread->lock.rule); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); } } if (status_lock == F_signal || F_status_is_error(status_lock)) { if (F_status_is_error(status_lock)) { - controller_rule_item_error_print_need_want_wish(main.data->error, strings[i], alias_other_buffer, "due to lock failure"); + controller_rule_item_error_print_need_want_wish(global.main->error, strings[i], alias_other_buffer, "due to lock failure"); } status = status_lock; } - else if (controller_rule_status_is_error(process->action, main.setting->rules.array[id_rule])) { - f_thread_unlock(&main.thread->lock.rule); + else if (controller_rule_status_is_error(process->action, global.setting->rules.array[id_rule])) { + f_thread_unlock(&global.thread->lock.rule); if (i == 0 || i == 1) { - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_item_error_print_need_want_wish(main.data->error, strings[i], alias_other_buffer, "is in a failed state"); + controller_rule_item_error_print_need_want_wish(global.main->error, strings[i], alias_other_buffer, "is in a failed state"); status = F_status_set_error(F_found_not); - controller_rule_error_print_cache(main.data->error, process->cache.action, F_true); + controller_rule_error_print_cache(global.main->error, process->cache.action, F_true); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); if (!(dependency->options & controller_process_option_simulate)) { f_thread_unlock(&dependency->active); @@ -2284,18 +2284,18 @@ extern "C" { } } else { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_item_error_print_need_want_wish(main.data->warning, strings[i], alias_other_buffer, "is in a failed state"); - controller_rule_error_print_cache(main.data->warning, process->cache.action, F_true); + controller_rule_item_error_print_need_want_wish(global.main->warning, strings[i], alias_other_buffer, "is in a failed state"); + controller_rule_error_print_cache(global.main->warning, process->cache.action, F_true); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } } } else { - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); } } @@ -2314,13 +2314,13 @@ extern "C" { return status; } - if (!controller_thread_is_enabled_process(process, main.thread)) { + if (!controller_thread_is_enabled_process(process, global.thread)) { return F_signal; } if ((process->options & controller_process_option_wait) && F_status_is_error_not(status) && (process->options & controller_process_option_validate)) { - status_lock = controller_rule_wait_all_process_type(process->type, main, F_false, process); + status_lock = controller_rule_wait_all_process_type(process->type, global, F_false, process); if (status_lock == F_signal) { return F_signal; @@ -2347,19 +2347,19 @@ extern "C" { } // for if (missing) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe rule '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, process->rule.name.used ? process->rule.name.string : f_string_empty_s, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' has no '", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_rule_action_type_name(process->action).string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' action to execute.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe rule '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, process->rule.name.used ? process->rule.name.string : f_string_empty_s, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' has no '", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_rule_action_type_name(process->action).string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' action to execute.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_rule_error_print_cache(main.data->error, process->cache.action, F_true); + controller_rule_error_print_cache(global.main->error, process->cache.action, F_true); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } status = F_status_set_error(F_parameter); @@ -2367,14 +2367,14 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = controller_rule_execute(process->action, process->options, main, process); + status = controller_rule_execute(process->action, process->options, global, process); if (status == F_child || status == F_signal || status == F_status_set_error(F_lock)) { return status; } if (F_status_is_error(status)) { - controller_rule_item_error_print(main.data->error, process->cache.action, F_true, main.thread); + controller_rule_item_error_print(global.main->error, process->cache.action, F_true, global.thread); } } } @@ -2383,13 +2383,13 @@ extern "C" { f_thread_unlock(&process->lock); - status_lock = controller_lock_write_process(process, main.thread, &process->lock); + status_lock = controller_lock_write_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); if (status_lock != F_signal) { - status = controller_lock_read_process(process, main.thread, &process->lock); + status = controller_lock_read_process(process, global.thread, &process->lock); if (status != F_signal && F_status_is_error_not(status)) { return status_lock; @@ -2406,14 +2406,14 @@ extern "C" { process->rule.status[process->action] = status; } - status_lock = controller_lock_write_process(process, main.thread, &main.thread->lock.rule); + status_lock = controller_lock_write_process(process, global.thread, &global.thread->lock.rule); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); f_thread_unlock(&process->lock); - status = controller_lock_read_process(process, main.thread, &process->lock); + status = controller_lock_read_process(process, global.thread, &process->lock); if (status != F_signal && F_status_is_error_not(status)) { return status_lock; @@ -2422,8 +2422,8 @@ extern "C" { return F_status_set_error(F_lock); } - if (controller_rule_find(process->rule.alias, main.setting->rules, &id_rule) == F_true) { - controller_rule_t *rule = &main.setting->rules.array[id_rule]; + if (controller_rule_find(process->rule.alias, global.setting->rules, &id_rule) == F_true) { + controller_rule_t *rule = &global.setting->rules.array[id_rule]; rule->status[process->action] = process->rule.status[process->action]; @@ -2444,13 +2444,13 @@ extern "C" { } // for } - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); f_thread_unlock(&process->lock); - status_lock = controller_lock_read_process(process, main.thread, &process->lock); + status_lock = controller_lock_read_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); return F_status_set_error(F_lock); } @@ -2460,9 +2460,9 @@ extern "C" { #endif // _di_controller_rule_process_ #ifndef _di_controller_rule_process_begin_ - f_status_t controller_rule_process_begin(const uint8_t options_force, const f_string_static_t alias_rule, const uint8_t action, const uint8_t options, const uint8_t type, const f_array_lengths_t stack, const controller_main_t main, const controller_cache_t cache) { + f_status_t controller_rule_process_begin(const uint8_t options_force, const f_string_static_t alias_rule, const uint8_t action, const uint8_t options, const uint8_t type, const f_array_lengths_t stack, const controller_global_t global, const controller_cache_t cache) { - if (!controller_thread_is_enabled_process_type(type, main.thread)) { + if (!controller_thread_is_enabled_process_type(type, global.thread)) { return F_signal; } @@ -2470,10 +2470,10 @@ extern "C" { controller_process_t *process = 0; - status = controller_lock_read_process_type(type, main.thread, &main.thread->lock.process); + status = controller_lock_read_process_type(type, global.thread, &global.thread->lock.process); if (status == F_signal || F_status_is_error(status)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status), F_true, global.thread); return status; } @@ -2481,49 +2481,49 @@ extern "C" { { f_array_length_t at = 0; - status = controller_process_prepare(type != controller_process_type_exit, action, alias_rule, main, &at); + status = controller_process_prepare(type != controller_process_type_exit, action, alias_rule, global, &at); if (F_status_is_error(status)) { - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_item_error_print_rule_not_loaded(main.data->error, alias_rule.string); - controller_rule_error_print_cache(main.data->error, cache.action, F_false); + controller_rule_item_error_print_rule_not_loaded(global.main->error, alias_rule.string); + controller_rule_error_print_cache(global.main->error, cache.action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } return status; } - process = main.thread->processs.array[at]; + process = global.thread->processs.array[at]; - status = controller_lock_read_process_type(type, main.thread, &process->active); + status = controller_lock_read_process_type(type, global.thread, &process->active); if (status == F_signal || F_status_is_error(status)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status), F_true, main.thread); - controller_rule_item_error_print(main.data->error, cache.action, F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status), F_true, global.thread); + controller_rule_item_error_print(global.main->error, cache.action, F_false, global.thread); - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); return status; } - status = controller_lock_write_process(process, main.thread, &process->lock); + status = controller_lock_write_process(process, global.thread, &process->lock); if (status == F_signal || F_status_is_error(status)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status), F_false, global.thread); f_thread_unlock(&process->active); - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); return status; } - // once a write lock on the process is achieved, it is safe to unlock the main process read lock. - f_thread_unlock(&main.thread->lock.process); + // once a write lock on the process is achieved, it is safe to unlock the global process read lock. + f_thread_unlock(&global.thread->lock.process); // if the process is already running, then there is nothing to do. if (process->state == controller_process_state_active || process->state == controller_process_state_busy) { @@ -2547,10 +2547,10 @@ extern "C" { f_thread_unlock(&process->lock); - status = controller_lock_write_process(process, main.thread, &process->lock); + status = controller_lock_write_process(process, global.thread, &process->lock); if (status == F_signal || F_status_is_error(status)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status), F_false, global.thread); f_thread_unlock(&process->active); @@ -2586,9 +2586,9 @@ extern "C" { process->stack.used = 0; - process->main_data = (void *) main.data; - process->main_setting = (void *) main.setting; - process->main_thread = (void *) main.thread; + process->main_data = (void *) global.main; + process->main_setting = (void *) global.setting; + process->main_thread = (void *) global.thread; if (F_status_is_error_not(status) && stack.used) { if (process->stack.size < stack.used) { @@ -2596,7 +2596,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_type_array_lengths_resize", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_type_array_lengths_resize", F_true, global.thread); } else { for (f_array_length_t i = 0; i < stack.used; ++i) { @@ -2618,7 +2618,7 @@ extern "C" { status = f_string_dynamic_append(cache.action.name_item, &process->cache.action.name_item); } else { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_append", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true, global.thread); } } @@ -2634,7 +2634,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_thread_create", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_thread_create", F_true, global.thread); } } else { @@ -2650,10 +2650,10 @@ extern "C" { if (!action || F_status_is_error(status) && (process->state == controller_process_state_active || process->state == controller_process_state_busy)) { - status = controller_lock_write_process(process, main.thread, &process->lock); + status = controller_lock_write_process(process, global.thread, &process->lock); if (status == F_signal || F_status_is_error(status)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status), F_false, global.thread); f_thread_unlock(&process->active); @@ -2689,23 +2689,23 @@ extern "C" { f_status_t status_lock = F_none; - controller_main_t main = controller_macro_main_t_initialize((controller_data_t *) process->main_data, (controller_setting_t *) process->main_setting, (controller_thread_t *) process->main_thread); + controller_global_t global = controller_macro_global_t_initialize((controller_main_t *) process->main_data, (controller_setting_t *) process->main_setting, (controller_thread_t *) process->main_thread); // the process and active locks shall be held for the duration of this processing (aside from switching between read to/from write). if (options_force & controller_process_option_asynchronous) { - status_lock = controller_lock_read_process(process, main.thread, &process->active); + status_lock = controller_lock_read_process(process, global.thread, &process->active); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); return status_lock; } } - status_lock = controller_lock_read_process(process, main.thread, &process->lock); + status_lock = controller_lock_read_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); if (options_force & controller_process_option_asynchronous) { f_thread_unlock(&process->active); @@ -2720,10 +2720,10 @@ extern "C" { const f_array_length_t used_original_stack = process->stack.used; - status_lock = controller_lock_read_process(process, main.thread, &main.thread->lock.rule); + status_lock = controller_lock_read_process(process, global.thread, &global.thread->lock.rule); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); f_thread_unlock(&process->lock); @@ -2734,15 +2734,15 @@ extern "C" { return status_lock; } - if (controller_rule_find(process->rule.alias, main.setting->rules, &id_rule) == F_true) { + if (controller_rule_find(process->rule.alias, global.setting->rules, &id_rule) == F_true) { f_thread_unlock(&process->lock); - status_lock = controller_lock_write_process(process, main.thread, &process->lock); + status_lock = controller_lock_write_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); if (options_force & controller_process_option_asynchronous) { f_thread_unlock(&process->active); @@ -2753,16 +2753,16 @@ extern "C" { controller_rule_delete_simple(&process->rule); - status = controller_rule_copy(main.setting->rules.array[id_rule], &process->rule); + status = controller_rule_copy(global.setting->rules.array[id_rule], &process->rule); f_thread_unlock(&process->lock); - status_lock = controller_lock_read_process(process, main.thread, &process->lock); + status_lock = controller_lock_read_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); if (options_force & controller_process_option_asynchronous) { f_thread_unlock(&process->active); @@ -2771,10 +2771,10 @@ extern "C" { return status_lock; } - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "controller_rule_copy", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "controller_rule_copy", F_true, global.thread); } else if (!process->action) { @@ -2788,20 +2788,20 @@ extern "C" { return F_process_not; } else { - for (f_array_length_t i = 0; i < process->stack.used && controller_thread_is_enabled_process(process, main.thread); ++i) { + for (f_array_length_t i = 0; i < process->stack.used && controller_thread_is_enabled_process(process, global.thread); ++i) { if (process->stack.array[i] == id_rule) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe rule '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, process->rule.alias.string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' is already on the execution dependency stack, this recursion is prohibited.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe rule '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, process->rule.alias.string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' is already on the execution dependency stack, this recursion is prohibited.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_rule_error_print_cache(main.data->error, process->cache.action, F_true); + controller_rule_error_print_cache(global.main->error, process->cache.action, F_true); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } // never continue on circular recursion errors even in simulate mode. @@ -2811,7 +2811,7 @@ extern "C" { } } // for - if (!controller_thread_is_enabled_process(process, main.thread)) { + if (!controller_thread_is_enabled_process(process, global.thread)) { f_thread_unlock(&process->lock); if (options_force & controller_process_option_asynchronous) { @@ -2825,15 +2825,15 @@ extern "C" { status = f_type_array_lengths_increase(&process->stack); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_type_array_lengths_increase", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_type_array_lengths_increase", F_true, global.thread); } else { f_thread_unlock(&process->lock); - status_lock = controller_lock_write_process(process, main.thread, &process->lock); + status_lock = controller_lock_write_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); if (options_force & controller_process_option_asynchronous) { f_thread_unlock(&process->active); @@ -2846,10 +2846,10 @@ extern "C" { f_thread_unlock(&process->lock); - status_lock = controller_lock_read_process(process, main.thread, &process->lock); + status_lock = controller_lock_read_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); if (options_force & controller_process_option_asynchronous) { f_thread_unlock(&process->active); @@ -2862,21 +2862,21 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = controller_rule_process(main, process); + status = controller_rule_process(global, process); } } else { - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); status = F_status_set_error(F_found_not); - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_item_error_print_rule_not_loaded(main.data->error, process->rule.alias.string); - controller_rule_error_print_cache(main.data->error, process->cache.action, F_false); + controller_rule_item_error_print_rule_not_loaded(global.main->error, process->rule.alias.string); + controller_rule_error_print_cache(global.main->error, process->cache.action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } } @@ -2890,10 +2890,10 @@ extern "C" { return status; } - status_lock = controller_lock_write_process(process, main.thread, &main.thread->lock.rule); + status_lock = controller_lock_write_process(process, global.thread, &global.thread->lock.rule); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); if (F_status_set_fine(status) != F_lock) { f_thread_unlock(&process->lock); @@ -2906,22 +2906,22 @@ extern "C" { return status_lock; } - if (controller_rule_find(process->rule.alias, main.setting->rules, &id_rule) == F_true) { + if (controller_rule_find(process->rule.alias, global.setting->rules, &id_rule) == F_true) { if (F_status_set_fine(status) == F_lock) { - main.setting->rules.array[id_rule].status[process->action] = F_status_set_error(F_failure); + global.setting->rules.array[id_rule].status[process->action] = F_status_set_error(F_failure); } else { - main.setting->rules.array[id_rule].status[process->action] = status; + global.setting->rules.array[id_rule].status[process->action] = status; } } - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); if (F_status_set_fine(status) != F_lock) { f_thread_unlock(&process->lock); } - if (status == F_signal || F_status_set_fine(status) == F_lock && !controller_thread_is_enabled_process(process, main.thread)) { + if (status == F_signal || F_status_set_fine(status) == F_lock && !controller_thread_is_enabled_process(process, global.thread)) { if (options_force & controller_process_option_asynchronous) { f_thread_unlock(&process->active); } @@ -2929,10 +2929,10 @@ extern "C" { return F_signal; } - status_lock = controller_lock_write_process(process, main.thread, &process->lock); + status_lock = controller_lock_write_process(process, global.thread, &process->lock); if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); if (options_force & controller_process_option_asynchronous) { f_thread_unlock(&process->active); @@ -2961,7 +2961,7 @@ extern "C" { f_thread_unlock(&process->active); } - if (controller_thread_is_enabled_process(process, main.thread)) { + if (controller_thread_is_enabled_process(process, global.thread)) { return status; } @@ -2970,7 +2970,7 @@ extern "C" { #endif // _di_controller_rule_process_do_ #ifndef _di_controller_rule_read_ - f_status_t controller_rule_read(const bool is_normal, const f_string_static_t alias, controller_main_t main, controller_cache_t *cache, controller_rule_t *rule) { + f_status_t controller_rule_read(const bool is_normal, const f_string_static_t alias, controller_global_t global, controller_cache_t *cache, controller_rule_t *rule) { f_status_t status = F_none; bool for_item = F_true; @@ -3059,17 +3059,17 @@ extern "C" { status = f_string_dynamic_append_nulless(alias, &rule->alias); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true, global.thread); } else { status = f_string_dynamic_terminate_after(&rule->alias); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); } else { - status = controller_file_load(F_true, controller_string_rules_s, rule->alias, controller_string_rule_s, controller_string_rules_length, controller_string_rule_length, main, cache); + status = controller_file_load(F_true, controller_string_rules_s, rule->alias, controller_string_rule_s, controller_string_rules_length, controller_string_rule_length, global, cache); } } @@ -3082,13 +3082,13 @@ extern "C" { status = fll_fss_basic_list_read(cache->buffer_file, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, global.thread); } else { status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); } } } @@ -3098,7 +3098,7 @@ extern "C" { status = controller_rule_items_increase_by(cache->object_items.used, &rule->items); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "controller_rule_items_increase_by", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "controller_rule_items_increase_by", F_true, global.thread); } else { f_array_length_t i = 0; @@ -3135,7 +3135,7 @@ extern "C" { status = f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread); break; } @@ -3144,7 +3144,7 @@ extern "C" { status = controller_string_dynamic_rip_nulless_terminated(cache->buffer_file, cache->object_items.array[i], &cache->action.name_item); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, global.thread); break; } @@ -3164,19 +3164,19 @@ extern "C" { rule->items.array[rule->items.used].type = controller_rule_item_type_utility; } else { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->warning.to.stream, "%s%sUnknown rule item '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s); - fprintf(main.data->warning.to.stream, "%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string); - f_print_dynamic(main.data->warning.to.stream, cache->action.name_item); - fprintf(main.data->warning.to.stream, "%s", main.data->warning.notable.after->string); - fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%s%sUnknown rule item '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s); + fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); + f_print_dynamic(global.main->warning.to.stream, cache->action.name_item); + fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); + fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); - controller_rule_error_print_cache(main.data->warning, cache->action, F_true); + controller_rule_error_print_cache(global.main->warning, cache->action, F_true); - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); } continue; @@ -3185,19 +3185,19 @@ extern "C" { status = f_string_dynamic_partial_append(cache->buffer_file, cache->content_items.array[i].array[0], &cache->buffer_item); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_partial_append", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append", F_true, global.thread); break; } status = f_string_dynamic_terminate_after(&cache->buffer_item); if (F_status_is_error(status)) { - controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread); + controller_error_print(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); break; } if (rule->items.array[rule->items.used].type) { - status = controller_rule_item_read(main, cache, &rule->items.array[rule->items.used]); + status = controller_rule_item_read(global, cache, &rule->items.array[rule->items.used]); if (F_status_is_error(status)) break; rule->items.used++; @@ -3205,7 +3205,7 @@ extern "C" { else { for_item = F_false; - status = controller_rule_setting_read(main, *main.setting, cache, rule); + status = controller_rule_setting_read(global, *global.setting, cache, rule); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_memory_not) { @@ -3218,7 +3218,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_rule_item_error_print(main.data->error, cache->action, for_item, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, for_item, global.thread); rule->status[0] = controller_status_simplify_error(F_status_set_fine(status)); return rule->status[0]; @@ -3229,7 +3229,7 @@ extern "C" { #endif // _di_controller_rule_read_ #ifndef _di_controller_rule_setting_read_ - f_status_t controller_rule_setting_read(const controller_main_t main, const controller_setting_t setting, controller_cache_t *cache, controller_rule_t *rule) { + f_status_t controller_rule_setting_read(const controller_global_t global, const controller_setting_t setting, controller_cache_t *cache, controller_rule_t *rule) { f_status_t status = F_none; f_status_t status_return = F_none; @@ -3240,7 +3240,7 @@ extern "C" { status = fll_fss_extended_read(cache->buffer_item, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, F_false, global.thread); return status; } @@ -3275,13 +3275,13 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->object_actions.array[i], &cache->action.name_item); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread); } else { status = f_string_dynamic_terminate_after(&cache->action.name_item); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread); } } @@ -3301,7 +3301,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -3352,15 +3352,15 @@ extern "C" { type = controller_rule_setting_type_user; } else { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->warning.to.stream, "%s%sUnknown rule setting '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s); - fprintf(main.data->warning.to.stream, "%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string); - f_print_dynamic(main.data->warning.to.stream, cache->action.name_item); - fprintf(main.data->warning.to.stream, "%s", main.data->warning.notable.after->string); - fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%s%sUnknown rule setting '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s); + fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); + f_print_dynamic(global.main->warning.to.stream, cache->action.name_item); + fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); + fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -3368,20 +3368,20 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->warning, cache->action, F_false); + controller_rule_error_print_cache(global.main->warning, cache->action, F_false); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } continue; } if (!cache->content_actions.array[i].used) { - if (main.data->warning.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->warning.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->warning.to.stream, "%s%sEmpty rule setting.%s%c", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s, main.data->warning.context.after->string, f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->warning.to.stream, "%s%sEmpty rule setting.%s%c", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, global.main->warning.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -3389,9 +3389,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->warning, cache->action, F_false); + controller_rule_error_print_cache(global.main->warning, cache->action, F_false); - controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->warning.to.stream, &global.thread->lock.print); } continue; @@ -3403,13 +3403,13 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, range2, &cache->action.name_action); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread); } else { status = f_string_dynamic_terminate_after(&cache->action.name_action); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread); } } @@ -3421,7 +3421,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -3439,7 +3439,7 @@ extern "C" { // @todo use sched_getaffinity() to get the available cpus and do not add an invalid cpu to the affinity array. if (!cache->content_actions.array[i].used) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { + if (global.main->error.verbosity != f_console_verbosity_quiet) { // get the current line number within the settings item. cache->action.line_item = line_item; @@ -3447,14 +3447,14 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting requires one or more Content.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting requires one or more Content.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -3489,7 +3489,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_macro_int32s_t_resize", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_macro_int32s_t_resize", F_true, F_false, global.thread); break; } @@ -3499,29 +3499,29 @@ extern "C" { status = F_status_set_fine(status); if (status == F_data_not || status == F_number || status == F_number_overflow || status == F_number_underflow) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { + if (global.main->error.verbosity != f_console_verbosity_quiet) { if (status == F_number_overflow || status == F_number_underflow) { - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an unsupported number '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); - fprintf(main.data->error.to.stream, "%s%s', the number is too large for this system.%s%c", main.data->error.notable.after->string, main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an unsupported number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fprintf(global.main->error.to.stream, "%s%s', the number is too large for this system.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } else { - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid number '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); - fprintf(main.data->error.to.stream, "%s%s', only whole numbers are allowed for an affinity value.%s%c", main.data->error.notable.after->string, main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fprintf(global.main->error.to.stream, "%s%s', only whole numbers are allowed for an affinity value.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } // get the current line number within the settings item. @@ -3530,7 +3530,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); } status = F_status_set_error(F_valid_not); @@ -3540,7 +3540,7 @@ extern "C" { } } else { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_signed", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_signed", F_true, F_false, global.thread); status = F_status_set_error(status); @@ -3561,7 +3561,7 @@ extern "C" { if (type == controller_rule_setting_type_define || type == controller_rule_setting_type_parameter) { if (cache->content_actions.array[i].used != 2) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { + if (global.main->error.verbosity != f_console_verbosity_quiet) { // get the current line number within the settings item. cache->action.line_item = line_item; @@ -3569,14 +3569,14 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting requires exactly two Content.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting requires exactly two Content.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -3596,7 +3596,7 @@ extern "C" { status = f_string_maps_increase(setting_maps); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_maps_increase", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_maps_increase", F_true, F_false, global.thread); if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -3613,7 +3613,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -3624,7 +3624,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &setting_maps->array[setting_maps->used].name); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread); if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -3641,7 +3641,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -3649,13 +3649,13 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[1], &setting_maps->array[setting_maps->used].value); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread); } else { status = f_string_dynamic_terminate_after(&setting_maps->array[setting_maps->used].value); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread); } } @@ -3675,7 +3675,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -3687,11 +3687,11 @@ extern "C" { if (type == controller_rule_setting_type_control_group) { if (cache->content_actions.array[i].used < 2 || rule->has & controller_rule_has_control_group) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting requires two or more Content.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting requires two or more Content.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -3699,9 +3699,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -3718,14 +3718,14 @@ extern "C" { rule->control_group.as_new = F_true; } else { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an unknown option '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); - fprintf(main.data->error.to.stream, "%s%s'.%s%c", main.data->error.notable.after->string, main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an unknown option '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fprintf(global.main->error.to.stream, "%s%s'.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -3733,9 +3733,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -3747,10 +3747,10 @@ extern "C" { rule->control_group.path.used = 0; - status = f_string_dynamic_append(main.setting->path_control, &rule->control_group.path); + status = f_string_dynamic_append(global.setting->path_control, &rule->control_group.path); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_false, global.thread); } else { rule->control_group.groups.used = 0; @@ -3760,7 +3760,7 @@ extern "C" { status = f_string_dynamics_increase(&rule->control_group.groups); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false, global.thread); break; } @@ -3769,7 +3769,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[j], &rule->control_group.groups.array[rule->control_group.groups.used]); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread); break; } @@ -3795,7 +3795,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -3808,11 +3808,11 @@ extern "C" { if (type == controller_rule_setting_type_limit) { if (cache->content_actions.array[i].used != 3) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting requires three Content.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting requires three Content.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -3820,9 +3820,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -3881,15 +3881,15 @@ extern "C" { type = controller_resource_limit_type_stack; } else { - if (main.data->error.verbosity == f_console_verbosity_debug) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity == f_console_verbosity_debug) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sUnknown resource limit type '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic(main.data->error.to.stream, cache->action.name_action); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sUnknown resource limit type '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic(global.main->error.to.stream, cache->action.name_action); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -3897,9 +3897,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_true); + controller_rule_error_print_cache(global.main->error, cache->action, F_true); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -3912,12 +3912,12 @@ extern "C" { for (j = 0; j < rule->limits.used; ++j) { if (type == rule->limits.array[j].type) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe resource limit type is already specified.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe resource limit type is already specified.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -3925,9 +3925,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } status = F_status_set_error(F_valid_not); @@ -3943,7 +3943,7 @@ extern "C" { f_macro_limit_sets_t_increase(status, rule->limits); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_limit_sets_increase", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_limit_sets_increase", F_true, F_false, global.thread); if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -3960,7 +3960,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -3976,22 +3976,22 @@ extern "C" { if (status == F_data_not || status == F_number || status == F_number_overflow || status == F_number_underflow) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); if (status == F_number_overflow || status == F_number_underflow) { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an unsupported number '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); - fprintf(main.data->error.to.stream, "%s%s', the number is too large for this system.%s%c", main.data->error.notable.after->string, main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an unsupported number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fprintf(global.main->error.to.stream, "%s%s', the number is too large for this system.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } else { - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid number '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); - fprintf(main.data->error.to.stream, "%s%s', only whole numbers are allowed for a resource limit value.%s%c", main.data->error.notable.after->string, main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fprintf(global.main->error.to.stream, "%s%s', only whole numbers are allowed for a resource limit value.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } // get the current line number within the settings item. @@ -4000,9 +4000,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } status = F_status_set_error(F_valid_not); @@ -4012,7 +4012,7 @@ extern "C" { } } else { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_signed", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_signed", F_true, F_false, global.thread); status = F_status_set_error(status); @@ -4052,11 +4052,11 @@ extern "C" { } if (setting_value->used || cache->content_actions.array[i].used != 1) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting requires exactly one Content.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting requires exactly one Content.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4064,9 +4064,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4097,7 +4097,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -4108,15 +4108,15 @@ extern "C" { if (status == F_false || F_status_set_fine(status) == F_complete_not_utf) { if (status == F_false) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid name '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic(main.data->error.to.stream, *setting_value); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s', there must be at least 1 graph character.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid name '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic(global.main->error.to.stream, *setting_value); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s', there must be at least 1 graph character.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4124,9 +4124,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4134,12 +4134,12 @@ extern "C" { } } else { - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); // this function should only return F_complete_not_utf on error. - controller_rule_error_print(main.data->error, cache->action, F_complete_not_utf, "controller_validate_has_graph", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_complete_not_utf, "controller_validate_has_graph", F_true, F_false, global.thread); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); if (F_status_is_error_not(status_return)) { status_return = status; @@ -4154,7 +4154,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -4164,13 +4164,13 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], setting_value); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread); } else { status = f_string_dynamic_terminate_after(setting_value); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread); } } @@ -4192,7 +4192,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -4204,11 +4204,11 @@ extern "C" { if (type == controller_rule_setting_type_scheduler) { if (cache->content_actions.array[i].used < 1 || cache->content_actions.array[i].used > 2 || rule->has & controller_rule_has_scheduler) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting requires either one or two Content.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting requires either one or two Content.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4216,9 +4216,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4253,14 +4253,14 @@ extern "C" { rule->scheduler.priority = 49; } else { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an unknown scheduler '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); - fprintf(main.data->error.to.stream, "%s%s'.%s%c", main.data->error.notable.after->string, main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an unknown scheduler '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fprintf(global.main->error.to.stream, "%s%s'.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4268,9 +4268,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4292,28 +4292,28 @@ extern "C" { if ((zero_only && number) || (!zero_only && (number < 1 || number > 99)) || status == F_data_not || status == F_number || status == F_number_overflow) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid number '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); if (zero_only) { - fprintf(main.data->error.to.stream, "%s%s', only ", main.data->error.notable.after->string, main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s0%s", main.data->error.context.after->string, main.data->error.notable.before->string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s is", main.data->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s', only ", global.main->error.notable.after->string, global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s0%s", global.main->error.context.after->string, global.main->error.notable.before->string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s is", global.main->error.context.before->string); } else { - fprintf(main.data->error.to.stream, "%s%s', only the whole numbers inclusively between ", main.data->error.notable.after->string, main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s1%s", main.data->error.context.after->string, main.data->error.notable.before->string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s and ", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s99%s", main.data->error.context.after->string, main.data->error.notable.before->string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s are", main.data->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s', only the whole numbers inclusively between ", global.main->error.notable.after->string, global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s1%s", global.main->error.context.after->string, global.main->error.notable.before->string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s and ", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s99%s", global.main->error.context.after->string, global.main->error.notable.before->string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s are", global.main->error.context.before->string); } - fprintf(main.data->error.to.stream, " allowed for the designated scheduler.%s%c", main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, " allowed for the designated scheduler.%s%c", global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4321,9 +4321,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4331,7 +4331,7 @@ extern "C" { } } else { - controller_rule_error_print(main.data->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false, global.thread); status = F_status_set_error(status); if (F_status_is_error_not(status_return)) { @@ -4354,11 +4354,11 @@ extern "C" { if (cache->content_actions.array[i].used != 1 || type == controller_rule_setting_type_capability && rule->capability || type == controller_rule_setting_type_group && (rule->has & controller_rule_has_group) || type == controller_rule_setting_type_nice && (rule->has & controller_rule_has_nice) || type == controller_rule_setting_type_user && (rule->has & controller_rule_has_user)) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting requires exactly one Content.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting requires exactly one Content.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4366,9 +4366,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4384,9 +4384,9 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &cache->action.generic); if (F_status_is_error(status)) { - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4394,9 +4394,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -4411,9 +4411,9 @@ extern "C" { status = f_string_dynamic_terminate_after(&cache->action.generic); if (F_status_is_error(status)) { - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4421,9 +4421,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -4439,9 +4439,9 @@ extern "C" { if (F_status_is_error(status) && F_status_set_fine(status) != F_supported_not) { if (F_status_set_fine(status) == F_memory_not) { - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_capability_from_text", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_capability_from_text", F_true, F_false, global.thread); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4449,19 +4449,19 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); status_return = status; break; } - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting failed to process the capabilities.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting failed to process the capabilities.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4469,9 +4469,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4491,18 +4491,18 @@ extern "C" { if (number < -20 || number > 19 || status == F_data_not || status == F_number || status == F_number_overflow || status == F_number_underflow) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid number '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); - fprintf(main.data->error.to.stream, "%s%s', only the whole numbers inclusively between ", main.data->error.notable.after->string, main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s-20%s", main.data->error.context.after->string, main.data->error.notable.before->string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s and ", main.data->error.context.before->string); - fprintf(main.data->error.to.stream, "%s%s19%s", main.data->error.context.after->string, main.data->error.notable.before->string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s are allowed.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fprintf(global.main->error.to.stream, "%s%s', only the whole numbers inclusively between ", global.main->error.notable.after->string, global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s-20%s", global.main->error.context.after->string, global.main->error.notable.before->string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s and ", global.main->error.context.before->string); + fprintf(global.main->error.to.stream, "%s%s19%s", global.main->error.context.after->string, global.main->error.notable.before->string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s are allowed.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4510,9 +4510,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4520,7 +4520,7 @@ extern "C" { } } else { - controller_rule_error_print(main.data->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false, global.thread); status = F_status_set_error(status); if (F_status_is_error_not(status_return)) { @@ -4542,49 +4542,49 @@ extern "C" { status = F_status_set_fine(status); if (status == F_exist_not) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid user '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' because no user was found by that name.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid user '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' because no user was found by that name.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } } else if (status == F_number_too_large) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid user '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' because the given ID is too large.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid user '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' because the given ID is too large.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } } else if (status == F_number) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid user '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' because the given ID is not a valid supported number.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid user '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' because the given ID is not a valid supported number.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } } else { - controller_rule_error_print(main.data->error, cache->action, status, "f_account_id_user_by_name", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, status, "f_account_id_user_by_name", F_true, F_false, global.thread); } // get the current line number within the settings item. @@ -4593,7 +4593,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(status); @@ -4610,11 +4610,11 @@ extern "C" { if (type == controller_rule_setting_type_group) { if (!cache->content_actions.array[i].used) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting requires one or more Content.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting requires one or more Content.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4622,9 +4622,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4643,7 +4643,7 @@ extern "C" { f_macro_array_lengths_t_increase_by(status, rule->groups, controller_default_allocation_step) if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, F_false, global.thread); if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -4660,7 +4660,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -4671,49 +4671,49 @@ extern "C" { status = F_status_set_fine(status); if (status == F_exist_not) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid group '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' because no group was found by that name.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid group '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' because no group was found by that name.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } } else if (status == F_number_too_large) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid group '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' because the given ID is too large.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid group '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' because the given ID is too large.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } } else if (status == F_number) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid group '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' because the given ID is not a valid supported number.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid group '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' because the given ID is not a valid supported number.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } } else { - controller_rule_error_print(main.data->error, cache->action, status, "f_account_id_group_by_name", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, status, "f_account_id_group_by_name", F_true, F_false, global.thread); } // get the current line number within the settings item. @@ -4722,7 +4722,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(status); @@ -4750,7 +4750,7 @@ extern "C" { status = f_string_dynamics_increase(setting_values); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false, global.thread); if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -4767,7 +4767,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -4777,13 +4777,13 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[j], &setting_values->array[setting_values->used]); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread); } else { status = f_string_dynamic_terminate_after(&setting_values->array[setting_values->used]); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread); } } @@ -4805,7 +4805,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -4815,13 +4815,13 @@ extern "C" { if (status == F_false || F_status_set_fine(status) == F_complete_not_utf) { if (status == F_false) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting has an invalid environment variable name '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, setting_values->array[setting_values->used].string, main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid environment variable name '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, setting_values->array[setting_values->used].string, global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4829,9 +4829,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4841,7 +4841,7 @@ extern "C" { else { // this function should only return F_complete_not_utf on error. - controller_rule_error_print(main.data->error, cache->action, F_complete_not_utf, "controller_validate_environment_name", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_complete_not_utf, "controller_validate_environment_name", F_true, F_false, global.thread); if (F_status_is_error_not(status_return)) { status_return = status; @@ -4856,7 +4856,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -4870,11 +4870,11 @@ extern "C" { // The "on" Rule Setting. if (cache->content_actions.array[i].used != 4) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting requires exactly four Content.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting requires exactly four Content.%s%c", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4882,9 +4882,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4923,16 +4923,16 @@ extern "C" { action = controller_rule_action_type_thaw; } else { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting's first value has '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' but only supports %s, %s, %s, %s, %s", main.data->error.context.before->string, controller_string_freeze_s, controller_string_kill_s, controller_string_pause_s, controller_string_reload_s, controller_string_restart_s); - fprintf(main.data->error.to.stream, "%s, %s, %s, and %s.%s%c", controller_string_resume_s, controller_string_start_s, controller_string_stop_s, controller_string_thaw_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting's first value has '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' but only supports %s, %s, %s, %s, %s", global.main->error.context.before->string, controller_string_freeze_s, controller_string_kill_s, controller_string_pause_s, controller_string_reload_s, controller_string_restart_s); + fprintf(global.main->error.to.stream, "%s, %s, %s, and %s.%s%c", controller_string_resume_s, controller_string_start_s, controller_string_stop_s, controller_string_thaw_s, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4940,9 +4940,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -4961,7 +4961,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "controller_rule_ons_increase", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "controller_rule_ons_increase", F_true, F_false, global.thread); } else { if (fl_string_dynamic_partial_compare_string(controller_string_need_s, cache->buffer_item, controller_string_need_length, cache->content_actions.array[i].array[1]) == F_equal_to) { @@ -4974,15 +4974,15 @@ extern "C" { setting_values = &rule->ons.array[j].wish; } else { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sRule setting's second value has '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' but only supports %s, %s, and %s.%s%c", main.data->error.context.before->string, controller_string_need_s, controller_string_want_s, controller_string_wish_s, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sRule setting's second value has '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' but only supports %s, %s, and %s.%s%c", global.main->error.context.before->string, controller_string_need_s, controller_string_want_s, controller_string_wish_s, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. cache->action.line_item = line_item; @@ -4990,9 +4990,9 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_error_print_cache(main.data->error, cache->action, F_false); + controller_rule_error_print_cache(global.main->error, cache->action, F_false); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } if (F_status_is_error_not(status_return)) { @@ -5005,7 +5005,7 @@ extern "C" { status = f_string_dynamics_increase_by(controller_default_allocation_step, setting_values); if (F_status_is_error(status)) { - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true, F_false, global.thread); } } @@ -5025,12 +5025,12 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } - status = controller_rule_id_construct(main, cache->buffer_item, cache->content_actions.array[i].array[2], cache->content_actions.array[i].array[3], &setting_values->array[setting_values->used]); + status = controller_rule_id_construct(global, cache->buffer_item, cache->content_actions.array[i].array[2], cache->content_actions.array[i].array[3], &setting_values->array[setting_values->used]); if (F_status_is_error(status)) { setting_values->array[setting_values->used].used = 0; @@ -5050,7 +5050,7 @@ extern "C" { cache->action.line_action = ++cache->action.line_item; - controller_rule_item_error_print(main.data->error, cache->action, F_false, main.thread); + controller_rule_item_error_print(global.main->error, cache->action, F_false, global.thread); continue; } @@ -5062,7 +5062,7 @@ extern "C" { if (F_status_is_error(status)) { setting_values->array[setting_values->used].used = 0; - controller_rule_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, F_false, main.thread); + controller_rule_error_print(global.main->error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, F_false, global.thread); if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -5078,21 +5078,21 @@ extern "C" { if (fl_string_dynamic_partial_compare_string(cache->buffer_item.string, cache->buffer_path, cache->buffer_item.used, cache->content_actions.array[i].array[1]) == F_equal_to_not) { - if (main.data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&main.thread->lock.print); + if (global.main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&global.thread->lock.print); - fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main.data->error.to.stream, "%s%sThe rule item action third parameter '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[2]); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s' must be a base path name, such as %llu '", main.data->error.context.before->string, cache->buffer_path.used); - fprintf(main.data->error.to.stream, "%s%s", main.data->error.context.after->string, main.data->error.notable.before->string); - f_print_dynamic(main.data->error.to.stream, cache->buffer_path); - fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string); - fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(global.main->error.to.stream, "%s%sThe rule item action third parameter '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[2]); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' must be a base path name, such as %llu '", global.main->error.context.before->string, cache->buffer_path.used); + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_dynamic(global.main->error.to.stream, cache->buffer_path); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); } setting_values->array[setting_values->used].used = 0; @@ -5122,11 +5122,11 @@ extern "C" { #endif // _di_controller_rule_setting_read_ #ifndef _di_controller_rule_validate_ - void controller_rule_validate(const controller_rule_t rule, const uint8_t action, const uint8_t options, const controller_main_t main, controller_cache_t *cache) { + void controller_rule_validate(const controller_rule_t rule, const uint8_t action, const uint8_t options, const controller_global_t global, controller_cache_t *cache) { - const controller_data_t *data = main.data; + const controller_main_t *main = global.main; - f_thread_mutex_lock(&main.thread->lock.print); + f_thread_mutex_lock(&global.thread->lock.print); switch (action) { case controller_rule_action_type_freeze: @@ -5142,16 +5142,16 @@ extern "C" { default: - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->error.to.stream, "%s%sUnsupported action type '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s); - fprintf(data->error.to.stream, "%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, controller_rule_action_type_name(action).string, data->error.notable.after->string); - fprintf(data->error.to.stream, "%s' while attempting to validate rule execution.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%s%sUnsupported action type '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); + fprintf(main->error.to.stream, "%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, controller_rule_action_type_name(action).string, main->error.notable.after->string); + fprintf(main->error.to.stream, "%s' while attempting to validate rule execution.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); - controller_rule_error_print_cache(data->error, cache->action, F_true); + controller_rule_error_print_cache(main->error, cache->action, F_true); } - controller_print_unlock_flush(data->error.to.stream, &main.thread->lock.print); + controller_print_unlock_flush(main->error.to.stream, &global.thread->lock.print); return; } @@ -5175,66 +5175,66 @@ extern "C" { } // for if (missing) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fprintf(data->output.stream, "Rule '"); - fprintf(data->output.stream, "%s%s%s", data->context.set.title.before->string, rule.name.used ? rule.name.string : f_string_empty_s, data->context.set.title.after->string); - fprintf(data->output.stream, "' has no '"); - fprintf(data->output.stream, "%s%s%s", data->context.set.important.before->string, controller_rule_action_type_name(action).string, data->context.set.important.after->string); - fprintf(data->output.stream, "' action to execute and would '"); - fprintf(data->output.stream, "%s%s%s", data->context.set.important.before->string, options & controller_process_option_require ? controller_string_fail_s : controller_string_succeed_s, data->context.set.important.after->string); - fprintf(data->output.stream, "' because it is '"); - fprintf(data->output.stream, "%s%s%s", data->context.set.important.before->string, options & controller_process_option_require ? controller_string_required_s : controller_string_optional_s, data->context.set.important.after->string); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, "Rule '"); + fprintf(main->output.stream, "%s%s%s", main->context.set.title.before->string, rule.name.used ? rule.name.string : f_string_empty_s, main->context.set.title.after->string); + fprintf(main->output.stream, "' has no '"); + fprintf(main->output.stream, "%s%s%s", main->context.set.important.before->string, controller_rule_action_type_name(action).string, main->context.set.important.after->string); + fprintf(main->output.stream, "' action to execute and would '"); + fprintf(main->output.stream, "%s%s%s", main->context.set.important.before->string, options & controller_process_option_require ? controller_string_fail_s : controller_string_succeed_s, main->context.set.important.after->string); + fprintf(main->output.stream, "' because it is '"); + fprintf(main->output.stream, "%s%s%s", main->context.set.important.before->string, options & controller_process_option_require ? controller_string_required_s : controller_string_optional_s, main->context.set.important.after->string); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } } - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fprintf(data->output.stream, "Rule %s%s%s {%c", data->context.set.title.before->string, rule.alias.used ? rule.alias.string : f_string_empty_s, data->context.set.title.after->string, f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s %s%c", data->context.set.important.before->string, controller_string_name_s, data->context.set.important.after->string, rule.name.used ? rule.name.string : f_string_empty_s, f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s %s%c", data->context.set.important.before->string, controller_string_how_s, data->context.set.important.after->string, options & controller_process_option_asynchronous ? controller_string_asynchronous_s : controller_string_synchronous_s, f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s %s%c", data->context.set.important.before->string, controller_string_wait_s, data->context.set.important.after->string, options & controller_process_option_wait ? controller_string_yes : controller_string_no_s, f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, "Rule %s%s%s {%c", main->context.set.title.before->string, rule.alias.used ? rule.alias.string : f_string_empty_s, main->context.set.title.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s %s%c", main->context.set.important.before->string, controller_string_name_s, main->context.set.important.after->string, rule.name.used ? rule.name.string : f_string_empty_s, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s %s%c", main->context.set.important.before->string, controller_string_how_s, main->context.set.important.after->string, options & controller_process_option_asynchronous ? controller_string_asynchronous_s : controller_string_synchronous_s, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s %s%c", main->context.set.important.before->string, controller_string_wait_s, main->context.set.important.after->string, options & controller_process_option_wait ? controller_string_yes : controller_string_no_s, f_string_eol_s[0]); if (f_capability_supported()) { - fprintf(data->output.stream, " %s%s%s ", data->context.set.important.before->string, controller_string_capability_s, data->context.set.important.after->string); + fprintf(main->output.stream, " %s%s%s ", main->context.set.important.before->string, controller_string_capability_s, main->context.set.important.after->string); if (rule.capability) { cache->action.generic.used = 0; if (F_status_is_error_not(f_capability_to_text(rule.capability, &cache->action.generic))) { - fprintf(data->output.stream, "%s", cache->action.generic.string); + fprintf(main->output.stream, "%s", cache->action.generic.string); } } - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); } else { - fprintf(data->output.stream, " %s%s%s ", data->context.set.important.before->string, controller_string_capability_s, data->context.set.important.after->string); - fprintf(data->output.stream, "%s(unsupported)%s%c", data->context.set.warning.before->string, data->context.set.warning.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s ", main->context.set.important.before->string, controller_string_capability_s, main->context.set.important.after->string); + fprintf(main->output.stream, "%s(unsupported)%s%c", main->context.set.warning.before->string, main->context.set.warning.after->string, f_string_eol_s[0]); } - fprintf(data->output.stream, " %s%s%s", data->context.set.important.before->string, controller_string_control_group_s, data->context.set.important.after->string); + fprintf(main->output.stream, " %s%s%s", main->context.set.important.before->string, controller_string_control_group_s, main->context.set.important.after->string); if (rule.has & controller_rule_has_control_group) { - fprintf(data->output.stream, " %s", rule.control_group.as_new ? controller_string_new_s : controller_string_existing_s); + fprintf(main->output.stream, " %s", rule.control_group.as_new ? controller_string_new_s : controller_string_existing_s); for (i = 0; i < rule.control_group.groups.used; ++i) { if (rule.control_group.groups.array[i].used) { - fprintf(data->output.stream, "%s", f_string_space_s); - f_print_dynamic(data->output.stream, rule.control_group.groups.array[i]); + fprintf(main->output.stream, "%s", f_string_space_s); + f_print_dynamic(main->output.stream, rule.control_group.groups.array[i]); } } // for } - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s", data->context.set.important.before->string, controller_string_nice_s, data->context.set.important.after->string); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s", main->context.set.important.before->string, controller_string_nice_s, main->context.set.important.after->string); if (rule.has & controller_rule_has_nice) { - fprintf(data->output.stream, " %i", rule.nice); + fprintf(main->output.stream, " %i", rule.nice); } - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s", data->context.set.important.before->string, controller_string_scheduler_s, data->context.set.important.after->string); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s", main->context.set.important.before->string, controller_string_scheduler_s, main->context.set.important.after->string); if (rule.has & controller_rule_has_scheduler) { f_string_t policy = ""; @@ -5258,78 +5258,78 @@ extern "C" { policy = controller_string_round_robin_s; } - fprintf(data->output.stream, " %s %i", policy, rule.scheduler.priority); + fprintf(main->output.stream, " %s %i", policy, rule.scheduler.priority); } - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s %s%c", data->context.set.important.before->string, controller_string_script_s, data->context.set.important.after->string, rule.script.used ? rule.script.string : f_string_empty_s, f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s", data->context.set.important.before->string, controller_string_user_s, data->context.set.important.after->string); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s %s%c", main->context.set.important.before->string, controller_string_script_s, main->context.set.important.after->string, rule.script.used ? rule.script.string : f_string_empty_s, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s", main->context.set.important.before->string, controller_string_user_s, main->context.set.important.after->string); if (rule.has & controller_rule_has_user) { - fprintf(data->output.stream, " %i", rule.user); + fprintf(main->output.stream, " %i", rule.user); } - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_affinity_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_affinity_s, main->context.set.important.after->string, f_string_eol_s[0]); for (i = 0; i < rule.affinity.used; ++i) { - fprintf(data->output.stream, " %i%c", rule.affinity.array[i], f_string_eol_s[0]); + fprintf(main->output.stream, " %i%c", rule.affinity.array[i], f_string_eol_s[0]); } // for - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_define_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_define_s, main->context.set.important.after->string, f_string_eol_s[0]); for (i = 0; i < rule.define.used; ++i) { if (rule.define.array[i].name.used && rule.define.array[i].value.used) { - fprintf(data->output.stream, " %s %s=%s %s%c", rule.define.array[i].name.string, data->context.set.important.before->string, data->context.set.important.after->string, rule.define.array[i].value.string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s %s=%s %s%c", rule.define.array[i].name.string, main->context.set.important.before->string, main->context.set.important.after->string, rule.define.array[i].value.string, f_string_eol_s[0]); } } // for - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_environment_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_environment_s, main->context.set.important.after->string, f_string_eol_s[0]); for (i = 0; i < rule.environment.used; ++i) { if (rule.environment.array[i].used) { - fprintf(data->output.stream, " %s%c", rule.environment.array[i].string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%c", rule.environment.array[i].string, f_string_eol_s[0]); } } // for - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_parameter_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_parameter_s, main->context.set.important.after->string, f_string_eol_s[0]); for (i = 0; i < rule.parameter.used; ++i) { if (rule.parameter.array[i].name.used && rule.parameter.array[i].value.used) { - fprintf(data->output.stream, " %s %s=%s %s%c", rule.parameter.array[i].name.string, data->context.set.important.before->string, data->context.set.important.after->string, rule.parameter.array[i].value.string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s %s=%s %s%c", rule.parameter.array[i].name.string, main->context.set.important.before->string, main->context.set.important.after->string, rule.parameter.array[i].value.string, f_string_eol_s[0]); } } // for - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_group_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_group_s, main->context.set.important.after->string, f_string_eol_s[0]); if (rule.has & controller_rule_has_group) { - fprintf(data->output.stream, " %i%c", rule.group, f_string_eol_s[0]); + fprintf(main->output.stream, " %i%c", rule.group, f_string_eol_s[0]); for (i = 0; i < rule.groups.used; ++i) { - fprintf(data->output.stream, " %i%c", rule.groups.array[i], f_string_eol_s[0]); + fprintf(main->output.stream, " %i%c", rule.groups.array[i], f_string_eol_s[0]); } // for } - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_limit_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_limit_s, main->context.set.important.after->string, f_string_eol_s[0]); for (i = 0; i < rule.limits.used; ++i) { - fprintf(data->output.stream, " %s %s=%s %llu %llu%c", controller_rule_setting_limit_type_name(rule.limits.array[i].type).string, data->context.set.important.before->string, data->context.set.important.after->string, rule.limits.array[i].value.rlim_cur, rule.limits.array[i].value.rlim_max, f_string_eol_s[0]); + fprintf(main->output.stream, " %s %s=%s %llu %llu%c", controller_rule_setting_limit_type_name(rule.limits.array[i].type).string, main->context.set.important.before->string, main->context.set.important.after->string, rule.limits.array[i].value.rlim_cur, rule.limits.array[i].value.rlim_max, f_string_eol_s[0]); } // for - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_on_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_on_s, main->context.set.important.after->string, f_string_eol_s[0]); for (i = 0; i < rule.ons.used; ++i) { - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_action_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_action_s, main->context.set.important.after->string, f_string_eol_s[0]); { f_string_t action = ""; @@ -5362,43 +5362,43 @@ extern "C" { action = controller_string_thaw_s; } - fprintf(data->output.stream, " %s%s%s %s%c", data->context.set.important.before->string, controller_string_type_s, data->context.set.important.after->string, action, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s %s%c", main->context.set.important.before->string, controller_string_type_s, main->context.set.important.after->string, action, f_string_eol_s[0]); } - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_need_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_need_s, main->context.set.important.after->string, f_string_eol_s[0]); for (j = 0; j < rule.ons.array[i].need.used; ++j) { if (rule.ons.array[i].need.array[j].used) { - fprintf(data->output.stream, " %s%c", rule.ons.array[i].need.array[j].string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%c", rule.ons.array[i].need.array[j].string, f_string_eol_s[0]); } } // for - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_want_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_want_s, main->context.set.important.after->string, f_string_eol_s[0]); for (j = 0; j < rule.ons.array[i].want.used; ++j) { if (rule.ons.array[i].want.array[j].used) { - fprintf(data->output.stream, " %s%c", rule.ons.array[i].want.array[j].string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%c", rule.ons.array[i].want.array[j].string, f_string_eol_s[0]); } } // for - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_wish_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_wish_s, main->context.set.important.after->string, f_string_eol_s[0]); for (j = 0; j < rule.ons.array[i].wish.used; ++j) { if (rule.ons.array[i].wish.array[j].used) { - fprintf(data->output.stream, " %s%c", rule.ons.array[i].wish.array[j].string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%c", rule.ons.array[i].wish.array[j].string, f_string_eol_s[0]); } } // for - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); } // for - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); if (rule.items.used) { controller_rule_action_t *action = 0; @@ -5412,77 +5412,77 @@ extern "C" { item = &rule.items.array[i]; - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_item_s, data->context.set.important.after->string, f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s %s%c", data->context.set.important.before->string, controller_string_type_s, data->context.set.important.after->string, controller_rule_item_type_name(item->type).string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_item_s, main->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s %s%c", main->context.set.important.before->string, controller_string_type_s, main->context.set.important.after->string, controller_rule_item_type_name(item->type).string, f_string_eol_s[0]); for (j = 0; j < item->actions.used; ++j) { action = &item->actions.array[j]; - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_action_s, data->context.set.important.after->string, f_string_eol_s[0]); - fprintf(data->output.stream, " %s%s%s %s%c", data->context.set.important.before->string, controller_string_type_s, data->context.set.important.after->string, controller_rule_action_type_name(action->type).string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_action_s, main->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s %s%c", main->context.set.important.before->string, controller_string_type_s, main->context.set.important.after->string, controller_rule_action_type_name(action->type).string, f_string_eol_s[0]); if (item->type == controller_rule_item_type_script || item->type == controller_rule_item_type_utility) { - fprintf(data->output.stream, " %s%s%s {%c", data->context.set.important.before->string, controller_string_parameter_s, data->context.set.important.after->string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s {%c", main->context.set.important.before->string, controller_string_parameter_s, main->context.set.important.after->string, f_string_eol_s[0]); parameter = &action->parameters.array[0]; if (parameter->used) { - fprintf(data->output.stream, " "); + fprintf(main->output.stream, " "); for (k = 0; k < parameter->used; ++k) { - fprintf(data->output.stream, "%c", parameter->string[k]); + fprintf(main->output.stream, "%c", parameter->string[k]); if (parameter->string[k] == f_fss_eol && k + 1 < parameter->used) { - fprintf(data->output.stream, " "); + fprintf(main->output.stream, " "); } } // for - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); } - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); } else { for (k = 0; k < action->parameters.used; ++k) { - fprintf(data->output.stream, " %s%s%s %s%c", data->context.set.important.before->string, controller_string_parameter_s, data->context.set.important.after->string, action->parameters.array[k].string, f_string_eol_s[0]); + fprintf(main->output.stream, " %s%s%s %s%c", main->context.set.important.before->string, controller_string_parameter_s, main->context.set.important.after->string, action->parameters.array[k].string, f_string_eol_s[0]); } // for } - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); } // for - fprintf(data->output.stream, " }%c", f_string_eol_s[0]); + fprintf(main->output.stream, " }%c", f_string_eol_s[0]); } // for } - fprintf(data->output.stream, "}%c", f_string_eol_s[0]); + fprintf(main->output.stream, "}%c", f_string_eol_s[0]); - controller_print_unlock_flush(data->output.stream, &main.thread->lock.print); + controller_print_unlock_flush(main->output.stream, &global.thread->lock.print); } #endif // _di_controller_rule_validate_ #ifndef _di_controller_rule_wait_all_ - f_status_t controller_rule_wait_all(const bool is_normal, const controller_main_t main, const bool required, controller_process_t *caller) { + f_status_t controller_rule_wait_all(const bool is_normal, const controller_global_t global, const bool required, controller_process_t *caller) { f_status_t status_lock = F_none; if (caller) { - status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process); + status_lock = controller_lock_read_process(caller, global.thread, &global.thread->lock.process); } else { - status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process); + status_lock = controller_lock_read(is_normal, global.thread, &global.thread->lock.process); } if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); return status_lock; } - if (!main.thread->processs.used) { - f_thread_unlock(&main.thread->lock.process); + if (!global.thread->processs.used) { + f_thread_unlock(&global.thread->lock.process); return F_data_not; } @@ -5496,62 +5496,62 @@ extern "C" { f_array_length_t j = 0; // build a list of what to wait for so that anything new after this point will not be waited for. - const f_array_length_t process_total = main.thread->processs.used; + const f_array_length_t process_total = global.thread->processs.used; controller_process_t *process_list[process_total]; for (; i < process_total; ++i) { - process_list[i] = main.thread->processs.array[i]; + process_list[i] = global.thread->processs.array[i]; } // for - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); for (i = 0; i < process_total; ++i) { if (caller) { - if (!controller_thread_is_enabled_process(caller, main.thread)) break; + if (!controller_thread_is_enabled_process(caller, global.thread)) break; } else { - if (!controller_thread_is_enabled(is_normal, main.thread)) break; + if (!controller_thread_is_enabled(is_normal, global.thread)) break; } - // re-establish main process read lock to wait for or protect from the cleanup thread while checking the read process. + // re-establish global process read lock to wait for or protect from the cleanup thread while checking the read process. if (caller) { - status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process); + status_lock = controller_lock_read_process(caller, global.thread, &global.thread->lock.process); } else { - status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process); + status_lock = controller_lock_read(is_normal, global.thread, &global.thread->lock.process); } if (status_lock == F_signal || F_status_is_error(status_lock)) break; if (!process_list[i]) { - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); continue; } if (caller) { - status_lock = controller_lock_read_process(caller, main.thread, &process_list[i]->active); + status_lock = controller_lock_read_process(caller, global.thread, &process_list[i]->active); } else { - status_lock = controller_lock_read(is_normal, main.thread, &process_list[i]->active); + status_lock = controller_lock_read(is_normal, global.thread, &process_list[i]->active); } if (status_lock == F_signal || F_status_is_error(status_lock)) { - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); break; } // once the active lock is obtained, then the main process read lock can be safely released. - f_thread_unlock(&main.thread->lock.process); + f_thread_unlock(&global.thread->lock.process); if (caller) { if (caller) { - status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.rule); + status_lock = controller_lock_read_process(caller, global.thread, &global.thread->lock.rule); } else { - status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.rule); + status_lock = controller_lock_read(is_normal, global.thread, &global.thread->lock.rule); } if (status_lock == F_signal || F_status_is_error(status_lock)) { @@ -5561,7 +5561,7 @@ extern "C" { } if (fl_string_dynamic_compare(caller->rule.alias, process_list[i]->rule.alias) == F_equal_to) { - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); f_thread_unlock(&process_list[i]->active); continue; @@ -5572,20 +5572,20 @@ extern "C" { for (j = 0; j < caller->stack.used; ++j) { if (caller) { - if (!controller_thread_is_enabled_process(caller, main.thread)) break; + if (!controller_thread_is_enabled_process(caller, global.thread)) break; } else { - if (!controller_thread_is_enabled(is_normal, main.thread)) break; + if (!controller_thread_is_enabled(is_normal, global.thread)) break; } - if (main.thread->processs.array[caller->stack.array[j]] && fl_string_dynamic_compare(process_list[i]->rule.alias, main.thread->processs.array[caller->stack.array[j]]->rule.alias) == F_equal_to) { + if (global.thread->processs.array[caller->stack.array[j]] && fl_string_dynamic_compare(process_list[i]->rule.alias, global.thread->processs.array[caller->stack.array[j]]->rule.alias) == F_equal_to) { skip = F_true; } if (skip) break; } // for - f_thread_unlock(&main.thread->lock.rule); + f_thread_unlock(&global.thread->lock.rule); if (skip) { f_thread_unlock(&process_list[i]->active); @@ -5595,10 +5595,10 @@ extern "C" { } if (caller) { - status_lock = controller_lock_read_process(caller, main.thread, &process_list[i]->lock); + status_lock = controller_lock_read_process(caller, global.thread, &process_list[i]->lock); } else { - status_lock = controller_lock_read(is_normal, main.thread, &process_list[i]->lock); + status_lock = controller_lock_read(is_normal, global.thread, &process_list[i]->lock); } if (status_lock == F_signal || F_status_is_error(status_lock)) { @@ -5622,14 +5622,14 @@ extern "C" { f_thread_unlock(&process_list[i]->lock); if (caller) { - status_lock = controller_lock_write_process(process_list[i], main.thread, &process_list[i]->lock); + status_lock = controller_lock_write_process(process_list[i], global.thread, &process_list[i]->lock); } else { - status_lock = controller_lock_write(is_normal, main.thread, &process_list[i]->lock); + status_lock = controller_lock_write(is_normal, global.thread, &process_list[i]->lock); } if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_false, global.thread); f_thread_unlock(&process_list[i]->active); @@ -5653,10 +5653,10 @@ extern "C" { } if (caller) { - status_lock = controller_lock_read_process(caller, main.thread, &process_list[i]->active); + status_lock = controller_lock_read_process(caller, global.thread, &process_list[i]->active); } else { - status_lock = controller_lock_read(is_normal, main.thread, &process_list[i]->active); + status_lock = controller_lock_read(is_normal, global.thread, &process_list[i]->active); } if (status_lock == F_signal || F_status_is_error(status_lock)) { @@ -5669,10 +5669,10 @@ extern "C" { f_thread_unlock(&process_list[i]->lock); if (caller) { - status_lock = controller_lock_read_process(caller, main.thread, &process_list[i]->lock); + status_lock = controller_lock_read_process(caller, global.thread, &process_list[i]->lock); } else { - status_lock = controller_lock_read(is_normal, main.thread, &process_list[i]->lock); + status_lock = controller_lock_read(is_normal, global.thread, &process_list[i]->lock); } if (status_lock == F_signal || F_status_is_error(status_lock)) break; @@ -5703,7 +5703,7 @@ extern "C" { if (!controller_rule_status_is_error(process_list[i]->action, process_list[i]->rule) && (process_list[i]->state == controller_process_state_active || process_list[i]->state == controller_process_state_busy)) { f_thread_unlock(&process_list[i]->lock); - status = controller_process_wait(main, process_list[i]); + status = controller_process_wait(global, process_list[i]); if (status == F_signal) { f_thread_unlock(&process_list[i]->active); @@ -5713,10 +5713,10 @@ extern "C" { if (required) { if (caller) { - status_lock = controller_lock_read_process(caller, main.thread, &process_list[i]->lock); + status_lock = controller_lock_read_process(caller, global.thread, &process_list[i]->lock); } else { - status_lock = controller_lock_read(is_normal, main.thread, &process_list[i]->lock); + status_lock = controller_lock_read(is_normal, global.thread, &process_list[i]->lock); } if (status_lock == F_signal || F_status_is_error(status_lock)) { @@ -5750,18 +5750,18 @@ extern "C" { } // for if (status_lock == F_signal || F_status_is_error(status_lock)) { - controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_true, main.thread); + controller_lock_error_critical_print(global.main->error, F_status_set_fine(status_lock), F_true, global.thread); return status_lock; } if (caller) { - if (!controller_thread_is_enabled_process(caller, main.thread)) { + if (!controller_thread_is_enabled_process(caller, global.thread)) { return F_signal; } } else { - if (!controller_thread_is_enabled(is_normal, main.thread)) { + if (!controller_thread_is_enabled(is_normal, global.thread)) { return F_signal; } } @@ -5779,9 +5779,9 @@ extern "C" { #endif // _di_controller_rule_wait_all_ #ifndef _di_controller_rule_wait_all_process_type_ - f_status_t controller_rule_wait_all_process_type(const uint8_t type, const controller_main_t main, const bool required, controller_process_t *caller) { + f_status_t controller_rule_wait_all_process_type(const uint8_t type, const controller_global_t global, const bool required, controller_process_t *caller) { - return controller_rule_wait_all(type != controller_process_type_exit, main, required, caller); + return controller_rule_wait_all(type != controller_process_type_exit, global, required, caller); } #endif // _di_controller_rule_wait_all_process_type_ diff --git a/level_3/controller/c/private-rule.h b/level_3/controller/c/private-rule.h index 1c65f79..ef84f26 100644 --- a/level_3/controller/c/private-rule.h +++ b/level_3/controller/c/private-rule.h @@ -51,8 +51,8 @@ extern "C" { * * The object and content ranges are merged together (in that order) as the action parameters. * - * @param main - * The main data. + * @param global + * The global data. * @param buffer * The buffer containing the content. * @param object @@ -76,7 +76,7 @@ extern "C" { * @see f_string_dynamics_increase() */ #ifndef _di_controller_rule_parameters_read_ - extern f_status_t controller_rule_parameters_read(const controller_main_t main, const f_string_static_t buffer, f_fss_object_t *object, f_fss_content_t *content, f_string_dynamics_t *parameters) f_attribute_visibility_internal; + extern f_status_t controller_rule_parameters_read(const controller_global_t global, const f_string_static_t buffer, f_fss_object_t *object, f_fss_content_t *content, f_string_dynamics_t *parameters) f_attribute_visibility_internal; #endif // _di_controller_rule_parameters_read_ /** @@ -118,8 +118,8 @@ extern "C" { * * This will automatically increase the size of the actions array as needed. * - * @param main - * The main data. + * @param global + * The global data. * @param type * The action type for this action or set of actions. * @param method @@ -146,7 +146,7 @@ extern "C" { * @see f_fss_count_lines() */ #ifndef _di_controller_rule_action_read_ - extern f_status_t controller_rule_action_read(const controller_main_t main, const uint8_t type, const uint8_t method, controller_cache_t *cache, controller_rule_item_t *item, controller_rule_actions_t *actions, f_string_range_t *range) f_attribute_visibility_internal; + extern f_status_t controller_rule_action_read(const controller_global_t global, const uint8_t type, const uint8_t method, controller_cache_t *cache, controller_rule_item_t *item, controller_rule_actions_t *actions, f_string_range_t *range) f_attribute_visibility_internal; #endif // _di_controller_rule_action_read_ /** @@ -351,8 +351,8 @@ extern "C" { * @param options * Process options to consider when executing. * If bit controller_process_option_simulate, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule). - * @param main - * The main data. + * @param global + * The global data. * @param process * The process data for processing this rule. * @@ -370,7 +370,7 @@ extern "C" { * On failure, the individual status for the rule is set to an appropriate error status. */ #ifndef _di_controller_rule_execute_ - extern f_status_t controller_rule_execute(const uint8_t action, const uint8_t options, const controller_main_t main, controller_process_t *process) f_attribute_visibility_internal; + extern f_status_t controller_rule_execute(const uint8_t action, const uint8_t options, const controller_global_t global, controller_process_t *process) f_attribute_visibility_internal; #endif // _di_controller_rule_execute_ /** @@ -396,8 +396,8 @@ extern "C" { * @param options * Process options to consider when executing. * If bit controller_process_option_simulate, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule). - * @param main - * The main data. + * @param global + * The global data. * @param execute_set * The execute parameter and as settings. * @param process @@ -415,7 +415,7 @@ extern "C" { * @see fll_execute_program() */ #ifndef _di_controller_rule_execute_foreground_ - extern f_status_t controller_rule_execute_foreground(const uint8_t type, const controller_rule_action_t action, const f_string_t program, const f_string_dynamics_t arguments, const uint8_t options, const controller_main_t main, controller_execute_set_t * const execute_set, controller_process_t *process) f_attribute_visibility_internal; + extern f_status_t controller_rule_execute_foreground(const uint8_t type, const controller_rule_action_t action, const f_string_t program, const f_string_dynamics_t arguments, const uint8_t options, const controller_global_t global, controller_execute_set_t * const execute_set, controller_process_t *process) f_attribute_visibility_internal; #endif // _di_controller_rule_execute_foreground_ /** @@ -448,8 +448,8 @@ extern "C" { * If bit controller_process_option_simulate, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule). * @param with * The "with" option flags. - * @param main - * The main data. + * @param global + * The global data. * @param execute_set * The execute parameter and as settings. * @param process @@ -468,14 +468,14 @@ extern "C" { * @see fll_execute_program() */ #ifndef _di_controller_rule_execute_pid_with_ - extern f_status_t controller_rule_execute_pid_with(const f_string_dynamic_t pid_file, const uint8_t type, const controller_rule_action_t action, const f_string_t program, const f_string_dynamics_t arguments, const uint8_t options, const uint8_t with, const controller_main_t main, controller_execute_set_t * const execute_set, controller_process_t *process) f_attribute_visibility_internal; + extern f_status_t controller_rule_execute_pid_with(const f_string_dynamic_t pid_file, const uint8_t type, const controller_rule_action_t action, const f_string_t program, const f_string_dynamics_t arguments, const uint8_t options, const uint8_t with, const controller_global_t global, controller_execute_set_t * const execute_set, controller_process_t *process) f_attribute_visibility_internal; #endif // _di_controller_rule_execute_pid_with_ /** * Construct an id from two distinct strings found within a single given source. * - * @param main - * The main data. + * @param global + * The global data. * @param source * The source string that both the directory and basename are copied from. * @param directory @@ -496,7 +496,7 @@ extern "C" { * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_rule_id_construct_ - extern f_status_t controller_rule_id_construct(const controller_main_t main, const f_string_static_t source, const f_string_range_t directory, const f_string_range_t basename, f_string_dynamic_t *alias) f_attribute_visibility_internal; + extern f_status_t controller_rule_id_construct(const controller_global_t global, const f_string_static_t source, const f_string_range_t directory, const f_string_range_t basename, f_string_dynamic_t *alias) f_attribute_visibility_internal; #endif // _di_controller_rule_id_construct_ /** @@ -540,8 +540,8 @@ extern "C" { * * This will perform additional FSS read functions as appropriate. * - * @param main - * The main data. + * @param global + * The global data. * @param cache * A structure for containing and caching relevant data. * @param item @@ -560,7 +560,7 @@ extern "C" { * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_rule_item_read_ - extern f_status_t controller_rule_item_read(const controller_main_t main, controller_cache_t *cache, controller_rule_item_t *item) f_attribute_visibility_internal; + extern f_status_t controller_rule_item_read(const controller_global_t global, controller_cache_t *cache, controller_rule_item_t *item) f_attribute_visibility_internal; #endif // _di_controller_rule_item_read_ /** @@ -625,8 +625,8 @@ extern "C" { * * The rule status will be updated by this function. * - * @param main - * The main data. + * @param global + * The global data. * @param process * The process data for processing this rule. * @@ -642,7 +642,7 @@ extern "C" { * Errors (with error bit) from: controller_lock_write(). */ #ifndef _di_controller_rule_process_ - extern f_status_t controller_rule_process(const controller_main_t main, controller_process_t *process) f_attribute_visibility_internal; + extern f_status_t controller_rule_process(const controller_global_t global, controller_process_t *process) f_attribute_visibility_internal; #endif // _di_controller_rule_process_ /** @@ -664,8 +664,8 @@ extern "C" { * @param stack * A stack representing the processes already running in this rule process dependency tree. * This is used to prevent circular dependencies. - * @param main - * The main data. + * @param global + * The global data. * @param cache * A structure for containing and caching relevant data. * @@ -688,7 +688,7 @@ extern "C" { * @see f_thread_create() */ #ifndef _di_controller_rule_process_begin_ - extern f_status_t controller_rule_process_begin(const uint8_t options_force, const f_string_static_t alias_rule, const uint8_t action, const uint8_t options, const uint8_t type, const f_array_lengths_t stack, const controller_main_t main, const controller_cache_t cache) f_attribute_visibility_internal; + extern f_status_t controller_rule_process_begin(const uint8_t options_force, const f_string_static_t alias_rule, const uint8_t action, const uint8_t options, const uint8_t type, const f_array_lengths_t stack, const controller_global_t global, const controller_cache_t cache) f_attribute_visibility_internal; #endif // _di_controller_rule_process_begin_ /** @@ -736,8 +736,8 @@ extern "C" { * The string identifying the rule. * This is constructed from the path parts to the file without the file extension and without the settings directory prefix. * "/etc/controller/rules/example/my.rule" would have a rule id of "example/my". - * @param main - * The main data. + * @param global + * The global data. * @param cache * A structure for containing and caching relevant data. * @param rule @@ -761,7 +761,7 @@ extern "C" { * @see fll_fss_basic_list_read(). */ #ifndef _di_controller_rule_read_ - extern f_status_t controller_rule_read(const bool is_normal, const f_string_static_t alias, controller_main_t main, controller_cache_t *cache, controller_rule_t *rule) f_attribute_visibility_internal; + extern f_status_t controller_rule_read(const bool is_normal, const f_string_static_t alias, controller_global_t global, controller_cache_t *cache, controller_rule_t *rule) f_attribute_visibility_internal; #endif // _di_controller_rule_read_ /** @@ -772,8 +772,8 @@ extern "C" { * Errors from this are not considered fatal, but the first error code encountered is returned. * Memory failure errors are always immediately returned. * - * @param main - * The main data. + * @param global + * The global data. * @param setting * The controller settings data. * @param cache @@ -800,7 +800,7 @@ extern "C" { * @see fll_path_canonical() */ #ifndef _di_controller_rule_setting_read_ - extern f_status_t controller_rule_setting_read(const controller_main_t main, const controller_setting_t setting, controller_cache_t *cache, controller_rule_t *rule) f_attribute_visibility_internal; + extern f_status_t controller_rule_setting_read(const controller_global_t global, const controller_setting_t setting, controller_cache_t *cache, controller_rule_t *rule) f_attribute_visibility_internal; #endif // _di_controller_rule_setting_read_ /** @@ -819,13 +819,13 @@ extern "C" { * If no bits set, then operate normally in a synchronous manner. * If bit controller_process_option_simulate, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule). * If bit controller_process_option_asynchronous, then run asynchronously. - * @param main - * The main data. + * @param global + * The global data. * @param cache * A structure for containing and caching relevant data. */ #ifndef _di_controller_rule_validate_ - extern void controller_rule_validate(const controller_rule_t rule, const uint8_t action, const uint8_t options, const controller_main_t main, controller_cache_t *cache) f_attribute_visibility_internal; + extern void controller_rule_validate(const controller_rule_t rule, const uint8_t action, const uint8_t options, const controller_global_t global, controller_cache_t *cache) f_attribute_visibility_internal; #endif // _di_controller_rule_validate_ /** @@ -835,8 +835,8 @@ extern "C" { * If TRUE, then process as if this operates during a normal operation (entry and control). * If FALSE, then process as if this operates during a an exit operation. * This is ignored when caller is not NULL. - * @param main - * The main data. + * @param global + * The global data. * @param required * If TRUE, then only process required rules and if a required rule has failed, return. * If FALSE, process all waits, returning normally. @@ -854,7 +854,7 @@ extern "C" { * F_require (with error bit set) if a required process is in failed status when required is TRUE. */ #ifndef _di_controller_rule_wait_all_ - extern f_status_t controller_rule_wait_all(const bool is_normal, const controller_main_t main, const bool required, controller_process_t *process) f_attribute_visibility_internal; + extern f_status_t controller_rule_wait_all(const bool is_normal, const controller_global_t global, const bool required, controller_process_t *process) f_attribute_visibility_internal; #endif // _di_controller_rule_wait_all_ /** @@ -862,8 +862,8 @@ extern "C" { * * @param type * The process type to use when checking if thread is enabled. - * @param main - * The main data. + * @param global + * The global data. * @param required * If TRUE, then only process required rules and if a required rule has failed, return. * If FALSE, process all waits, returning normally. @@ -881,7 +881,7 @@ extern "C" { * @see controller_rule_wait_all() */ #ifndef _di_controller_rule_wait_all_process_type_ - extern f_status_t controller_rule_wait_all_process_type(const uint8_t type, const controller_main_t main, const bool required, controller_process_t *caller) f_attribute_visibility_internal; + extern f_status_t controller_rule_wait_all_process_type(const uint8_t type, const controller_global_t global, const bool required, controller_process_t *caller) f_attribute_visibility_internal; #endif // _di_controller_rule_wait_all_process_type_ #ifdef __cplusplus diff --git a/level_3/controller/c/private-thread.c b/level_3/controller/c/private-thread.c index bee50e6..0cae96c 100644 --- a/level_3/controller/c/private-thread.c +++ b/level_3/controller/c/private-thread.c @@ -14,30 +14,30 @@ extern "C" { f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0); - const controller_main_t *main = (controller_main_t *) arguments; + const controller_global_t *global = (controller_global_t *) arguments; - if (main->thread->enabled != controller_thread_enabled) return 0; + if (global->thread->enabled != controller_thread_enabled) return 0; - const unsigned int interval = main->data->parameters[controller_parameter_simulate].result == f_console_result_found ? controller_thread_cleanup_interval_short : controller_thread_cleanup_interval_long; + const unsigned int interval = global->main->parameters[controller_parameter_simulate].result == f_console_result_found ? controller_thread_cleanup_interval_short : controller_thread_cleanup_interval_long; f_status_t status = F_none; - while (main->thread->enabled == controller_thread_enabled) { + while (global->thread->enabled == controller_thread_enabled) { sleep(interval); - if (main->thread->enabled != controller_thread_enabled) break; + if (global->thread->enabled != controller_thread_enabled) break; - if (f_thread_lock_write_try(&main->thread->lock.process) == F_none) { + if (f_thread_lock_write_try(&global->thread->lock.process) == F_none) { controller_process_t *process = 0; f_array_length_t i = 0; - for (; i < main->thread->processs.size && main->thread->enabled == controller_thread_enabled; ++i) { + for (; i < global->thread->processs.size && global->thread->enabled == controller_thread_enabled; ++i) { - if (!main->thread->processs.array[i]) continue; + if (!global->thread->processs.array[i]) continue; - process = main->thread->processs.array[i]; + process = global->thread->processs.array[i]; // if "active" has a read lock, then do not attempt to clean it. if (f_thread_lock_write_try(&process->active) != F_none) { @@ -85,7 +85,7 @@ extern "C" { status = f_thread_lock_write(&process->lock); if (F_status_is_error(status)) { - controller_lock_error_critical_print(main->data->error, F_status_set_fine(status), F_false, main->thread); + controller_lock_error_critical_print(global->main->error, F_status_set_fine(status), F_false, global->thread); f_thread_unlock(&process->active); continue; @@ -129,14 +129,14 @@ extern "C" { } // deallocate any rules in the space that is declared to be unused. - if (i >= main->thread->processs.used) { + if (i >= global->thread->processs.used) { controller_rule_delete_simple(&process->rule); } f_thread_unlock(&process->active); } // for - f_thread_unlock(&main->thread->lock.process); + f_thread_unlock(&global->thread->lock.process); } } // while @@ -149,9 +149,9 @@ extern "C" { f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0); - controller_main_t *main = (controller_main_t *) arguments; + controller_global_t *global = (controller_global_t *) arguments; - if (main->thread->enabled != controller_thread_enabled) return 0; + if (global->thread->enabled != controller_thread_enabled) return 0; return 0; } @@ -183,70 +183,70 @@ extern "C" { #endif // _di_controller_thread_is_enabled_process_type_ #ifndef _di_controller_thread_main_ - f_status_t controller_thread_main(controller_data_t *data, controller_setting_t *setting) { + f_status_t controller_thread_main(controller_main_t *main, controller_setting_t *setting) { f_status_t status = F_none; controller_thread_t thread = controller_thread_t_initialize; - controller_main_t main = controller_macro_main_t_initialize(data, setting, &thread); + controller_global_t global = controller_macro_global_t_initialize(main, setting, &thread); - // the main locks must be initialized, but only once, so initialize immediately upon allocation. + // the global locks must be initialized, but only once, so initialize immediately upon allocation. status = controller_lock_create(&thread.lock); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, status, "controller_lock_create", F_true); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, status, "controller_lock_create", F_true); } } else { status = controller_processs_increase(&thread.processs); if (F_status_is_error(status)) { - controller_error_print(data->error, F_status_set_fine(status), "controller_processs_increase", F_true, &thread); + controller_error_print(main->error, F_status_set_fine(status), "controller_processs_increase", F_true, &thread); } } if (F_status_is_error_not(status)) { - status = f_thread_create(0, &thread.id_signal, &controller_thread_signal_normal, (void *) &main); + status = f_thread_create(0, &thread.id_signal, &controller_thread_signal_normal, (void *) &global); } if (F_status_is_error(status)) { thread.id_signal = 0; - if (data->error.verbosity != f_console_verbosity_quiet) { - controller_error_print(data->error, F_status_set_fine(status), "f_thread_create", F_true, &thread); + if (main->error.verbosity != f_console_verbosity_quiet) { + controller_error_print(main->error, F_status_set_fine(status), "f_thread_create", F_true, &thread); } } else { - if (data->parameters[controller_parameter_daemon].result == f_console_result_found) { + if (main->parameters[controller_parameter_daemon].result == f_console_result_found) { setting->ready = controller_setting_ready_done; if (f_file_exists(setting->path_pid.string) == F_true) { - if (data->error.verbosity != f_console_verbosity_quiet) { + if (main->error.verbosity != f_console_verbosity_quiet) { f_thread_mutex_lock(&thread.lock.print); - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->error.to.stream, "%s%sThe pid file '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s); - fprintf(data->error.to.stream, "%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, setting->path_pid.string, data->error.notable.after->string); - fprintf(data->error.to.stream, "%s' must not already exist.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%s%sThe pid file '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); + fprintf(main->error.to.stream, "%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, setting->path_pid.string, main->error.notable.after->string); + fprintf(main->error.to.stream, "%s' must not already exist.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(data->error.to.stream, &thread.lock.print); + controller_print_unlock_flush(main->error.to.stream, &thread.lock.print); } setting->ready = controller_setting_ready_abort; status = F_status_set_error(F_available_not); } } - else if (main.setting->name_entry.used) { + else if (global.setting->name_entry.used) { - const controller_main_entry_t entry = controller_macro_main_entry_t_initialize(&main, main.setting); + const controller_main_entry_t entry = controller_macro_main_entry_t_initialize(&global, global.setting); status = f_thread_create(0, &thread.id_entry, &controller_thread_entry, (void *) &entry); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - controller_error_print(data->error, F_status_set_fine(status), "f_thread_create", F_true, &thread); + if (main->error.verbosity != f_console_verbosity_quiet) { + controller_error_print(main->error, F_status_set_fine(status), "f_thread_create", F_true, &thread); } } else { @@ -261,33 +261,33 @@ extern "C" { // only make the rule and control threads available once any/all pre-processing and are completed. if (F_status_is_error_not(status) && status != F_signal && status != F_failure && status != F_child && thread.enabled == controller_thread_enabled) { - if (data->parameters[controller_parameter_validate].result == f_console_result_none) { + if (main->parameters[controller_parameter_validate].result == f_console_result_none) { // wait for the entry thread to complete before starting the rule thread. controller_thread_join(&thread.id_rule); if (thread.enabled && setting->mode == controller_setting_mode_service) { - status = f_thread_create(0, &thread.id_rule, &controller_thread_rule, (void *) &main); + status = f_thread_create(0, &thread.id_rule, &controller_thread_rule, (void *) &global); if (F_status_is_error(status)) { thread.id_rule = 0; } else { - status = f_thread_create(0, &thread.id_control, &controller_thread_control, (void *) &main); + status = f_thread_create(0, &thread.id_control, &controller_thread_control, (void *) &global); } if (F_status_is_error(status)) { thread.id_control = 0; } else { - status = f_thread_create(0, &thread.id_cleanup, &controller_thread_cleanup, (void *) &main); + status = f_thread_create(0, &thread.id_cleanup, &controller_thread_cleanup, (void *) &global); } if (F_status_is_error(status)) { thread.id_cleanup = 0; - if (data->error.verbosity != f_console_verbosity_quiet) { - controller_error_print(data->error, F_status_set_fine(status), "f_thread_create", F_true, &thread); + if (main->error.verbosity != f_console_verbosity_quiet) { + controller_error_print(main->error, F_status_set_fine(status), "f_thread_create", F_true, &thread); } } } @@ -300,19 +300,19 @@ extern "C" { return F_child; } - if (F_status_is_error_not(status) && status != F_signal && status != F_failure && data->parameters[controller_parameter_validate].result == f_console_result_none && controller_thread_is_enabled(F_true, &thread)) { + if (F_status_is_error_not(status) && status != F_signal && status != F_failure && main->parameters[controller_parameter_validate].result == f_console_result_none && controller_thread_is_enabled(F_true, &thread)) { if (setting->mode == controller_setting_mode_service) { controller_thread_join(&thread.id_signal); } else if (setting->mode == controller_setting_mode_program) { - controller_rule_wait_all(F_true, main, F_false, 0); + controller_rule_wait_all(F_true, global, F_false, 0); } } - controller_thread_process_cancel(F_true, controller_thread_cancel_call, &main, 0); + controller_thread_process_cancel(F_true, controller_thread_cancel_call, &global, 0); - controller_thread_process_exit(&main); + controller_thread_process_exit(&global); if (thread.id_signal) f_thread_join(thread.id_signal, 0); if (thread.id_cleanup) f_thread_join(thread.id_cleanup, 0); @@ -356,13 +356,13 @@ extern "C" { // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below. // Deallocate as much as possible. - controller_data_t *data = (controller_data_t *) process->main_data; + controller_main_t *main = (controller_main_t *) process->main_data; controller_setting_t *setting = (controller_setting_t *) process->main_setting; controller_thread_t *thread = (controller_thread_t *) process->main_thread; controller_thread_delete_simple(thread); controller_setting_delete_simple(setting); - controller_data_delete(data); + controller_main_delete(main); } } #endif // _di_controller_thread_process_ @@ -390,34 +390,34 @@ extern "C" { #endif // _di_controller_thread_process_other_ #ifndef _di_controller_thread_process_cancel_ - void controller_thread_process_cancel(const bool is_normal, const uint8_t by, controller_main_t *main, controller_process_t *caller) { + void controller_thread_process_cancel(const bool is_normal, const uint8_t by, controller_global_t *global, controller_process_t *caller) { // only cancel when enabled. - if (!controller_thread_is_enabled(is_normal, main->thread)) { + if (!controller_thread_is_enabled(is_normal, global->thread)) { return; } // use the alert lock to toggle enabled (being used as if it were a write like and signal lock). - f_status_t status = f_thread_mutex_lock(&main->thread->lock.alert); + f_status_t status = f_thread_mutex_lock(&global->thread->lock.alert); if (F_status_is_error(status)) { - main->thread->enabled = controller_thread_enabled_not; + global->thread->enabled = controller_thread_enabled_not; } else { if (by == controller_thread_cancel_execute) { - main->thread->enabled = controller_thread_enabled_execute; + global->thread->enabled = controller_thread_enabled_execute; } else if (by == controller_thread_cancel_exit) { - main->thread->enabled = controller_thread_enabled_not; + global->thread->enabled = controller_thread_enabled_not; } else if (by == controller_thread_cancel_exit_execute) { - main->thread->enabled = controller_thread_enabled_exit_execute; + global->thread->enabled = controller_thread_enabled_exit_execute; } else { - main->thread->enabled = controller_thread_enabled_exit; + global->thread->enabled = controller_thread_enabled_exit; } - f_thread_mutex_unlock(&main->thread->lock.alert); + f_thread_mutex_unlock(&global->thread->lock.alert); } f_array_length_t spent = 0; @@ -432,30 +432,30 @@ extern "C" { // the sleep() function that is run inside the cleanup function must be interrupted via the f_thread_cancel(). // @todo consider switching to nanosleep() which may act better with interrupts and not require f_thread_cancel(). - if (main->thread->id_cleanup) { - f_thread_cancel(main->thread->id_cleanup); - f_thread_join(main->thread->id_cleanup, 0); + if (global->thread->id_cleanup) { + f_thread_cancel(global->thread->id_cleanup); + f_thread_join(global->thread->id_cleanup, 0); - main->thread->id_cleanup = 0; + global->thread->id_cleanup = 0; } // the sigtimedwait() function that is run inside of signal must be interrupted via the f_thread_cancel(). - if (by != controller_thread_cancel_signal && main->thread->id_signal) { - f_thread_cancel(main->thread->id_signal); - f_thread_join(main->thread->id_signal, 0); + if (by != controller_thread_cancel_signal && global->thread->id_signal) { + f_thread_cancel(global->thread->id_signal); + f_thread_join(global->thread->id_signal, 0); - main->thread->id_signal = 0; + global->thread->id_signal = 0; } - for (; i < main->thread->processs.used; ++i) { + for (; i < global->thread->processs.used; ++i) { - if (!main->thread->processs.array[i]) continue; + if (!global->thread->processs.array[i]) continue; if (caller && i == caller->id) continue; - process = main->thread->processs.array[i]; + process = global->thread->processs.array[i]; // do not cancel exit processes, when not performing "execute" during exit. - if (process->type == controller_process_type_exit && main->thread->enabled != controller_thread_enabled_exit_execute) continue; + if (process->type == controller_process_type_exit && global->thread->enabled != controller_thread_enabled_exit_execute) continue; for (j = 0; j < process->childs.used; ++j) { @@ -476,15 +476,15 @@ extern "C" { } // for } // for - for (i = 0; i < main->thread->processs.size && spent < controller_thread_exit_process_cancel_total; ++i) { + for (i = 0; i < global->thread->processs.size && spent < controller_thread_exit_process_cancel_total; ++i) { - if (!main->thread->processs.array[i]) continue; + if (!global->thread->processs.array[i]) continue; if (caller && i == caller->id) continue; - process = main->thread->processs.array[i]; + process = global->thread->processs.array[i]; // do not cancel exit processes, when not performing "execute" during exit. - if (process->type == controller_process_type_exit && main->thread->enabled != controller_thread_enabled_exit_execute) continue; + if (process->type == controller_process_type_exit && global->thread->enabled != controller_thread_enabled_exit_execute) continue; do { if (!process->id_thread) break; @@ -537,15 +537,15 @@ extern "C" { } } // for - for (i = 0; i < main->thread->processs.size; ++i) { + for (i = 0; i < global->thread->processs.size; ++i) { - if (!main->thread->processs.array[i]) continue; + if (!global->thread->processs.array[i]) continue; if (caller && i == caller->id) continue; - process = main->thread->processs.array[i]; + process = global->thread->processs.array[i]; // do not kill exit processes, when not performing "execute" during exit. - if (process->type == controller_process_type_exit && main->thread->enabled != controller_thread_enabled_exit_execute) continue; + if (process->type == controller_process_type_exit && global->thread->enabled != controller_thread_enabled_exit_execute) continue; if (process->id_thread) { if (process->childs.used) { @@ -595,93 +595,93 @@ extern "C" { #endif // _di_controller_thread_process_cancel_ #ifndef _di_controller_thread_process_exit_ - void controller_thread_process_exit(controller_main_t *main) { + void controller_thread_process_exit(controller_global_t *global) { - if (main->thread->enabled != controller_thread_enabled_exit) return; + if (global->thread->enabled != controller_thread_enabled_exit) return; - if (main->setting->ready == controller_setting_ready_done) { + if (global->setting->ready == controller_setting_ready_done) { // the exit processing runs using the entry thread. - if (main->thread->id_entry) { - f_thread_cancel(main->thread->id_entry); - f_thread_join(main->thread->id_entry, 0); + if (global->thread->id_entry) { + f_thread_cancel(global->thread->id_entry); + f_thread_join(global->thread->id_entry, 0); - main->thread->id_entry = 0; + global->thread->id_entry = 0; } // restart the signal thread to allow for signals while operating the Exit. - if (!main->thread->id_signal) { - f_thread_create(0, &main->thread->id_signal, &controller_thread_signal_other, (void *) main); + if (!global->thread->id_signal) { + f_thread_create(0, &global->thread->id_signal, &controller_thread_signal_other, (void *) global); } - const controller_main_entry_t entry = controller_macro_main_entry_t_initialize(main, main->setting); + const controller_main_entry_t entry = controller_macro_main_entry_t_initialize(global, global->setting); - f_status_t status = f_thread_create(0, &main->thread->id_entry, &controller_thread_exit, (void *) &entry); + f_status_t status = f_thread_create(0, &global->thread->id_entry, &controller_thread_exit, (void *) &entry); if (F_status_is_error(status)) { - if (main->data->error.verbosity != f_console_verbosity_quiet) { - controller_error_print(main->data->error, F_status_set_fine(status), "f_thread_create", F_true, main->thread); + if (global->main->error.verbosity != f_console_verbosity_quiet) { + controller_error_print(global->main->error, F_status_set_fine(status), "f_thread_create", F_true, global->thread); } - if (F_status_is_error_not(f_thread_mutex_lock(&main->thread->lock.alert))) { - main->thread->enabled = controller_thread_enabled_not; + if (F_status_is_error_not(f_thread_mutex_lock(&global->thread->lock.alert))) { + global->thread->enabled = controller_thread_enabled_not; - f_thread_mutex_unlock(&main->thread->lock.alert); + f_thread_mutex_unlock(&global->thread->lock.alert); } else { - main->thread->enabled = controller_thread_enabled_not; + global->thread->enabled = controller_thread_enabled_not; } } else { struct timespec time; do { - status = f_thread_mutex_lock(&main->thread->lock.alert); + status = f_thread_mutex_lock(&global->thread->lock.alert); if (F_status_is_error(status)) { - main->thread->enabled = controller_thread_enabled_not; + global->thread->enabled = controller_thread_enabled_not; break; } controller_time(controller_thread_exit_ready_timeout_seconds, controller_thread_exit_ready_timeout_nanoseconds, &time); - status = f_thread_condition_wait_timed(&time, &main->thread->lock.alert_condition, &main->thread->lock.alert); + status = f_thread_condition_wait_timed(&time, &global->thread->lock.alert_condition, &global->thread->lock.alert); - f_thread_mutex_unlock(&main->thread->lock.alert); + f_thread_mutex_unlock(&global->thread->lock.alert); - } while (F_status_is_error_not(status) && main->thread->enabled == controller_thread_enabled_exit); + } while (F_status_is_error_not(status) && global->thread->enabled == controller_thread_enabled_exit); if (F_status_is_error(status)) { - if (F_status_is_error_not(f_thread_mutex_lock(&main->thread->lock.alert))) { - main->thread->enabled = controller_thread_enabled_not; + if (F_status_is_error_not(f_thread_mutex_lock(&global->thread->lock.alert))) { + global->thread->enabled = controller_thread_enabled_not; - f_thread_mutex_unlock(&main->thread->lock.alert); + f_thread_mutex_unlock(&global->thread->lock.alert); } else { - main->thread->enabled = controller_thread_enabled_not; + global->thread->enabled = controller_thread_enabled_not; } } } // the sigtimedwait() function that is run inside of signal must be interrupted via the f_thread_cancel(). - if (main->thread->id_signal) { - f_thread_cancel(main->thread->id_signal); - f_thread_join(main->thread->id_signal, 0); + if (global->thread->id_signal) { + f_thread_cancel(global->thread->id_signal); + f_thread_join(global->thread->id_signal, 0); - main->thread->id_signal = 0; + global->thread->id_signal = 0; } - controller_thread_process_cancel(F_false, controller_thread_cancel_exit, main, 0); + controller_thread_process_cancel(F_false, controller_thread_cancel_exit, global, 0); } else { - if (F_status_is_error_not(f_thread_mutex_lock(&main->thread->lock.alert))) { - main->thread->enabled = controller_thread_enabled_not; + if (F_status_is_error_not(f_thread_mutex_lock(&global->thread->lock.alert))) { + global->thread->enabled = controller_thread_enabled_not; - f_thread_mutex_unlock(&main->thread->lock.alert); + f_thread_mutex_unlock(&global->thread->lock.alert); } else { - main->thread->enabled = controller_thread_enabled_not; + global->thread->enabled = controller_thread_enabled_not; } } } @@ -694,75 +694,75 @@ extern "C" { controller_main_entry_t *entry = (controller_main_entry_t *) arguments; - if (!controller_thread_is_enabled(F_true, entry->main->thread)) return 0; + if (!controller_thread_is_enabled(F_true, entry->global->thread)) return 0; - controller_data_t *data = entry->main->data; - controller_cache_t *cache = &entry->main->thread->cache; - f_status_t *status = &entry->main->thread->status; + controller_main_t *main = entry->global->main; + controller_cache_t *cache = &entry->global->thread->cache; + f_status_t *status = &entry->global->thread->status; - *status = controller_entry_read(F_true, *entry->main, cache); + *status = controller_entry_read(F_true, *entry->global, cache); if (F_status_is_error(*status)) { entry->setting->ready = controller_setting_ready_fail; } else if (*status != F_signal && *status != F_child) { - *status = controller_preprocess_entry(F_true, *entry->main, cache); + *status = controller_preprocess_entry(F_true, *entry->global, cache); } if (F_status_is_error_not(*status) && *status != F_signal && *status != F_child) { - if (data->parameters[controller_parameter_validate].result == f_console_result_none || data->parameters[controller_parameter_simulate].result == f_console_result_found) { + if (main->parameters[controller_parameter_validate].result == f_console_result_none || main->parameters[controller_parameter_simulate].result == f_console_result_found) { if (f_file_exists(entry->setting->path_pid.string) == F_true) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&entry->main->thread->lock.print); + if (main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&entry->global->thread->lock.print); - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->error.to.stream, "%s%sThe pid file '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s); - fprintf(data->error.to.stream, "%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, entry->setting->path_pid.string, data->error.notable.after->string); - fprintf(data->error.to.stream, "%s' must not already exist.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%s%sThe pid file '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); + fprintf(main->error.to.stream, "%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, entry->setting->path_pid.string, main->error.notable.after->string); + fprintf(main->error.to.stream, "%s' must not already exist.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(data->error.to.stream, &entry->main->thread->lock.print); + controller_print_unlock_flush(main->error.to.stream, &entry->global->thread->lock.print); } entry->setting->ready = controller_setting_ready_fail; *status = F_status_set_error(F_available_not); } else { - *status = controller_process_entry(F_false, F_true, entry->main, cache); + *status = controller_process_entry(F_false, F_true, entry->global, cache); if (F_status_is_error(*status)) { entry->setting->ready = controller_setting_ready_fail; - if ((F_status_set_fine(*status) == F_execute || F_status_set_fine(*status) == F_require) && entry->main->setting->failsafe_enabled) { + if ((F_status_set_fine(*status) == F_execute || F_status_set_fine(*status) == F_require) && entry->global->setting->failsafe_enabled) { - const uint8_t original_enabled = entry->main->thread->enabled; + const uint8_t original_enabled = entry->global->thread->enabled; // restore operating mode so that the failsafe can execute. - *status = f_thread_mutex_lock(&entry->main->thread->lock.alert); + *status = f_thread_mutex_lock(&entry->global->thread->lock.alert); if (F_status_is_error_not(*status)) { - entry->main->thread->enabled = controller_thread_enabled; + entry->global->thread->enabled = controller_thread_enabled; - f_thread_mutex_unlock(&entry->main->thread->lock.alert); + f_thread_mutex_unlock(&entry->global->thread->lock.alert); } // restart the signal thread to allow for signals while operating the failsafe Items. - if (!entry->main->thread->id_signal) { - f_thread_create(0, &entry->main->thread->id_signal, &controller_thread_signal_normal, (void *) entry->main); + if (!entry->global->thread->id_signal) { + f_thread_create(0, &entry->global->thread->id_signal, &controller_thread_signal_normal, (void *) entry->global); } - const f_status_t status_failsafe = controller_process_entry(F_true, F_true, entry->main, cache); + const f_status_t status_failsafe = controller_process_entry(F_true, F_true, entry->global, cache); if (F_status_is_error(status_failsafe)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&entry->main->thread->lock.print); + if (main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&entry->global->thread->lock.print); - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->error.to.stream, "%s%sFailed while processing requested failsafe item '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s); - fprintf(data->error.to.stream, "%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, entry->main->setting->entry.items.array[entry->main->setting->failsafe_enabled].name.string, data->error.notable.after->string); - fprintf(data->error.to.stream, "%s'.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%s%sFailed while processing requested failsafe item '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); + fprintf(main->error.to.stream, "%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, entry->global->setting->entry.items.array[entry->global->setting->failsafe_enabled].name.string, main->error.notable.after->string); + fprintf(main->error.to.stream, "%s'.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(data->error.to.stream, &entry->main->thread->lock.print); + controller_print_unlock_flush(main->error.to.stream, &entry->global->thread->lock.print); } *status = F_status_set_error(F_failure); @@ -770,12 +770,12 @@ extern "C" { else { // restore operating mode to value prior to failsafe mode. - *status = f_thread_mutex_lock(&entry->main->thread->lock.alert); + *status = f_thread_mutex_lock(&entry->global->thread->lock.alert); if (F_status_is_error_not(*status)) { - entry->main->thread->enabled = original_enabled; + entry->global->thread->enabled = original_enabled; - f_thread_mutex_unlock(&entry->main->thread->lock.alert); + f_thread_mutex_unlock(&entry->global->thread->lock.alert); } *status = F_failure; @@ -798,14 +798,14 @@ extern "C" { // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below. // Deallocate as much as possible. - controller_thread_delete_simple(entry->main->thread); - controller_setting_delete_simple(entry->main->setting); - controller_data_delete(entry->main->data); + controller_thread_delete_simple(entry->global->thread); + controller_setting_delete_simple(entry->global->setting); + controller_main_delete(entry->global->main); return 0; } - f_thread_condition_signal_all(&entry->main->thread->lock.alert_condition); + f_thread_condition_signal_all(&entry->global->thread->lock.alert_condition); return 0; } @@ -818,11 +818,11 @@ extern "C" { controller_main_entry_t *entry = (controller_main_entry_t *) arguments; - controller_data_t *data = entry->main->data; - controller_cache_t *cache = &entry->main->thread->cache; - f_status_t *status = &entry->main->thread->status; + controller_main_t *main = entry->global->main; + controller_cache_t *cache = &entry->global->thread->cache; + f_status_t *status = &entry->global->thread->status; - *status = controller_entry_read(F_false, *entry->main, cache); + *status = controller_entry_read(F_false, *entry->global, cache); if (F_status_is_error(*status)) { entry->setting->ready = controller_setting_ready_fail; @@ -831,49 +831,49 @@ extern "C" { entry->setting->ready = controller_setting_ready_done; } else if (*status != F_signal && *status != F_child) { - *status = controller_preprocess_entry(F_false, *entry->main, cache); + *status = controller_preprocess_entry(F_false, *entry->global, cache); } if (F_status_is_error_not(*status) && *status != F_signal && *status != F_child && *status != F_file_found_not) { - if (data->parameters[controller_parameter_validate].result == f_console_result_none || data->parameters[controller_parameter_simulate].result == f_console_result_found) { + if (main->parameters[controller_parameter_validate].result == f_console_result_none || main->parameters[controller_parameter_simulate].result == f_console_result_found) { - *status = controller_process_entry(F_false, F_false, entry->main, cache); + *status = controller_process_entry(F_false, F_false, entry->global, cache); if (F_status_is_error(*status)) { entry->setting->ready = controller_setting_ready_fail; - if ((F_status_set_fine(*status) == F_execute || F_status_set_fine(*status) == F_require) && entry->main->setting->failsafe_enabled) { + if ((F_status_set_fine(*status) == F_execute || F_status_set_fine(*status) == F_require) && entry->global->setting->failsafe_enabled) { - const uint8_t original_enabled = entry->main->thread->enabled; + const uint8_t original_enabled = entry->global->thread->enabled; // restore operating mode so that the failsafe can execute. if (F_status_set_fine(*status) == F_execute) { - *status = f_thread_mutex_lock(&entry->main->thread->lock.alert); + *status = f_thread_mutex_lock(&entry->global->thread->lock.alert); if (F_status_is_error_not(*status)) { - entry->main->thread->enabled = controller_thread_enabled_exit; + entry->global->thread->enabled = controller_thread_enabled_exit; - f_thread_mutex_unlock(&entry->main->thread->lock.alert); + f_thread_mutex_unlock(&entry->global->thread->lock.alert); } // restart the signal thread to allow for signals while operating the failsafe Items. - if (!entry->main->thread->id_signal) { - f_thread_create(0, &entry->main->thread->id_signal, &controller_thread_signal_other, (void *) entry->main); + if (!entry->global->thread->id_signal) { + f_thread_create(0, &entry->global->thread->id_signal, &controller_thread_signal_other, (void *) entry->global); } } - const f_status_t status_failsafe = controller_process_entry(F_true, F_false, entry->main, cache); + const f_status_t status_failsafe = controller_process_entry(F_true, F_false, entry->global, cache); if (F_status_is_error(status_failsafe)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&entry->main->thread->lock.print); + if (main->error.verbosity != f_console_verbosity_quiet) { + f_thread_mutex_lock(&entry->global->thread->lock.print); - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(data->error.to.stream, "%s%sFailed while processing requested failsafe item '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s); - fprintf(data->error.to.stream, "%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, entry->main->setting->entry.items.array[entry->main->setting->failsafe_enabled].name.string, data->error.notable.after->string); - fprintf(data->error.to.stream, "%s'.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%s%sFailed while processing requested failsafe item '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); + fprintf(main->error.to.stream, "%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, entry->global->setting->entry.items.array[entry->global->setting->failsafe_enabled].name.string, main->error.notable.after->string); + fprintf(main->error.to.stream, "%s'.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); - controller_print_unlock_flush(data->error.to.stream, &entry->main->thread->lock.print); + controller_print_unlock_flush(main->error.to.stream, &entry->global->thread->lock.print); } *status = F_status_set_error(F_failure); @@ -881,12 +881,12 @@ extern "C" { else { // restore operating mode to value prior to failsafe mode. - *status = f_thread_mutex_lock(&entry->main->thread->lock.alert); + *status = f_thread_mutex_lock(&entry->global->thread->lock.alert); if (F_status_is_error_not(*status)) { - entry->main->thread->enabled = original_enabled; + entry->global->thread->enabled = original_enabled; - f_thread_mutex_unlock(&entry->main->thread->lock.alert); + f_thread_mutex_unlock(&entry->global->thread->lock.alert); } *status = F_failure; @@ -908,20 +908,20 @@ extern "C" { // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below. // Deallocate as much as possible. - controller_thread_delete_simple(entry->main->thread); - controller_setting_delete_simple(entry->main->setting); - controller_data_delete(entry->main->data); + controller_thread_delete_simple(entry->global->thread); + controller_setting_delete_simple(entry->global->setting); + controller_main_delete(entry->global->main); return 0; } - if (F_status_is_error_not(f_thread_mutex_lock(&entry->main->thread->lock.alert))) { - entry->main->thread->enabled = controller_thread_enabled_not; + if (F_status_is_error_not(f_thread_mutex_lock(&entry->global->thread->lock.alert))) { + entry->global->thread->enabled = controller_thread_enabled_not; - f_thread_mutex_unlock(&entry->main->thread->lock.alert); + f_thread_mutex_unlock(&entry->global->thread->lock.alert); } - f_thread_condition_signal_all(&entry->main->thread->lock.alert_condition); + f_thread_condition_signal_all(&entry->global->thread->lock.alert_condition); return 0; } @@ -947,40 +947,40 @@ extern "C" { f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0); - controller_main_t *main = (controller_main_t *) arguments; + controller_global_t *global = (controller_global_t *) arguments; - if (!controller_thread_is_enabled(F_true, main->thread)) return 0; + if (!controller_thread_is_enabled(F_true, global->thread)) return 0; return 0; } #endif // _di_controller_thread_rule_ #ifndef _di_controller_thread_signal_ - void controller_thread_signal(const bool is_normal, controller_main_t *main) { + void controller_thread_signal(const bool is_normal, controller_global_t *global) { - if (!controller_thread_is_enabled(is_normal, main->thread)) return; + if (!controller_thread_is_enabled(is_normal, global->thread)) return; siginfo_t information; struct timespec time; int error = 0; - while (controller_thread_is_enabled(is_normal, main->thread)) { + while (controller_thread_is_enabled(is_normal, global->thread)) { controller_time(controller_thread_exit_ready_timeout_seconds, controller_thread_exit_ready_timeout_nanoseconds, &time); - error = sigtimedwait(&main->data->signal.set, &information, &time); + error = sigtimedwait(&global->main->signal.set, &information, &time); if (error == -1) { if (errno == EAGAIN) continue; } - if (main->data->parameters[controller_parameter_interruptable].result == f_console_result_found) { + if (global->main->parameters[controller_parameter_interruptable].result == f_console_result_found) { if (information.si_signo == F_signal_interrupt || information.si_signo == F_signal_abort || information.si_signo == F_signal_quit || information.si_signo == F_signal_termination) { - main->thread->signal = information.si_signo; + global->thread->signal = information.si_signo; - controller_thread_process_cancel(is_normal, controller_thread_cancel_signal, main, 0); + controller_thread_process_cancel(is_normal, controller_thread_cancel_signal, global, 0); break; } @@ -994,7 +994,7 @@ extern "C" { f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0); - controller_thread_signal(F_true, (controller_main_t *) arguments); + controller_thread_signal(F_true, (controller_global_t *) arguments); return 0; } @@ -1005,7 +1005,7 @@ extern "C" { f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0); - controller_thread_signal(F_false, (controller_main_t *) arguments); + controller_thread_signal(F_false, (controller_global_t *) arguments); return 0; } diff --git a/level_3/controller/c/private-thread.h b/level_3/controller/c/private-thread.h index bb308ab..017c976 100644 --- a/level_3/controller/c/private-thread.h +++ b/level_3/controller/c/private-thread.h @@ -17,7 +17,7 @@ extern "C" { * * @param arguments * The thread arguments. - * Must be of type controller_main_t. + * Must be of type controller_global_t. * * @return * 0, always. @@ -31,7 +31,7 @@ extern "C" { * * @param arguments * The thread arguments. - * Must be of type controller_main_t. + * Must be of type controller_global_t. * * @return * 0, always. @@ -96,8 +96,8 @@ extern "C" { /** * Start all threads, wait on threads, and handle requests. * - * @param data - * The controller data. + * @param main + * The main data. * @param setting * The controller settings data. * @@ -109,7 +109,7 @@ extern "C" { * F_failure (with error bit) on any failure. */ #ifndef _di_controller_thread_main_ - extern f_status_t controller_thread_main(controller_data_t *data, controller_setting_t *setting) f_attribute_visibility_internal; + extern f_status_t controller_thread_main(controller_main_t *main, controller_setting_t *setting) f_attribute_visibility_internal; #endif // _di_controller_thread_main_ /** @@ -171,24 +171,24 @@ extern "C" { * If controller_thread_cancel_signal, then this was called from within the signal handling thread, so do not cancel the signal thread. * If controller_thread_cancel_call, then this was not called from within the signal handling thread, so cancel the signal thread. * If controller_thread_cancel_execute, then this was called from within the Entry/Exit for executing a process, so cancel the signal thread but not the Entry thread. - * @param main - * The main thread data. + * @param global + * The global thread data. * @param caller * (optional) The process that is calling the cancel so that this process itself does not get cancelled. * Set to NULL to not use. */ #ifndef _di_controller_thread_process_cancel_ - extern void controller_thread_process_cancel(const bool is_normal, const uint8_t by, controller_main_t *main, controller_process_t *caller) f_attribute_visibility_internal; + extern void controller_thread_process_cancel(const bool is_normal, const uint8_t by, controller_global_t *global, controller_process_t *caller) f_attribute_visibility_internal; #endif // _di_controller_thread_process_cancel_ /** * Process the Exit file, if applicable. * - * @param main - * The main thread data. + * @param global + * The global thread data. */ #ifndef _di_controller_thread_process_exit_ - extern void controller_thread_process_exit(controller_main_t *main) f_attribute_visibility_internal; + extern void controller_thread_process_exit(controller_global_t *global) f_attribute_visibility_internal; #endif // _di_controller_thread_process_exit_ /** @@ -260,7 +260,7 @@ extern "C" { * * @param arguments * The thread arguments. - * Must be of type controller_main_t. + * Must be of type controller_global_t. * * @return * 0, always. @@ -277,11 +277,11 @@ extern "C" { * @param is_normal * If TRUE, then process as if this operates during a normal operation (entry and control). * If FALSE, then process as if this operates during a an exit operation. - * @param main - * The main data. + * @param global + * The global data. */ #ifndef _di_controller_thread_signal_ - extern void controller_thread_signal(const bool is_normal, controller_main_t *main) f_attribute_visibility_internal; + extern void controller_thread_signal(const bool is_normal, controller_global_t *global) f_attribute_visibility_internal; #endif // _di_controller_thread_signal_ /** @@ -291,7 +291,7 @@ extern "C" { * * @param arguments * The thread arguments. - * Must be of type controller_main_t. + * Must be of type controller_global_t. * * @return * 0, always. @@ -309,7 +309,7 @@ extern "C" { * * @param arguments * The thread arguments. - * Must be of type controller_main_t. + * Must be of type controller_global_t. * * @return * 0, always. diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index a92e16a..d52ca62 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -99,33 +99,33 @@ extern "C" { #endif // _di_fake_print_help_ #ifndef _di_fake_main_ - f_status_t fake_main(const f_console_arguments_t arguments, fake_data_t *data) { + f_status_t fake_main(const f_console_arguments_t arguments, fake_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fake_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fake_total_parameters); // Load all parameters and identify priority of color parameters. { f_console_parameter_id_t ids[3] = { fake_parameter_no_color, fake_parameter_light, fake_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); - fake_data_delete(data); + fake_main_delete(main); return status; } } @@ -139,34 +139,34 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); - fake_data_delete(data); + fake_main_delete(main); return status; } if (choice == fake_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fake_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fake_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fake_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - f_array_length_t operations_length = data->parameters[fake_parameter_operation_build].locations.used; + f_array_length_t operations_length = main->parameters[fake_parameter_operation_build].locations.used; - operations_length += data->parameters[fake_parameter_operation_clean].locations.used; - operations_length += data->parameters[fake_parameter_operation_make].locations.used; - operations_length += data->parameters[fake_parameter_operation_skeleton].locations.used; + operations_length += main->parameters[fake_parameter_operation_clean].locations.used; + operations_length += main->parameters[fake_parameter_operation_make].locations.used; + operations_length += main->parameters[fake_parameter_operation_skeleton].locations.used; uint8_t operations[operations_length]; f_string_t operations_name = 0; @@ -178,17 +178,17 @@ extern "C" { f_array_length_t j = 0; f_array_length_t k = 0; - for (; i < data->parameters[fake_parameter_operation_build].locations.used; i++, locations_length++) { + for (; i < main->parameters[fake_parameter_operation_build].locations.used; i++, locations_length++) { operations[locations_length] = fake_operation_build; - locations[locations_length] = data->parameters[fake_parameter_operation_build].locations.array[i]; + locations[locations_length] = main->parameters[fake_parameter_operation_build].locations.array[i]; } // for - for (i = 0; i < data->parameters[fake_parameter_operation_clean].locations.used; i++) { + for (i = 0; i < main->parameters[fake_parameter_operation_clean].locations.used; i++) { for (j = 0; j < locations_length; j++) { - if (data->parameters[fake_parameter_operation_clean].locations.array[i] < locations[j]) { + if (main->parameters[fake_parameter_operation_clean].locations.array[i] < locations[j]) { for (k = locations_length; k > j; k--) { locations[k] = locations[k - 1]; operations[k] = operations[k - 1]; @@ -198,16 +198,16 @@ extern "C" { } } // for - locations[j] = data->parameters[fake_parameter_operation_clean].locations.array[i]; + locations[j] = main->parameters[fake_parameter_operation_clean].locations.array[i]; operations[j] = fake_operation_clean; locations_length++; } // for - for (i = 0; i < data->parameters[fake_parameter_operation_make].locations.used; i++) { + for (i = 0; i < main->parameters[fake_parameter_operation_make].locations.used; i++) { for (j = 0; j < locations_length; j++) { - if (data->parameters[fake_parameter_operation_make].locations.array[i] < locations[j]) { + if (main->parameters[fake_parameter_operation_make].locations.array[i] < locations[j]) { for (k = locations_length; k > j; k--) { locations[k] = locations[k - 1]; operations[k] = operations[k - 1]; @@ -217,16 +217,16 @@ extern "C" { } } // for - locations[j] = data->parameters[fake_parameter_operation_make].locations.array[i]; + locations[j] = main->parameters[fake_parameter_operation_make].locations.array[i]; operations[j] = fake_operation_make; locations_length++; } // for - for (i = 0; i < data->parameters[fake_parameter_operation_skeleton].locations.used; i++) { + for (i = 0; i < main->parameters[fake_parameter_operation_skeleton].locations.used; i++) { for (j = 0; j < locations_length; j++) { - if (data->parameters[fake_parameter_operation_skeleton].locations.array[i] < locations[j]) { + if (main->parameters[fake_parameter_operation_skeleton].locations.array[i] < locations[j]) { for (k = locations_length; k > j; k--) { locations[k] = locations[k - 1]; operations[k] = operations[k - 1]; @@ -236,7 +236,7 @@ extern "C" { } } // for - locations[j] = data->parameters[fake_parameter_operation_skeleton].locations.array[i]; + locations[j] = main->parameters[fake_parameter_operation_skeleton].locations.array[i]; operations[j] = fake_operation_skeleton; locations_length++; } // for @@ -244,99 +244,99 @@ extern "C" { status = F_none; - if (data->parameters[fake_parameter_help].result == f_console_result_found) { - fake_print_help(data->output, data->context); + if (main->parameters[fake_parameter_help].result == f_console_result_found) { + fake_print_help(main->output, main->context); - fake_data_delete(data); + fake_main_delete(main); return F_none; } - if (data->parameters[fake_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fake_version); + if (main->parameters[fake_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fake_version); - fake_data_delete(data); + fake_main_delete(main); return F_none; } if (operations_length) { bool validate_parameter_directories = F_true; - status = fake_process_console_parameters(arguments, data); + status = fake_process_console_parameters(arguments, main); if (F_status_is_error_not(status)) { - status = fake_path_generate(data); + status = fake_path_generate(main); } if (F_status_is_error(status)) { - fake_data_delete(data); + fake_main_delete(main); return F_status_set_error(status); } for (uint8_t i = 0; i < operations_length; i++) { - data->operation = operations[i]; + main->operation = operations[i]; - if (data->operation == fake_operation_build) { + if (main->operation == fake_operation_build) { operations_name = fake_other_operation_build; } - else if (data->operation == fake_operation_clean) { + else if (main->operation == fake_operation_clean) { operations_name = fake_other_operation_clean; } - else if (data->operation == fake_operation_make) { + else if (main->operation == fake_operation_make) { operations_name = fake_other_operation_make; } - else if (data->operation == fake_operation_skeleton) { + else if (main->operation == fake_operation_skeleton) { operations_name = fake_other_operation_skeleton; } - if (data->operation == fake_operation_build) { + if (main->operation == fake_operation_build) { if (validate_parameter_directories) { - status = fake_validate_parameter_directories(arguments, *data); + status = fake_validate_parameter_directories(arguments, *main); validate_parameter_directories = F_false; } if (F_status_is_error_not(status) && status != F_signal) { f_string_static_t stub = f_string_static_t_initialize; - status = fake_build_operate(stub, data); + status = fake_build_operate(stub, main); } } - else if (data->operation == fake_operation_clean) { + else if (main->operation == fake_operation_clean) { if (validate_parameter_directories) { - status = fake_validate_parameter_directories(arguments, *data); + status = fake_validate_parameter_directories(arguments, *main); validate_parameter_directories = F_false; } if (F_status_is_error_not(status) && status != F_signal) { - status = fake_clean_operate(*data); + status = fake_clean_operate(*main); } } - else if (data->operation == fake_operation_make) { + else if (main->operation == fake_operation_make) { if (validate_parameter_directories) { - status = fake_validate_parameter_directories(arguments, *data); + status = fake_validate_parameter_directories(arguments, *main); validate_parameter_directories = F_false; } if (F_status_is_error_not(status) && status != F_signal) { - status = fake_make_operate(data); + status = fake_make_operate(main); if (status == F_child) { break; } } } - else if (data->operation == fake_operation_skeleton) { - status = fake_skeleton_operate(*data); + else if (main->operation == fake_operation_skeleton) { + status = fake_skeleton_operate(*main); } - if (status == F_signal || status == F_child || fake_signal_received(*data)) { + if (status == F_signal || status == F_child || fake_signal_received(*main)) { break; } else if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->error.context, "%sThe operation '", fll_error_print_error); - f_color_print(data->error.to.stream, data->error.notable, "%s", operations_name); - f_color_print(data->error.to.stream, data->error.context, "' failed.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->error.context, "%sThe operation '", fll_error_print_error); + f_color_print(main->error.to.stream, main->error.notable, "%s", operations_name); + f_color_print(main->error.to.stream, main->error.context, "' failed.%c", f_string_eol_s[0]); } break; @@ -344,101 +344,101 @@ extern "C" { } // for // ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (data->error.verbosity != f_console_verbosity_quiet) { + if (main->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status) || status == F_signal) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } else if (status != F_child) { - fprintf(data->output.stream, "%cAll operations complete.%c%c", f_string_eol_s[0], f_string_eol_s[0], f_string_eol_s[0]); + fprintf(main->output.stream, "%cAll operations complete.%c%c", f_string_eol_s[0], f_string_eol_s[0], f_string_eol_s[0]); } } } else { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->error.context, "%sYou failed to specify an operation.%c", fll_error_print_error, f_string_eol_s[0]); - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->error.context, "%sYou failed to specify an operation.%c", fll_error_print_error, f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - fake_data_delete(data); + fake_main_delete(main); return status; } #endif // _di_fake_main_ -#ifndef _di_fake_data_delete_ - f_status_t fake_data_delete(fake_data_t *data) { +#ifndef _di_fake_main_delete_ + f_status_t fake_main_delete(fake_main_t *main) { for (f_array_length_t i = 0; i < fake_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); - - f_macro_string_dynamics_t_delete_simple(data->define); - f_macro_string_dynamic_t_delete_simple(data->fakefile); - f_macro_string_dynamics_t_delete_simple(data->mode); - f_macro_string_dynamic_t_delete_simple(data->process); - f_macro_string_dynamic_t_delete_simple(data->settings); - - f_macro_string_dynamic_t_delete_simple(data->path_build); - f_macro_string_dynamic_t_delete_simple(data->path_build_documents); - f_macro_string_dynamic_t_delete_simple(data->path_build_includes); - f_macro_string_dynamic_t_delete_simple(data->path_build_libraries); - f_macro_string_dynamic_t_delete_simple(data->path_build_libraries_script); - f_macro_string_dynamic_t_delete_simple(data->path_build_libraries_shared); - f_macro_string_dynamic_t_delete_simple(data->path_build_libraries_static); - f_macro_string_dynamic_t_delete_simple(data->path_build_objects); - f_macro_string_dynamic_t_delete_simple(data->path_build_programs); - f_macro_string_dynamic_t_delete_simple(data->path_build_programs_script); - f_macro_string_dynamic_t_delete_simple(data->path_build_programs_shared); - f_macro_string_dynamic_t_delete_simple(data->path_build_programs_static); - f_macro_string_dynamic_t_delete_simple(data->path_build_settings); - f_macro_string_dynamic_t_delete_simple(data->path_build_stage); - f_macro_string_dynamic_t_delete_simple(data->path_work); - - f_macro_string_dynamic_t_delete_simple(data->path_data); - f_macro_string_dynamic_t_delete_simple(data->path_data_build); - - f_macro_string_dynamic_t_delete_simple(data->path_data_settings); - - f_macro_string_dynamic_t_delete_simple(data->path_documents); - - f_macro_string_dynamic_t_delete_simple(data->path_licenses); - - f_macro_string_dynamic_t_delete_simple(data->path_sources); - f_macro_string_dynamic_t_delete_simple(data->path_sources_bash); - f_macro_string_dynamic_t_delete_simple(data->path_sources_c); - f_macro_string_dynamic_t_delete_simple(data->path_sources_cpp); - f_macro_string_dynamic_t_delete_simple(data->path_sources_script); - - f_macro_string_dynamic_t_delete_simple(data->path_work); - f_macro_string_dynamic_t_delete_simple(data->path_work_includes); - f_macro_string_dynamic_t_delete_simple(data->path_work_libraries); - f_macro_string_dynamic_t_delete_simple(data->path_work_libraries_script); - f_macro_string_dynamic_t_delete_simple(data->path_work_libraries_shared); - f_macro_string_dynamic_t_delete_simple(data->path_work_libraries_static); - f_macro_string_dynamic_t_delete_simple(data->path_work_programs); - f_macro_string_dynamic_t_delete_simple(data->path_work_programs_script); - f_macro_string_dynamic_t_delete_simple(data->path_work_programs_shared); - f_macro_string_dynamic_t_delete_simple(data->path_work_programs_static); - - f_macro_string_dynamic_t_delete_simple(data->file_data_build_defines); - f_macro_string_dynamic_t_delete_simple(data->file_data_build_dependencies); - f_macro_string_dynamic_t_delete_simple(data->file_data_build_fakefile); - f_macro_string_dynamic_t_delete_simple(data->file_data_build_settings); - - f_macro_string_dynamic_t_delete_simple(data->file_documents_readme); - - f_macro_color_context_t_delete_simple(data->context); + f_macro_array_lengths_t_delete_simple(main->remaining); + + f_macro_string_dynamics_t_delete_simple(main->define); + f_macro_string_dynamic_t_delete_simple(main->fakefile); + f_macro_string_dynamics_t_delete_simple(main->mode); + f_macro_string_dynamic_t_delete_simple(main->process); + f_macro_string_dynamic_t_delete_simple(main->settings); + + f_macro_string_dynamic_t_delete_simple(main->path_build); + f_macro_string_dynamic_t_delete_simple(main->path_build_documents); + f_macro_string_dynamic_t_delete_simple(main->path_build_includes); + f_macro_string_dynamic_t_delete_simple(main->path_build_libraries); + f_macro_string_dynamic_t_delete_simple(main->path_build_libraries_script); + f_macro_string_dynamic_t_delete_simple(main->path_build_libraries_shared); + f_macro_string_dynamic_t_delete_simple(main->path_build_libraries_static); + f_macro_string_dynamic_t_delete_simple(main->path_build_objects); + f_macro_string_dynamic_t_delete_simple(main->path_build_programs); + f_macro_string_dynamic_t_delete_simple(main->path_build_programs_script); + f_macro_string_dynamic_t_delete_simple(main->path_build_programs_shared); + f_macro_string_dynamic_t_delete_simple(main->path_build_programs_static); + f_macro_string_dynamic_t_delete_simple(main->path_build_settings); + f_macro_string_dynamic_t_delete_simple(main->path_build_stage); + f_macro_string_dynamic_t_delete_simple(main->path_work); + + f_macro_string_dynamic_t_delete_simple(main->path_data); + f_macro_string_dynamic_t_delete_simple(main->path_data_build); + + f_macro_string_dynamic_t_delete_simple(main->path_data_settings); + + f_macro_string_dynamic_t_delete_simple(main->path_documents); + + f_macro_string_dynamic_t_delete_simple(main->path_licenses); + + f_macro_string_dynamic_t_delete_simple(main->path_sources); + f_macro_string_dynamic_t_delete_simple(main->path_sources_bash); + f_macro_string_dynamic_t_delete_simple(main->path_sources_c); + f_macro_string_dynamic_t_delete_simple(main->path_sources_cpp); + f_macro_string_dynamic_t_delete_simple(main->path_sources_script); + + f_macro_string_dynamic_t_delete_simple(main->path_work); + f_macro_string_dynamic_t_delete_simple(main->path_work_includes); + f_macro_string_dynamic_t_delete_simple(main->path_work_libraries); + f_macro_string_dynamic_t_delete_simple(main->path_work_libraries_script); + f_macro_string_dynamic_t_delete_simple(main->path_work_libraries_shared); + f_macro_string_dynamic_t_delete_simple(main->path_work_libraries_static); + f_macro_string_dynamic_t_delete_simple(main->path_work_programs); + f_macro_string_dynamic_t_delete_simple(main->path_work_programs_script); + f_macro_string_dynamic_t_delete_simple(main->path_work_programs_shared); + f_macro_string_dynamic_t_delete_simple(main->path_work_programs_static); + + f_macro_string_dynamic_t_delete_simple(main->file_data_build_defines); + f_macro_string_dynamic_t_delete_simple(main->file_data_build_dependencies); + f_macro_string_dynamic_t_delete_simple(main->file_data_build_fakefile); + f_macro_string_dynamic_t_delete_simple(main->file_data_build_settings); + + f_macro_string_dynamic_t_delete_simple(main->file_documents_readme); + + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fake_data_delete_ +#endif // _di_fake_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fake/c/fake.h b/level_3/fake/c/fake.h index 0b083cb..ae5ab72 100644 --- a/level_3/fake/c/fake.h +++ b/level_3/fake/c/fake.h @@ -368,7 +368,7 @@ extern "C" { #define fake_total_parameters 28 #endif // _di_fake_defines_ -#ifndef _di_fake_data_t_ +#ifndef _di_fake_main_t_ typedef struct { f_console_parameter_t parameters[fake_total_parameters]; @@ -438,9 +438,9 @@ extern "C" { f_string_dynamic_t file_documents_readme; f_color_context_t context; - } fake_data_t; + } fake_main_t; - #define fake_data_t_initialize \ + #define fake_main_t_initialize \ { \ fake_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -497,7 +497,7 @@ extern "C" { f_string_dynamic_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_fake_data_t_ +#endif // _di_fake_main_t_ /** * Print help. @@ -517,9 +517,9 @@ extern "C" { /** * Execute main program. * - * Be sure to call fake_data_delete() after executing this. + * Be sure to call fake_main_delete() after executing this. * - * If data.signal is non-zero, then this blocks and handles the following signals: + * If main.signal is non-zero, then this blocks and handles the following signals: * - F_signal_abort * - F_signal_hangup * - F_signal_interrupt @@ -528,8 +528,8 @@ extern "C" { * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -537,19 +537,19 @@ extern "C" { * * Status codes (with error bit) are returned on any problem. * - * @see fake_data_delete() + * @see fake_main_delete() */ #ifndef _di_fake_main_ - extern f_status_t fake_main(const f_console_arguments_t arguments, fake_data_t *data); + extern f_status_t fake_main(const f_console_arguments_t arguments, fake_main_t *main); #endif // _di_fake_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fake_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -558,9 +558,9 @@ extern "C" { * * @see fake_main() */ -#ifndef _di_fake_data_delete_ - extern f_status_t fake_data_delete(fake_data_t *data); -#endif // _di_fake_data_delete_ +#ifndef _di_fake_main_delete_ + extern f_status_t fake_main_delete(fake_main_t *main); +#endif // _di_fake_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fake/c/main.c b/level_3/fake/c/main.c index b4f1804..b11290c 100644 --- a/level_3/fake/c/main.c +++ b/level_3/fake/c/main.c @@ -16,35 +16,35 @@ */ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fake_data_t data = fake_data_t_initialize; + fake_main_t main = fake_main_t_initialize; f_status_t status = F_none; - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); + f_signal_set_empty(&main.signal.set); + f_signal_set_add(F_signal_abort, &main.signal.set); + f_signal_set_add(F_signal_hangup, &main.signal.set); + f_signal_set_add(F_signal_interrupt, &main.signal.set); + f_signal_set_add(F_signal_quit, &main.signal.set); + f_signal_set_add(F_signal_termination, &main.signal.set); - status = f_signal_mask(SIG_BLOCK, &data.signal.set, 0); + status = f_signal_mask(SIG_BLOCK, &main.signal.set, 0); if (F_status_is_error_not(status)) { - status = f_signal_open(&data.signal); + status = f_signal_open(&main.signal); // if there is an error opening a signal descriptor, then do not handle signals. if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &data.signal.set, 0); - f_signal_close(&data.signal); + f_signal_mask(SIG_UNBLOCK, &main.signal.set, 0); + f_signal_close(&main.signal); } } // @fixme: bad design in POSIX where there is no get umask without setting it. - data.umask = umask(0); + main.umask = umask(0); // restore umask. - umask(data.umask); + umask(main.umask); - status = fake_main(arguments, &data); + status = fake_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); @@ -55,10 +55,10 @@ int main(const int argc, const f_string_t *argv) { close(f_type_descriptor_input); close(f_type_descriptor_error); - f_signal_close(&data.signal); + f_signal_close(&main.signal); if (status == F_child) { - exit(data.child); + exit(main.child); } if (F_status_is_error(status)) { diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 62002f6..a2a37f5 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -9,30 +9,30 @@ extern "C" { #endif #ifndef _di_fake_build_arguments_standard_add_ - void fake_build_arguments_standard_add(const fake_data_t data, const fake_build_data_t data_build, const bool is_shared, const bool is_library, f_string_dynamics_t *arguments, f_status_t *status) { + void fake_build_arguments_standard_add(const fake_main_t main, const fake_build_data_t data_build, const bool is_shared, const bool is_library, f_string_dynamics_t *arguments, f_status_t *status) { if (F_status_is_error(*status)) return; - f_array_length_t build_libraries_length = fake_build_parameter_library_link_path_length + data.path_build_libraries_shared.used; + f_array_length_t build_libraries_length = fake_build_parameter_library_link_path_length + main.path_build_libraries_shared.used; char build_libraries[build_libraries_length + 1]; memcpy(build_libraries, fake_build_parameter_library_link_path, fake_build_parameter_library_link_path_length); if (is_shared) { - memcpy(build_libraries + fake_build_parameter_library_link_path_length, data.path_build_libraries_shared.string, data.path_build_libraries_shared.used); + memcpy(build_libraries + fake_build_parameter_library_link_path_length, main.path_build_libraries_shared.string, main.path_build_libraries_shared.used); } else { - memcpy(build_libraries + fake_build_parameter_library_link_path_length, data.path_build_libraries_static.string, data.path_build_libraries_static.used); + memcpy(build_libraries + fake_build_parameter_library_link_path_length, main.path_build_libraries_static.string, main.path_build_libraries_static.used); } build_libraries[build_libraries_length] = 0; - f_array_length_t build_includes_length = fake_build_parameter_library_include_length + data.path_build_includes.used; + f_array_length_t build_includes_length = fake_build_parameter_library_include_length + main.path_build_includes.used; char build_includes[build_includes_length + 1]; memcpy(build_includes, fake_build_parameter_library_include, fake_build_parameter_library_include_length); - memcpy(build_includes + fake_build_parameter_library_include_length, data.path_build_includes.string, data.path_build_includes.used); + memcpy(build_includes + fake_build_parameter_library_include_length, main.path_build_includes.string, main.path_build_includes.used); const f_string_t values[] = { build_libraries, @@ -49,16 +49,16 @@ extern "C" { if (F_status_is_error(*status)) break; } // for - if (data.path_work.used) { + if (main.path_work.used) { f_array_length_t length = 0; if (F_status_is_error_not(*status)) { - length = fake_build_parameter_library_include_length + data.path_work_includes.used; + length = fake_build_parameter_library_include_length + main.path_work_includes.used; char string[length + 1]; memcpy(string, fake_build_parameter_library_include, fake_build_parameter_library_include_length); - memcpy(string + fake_build_parameter_library_include_length, data.path_work_includes.string, data.path_work_includes.used); + memcpy(string + fake_build_parameter_library_include_length, main.path_work_includes.string, main.path_work_includes.used); string[length] = 0; @@ -66,12 +66,12 @@ extern "C" { } if (data_build.setting.search_shared && (is_shared || !data_build.setting.search_exclusive) && F_status_is_error_not(*status)) { - length = fake_build_parameter_library_link_path_length + data.path_work_libraries_shared.used; + length = fake_build_parameter_library_link_path_length + main.path_work_libraries_shared.used; char string[length + 1]; memcpy(string, fake_build_parameter_library_link_path, fake_build_parameter_library_link_path_length); - memcpy(string + fake_build_parameter_library_link_path_length, data.path_work_libraries_shared.string, data.path_work_libraries_shared.used); + memcpy(string + fake_build_parameter_library_link_path_length, main.path_work_libraries_shared.string, main.path_work_libraries_shared.used); string[length] = 0; @@ -79,12 +79,12 @@ extern "C" { } if (data_build.setting.search_static && (!is_shared || !data_build.setting.search_exclusive) && F_status_is_error_not(*status)) { - length = fake_build_parameter_library_link_path_length + data.path_work_libraries_static.used; + length = fake_build_parameter_library_link_path_length + main.path_work_libraries_static.used; char string[length + 1]; memcpy(string, fake_build_parameter_library_link_path, fake_build_parameter_library_link_path_length); - memcpy(string + fake_build_parameter_library_link_path_length, data.path_work_libraries_static.string, data.path_work_libraries_static.used); + memcpy(string + fake_build_parameter_library_link_path_length, main.path_work_libraries_static.string, main.path_work_libraries_static.used); string[length] = 0; @@ -127,13 +127,13 @@ extern "C" { } // for } - if (data.define.used) { + if (main.define.used) { f_array_length_t length = 0; f_array_length_t i = 0; - for (; i < data.define.used && F_status_is_error_not(*status); i++) { + for (; i < main.define.used && F_status_is_error_not(*status); i++) { - *status = fll_execute_arguments_add(data.define.array[i].string, data.define.array[i].used, arguments); + *status = fll_execute_arguments_add(main.define.array[i].string, main.define.array[i].used, arguments); if (F_status_is_error(*status)) break; } // for } @@ -166,10 +166,10 @@ extern "C" { #endif // _di_fake_build_arguments_standard_add_ #ifndef _di_fake_build_copy_ - void fake_build_copy(const fake_data_t data, const f_mode_t mode, const f_string_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_array_length_t preserve, f_status_t *status) { + void fake_build_copy(const fake_main_t main, const f_mode_t mode, const f_string_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_array_length_t preserve, f_status_t *status) { if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return; } @@ -179,16 +179,16 @@ extern "C" { f_string_dynamic_t destination_file = f_string_dynamic_t_initialize; f_string_dynamic_t destination_directory = f_string_dynamic_t_initialize; - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.important, "Copying %s.", label); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.important, "Copying %s.", label); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } f_macro_string_dynamic_t_resize(*status, path_source, source.used); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), " f_macro_string_dynamic_t_resize", F_true); + fll_error_print(main.error, F_status_set_fine(*status), " f_macro_string_dynamic_t_resize", F_true); f_macro_string_dynamic_t_delete_simple(path_source); return; @@ -198,8 +198,8 @@ extern "C" { fl_directory_recurse_t recurse = fl_directory_recurse_t_initialize; - if (data.error.verbosity == f_console_verbosity_verbose) { - recurse.output = data.output; + if (main.error.verbosity == f_console_verbosity_verbose) { + recurse.output = main.output; recurse.verbose = fake_verbose_print_copy; } @@ -213,25 +213,25 @@ extern "C" { *status = f_string_dynamic_append_nulless(files.array[i], &path_source); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); break; } *status = f_string_dynamic_terminate_after(&path_source); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); break; } *status = f_directory_is(path_source.string); - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); break; } @@ -242,40 +242,40 @@ extern "C" { *status = f_string_dynamic_append(destination, &destination_directory); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); break; } *status = f_file_name_base(path_source.string, path_source.used, &destination_directory); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_file_name_base", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_file_name_base", F_true); break; } *status = f_string_dynamic_terminate_after(&destination_directory); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } *status = fl_directory_copy(path_source.string, destination_directory.string, path_source.used, destination_directory.used, mode, recurse); if (F_status_is_error(*status)) { - if (data.error.verbosity == f_console_verbosity_verbose) { + if (main.error.verbosity == f_console_verbosity_verbose) { for (f_array_length_t j = 0; j < failures.used; j++) { - fake_print_error_build_operation_file(data, F_status_set_fine(*status), "fl_directory_copy", "copy directory", "to", path_source.string, destination_directory.string, F_true); + fake_print_error_build_operation_file(main, F_status_set_fine(*status), "fl_directory_copy", "copy directory", "to", path_source.string, destination_directory.string, F_true); } // for if (F_status_set_fine(*status) != F_failure) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_directory_copy", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fl_directory_copy", F_true); } break; } - else if (data.error.verbosity != f_console_verbosity_quiet) { - fake_print_error_build_operation_file(data, F_status_set_fine(*status), "fl_directory_copy", "copy directory", "to", path_source.string, destination_directory.string, F_true); + else if (main.error.verbosity != f_console_verbosity_quiet) { + fake_print_error_build_operation_file(main, F_status_set_fine(*status), "fl_directory_copy", "copy directory", "to", path_source.string, destination_directory.string, F_true); } break; @@ -288,7 +288,7 @@ extern "C" { *status = f_string_dynamic_append_nulless(destination, &destination_file); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); break; } @@ -296,35 +296,35 @@ extern "C" { *status = f_string_dynamic_append_nulless(destination, &destination_directory); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); break; } *status = f_file_name_directory(path_source.string + preserve, path_source.used - preserve, &destination_directory); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_file_name_directory", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_file_name_directory", F_true); break; } *status = f_string_dynamic_terminate_after(&destination_directory); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } *status = fl_directory_create(destination_directory.string, destination_directory.used, f_file_mode_all_rwx); if (F_status_is_error(*status)) { - fll_error_file_print(data.error, F_status_set_fine(*status), "fl_directory_create", F_true, destination_directory.string, "create", fll_error_file_type_directory); + fll_error_file_print(main.error, F_status_set_fine(*status), "fl_directory_create", F_true, destination_directory.string, "create", fll_error_file_type_directory); break; } *status = f_string_append(path_source.string + preserve, path_source.used - preserve, &destination_file); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append", F_true); break; } } @@ -332,7 +332,7 @@ extern "C" { *status = f_file_name_base(path_source.string, path_source.used, &destination_file); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_file_name_base", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_file_name_base", F_true); break; } } @@ -340,11 +340,11 @@ extern "C" { *status = f_string_dynamic_terminate_after(&destination_file); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); break; } @@ -352,16 +352,16 @@ extern "C" { *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, F_status_set_fine(*status), "f_file_copy", "copy", "to", path_source.string, destination_file.string, F_true); + fake_print_error_build_operation_file(main, F_status_set_fine(*status), "f_file_copy", "copy", "to", path_source.string, destination_file.string, F_true); break; } - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "Copied file '%s' to '%s'.%c", path_source.string, destination_file.string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "Copied file '%s' to '%s'.%c", path_source.string, destination_file.string, f_string_eol_s[0]); } } else if (F_status_is_error(*status)) { - fll_error_file_print(data.error, F_status_set_fine(*status), "f_directory_is", F_true, path_source.string, "create", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_directory_is", F_true, path_source.string, "create", fll_error_file_type_file); break; } @@ -374,28 +374,28 @@ extern "C" { f_macro_string_dynamic_t_delete_simple(destination_directory); if (F_status_is_error_not(*status)) { - fake_build_touch(data, file_stage, status); + fake_build_touch(main, file_stage, status); } } #endif // _di_fake_build_copy_ #ifndef _di_fake_build_skeleton_ - void fake_build_skeleton(const fake_data_t data, const fake_build_data_t data_build, const mode_t mode, const f_string_static_t file_stage, f_status_t *status) { + void fake_build_skeleton(const fake_main_t main, const fake_build_data_t data_build, const mode_t mode, const f_string_static_t file_stage, f_status_t *status) { if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return; } f_string_static_t path_headers = f_string_static_t_initialize; - f_array_length_t directory_headers_length = data.path_build_includes.used + data_build.setting.path_headers.used; + f_array_length_t directory_headers_length = main.path_build_includes.used + data_build.setting.path_headers.used; char directory_headers[directory_headers_length + 1]; if (data_build.setting.path_headers.used) { - memcpy(directory_headers, data.path_build_includes.string, data.path_build_includes.used); - memcpy(directory_headers + data.path_build_includes.used, data_build.setting.path_headers.string, data_build.setting.path_headers.used); + memcpy(directory_headers, main.path_build_includes.string, main.path_build_includes.used); + memcpy(directory_headers + main.path_build_includes.used, data_build.setting.path_headers.string, data_build.setting.path_headers.used); directory_headers[directory_headers_length] = 0; @@ -412,34 +412,34 @@ extern "C" { } const f_string_static_t *directorys[] = { - &data.path_build, - &data.path_build_documents, - &data.path_build_includes, - &data.path_build_libraries, - &data.path_build_libraries_script, - &data.path_build_libraries_shared, - &data.path_build_libraries_static, - &data.path_build_objects, - &data.path_build_programs, - &data.path_build_programs_script, - &data.path_build_programs_shared, - &data.path_build_programs_static, - &data.path_build_settings, - &data.path_build_stage, + &main.path_build, + &main.path_build_documents, + &main.path_build_includes, + &main.path_build_libraries, + &main.path_build_libraries_script, + &main.path_build_libraries_shared, + &main.path_build_libraries_static, + &main.path_build_objects, + &main.path_build_programs, + &main.path_build_programs_script, + &main.path_build_programs_shared, + &main.path_build_programs_static, + &main.path_build_settings, + &main.path_build_stage, &path_headers, }; - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.important, "Creating base build directories."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.important, "Creating base build directories."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } for (uint8_t i = 0; i < 15; i++) { if (!directorys[i]->used) continue; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return; } @@ -478,25 +478,25 @@ extern "C" { continue; } - fll_error_file_print(data.error, F_status_set_fine(*status), "f_directory_create", F_true, directorys[i]->string, "create", fll_error_file_type_directory); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_directory_create", F_true, directorys[i]->string, "create", fll_error_file_type_directory); return; } - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "Created directory '%s'.%c", directorys[i]->string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "Created directory '%s'.%c", directorys[i]->string, f_string_eol_s[0]); } } // for - fake_build_touch(data, file_stage, status); + fake_build_touch(main, file_stage, status); } #endif // _di_fake_build_skeleton_ #ifndef _di_fake_build_execute_process_script_ - int fake_build_execute_process_script(const fake_data_t data, const fake_build_data_t data_build, const f_string_static_t process_script, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return data.child; + int fake_build_execute_process_script(const fake_main_t main, const fake_build_data_t data_build, const f_string_static_t process_script, const f_string_static_t file_stage, f_status_t *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main.child; if (!process_script.used) return 0; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return 0; } @@ -506,16 +506,16 @@ extern "C" { *status = fll_execute_arguments_add(fake_other_operation_build, fake_other_operation_build_length, &arguments); // ensure console color mode is passed to the scripts so that they can also react to color mode. - if (F_status_is_error_not(*status) && data.context.mode != f_color_mode_none) { + if (F_status_is_error_not(*status) && main.context.mode != f_color_mode_none) { char argument[3] = { f_console_symbol_short_disable_s[0], 0, 0 }; - if (data.context.mode == f_color_mode_dark) { + if (main.context.mode == f_color_mode_dark) { argument[1] = f_console_standard_short_dark_s[0]; } - else if (data.context.mode == f_color_mode_light) { + else if (main.context.mode == f_color_mode_light) { argument[1] = f_console_standard_short_light_s[0]; } - else if (data.context.mode == f_color_mode_no_color) { + else if (main.context.mode == f_color_mode_no_color) { argument[1] = f_console_standard_short_no_color_s[0]; } @@ -523,16 +523,16 @@ extern "C" { } // ensure verbosity level is passed to the scripts so that they can also react to requested verbosity. - if (F_status_is_error_not(*status) && data.error.verbosity != f_console_verbosity_normal) { + if (F_status_is_error_not(*status) && main.error.verbosity != f_console_verbosity_normal) { char argument[3] = { f_console_symbol_short_disable_s[0], 0, 0 }; - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { argument[1] = f_console_standard_short_quiet_s[0]; } - else if (data.error.verbosity == f_console_verbosity_verbose) { + else if (main.error.verbosity == f_console_verbosity_verbose) { argument[1] = f_console_standard_short_verbose_s[0]; } - else if (data.error.verbosity == f_console_verbosity_debug) { + else if (main.error.verbosity == f_console_verbosity_debug) { argument[1] = f_console_standard_short_debug_s[0]; } @@ -540,7 +540,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return 0; @@ -549,10 +549,10 @@ extern "C" { { f_string_dynamic_t defines = f_string_dynamic_t_initialize; - if (data.define.used) { - for (f_array_length_t i = 0; i < data.define.used; i++) { + if (main.define.used) { + for (f_array_length_t i = 0; i < main.define.used; i++) { - *status = f_string_dynamic_mash(f_string_space_s, 1, data.define.array[i], &defines); + *status = f_string_dynamic_mash(f_string_space_s, 1, main.define.array[i], &defines); if (F_status_is_error(*status)) { break; @@ -560,7 +560,7 @@ extern "C" { } // for if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_mash", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_mash", F_true); f_macro_string_dynamic_t_delete_simple(defines); f_macro_string_dynamics_t_delete_simple(arguments); @@ -570,7 +570,7 @@ extern "C" { *status = f_string_dynamic_terminate_after(&defines); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); f_macro_string_dynamic_t_delete_simple(defines); f_macro_string_dynamics_t_delete_simple(arguments); @@ -620,22 +620,22 @@ extern "C" { const f_string_t parameters_value[] = { defines.string, - data.process.string, - data.settings.string, - data.path_build.string, - data.path_data.string, - data.path_sources.string, - data.path_work.string, + main.process.string, + main.settings.string, + main.path_build.string, + main.path_data.string, + main.path_sources.string, + main.path_work.string, }; const f_array_length_t parameters_value_length[] = { defines.used, - data.process.used, - data.settings.used, - data.path_build.used, - data.path_data.used, - data.path_sources.used, - data.path_work.used, + main.process.used, + main.settings.used, + main.path_build.used, + main.path_data.used, + main.path_sources.used, + main.path_work.used, }; *status = fll_execute_arguments_add_parameter_set(parameters_prefix, parameters_prefix_length, parameters_name, parameters_name_length, parameters_value, parameters_value_length, 7, &arguments); @@ -643,7 +643,7 @@ extern "C" { f_macro_string_dynamic_t_delete_simple(defines); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_arguments_add_parameter_set", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_execute_arguments_add_parameter_set", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return 0; @@ -657,7 +657,7 @@ extern "C" { function = "f_string_dynamic_append_nulless"; if (process_script.string[0] != '/') { - *status = f_string_dynamic_append_nulless(data.path_data_build, &path); + *status = f_string_dynamic_append_nulless(main.path_data_build, &path); } if (F_status_is_error_not(*status)) { @@ -670,7 +670,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), function, F_true); + fll_error_print(main.error, F_status_set_fine(*status), function, F_true); f_macro_string_dynamic_t_delete_simple(path); f_macro_string_dynamics_t_delete_simple(arguments); @@ -680,7 +680,7 @@ extern "C" { int return_code = 0; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); f_macro_string_dynamic_t_delete_simple(path); @@ -698,26 +698,26 @@ extern "C" { f_macro_string_dynamics_t_delete_simple(arguments); - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); } else if (*status != F_child) { if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_failure) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.error.context, "%sFailed to execute script: ", data.error.prefix); - f_color_print(data.error.to.stream, data.error.notable, "%s", path.string); - f_color_print(data.error.to.stream, data.error.context, "."); - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.error.context, "%sFailed to execute script: ", main.error.prefix); + f_color_print(main.error.to.stream, main.error.notable, "%s", path.string); + f_color_print(main.error.to.stream, main.error.context, "."); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); } } else { - fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_program", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_execute_program", F_true); } } else { - fake_build_touch(data, file_stage, status); + fake_build_touch(main, file_stage, status); } } } @@ -729,7 +729,7 @@ extern "C" { #endif // _di_fake_build_execute_process_script_ #ifndef _di_fake_build_get_file_name_without_extension_ - f_status_t fake_build_get_file_name_without_extension(const fake_data_t data, const f_string_static_t path, f_string_dynamic_t *name) { + f_status_t fake_build_get_file_name_without_extension(const fake_main_t main, const f_string_static_t path, f_string_dynamic_t *name) { name->used = 0; if (!path.used) return F_none; @@ -737,7 +737,7 @@ extern "C" { f_status_t status = f_file_name_base(path.string, path.used, name); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_file_name_base", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_file_name_base", F_true); return status; } @@ -753,7 +753,7 @@ extern "C" { status = f_string_dynamic_terminate_after(name); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); return status; } @@ -762,41 +762,41 @@ extern "C" { #endif // _di_fake_build_get_file_name_without_extension_ #ifndef _di_fake_build_libraries_script_ - int fake_build_libraries_script(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return data.child; + int fake_build_libraries_script(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main.child; // @todo needs to perform some sort of regex replace on the library scripts. - fake_build_touch(data, file_stage, status); + fake_build_touch(main, file_stage, status); return 0; } #endif // _di_fake_build_libraries_script_ #ifndef _di_fake_build_library_shared_ - int fake_build_library_shared(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return data.child; + int fake_build_library_shared(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main.child; if (!data_build.setting.build_sources_library.used) return 0; - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.important, "Compiling shared library."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.important, "Compiling shared library."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } f_string_dynamics_t arguments = f_string_dynamics_t_initialize; { - const f_string_static_t *path_sources = &data.path_sources; + const f_string_static_t *path_sources = &main.path_sources; if (data_build.setting.path_standard) { - path_sources = &data.path_sources_c; + path_sources = &main.path_sources_c; if (data_build.setting.build_language == fake_build_language_type_cpp) { - path_sources = &data.path_sources_cpp; + path_sources = &main.path_sources_cpp; } } - else if (data.parameters[fake_parameter_path_sources].result != f_console_result_additional) { + else if (main.parameters[fake_parameter_path_sources].result != f_console_result_additional) { path_sources = &data_build.setting.path_sources; } @@ -817,7 +817,7 @@ extern "C" { } // for if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return 0; @@ -897,12 +897,12 @@ extern "C" { parameter_file_name_micro[parameter_file_name_micro_length] = 0; { - f_array_length_t parameter_file_path_length = data.path_build_libraries_shared.used + parameter_file_name_micro_length; + f_array_length_t parameter_file_path_length = main.path_build_libraries_shared.used + parameter_file_name_micro_length; char parameter_file_path[parameter_file_path_length + 1]; - memcpy(parameter_file_path, data.path_build_libraries_shared.string, data.path_build_libraries_shared.used); - memcpy(parameter_file_path + data.path_build_libraries_shared.used, parameter_file_name_micro, parameter_file_name_micro_length); + memcpy(parameter_file_path, main.path_build_libraries_shared.string, main.path_build_libraries_shared.used); + memcpy(parameter_file_path + main.path_build_libraries_shared.used, parameter_file_name_micro, parameter_file_name_micro_length); parameter_file_path[parameter_file_path_length] = 0; @@ -953,10 +953,10 @@ extern "C" { if (F_status_is_error(*status)) break; } // for - fake_build_arguments_standard_add(data, data_build, F_true, F_true, &arguments, status); + fake_build_arguments_standard_add(main, data_build, F_true, F_true, &arguments, status); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return 0; @@ -964,7 +964,7 @@ extern "C" { } { - const int result = fake_execute(data, data_build.environment, data_build.setting.build_compiler, arguments, status); + const int result = fake_execute(main, data_build.environment, data_build.setting.build_compiler, arguments, status); f_macro_string_dynamics_t_delete_simple(arguments); @@ -978,7 +978,7 @@ extern "C" { } if (data_build.setting.version_target != fake_build_version_type_micro) { - f_array_length_t parameter_file_path_length = data.path_build_libraries_shared.used; + f_array_length_t parameter_file_path_length = main.path_build_libraries_shared.used; if (data_build.setting.version_target == fake_build_version_type_major) { parameter_file_path_length += parameter_file_name_major_length; @@ -989,51 +989,51 @@ extern "C" { char parameter_file_path[parameter_file_path_length + 1]; - memcpy(parameter_file_path, data.path_build_libraries_shared.string, data.path_build_libraries_shared.used); + memcpy(parameter_file_path, main.path_build_libraries_shared.string, main.path_build_libraries_shared.used); if (data_build.setting.version_target == fake_build_version_type_major) { - memcpy(parameter_file_path + data.path_build_libraries_shared.used, parameter_file_name_major, parameter_file_name_major_length); + memcpy(parameter_file_path + main.path_build_libraries_shared.used, parameter_file_name_major, parameter_file_name_major_length); } else { - memcpy(parameter_file_path + data.path_build_libraries_shared.used, parameter_file_name_minor, parameter_file_name_minor_length); + memcpy(parameter_file_path + main.path_build_libraries_shared.used, parameter_file_name_minor, parameter_file_name_minor_length); } parameter_file_path[parameter_file_path_length] = 0; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return 0; } *status = f_file_link(parameter_file_name_micro, parameter_file_path); - if (F_status_is_error_not(*status) && data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "Linked file '%s' to '%s'.%c", parameter_file_path, parameter_file_name_micro, f_string_eol_s[0]); + if (F_status_is_error_not(*status) && main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "Linked file '%s' to '%s'.%c", parameter_file_path, parameter_file_name_micro, f_string_eol_s[0]); } else if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found) { - fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, "link", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, "link", fll_error_file_type_file); return 0; } - fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_micro, "link", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_micro, "link", fll_error_file_type_file); return 0; } } if (F_status_is_error_not(*status)) { - f_array_length_t parameter_file_path_length = data.path_build_libraries_shared.used + parameter_file_name_length; + f_array_length_t parameter_file_path_length = main.path_build_libraries_shared.used + parameter_file_name_length; char parameter_file_path[parameter_file_path_length + 1]; - memcpy(parameter_file_path, data.path_build_libraries_shared.string, data.path_build_libraries_shared.used); + memcpy(parameter_file_path, main.path_build_libraries_shared.string, main.path_build_libraries_shared.used); - memcpy(parameter_file_path + data.path_build_libraries_shared.used, parameter_file_name, parameter_file_name_length); + memcpy(parameter_file_path + main.path_build_libraries_shared.used, parameter_file_name, parameter_file_name_length); parameter_file_path[parameter_file_path_length] = 0; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return 0; } @@ -1048,57 +1048,57 @@ extern "C" { *status = f_file_link(parameter_file_name_micro, parameter_file_path); } - if (F_status_is_error_not(*status) && data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "Linked file '%s' to '", parameter_file_path); + if (F_status_is_error_not(*status) && main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "Linked file '%s' to '", parameter_file_path); if (data_build.setting.version_target == fake_build_version_type_major) { - fprintf(data.output.stream, "%s", parameter_file_name_major); + fprintf(main.output.stream, "%s", parameter_file_name_major); } else if (data_build.setting.version_target == fake_build_version_type_minor) { - fprintf(data.output.stream, "%s", parameter_file_name_minor); + fprintf(main.output.stream, "%s", parameter_file_name_minor); } else if (data_build.setting.version_target == fake_build_version_type_micro) { - fprintf(data.output.stream, "%s", parameter_file_name_micro); + fprintf(main.output.stream, "%s", parameter_file_name_micro); } - fprintf(data.output.stream, "'.%c", f_string_eol_s[0]); + fprintf(main.output.stream, "'.%c", f_string_eol_s[0]); } else if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found) { - fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, "link", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, "link", fll_error_file_type_file); return 0; } if (data_build.setting.version_target == fake_build_version_type_major) { - fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_major, "link", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_major, "link", fll_error_file_type_file); } else if (data_build.setting.version_target == fake_build_version_type_minor) { - fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_minor, "link", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_minor, "link", fll_error_file_type_file); } else if (data_build.setting.version_target == fake_build_version_type_micro) { - fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_micro, "link", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_micro, "link", fll_error_file_type_file); } return 0; } } - fake_build_touch(data, file_stage, status); + fake_build_touch(main, file_stage, status); return 0; } #endif // _di_fake_build_library_shared_ #ifndef _di_fake_build_library_static_ - int fake_build_library_static(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return data.child; + int fake_build_library_static(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main.child; if (!data_build.setting.build_sources_library.used) return 0; - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.important, "Compiling static library."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.important, "Compiling static library."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } f_string_dynamic_t file_name = f_string_dynamic_t_initialize; @@ -1108,15 +1108,15 @@ extern "C" { *status = fll_execute_arguments_add(fake_build_parameter_object_link_arguments, fake_build_parameter_object_link_arguments_length, &arguments); if (F_status_is_error_not(*status)) { - f_array_length_t destination_length = data.path_build_libraries_static.used + fake_build_parameter_library_name_prefix_length; + f_array_length_t destination_length = main.path_build_libraries_static.used + fake_build_parameter_library_name_prefix_length; destination_length += data_build.setting.project_name.used + fake_build_parameter_library_name_suffix_static_length; char destination[destination_length + 1]; destination_length = 0; - memcpy(destination, data.path_build_libraries_static.string, data.path_build_libraries_static.used); - destination_length += data.path_build_libraries_static.used; + memcpy(destination, main.path_build_libraries_static.string, main.path_build_libraries_static.used); + destination_length += main.path_build_libraries_static.used; memcpy(destination + destination_length, fake_build_parameter_library_name_prefix, fake_build_parameter_library_name_prefix_length); destination_length += fake_build_parameter_library_name_prefix_length; @@ -1138,14 +1138,14 @@ extern "C" { for (f_array_length_t i = 0; i < data_build.setting.build_sources_library.used; i++) { source_path.used = 0; - *status = fake_build_get_file_name_without_extension(data, data_build.setting.build_sources_library.array[i], &file_name); + *status = fake_build_get_file_name_without_extension(main, data_build.setting.build_sources_library.array[i], &file_name); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); break; } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); break; } @@ -1153,36 +1153,36 @@ 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)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_file_name_directory", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_file_name_directory", F_true); break; } if (source_path.used) { - *status = f_string_dynamic_prepend(data.path_build_objects, &source_path); + *status = f_string_dynamic_prepend(main.path_build_objects, &source_path); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_prepend", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_prepend", F_true); break; } *status = f_string_append_assure(f_path_separator_s, f_path_separator_length, &source_path); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append_assure", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append_assure", F_true); break; } *status = f_string_dynamic_terminate_after(&source_path); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } source_length = source_path.used + file_name.used + fake_build_parameter_object_name_suffix_length; } else { - source_length = data.path_build_objects.used + file_name.used + fake_build_parameter_object_name_suffix_length; + source_length = main.path_build_objects.used + file_name.used + fake_build_parameter_object_name_suffix_length; } char source[source_length + 1]; @@ -1193,9 +1193,9 @@ extern "C" { memcpy(source + source_path.used + file_name.used, fake_build_parameter_object_name_suffix, fake_build_parameter_object_name_suffix_length); } else { - memcpy(source, data.path_build_objects.string, data.path_build_objects.used); - memcpy(source + data.path_build_objects.used, file_name.string, file_name.used); - memcpy(source + data.path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix, fake_build_parameter_object_name_suffix_length); + memcpy(source, main.path_build_objects.string, main.path_build_objects.used); + memcpy(source + main.path_build_objects.used, file_name.string, file_name.used); + memcpy(source + main.path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix, fake_build_parameter_object_name_suffix_length); } source[source_length] = 0; @@ -1203,16 +1203,16 @@ extern "C" { *status = fll_execute_arguments_add(source, source_length, &arguments); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); break; } } // for } - int result = data.child; + int result = main.child; if (F_status_is_error_not(*status)) { - result = fake_execute(data, data_build.environment, data_build.setting.build_indexer, arguments, status); + result = fake_execute(main, data_build.environment, data_build.setting.build_indexer, arguments, status); } f_macro_string_dynamic_t_delete_simple(file_name); @@ -1220,7 +1220,7 @@ extern "C" { f_macro_string_dynamics_t_delete_simple(arguments); if (F_status_is_error_not(*status) && *status != F_child) { - fake_build_touch(data, file_stage, status); + fake_build_touch(main, file_stage, status); } return result; @@ -1228,7 +1228,7 @@ extern "C" { #endif // _di_fake_build_library_static_ #ifndef _di_fake_build_load_environment_ - void fake_build_load_environment(const fake_data_t data, const fake_build_data_t data_build, f_string_maps_t *environment, f_status_t *status) { + void fake_build_load_environment(const fake_main_t main, const fake_build_data_t data_build, f_string_maps_t *environment, f_status_t *status) { if (F_status_is_error(*status)) return; // reset the environment. @@ -1256,7 +1256,7 @@ extern "C" { *status = fl_environment_load_name(variables_name[i], variables_length[i], environment); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_environment_load_name", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fl_environment_load_name", F_true); break; } } // for @@ -1268,14 +1268,14 @@ extern "C" { if (environment->used + data_build.setting.environment.used > environment->size) { if (environment->used + data_build.setting.environment.used > f_array_length_t_size) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe values for the setting '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", fake_build_setting_name_environment); - f_color_print(data.error.to.stream, data.context.set.error, "' of setting file '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", data.file_data_build_settings.string); - f_color_print(data.error.to.stream, data.context.set.error, "' is too large."); - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe values for the setting '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", fake_build_setting_name_environment); + f_color_print(main.error.to.stream, main.context.set.error, "' of setting file '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", main.file_data_build_settings.string); + f_color_print(main.error.to.stream, main.context.set.error, "' is too large."); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); } *status = F_status_set_error(F_array_too_large); @@ -1286,21 +1286,21 @@ extern "C" { *status = fl_environment_load_names(data_build.setting.environment, environment); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_environment_load_names", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fl_environment_load_names", F_true); } } #endif // _di_fake_build_load_environment_ #ifndef _di_fake_build_load_setting_ - void fake_build_load_setting(const fake_data_t data, const f_string_static_t setting_file, fake_build_setting_t *setting, f_status_t *status) { + void fake_build_load_setting(const fake_main_t main, const f_string_static_t setting_file, fake_build_setting_t *setting, f_status_t *status) { if (F_status_is_error(*status)) return; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return; } - char path_file[data.path_data_build.used + setting_file.used + 1]; + char path_file[main.path_data_build.used + setting_file.used + 1]; { f_string_dynamic_t buffer = f_string_dynamic_t_initialize; @@ -1309,18 +1309,18 @@ extern "C" { f_fss_contents_t contents = f_fss_contents_t_initialize; if (setting_file.used) { - memcpy(path_file, data.path_data_build.string, data.path_data_build.used); - memcpy(path_file + data.path_data_build.used, setting_file.string, setting_file.used); + memcpy(path_file, main.path_data_build.string, main.path_data_build.used); + memcpy(path_file + main.path_data_build.used, setting_file.string, setting_file.used); - path_file[data.path_data_build.used + setting_file.used] = 0; + path_file[main.path_data_build.used + setting_file.used] = 0; - *status = fake_file_buffer(data, path_file, &buffer); + *status = fake_file_buffer(main, path_file, &buffer); } else { - *status = fake_file_buffer(data, data.file_data_build_settings.string, &buffer); + *status = fake_file_buffer(main, main.file_data_build_settings.string, &buffer); } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); } else if (F_status_is_error_not(*status)) { @@ -1330,16 +1330,16 @@ extern "C" { *status = fll_fss_extended_read(buffer, &range, &objects, &contents, 0, 0, &delimits, 0); if (F_status_is_error(*status)) { - fake_print_error_fss(data, F_status_set_fine(*status), "fll_fss_extended_read", data.file_data_build_settings.string, range, F_true); + fake_print_error_fss(main, F_status_set_fine(*status), "fll_fss_extended_read", main.file_data_build_settings.string, range, F_true); } else { *status = fl_fss_apply_delimit(delimits, &buffer); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); } else { - fake_build_load_setting_process(data, setting_file.used ? path_file : data.file_data_build_settings.string, buffer, objects, contents, setting, status); + fake_build_load_setting_process(main, setting_file.used ? path_file : main.file_data_build_settings.string, buffer, objects, contents, setting, status); } } @@ -1366,13 +1366,13 @@ extern "C" { for (uint8_t i = 0; i < 1; i++) { if (!settings[i]->used) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe setting '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", names[i]); - f_color_print(data.error.to.stream, data.context.set.error, "' is required but is not specified in the settings file '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", setting_file.used ? path_file : data.file_data_build_settings.string); - f_color_print(data.error.to.stream, data.context.set.error, "'."); - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe setting '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", names[i]); + f_color_print(main.error.to.stream, main.context.set.error, "' is required but is not specified in the settings file '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", setting_file.used ? path_file : main.file_data_build_settings.string); + f_color_print(main.error.to.stream, main.context.set.error, "'."); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); failed = F_true; } @@ -1384,15 +1384,15 @@ extern "C" { } } - fake_build_load_setting_defaults(data, setting, status); + fake_build_load_setting_defaults(main, setting, status); } #endif // _di_fake_build_load_setting_ #ifndef _di_fake_build_load_setting_process_ - void fake_build_load_setting_process(const fake_data_t data, const f_string_t path_file, const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, fake_build_setting_t *setting, f_status_t *status) { + void fake_build_load_setting_process(const fake_main_t main, const f_string_t path_file, const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, fake_build_setting_t *setting, f_status_t *status) { if (F_status_is_error(*status) && buffer.used) return; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return; } @@ -1586,8 +1586,8 @@ extern "C" { f_array_length_t j = 0; // if any mode is specified, the entire defaults is replaced. - if (data.mode.used) { - modes = &data.mode; + if (main.mode.used) { + modes = &main.mode; } for (; i < modes->used; i++) { @@ -1602,14 +1602,14 @@ extern "C" { } // for if (found == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe specified mode '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", modes->array[i].string); - f_color_print(data.error.to.stream, data.context.set.error, "' is not a valid mode, according to '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file); - f_color_print(data.error.to.stream, data.context.set.error, "'."); - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe specified mode '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", modes->array[i].string); + f_color_print(main.error.to.stream, main.context.set.error, "' is not a valid mode, according to '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", path_file); + f_color_print(main.error.to.stream, main.context.set.error, "'."); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); } error_printed = F_true; @@ -1680,20 +1680,20 @@ extern "C" { if (F_status_is_error(*status)) { if (*status == F_status_set_error(F_string_too_large)) { - if (data.error.verbosity != f_console_verbosity_quiet) { + if (main.error.verbosity != f_console_verbosity_quiet) { // @todo update FSS functions to return which setting index the problem happened on. - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sA setting in the build setting file '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file); - f_color_print(data.error.to.stream, data.context.set.error, "' is too long."); - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sA setting in the build setting file '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", path_file); + f_color_print(main.error.to.stream, main.context.set.error, "' is too long."); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); } } else if (!error_printed) { - fll_error_print(data.error, F_status_set_fine(*status), function, F_true); + fll_error_print(main.error, F_status_set_fine(*status), function, F_true); } } - else if (!fake_signal_received(data)) { + else if (!fake_signal_received(main)) { const f_string_t settings_single_name[] = { fake_build_setting_name_build_compiler, fake_build_setting_name_build_indexer, @@ -1880,16 +1880,16 @@ extern "C" { if (!settings_single_source[i]->used) continue; if (settings_single_source[i]->used > 1) { - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.warning, "%sthe setting '", fll_error_print_warning); - f_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]); - f_color_print(data.output.stream, data.context.set.warning, "' in the file '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", path_file); - f_color_print(data.output.stream, data.context.set.warning, "' may only have a single property, only using the first: '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_source[i]->array[0].string); - f_color_print(data.output.stream, data.context.set.warning, "'."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.warning, "%sthe setting '", fll_error_print_warning); + f_color_print(main.output.stream, main.context.set.notable, "%s", settings_single_name[i]); + f_color_print(main.output.stream, main.context.set.warning, "' in the file '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", path_file); + f_color_print(main.output.stream, main.context.set.warning, "' may only have a single property, only using the first: '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", settings_single_source[i]->array[0].string); + f_color_print(main.output.stream, main.context.set.warning, "'."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } } @@ -1903,20 +1903,20 @@ extern "C" { else { *settings_single_bool[i] = F_true; - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.warning, "%sthe setting '", fll_error_print_warning); - f_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]); - f_color_print(data.output.stream, data.context.set.warning, "' in the file '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", path_file); - f_color_print(data.output.stream, data.context.set.warning, "' may be either '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_common_setting_bool_yes); - f_color_print(data.output.stream, data.context.set.warning, "' or '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_common_setting_bool_no); - f_color_print(data.output.stream, data.context.set.warning, "', defaulting to '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_common_setting_bool_yes); - f_color_print(data.output.stream, data.context.set.warning, "'."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.warning, "%sthe setting '", fll_error_print_warning); + f_color_print(main.output.stream, main.context.set.notable, "%s", settings_single_name[i]); + f_color_print(main.output.stream, main.context.set.warning, "' in the file '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", path_file); + f_color_print(main.output.stream, main.context.set.warning, "' may be either '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_common_setting_bool_yes); + f_color_print(main.output.stream, main.context.set.warning, "' or '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_common_setting_bool_no); + f_color_print(main.output.stream, main.context.set.warning, "', defaulting to '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_common_setting_bool_yes); + f_color_print(main.output.stream, main.context.set.warning, "'."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } } } @@ -1933,22 +1933,22 @@ extern "C" { else { *settings_single_language[i] = fake_build_language_type_c; - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.warning, "%sthe setting '", fll_error_print_warning); - f_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]); - f_color_print(data.output.stream, data.context.set.warning, "' in the file '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", path_file); - f_color_print(data.output.stream, data.context.set.warning, "' may only be one of '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_language_bash); - f_color_print(data.output.stream, data.context.set.warning, "', '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_language_c); - f_color_print(data.output.stream, data.context.set.warning, "', or '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_language_cpp); - f_color_print(data.output.stream, data.context.set.warning, "', defaulting to '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_language_c); - f_color_print(data.output.stream, data.context.set.warning, "'."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.warning, "%sthe setting '", fll_error_print_warning); + f_color_print(main.output.stream, main.context.set.notable, "%s", settings_single_name[i]); + f_color_print(main.output.stream, main.context.set.warning, "' in the file '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", path_file); + f_color_print(main.output.stream, main.context.set.warning, "' may only be one of '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_build_language_bash); + f_color_print(main.output.stream, main.context.set.warning, "', '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_build_language_c); + f_color_print(main.output.stream, main.context.set.warning, "', or '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_build_language_cpp); + f_color_print(main.output.stream, main.context.set.warning, "', defaulting to '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_build_language_c); + f_color_print(main.output.stream, main.context.set.warning, "'."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } } } @@ -1965,22 +1965,22 @@ extern "C" { else { *settings_single_version[i] = fake_build_version_type_major; - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.warning, "%sthe setting '", fll_error_print_warning); - f_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]); - f_color_print(data.output.stream, data.context.set.warning, "' in the file '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", path_file); - f_color_print(data.output.stream, data.context.set.warning, "' may only be one of '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_version_major); - f_color_print(data.output.stream, data.context.set.warning, "', '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_version_minor); - f_color_print(data.output.stream, data.context.set.warning, "', or '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_version_micro); - f_color_print(data.output.stream, data.context.set.warning, "', defaulting to '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_version_major); - f_color_print(data.output.stream, data.context.set.warning, "'."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.warning, "%sthe setting '", fll_error_print_warning); + f_color_print(main.output.stream, main.context.set.notable, "%s", settings_single_name[i]); + f_color_print(main.output.stream, main.context.set.warning, "' in the file '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", path_file); + f_color_print(main.output.stream, main.context.set.warning, "' may only be one of '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_build_version_major); + f_color_print(main.output.stream, main.context.set.warning, "', '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_build_version_minor); + f_color_print(main.output.stream, main.context.set.warning, "', or '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_build_version_micro); + f_color_print(main.output.stream, main.context.set.warning, "', defaulting to '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", fake_build_version_major); + f_color_print(main.output.stream, main.context.set.warning, "'."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } } } @@ -1990,21 +1990,21 @@ extern "C" { *status = f_string_dynamic_append_nulless(settings_single_source[i]->array[0], settings_single_destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); break; } if (settings_single_type[i] == 2) { *status = f_string_append_assure(f_path_separator_s, f_path_separator_length, settings_single_destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append_assure", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append_assure", F_true); break; } } *status = f_string_dynamic_terminate_after(settings_single_destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } } @@ -2042,10 +2042,10 @@ extern "C" { #endif // _di_fake_build_load_setting_process_ #ifndef _di_fake_build_load_setting_defaults_ - void fake_build_load_setting_defaults(const fake_data_t data, fake_build_setting_t *setting, f_status_t *status) { + void fake_build_load_setting_defaults(const fake_main_t main, fake_build_setting_t *setting, f_status_t *status) { if (F_status_is_error(*status)) return; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return; } @@ -2075,14 +2075,14 @@ extern "C" { *status = f_string_append_assure(sources[i], lengths[i], destinations[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append_assure", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append_assure", F_true); break; } *status = f_string_dynamic_terminate_after(destinations[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } } // for @@ -2091,9 +2091,9 @@ extern "C" { if (F_status_is_error(*status)) return; // Override setting file when any of these are specified in the command line. - if (data.parameters[fake_parameter_shared_disabled].result == f_console_result_found) { - if (data.parameters[fake_parameter_shared_enabled].result == f_console_result_found) { - if (data.parameters[fake_parameter_shared_enabled].location > data.parameters[fake_parameter_shared_disabled].location) { + if (main.parameters[fake_parameter_shared_disabled].result == f_console_result_found) { + if (main.parameters[fake_parameter_shared_enabled].result == f_console_result_found) { + if (main.parameters[fake_parameter_shared_enabled].location > main.parameters[fake_parameter_shared_disabled].location) { setting->build_shared = F_true; setting->search_shared = F_true; } @@ -2102,23 +2102,23 @@ extern "C" { setting->search_shared = F_false; } - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.error, "%sthe parameters '", fll_error_print_warning); - f_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_shared_disabled); - f_color_print(data.output.stream, data.context.set.error, "' and '"); - f_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_shared_enabled); - f_color_print(data.output.stream, data.context.set.error, "' contradict, defaulting to '"); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "%sthe parameters '", fll_error_print_warning); + f_color_print(main.output.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_shared_disabled); + f_color_print(main.output.stream, main.context.set.error, "' and '"); + f_color_print(main.output.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_shared_enabled); + f_color_print(main.output.stream, main.context.set.error, "' contradict, defaulting to '"); if (setting->build_shared) { - f_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_shared_enabled); + f_color_print(main.output.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_shared_enabled); } else { - f_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_shared_disabled); + f_color_print(main.output.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_shared_disabled); } - f_color_print(data.output.stream, data.context.set.error, "'."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "'."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } } else { @@ -2126,14 +2126,14 @@ extern "C" { setting->search_shared = F_false; } } - else if (data.parameters[fake_parameter_shared_enabled].result == f_console_result_found) { + else if (main.parameters[fake_parameter_shared_enabled].result == f_console_result_found) { setting->build_shared = F_true; setting->search_shared = F_true; } - if (data.parameters[fake_parameter_static_disabled].result == f_console_result_found) { - if (data.parameters[fake_parameter_static_enabled].result == f_console_result_found) { - if (data.parameters[fake_parameter_static_enabled].location > data.parameters[fake_parameter_static_disabled].location) { + if (main.parameters[fake_parameter_static_disabled].result == f_console_result_found) { + if (main.parameters[fake_parameter_static_enabled].result == f_console_result_found) { + if (main.parameters[fake_parameter_static_enabled].location > main.parameters[fake_parameter_static_disabled].location) { setting->build_static = F_true; setting->search_static = F_true; } @@ -2142,23 +2142,23 @@ extern "C" { setting->search_static = F_false; } - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.error, "%sthe parameters '", fll_error_print_warning); - f_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_static_disabled); - f_color_print(data.output.stream, data.context.set.error, "' and '"); - f_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_static_enabled); - f_color_print(data.output.stream, data.context.set.error, "' contradict, defaulting to '"); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "%sthe parameters '", fll_error_print_warning); + f_color_print(main.output.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_static_disabled); + f_color_print(main.output.stream, main.context.set.error, "' and '"); + f_color_print(main.output.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_static_enabled); + f_color_print(main.output.stream, main.context.set.error, "' contradict, defaulting to '"); if (setting->build_static) { - f_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_static_enabled); + f_color_print(main.output.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_static_enabled); } else { - f_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_static_disabled); + f_color_print(main.output.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_static_disabled); } - f_color_print(data.output.stream, data.context.set.error, "'."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "'."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } } else { @@ -2166,47 +2166,47 @@ extern "C" { setting->search_static = F_false; } } - else if (data.parameters[fake_parameter_static_enabled].result == f_console_result_found) { + else if (main.parameters[fake_parameter_static_enabled].result == f_console_result_found) { setting->build_static = F_true; setting->search_static = F_true; } if (setting->build_language == fake_build_language_type_c || setting->build_language == fake_build_language_type_cpp) { if (setting->build_shared == F_false && setting->build_static == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe build settings '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", fake_build_setting_name_build_shared); - f_color_print(data.error.to.stream, data.context.set.error, "' and '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", fake_build_setting_name_build_static); - f_color_print(data.error.to.stream, data.context.set.error, "' cannot both be false when using the language '"); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe build settings '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", fake_build_setting_name_build_shared); + f_color_print(main.error.to.stream, main.context.set.error, "' and '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", fake_build_setting_name_build_static); + f_color_print(main.error.to.stream, main.context.set.error, "' cannot both be false when using the language '"); if (setting->build_language == fake_build_language_type_c) { - f_color_print(data.error.to.stream, data.context.set.notable, "%s", fake_build_language_c); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", fake_build_language_c); } else { - f_color_print(data.error.to.stream, data.context.set.notable, "%s", fake_build_language_cpp); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", fake_build_language_cpp); } - f_color_print(data.error.to.stream, data.context.set.error, "'."); - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'."); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); } *status = F_status_set_error(F_failure); } } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); } } #endif // _di_fake_build_load_setting_defaults_ #ifndef _di_fake_build_load_stage_ - void fake_build_load_stage(const fake_data_t data, const f_string_static_t settings_file, fake_build_stage_t *stage, f_status_t *status) { + void fake_build_load_stage(const fake_main_t main, const f_string_static_t settings_file, fake_build_stage_t *stage, f_status_t *status) { if (F_status_is_error(*status)) return; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); } @@ -2266,35 +2266,35 @@ extern "C" { *status = f_file_name_base(settings_file.string, settings_file.used, &settings_file_base); } else { - *status = f_file_name_base(data.file_data_build_settings.string, data.file_data_build_settings.used, &settings_file_base); + *status = f_file_name_base(main.file_data_build_settings.string, main.file_data_build_settings.used, &settings_file_base); } if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_file_name_base", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_file_name_base", F_true); return; } for (uint8_t i = 0; i < fake_build_stage_total; i++) { - *status = f_string_dynamic_append_nulless(data.path_build_stage, values[i]); + *status = f_string_dynamic_append_nulless(main.path_build_stage, values[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); break; } - if (data.process.used) { - *status = f_string_append(data.process.string, data.process.used, values[i]); + if (main.process.used) { + *status = f_string_append(main.process.string, main.process.used, values[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append", F_true); break; } *status = f_string_append(fake_build_stage_separate, fake_build_stage_separate_length, values[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append", F_true); break; } } @@ -2302,35 +2302,35 @@ extern "C" { *status = f_string_append_nulless(names[i], lengths[i], values[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); break; } *status = f_string_append(fake_build_stage_separate, fake_build_stage_separate_length, values[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append", F_true); break; } *status = f_string_dynamic_append(settings_file_base, values[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); break; } *status = f_string_append(fake_build_stage_built, fake_build_stage_built_length, values[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append", F_true); break; } *status = f_string_dynamic_terminate_after(values[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } } // for @@ -2340,14 +2340,14 @@ extern "C" { #endif // _di_fake_build_load_stage_ #ifndef _di_fake_build_objects_static_ - int fake_build_objects_static(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return data.child; + int fake_build_objects_static(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main.child; if (!data_build.setting.build_sources_library.used) return 0; - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.important, "Compiling static objects."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.important, "Compiling static objects."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } f_string_dynamic_t file_name = f_string_dynamic_t_initialize; @@ -2356,18 +2356,18 @@ extern "C" { f_array_length_t source_length = 0; f_array_length_t destination_length = 0; - const f_string_static_t *path_sources = &data.path_sources; + const f_string_static_t *path_sources = &main.path_sources; - int result = data.child; + int result = main.child; if (data_build.setting.path_standard) { - path_sources = &data.path_sources_c; + path_sources = &main.path_sources_c; if (data_build.setting.build_language == fake_build_language_type_cpp) { - path_sources = &data.path_sources_cpp; + path_sources = &main.path_sources_cpp; } } - else if (data.parameters[fake_parameter_path_sources].result != f_console_result_additional) { + else if (main.parameters[fake_parameter_path_sources].result != f_console_result_additional) { path_sources = &data_build.setting.path_sources; } @@ -2383,14 +2383,14 @@ extern "C" { memcpy(source + path_sources->used, data_build.setting.build_sources_library.array[i].string, data_build.setting.build_sources_library.array[i].used); source[source_length] = 0; - *status = fake_build_get_file_name_without_extension(data, data_build.setting.build_sources_library.array[i], &file_name); + *status = fake_build_get_file_name_without_extension(main, data_build.setting.build_sources_library.array[i], &file_name); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); break; } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); break; } @@ -2398,33 +2398,33 @@ 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)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_file_name_directory", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_file_name_directory", F_true); break; } if (destination_path.used) { - *status = f_string_dynamic_prepend(data.path_build_objects, &destination_path); + *status = f_string_dynamic_prepend(main.path_build_objects, &destination_path); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_prepend", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_prepend", F_true); break; } *status = f_string_append_assure(f_path_separator_s, f_path_separator_length, &destination_path); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append_assure", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append_assure", F_true); break; } *status = f_string_dynamic_terminate_after(&destination_path); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); break; } @@ -2432,12 +2432,12 @@ extern "C" { *status = f_directory_exists(destination_path.string); if (*status == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe path '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination_path.string); - f_color_print(data.error.to.stream, data.context.set.error, "' exists but is not a directory."); - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe path '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination_path.string); + f_color_print(main.error.to.stream, main.context.set.error, "' exists but is not a directory."); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); } *status = F_status_set_error(F_failure); @@ -2448,32 +2448,32 @@ extern "C" { if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found_not) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe path '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination_path.string); - f_color_print(data.error.to.stream, data.context.set.error, "' could not be created, a parent directory does not exist."); - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe path '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination_path.string); + f_color_print(main.error.to.stream, main.context.set.error, "' could not be created, a parent directory does not exist."); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); } else { - fll_error_file_print(data.error, F_status_set_fine(*status), "f_directory_create", F_true, destination_path.string, "create", fll_error_file_type_directory); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_directory_create", F_true, destination_path.string, "create", fll_error_file_type_directory); } break; } - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "Directory '%s' created.%c", destination_path.string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "Directory '%s' created.%c", destination_path.string, f_string_eol_s[0]); } } else if (F_status_is_error(*status)) { - fll_error_file_print(data.error, F_status_set_fine(*status), "f_directory_exists", F_true, destination_path.string, "create", fll_error_file_type_directory); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_directory_exists", F_true, destination_path.string, "create", fll_error_file_type_directory); break; } destination_length = destination_path.used + file_name.used + fake_build_parameter_object_name_suffix_length; } else { - destination_length = data.path_build_objects.used + file_name.used + fake_build_parameter_object_name_suffix_length; + destination_length = main.path_build_objects.used + file_name.used + fake_build_parameter_object_name_suffix_length; } char destination[destination_length + 1]; @@ -2484,9 +2484,9 @@ extern "C" { memcpy(destination + destination_path.used + file_name.used, fake_build_parameter_object_name_suffix, fake_build_parameter_object_name_suffix_length); } else { - memcpy(destination, data.path_build_objects.string, data.path_build_objects.used); - memcpy(destination + data.path_build_objects.used, file_name.string, file_name.used); - memcpy(destination + data.path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix, fake_build_parameter_object_name_suffix_length); + memcpy(destination, main.path_build_objects.string, main.path_build_objects.used); + memcpy(destination + main.path_build_objects.used, file_name.string, file_name.used); + memcpy(destination + main.path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix, fake_build_parameter_object_name_suffix_length); } destination[destination_length] = 0; @@ -2513,14 +2513,14 @@ extern "C" { if (F_status_is_error(*status)) break; } // for - fake_build_arguments_standard_add(data, data_build, F_false, F_true, &arguments, status); + fake_build_arguments_standard_add(main, data_build, F_false, F_true, &arguments, status); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); break; } - result = fake_execute(data, data_build.environment, data_build.setting.build_compiler, arguments, status); + result = fake_execute(main, data_build.environment, data_build.setting.build_compiler, arguments, status); f_macro_string_dynamics_t_delete_simple(arguments); @@ -2532,7 +2532,7 @@ extern "C" { f_macro_string_dynamics_t_delete_simple(arguments); if (F_status_is_error_not(*status) && *status != F_child) { - fake_build_touch(data, file_stage, status); + fake_build_touch(main, file_stage, status); } return result; @@ -2540,9 +2540,9 @@ extern "C" { #endif // _di_fake_build_objects_static_ #ifndef _di_fake_build_operate_ - f_status_t fake_build_operate(const f_string_static_t setting_file, fake_data_t *data) { + f_status_t fake_build_operate(const f_string_static_t setting_file, fake_main_t *main) { - if (fake_signal_received(*data)) { + if (fake_signal_received(*main)) { return F_signal; } @@ -2552,71 +2552,71 @@ extern "C" { fake_build_data_t data_build = fake_build_data_t_initialize; fake_build_stage_t stage = fake_build_stage_t_initialize; - f_macro_mode_t_set_default_umask(mode, data->umask); + f_macro_mode_t_set_default_umask(mode, main->umask); - fake_build_load_setting(*data, setting_file, &data_build.setting, &status); + fake_build_load_setting(*main, setting_file, &data_build.setting, &status); if (F_status_is_fine(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - f_color_print(data->output.stream, data->context.set.important, "Building project%c", data_build.setting.project_name.used ? ' ' : 0); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + f_color_print(main->output.stream, main->context.set.important, "Building project%c", data_build.setting.project_name.used ? ' ' : 0); if (data_build.setting.project_name.used) { - f_color_print_code(data->output.stream, data->context.notable); - f_print_dynamic(data->output.stream, data_build.setting.project_name); - f_color_print_code(data->output.stream, data->context.reset); + f_color_print_code(main->output.stream, main->context.notable); + f_print_dynamic(main->output.stream, data_build.setting.project_name); + f_color_print_code(main->output.stream, main->context.reset); } - f_color_print(data->output.stream, data->context.set.important, "."); - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + f_color_print(main->output.stream, main->context.set.important, "."); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); } } - fake_build_load_stage(*data, setting_file, &stage, &status); + fake_build_load_stage(*main, setting_file, &stage, &status); - fake_build_load_environment(*data, data_build, &data_build.environment, &status); + fake_build_load_environment(*main, data_build, &data_build.environment, &status); - fake_build_skeleton(*data, data_build, mode.directory, stage.file_skeleton, &status); + fake_build_skeleton(*main, data_build, mode.directory, stage.file_skeleton, &status); - data->child = fake_build_execute_process_script(*data, data_build, data_build.setting.process_pre, stage.file_process_pre, &status); + main->child = fake_build_execute_process_script(*main, data_build, data_build.setting.process_pre, stage.file_process_pre, &status); - fake_build_copy(*data, mode, "setting files", data->path_data_settings, data->path_build_settings, data_build.setting.build_sources_setting, stage.file_sources_settings, 0, &status); + fake_build_copy(*main, mode, "setting files", main->path_data_settings, main->path_build_settings, data_build.setting.build_sources_setting, stage.file_sources_settings, 0, &status); if (data_build.setting.build_language == fake_build_language_type_bash) { - fake_build_libraries_script(*data, data_build, mode, stage.file_libraries_script, &status); + fake_build_libraries_script(*main, data_build, mode, stage.file_libraries_script, &status); - fake_build_programs_script(*data, data_build, mode, stage.file_programs_script, &status); + fake_build_programs_script(*main, data_build, mode, stage.file_programs_script, &status); if (data_build.setting.build_script) { - fake_build_copy(*data, mode, "scripts", data->path_sources_script, data->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status); + fake_build_copy(*main, mode, "scripts", main->path_sources_script, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status); } } else { if (data_build.setting.build_sources_headers.used) { - const f_string_static_t *path_sources = &data->path_sources; + const f_string_static_t *path_sources = &main->path_sources; if (data_build.setting.path_standard) { - path_sources = &data->path_sources_c; + path_sources = &main->path_sources_c; if (data_build.setting.build_language == fake_build_language_type_cpp) { - path_sources = &data->path_sources_cpp; + path_sources = &main->path_sources_cpp; } } - else if (data->parameters[fake_parameter_path_sources].result != f_console_result_additional) { + else if (main->parameters[fake_parameter_path_sources].result != f_console_result_additional) { path_sources = &data_build.setting.path_sources; } const f_array_length_t path_sources_base_length = path_sources->used; f_string_static_t path_headers = f_string_static_t_initialize; - f_array_length_t directory_headers_length = data->path_build_includes.used + data_build.setting.path_headers.used; + f_array_length_t directory_headers_length = main->path_build_includes.used + data_build.setting.path_headers.used; char directory_headers[directory_headers_length + 1]; - memcpy(directory_headers, data->path_build_includes.string, data->path_build_includes.used); + memcpy(directory_headers, main->path_build_includes.string, main->path_build_includes.used); if (data_build.setting.path_headers.used) { - memcpy(directory_headers + data->path_build_includes.used, data_build.setting.path_headers.string, data_build.setting.path_headers.used); + memcpy(directory_headers + main->path_build_includes.used, data_build.setting.path_headers.string, data_build.setting.path_headers.used); } directory_headers[directory_headers_length] = 0; @@ -2625,31 +2625,31 @@ extern "C" { path_headers.used = directory_headers_length; path_headers.size = directory_headers_length + 1; - fake_build_copy(*data, mode, "header files", *path_sources, path_headers, data_build.setting.build_sources_headers, stage.file_sources_headers, data_build.setting.path_headers_preserve ? path_sources_base_length : 0, &status); + fake_build_copy(*main, mode, "header files", *path_sources, path_headers, data_build.setting.build_sources_headers, stage.file_sources_headers, data_build.setting.path_headers_preserve ? path_sources_base_length : 0, &status); } if (data_build.setting.build_shared) { - data->child = fake_build_library_shared(*data, data_build, mode, stage.file_libraries_shared, &status); + main->child = fake_build_library_shared(*main, data_build, mode, stage.file_libraries_shared, &status); - data->child = fake_build_program_shared(*data, data_build, mode, stage.file_programs_shared, &status); + main->child = fake_build_program_shared(*main, data_build, mode, stage.file_programs_shared, &status); } if (data_build.setting.build_static) { - data->child = fake_build_objects_static(*data, data_build, mode, stage.file_objects_static, &status); + main->child = fake_build_objects_static(*main, data_build, mode, stage.file_objects_static, &status); - data->child = fake_build_library_static(*data, data_build, mode, stage.file_libraries_static, &status); + main->child = fake_build_library_static(*main, data_build, mode, stage.file_libraries_static, &status); - data->child = fake_build_program_static(*data, data_build, mode, stage.file_programs_static, &status); + main->child = fake_build_program_static(*main, data_build, mode, stage.file_programs_static, &status); } if (data_build.setting.build_script) { - fake_build_copy(*data, mode, "scripts", data->path_sources_script, data->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status); + fake_build_copy(*main, mode, "scripts", main->path_sources_script, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status); } } - fake_build_execute_process_script(*data, data_build, data_build.setting.process_post, stage.file_process_post, &status); + fake_build_execute_process_script(*main, data_build, data_build.setting.process_post, stage.file_process_post, &status); - fake_macro_build_data_delete_simple(data_build); + fake_macro_build_main_delete_simple(data_build); fake_macro_build_stage_t_delete_simple(stage); // signal is set with error code only to prevent further execution above, return without the error bit set. @@ -2662,41 +2662,41 @@ extern "C" { #endif // _di_fake_build_operate_ #ifndef _di_fake_build_programs_script_ - int fake_build_programs_script(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return data.child; + int fake_build_programs_script(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main.child; // @todo needs to perform some sort of regex replace on the program scripts. - fake_build_touch(data, file_stage, status); + fake_build_touch(main, file_stage, status); return 0; } #endif // _di_fake_build_programs_script_ #ifndef _di_fake_build_program_shared_ - int fake_build_program_shared(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return data.child; + int fake_build_program_shared(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main.child; if (!data_build.setting.build_sources_program.used) return 0; - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.important, "Compiling shared program."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.important, "Compiling shared program."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } f_string_dynamics_t arguments = f_string_dynamics_t_initialize; { - const f_string_static_t *path_sources = &data.path_sources; + const f_string_static_t *path_sources = &main.path_sources; if (data_build.setting.path_standard) { - path_sources = &data.path_sources_c; + path_sources = &main.path_sources_c; if (data_build.setting.build_language == fake_build_language_type_cpp) { - path_sources = &data.path_sources_cpp; + path_sources = &main.path_sources_cpp; } } - else if (data.parameters[fake_parameter_path_sources].result != f_console_result_additional) { + else if (main.parameters[fake_parameter_path_sources].result != f_console_result_additional) { path_sources = &data_build.setting.path_sources; } @@ -2717,12 +2717,12 @@ extern "C" { } if (F_status_is_error_not(*status)) { - f_array_length_t parameter_file_name_path_length = data.path_build_programs_shared.used + data_build.setting.project_name.used; + f_array_length_t parameter_file_name_path_length = main.path_build_programs_shared.used + data_build.setting.project_name.used; char parameter_file_name_path[parameter_file_name_path_length + 1]; - memcpy(parameter_file_name_path, data.path_build_programs_shared.string, data.path_build_programs_shared.used); - memcpy(parameter_file_name_path + data.path_build_programs_shared.used, data_build.setting.project_name.string, data_build.setting.project_name.used); + memcpy(parameter_file_name_path, main.path_build_programs_shared.string, main.path_build_programs_shared.used); + memcpy(parameter_file_name_path + main.path_build_programs_shared.used, data_build.setting.project_name.string, data_build.setting.project_name.used); parameter_file_name_path[parameter_file_name_path_length] = 0; const f_string_t values[] = { @@ -2754,21 +2754,21 @@ extern "C" { *status = fll_execute_arguments_add(link_project_library, link_project_library_length, &arguments); } - fake_build_arguments_standard_add(data, data_build, F_true, F_false, &arguments, status); + fake_build_arguments_standard_add(main, data_build, F_true, F_false, &arguments, status); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return 0; } - int result = fake_execute(data, data_build.environment, data_build.setting.build_compiler, arguments, status); + int result = fake_execute(main, data_build.environment, data_build.setting.build_compiler, arguments, status); f_macro_string_dynamics_t_delete_simple(arguments); if (F_status_is_error_not(*status) && *status != F_child) { - fake_build_touch(data, file_stage, status); + fake_build_touch(main, file_stage, status); } return result; @@ -2776,29 +2776,29 @@ extern "C" { #endif // _di_fake_build_program_shared_ #ifndef _di_fake_build_program_static_ - int fake_build_program_static(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return data.child; + int fake_build_program_static(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true || *status == F_child) return main.child; if (!data_build.setting.build_sources_program.used) return 0; - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.important, "Compiling static program."); - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.important, "Compiling static program."); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); } f_string_dynamics_t arguments = f_string_dynamics_t_initialize; { - const f_string_static_t *path_sources = &data.path_sources; + const f_string_static_t *path_sources = &main.path_sources; if (data_build.setting.path_standard) { - path_sources = &data.path_sources_c; + path_sources = &main.path_sources_c; if (data_build.setting.build_language == fake_build_language_type_cpp) { - path_sources = &data.path_sources_cpp; + path_sources = &main.path_sources_cpp; } } - else if (data.parameters[fake_parameter_path_sources].result != f_console_result_additional) { + else if (main.parameters[fake_parameter_path_sources].result != f_console_result_additional) { path_sources = &data_build.setting.path_sources; } @@ -2821,7 +2821,7 @@ extern "C" { } if (F_status_is_error_not(*status)) { - f_array_length_t source_library_length = data.path_build_libraries_static.used + fake_build_parameter_library_name_prefix_length + data_build.setting.project_name.used + fake_build_parameter_library_name_suffix_static_length; + f_array_length_t source_library_length = main.path_build_libraries_static.used + fake_build_parameter_library_name_prefix_length + data_build.setting.project_name.used + fake_build_parameter_library_name_suffix_static_length; char source_library[source_library_length + 1]; @@ -2829,8 +2829,8 @@ extern "C" { // only include the library if there are sources that would result in it being built. if (data_build.setting.build_sources_library.used) { - memcpy(source_library, data.path_build_libraries_static.string, data.path_build_libraries_static.used); - source_library_length += data.path_build_libraries_static.used; + memcpy(source_library, main.path_build_libraries_static.string, main.path_build_libraries_static.used); + source_library_length += main.path_build_libraries_static.used; memcpy(source_library + source_library_length, fake_build_parameter_library_name_prefix, fake_build_parameter_library_name_prefix_length); source_library_length += fake_build_parameter_library_name_prefix_length; @@ -2844,12 +2844,12 @@ extern "C" { source_library[source_library_length] = 0; - f_array_length_t parameter_file_name_path_length = data.path_build_programs_static.used + data_build.setting.project_name.used; + f_array_length_t parameter_file_name_path_length = main.path_build_programs_static.used + data_build.setting.project_name.used; char parameter_file_name_path[parameter_file_name_path_length + 1]; - memcpy(parameter_file_name_path, data.path_build_programs_static.string, data.path_build_programs_static.used); - memcpy(parameter_file_name_path + data.path_build_programs_static.used, data_build.setting.project_name.string, data_build.setting.project_name.used); + memcpy(parameter_file_name_path, main.path_build_programs_static.string, main.path_build_programs_static.used); + memcpy(parameter_file_name_path + main.path_build_programs_static.used, data_build.setting.project_name.string, data_build.setting.project_name.used); parameter_file_name_path[parameter_file_name_path_length] = 0; const f_string_t values[] = { @@ -2872,21 +2872,21 @@ extern "C" { } // for } - fake_build_arguments_standard_add(data, data_build, F_false, F_false, &arguments, status); + fake_build_arguments_standard_add(main, data_build, F_false, F_false, &arguments, status); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return 0; } - int result = fake_execute(data, data_build.environment, data_build.setting.build_compiler, arguments, status); + int result = fake_execute(main, data_build.environment, data_build.setting.build_compiler, arguments, status); f_macro_string_dynamics_t_delete_simple(arguments); if (F_status_is_error_not(*status) && *status != F_child) { - fake_build_touch(data, file_stage, status); + fake_build_touch(main, file_stage, status); } return result; @@ -2894,14 +2894,14 @@ extern "C" { #endif // _di_fake_build_program_static_ #ifndef _di_fake_build_touch_ - void fake_build_touch(const fake_data_t data, const f_string_dynamic_t file, f_status_t *status) { + void fake_build_touch(const fake_main_t main, const f_string_dynamic_t file, f_status_t *status) { if (F_status_is_error(*status)) return; f_mode_t mode = f_mode_t_initialize; - f_macro_mode_t_set_default_umask(mode, data.umask); + f_macro_mode_t_set_default_umask(mode, main.umask); - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return; } @@ -2909,7 +2909,7 @@ extern "C" { *status = f_file_touch(file.string, mode.regular, F_false); if (F_status_is_error(*status)) { - fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_touch", F_true, file.string, "touch", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(*status), "f_file_touch", F_true, file.string, "touch", fll_error_file_type_file); } } #endif // _di_fake_build_touch_ diff --git a/level_3/fake/c/private-build.h b/level_3/fake/c/private-build.h index 133bd20..7dead20 100644 --- a/level_3/fake/c/private-build.h +++ b/level_3/fake/c/private-build.h @@ -340,7 +340,7 @@ extern "C" { f_string_maps_t_initialize, \ } - #define fake_macro_build_data_delete_simple(build) \ + #define fake_macro_build_main_delete_simple(build) \ fake_macro_build_setting_t_delete_simple(build.setting) \ f_macro_string_maps_t_delete_simple(build.environment); #endif // _di_fake_build_data_t_ @@ -388,8 +388,8 @@ extern "C" { /** * Add the standard arguments for building a library/program. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build * The build data. * @param is_shared @@ -406,14 +406,14 @@ extern "C" { * @see fll_execute_arguments_add() */ #ifndef _di_fake_build_arguments_standard_add_ - extern void fake_build_arguments_standard_add(const fake_data_t data, const fake_build_data_t data_build, const bool is_shared, const bool is_library, f_string_dynamics_t *arguments, f_status_t *status) f_attribute_visibility_internal; + extern void fake_build_arguments_standard_add(const fake_main_t main, const fake_build_data_t data_build, const bool is_shared, const bool is_library, f_string_dynamics_t *arguments, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_arguments_standard_add_ /** - * Copy over the data setting files. + * Copy over the main setting files. * - * @param data - * The program data. + * @param main + * The main data. * @param mode * The modes for each file type. * @param label @@ -444,14 +444,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_copy_ - extern void fake_build_copy(const fake_data_t data, const f_mode_t mode, const f_string_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_array_length_t preserve, f_status_t *status) f_attribute_visibility_internal; + extern void fake_build_copy(const fake_main_t main, const f_mode_t mode, const f_string_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_array_length_t preserve, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_copy_ /** * Create all of the base directories inside the build directory. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build * The build data. * @param mode @@ -467,16 +467,16 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_skeleton_ - extern void fake_build_skeleton(const fake_data_t data, const fake_build_data_t data_build, const mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; + extern void fake_build_skeleton(const fake_main_t main, const fake_build_data_t data_build, const mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_skeleton_ /** * Execute the Pre-Process or Post-pocess build script. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build - * All build related data. + * All build related main. * @param process_script * The setting_data file name fo the appropriate process script. * This is expected to be either setting.process_pre or setting.process_post. @@ -492,14 +492,14 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ #ifndef _di_fake_build_execute_process_script_ - extern int fake_build_execute_process_script(const fake_data_t data, const fake_build_data_t data_build, const f_string_static_t process_script, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; + extern int fake_build_execute_process_script(const fake_main_t main, const fake_build_data_t data_build, const f_string_static_t process_script, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_execute_process_script_ /** * Get the file name without the extension and without the path parts. * - * @param data - * The program data. + * @param main + * The main data. * @param path * The file path to get the file name from. * @param name @@ -511,14 +511,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_get_file_name_without_extension_ - extern f_status_t fake_build_get_file_name_without_extension(const fake_data_t data, const f_string_static_t path, f_string_dynamic_t *name); + extern f_status_t fake_build_get_file_name_without_extension(const fake_main_t main, const f_string_static_t path, f_string_dynamic_t *name); #endif // _di_fake_build_get_file_name_without_extension_ /** * Build the script libraries. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build * All build related data. * @param mode @@ -535,14 +535,14 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ #ifndef _di_fake_build_libraries_script_ - extern int fake_build_libraries_script(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; + extern int fake_build_libraries_script(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_libraries_script_ /** * Build the shared libraries. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build * All build related data. * @param mode @@ -559,14 +559,14 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ #ifndef _di_fake_build_library_shared_ - extern int fake_build_library_shared(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; + extern int fake_build_library_shared(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_library_shared_ /** * Build the static libraries. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build * All build related data. * @param mode @@ -583,14 +583,14 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ #ifndef _di_fake_build_library_static_ - extern int fake_build_library_static(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; + extern int fake_build_library_static(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_library_static_ /** * Find the build setting file, load it, validate it, and process it. * - * @param data - * The program data. + * @param main + * The main data. * @param setting_file * The name of the settings file to use. * If setting_file.used is 0, then the default or program parameter supplied file is used. @@ -606,14 +606,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_load_setting_ - extern void fake_build_load_setting(const fake_data_t data, const f_string_static_t setting_file, fake_build_setting_t *setting, f_status_t *status) f_attribute_visibility_internal; + extern void fake_build_load_setting(const fake_main_t main, const f_string_static_t setting_file, fake_build_setting_t *setting, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_load_setting_ /** * Assign build setting defaults. * - * @param data - * The program data. + * @param main + * The main data. * @param path_file * The path to the buffer. * @param buffer @@ -630,14 +630,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_load_setting_defaults_ - extern void fake_build_load_setting_defaults(const fake_data_t data, fake_build_setting_t *setting, f_status_t *status) f_attribute_visibility_internal; + extern void fake_build_load_setting_defaults(const fake_main_t main, fake_build_setting_t *setting, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_load_setting_defaults_ /** * Load and process the setting buffer. * - * @param data - * The program data. + * @param main + * The main data. * @param path_file * The path to the buffer. * @param buffer @@ -658,14 +658,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_load_setting_process_ - extern void fake_build_load_setting_process(const fake_data_t data, const f_string_t path_file, const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, fake_build_setting_t *setting, f_status_t *status) f_attribute_visibility_internal; + extern void fake_build_load_setting_process(const fake_main_t main, const f_string_t path_file, const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, fake_build_setting_t *setting, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_load_setting_process_ /** * Load the environment used when executing commands. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build * All build related data. * @param environment @@ -679,14 +679,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_load_environment_ - extern void fake_build_load_environment(const fake_data_t data, const fake_build_data_t data_build, f_string_maps_t *environment, f_status_t *status) f_attribute_visibility_internal; + extern void fake_build_load_environment(const fake_main_t main, const fake_build_data_t data_build, f_string_maps_t *environment, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_load_environment_ /** * Load the stage file paths. * - * @param data - * The program data. + * @param main + * The main data. * @param settings_file * The path to the settings file. * @param stage @@ -700,14 +700,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_load_stage_ - extern void fake_build_load_stage(const fake_data_t data, const f_string_static_t settings_file, fake_build_stage_t *stage, f_status_t *status) f_attribute_visibility_internal; + extern void fake_build_load_stage(const fake_main_t main, const f_string_static_t settings_file, fake_build_stage_t *stage, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_load_stage_ /** * Build the static objects. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build * All build related data. * @param mode @@ -724,7 +724,7 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ #ifndef _di_fake_build_objects_static_ - extern int fake_build_objects_static(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; + extern int fake_build_objects_static(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_objects_static_ /** @@ -733,8 +733,8 @@ extern "C" { * @param setting_file * The name of the settings file to use. * If setting_file.used is 0, then the default or program parameter supplied file is used. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -742,14 +742,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_operate_ - extern f_status_t fake_build_operate(const f_string_static_t setting_file, fake_data_t *data) f_attribute_visibility_internal; + extern f_status_t fake_build_operate(const f_string_static_t setting_file, fake_main_t *main) f_attribute_visibility_internal; #endif // _di_fake_build_operate_ /** * Build the script programs. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build * All build related data. * @param mode @@ -766,14 +766,14 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ #ifndef _di_fake_build_programs_script_ - extern int fake_build_programs_script(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; + extern int fake_build_programs_script(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_programs_script_ /** * Build the shared programs. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build * All build related data. * @param mode @@ -790,14 +790,14 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ #ifndef _di_fake_build_program_shared_ - extern int fake_build_program_shared(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; + extern int fake_build_program_shared(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_program_shared_ /** * Build the static programs. * - * @param data - * The program data. + * @param main + * The main data. * @param data_build * All build related data. * @param mode @@ -814,14 +814,14 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ #ifndef _di_fake_build_program_static_ - extern int fake_build_program_static(const fake_data_t data, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; + extern int fake_build_program_static(const fake_main_t main, const fake_build_data_t data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_program_static_ /** * Touch the given build stage file, but only if there are no current errors in status. * - * @param data - * The program data. + * @param main + * The main data. * @param file * The file path to touch. * @param status @@ -830,7 +830,7 @@ extern "C" { * @see f_file_touch() */ #ifndef _di_fake_build_touch_ - extern void fake_build_touch(const fake_data_t data, const f_string_dynamic_t file, f_status_t *status) f_attribute_visibility_internal; + extern void fake_build_touch(const fake_main_t main, const f_string_dynamic_t file, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_build_touch_ #ifdef __cplusplus diff --git a/level_3/fake/c/private-clean.c b/level_3/fake/c/private-clean.c index 6b9944f..e04bd68 100644 --- a/level_3/fake/c/private-clean.c +++ b/level_3/fake/c/private-clean.c @@ -10,37 +10,37 @@ extern "C" { #endif #ifndef _di_fake_clean_operate_ - f_status_t fake_clean_operate(const fake_data_t data) { + f_status_t fake_clean_operate(const fake_main_t main) { f_status_t status = F_none; - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.important, "Deleting all files within build directory '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", data.path_build.string); - f_color_print(data.output.stream, data.context.set.important, "'.%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.important, "Deleting all files within build directory '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", main.path_build.string); + f_color_print(main.output.stream, main.context.set.important, "'.%c", f_string_eol_s[0]); } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { return F_signal; } - if (data.error.verbosity == f_console_verbosity_verbose) { - status = f_directory_remove_custom(data.path_build.string, f_directory_descriptors_max, F_true, fake_clean_remove_recursively_verbosely); + if (main.error.verbosity == f_console_verbosity_verbose) { + status = f_directory_remove_custom(main.path_build.string, f_directory_descriptors_max, F_true, fake_clean_remove_recursively_verbosely); } else { - status = f_directory_remove(data.path_build.string, f_directory_descriptors_max, F_true); + status = f_directory_remove(main.path_build.string, f_directory_descriptors_max, F_true); } if (F_status_set_fine(status) == F_file_found_not) { - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "The build directory '%s' does not exist.%c", data.path_build.string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "The build directory '%s' does not exist.%c", main.path_build.string, f_string_eol_s[0]); } status = F_none; } if (F_status_is_error(status)) { - fll_error_file_print(data.error, F_status_set_fine(status), "f_directory_remove", F_true, data.path_build.string, "remove", fll_error_file_type_directory); + fll_error_file_print(main.error, F_status_set_fine(status), "f_directory_remove", F_true, main.path_build.string, "remove", fll_error_file_type_directory); return status; } diff --git a/level_3/fake/c/private-clean.h b/level_3/fake/c/private-clean.h index e4b4994..1c4ed98 100644 --- a/level_3/fake/c/private-clean.h +++ b/level_3/fake/c/private-clean.h @@ -15,8 +15,8 @@ extern "C" { /** * Execute the clean operation. * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -24,7 +24,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_clean_operate_ - extern f_status_t fake_clean_operate(const fake_data_t data) f_attribute_visibility_internal; + extern f_status_t fake_clean_operate(const fake_main_t main) f_attribute_visibility_internal; #endif // _di_fake_clean_operate_ /** diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index da0180f..23a6cff 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -9,25 +9,25 @@ extern "C" { #endif #ifndef _di_fake_execute_ - int fake_execute(const fake_data_t data, const f_string_maps_t environment, const f_string_static_t program, const f_string_statics_t arguments, f_status_t *status) { + int fake_execute(const fake_main_t main, const f_string_maps_t environment, const f_string_static_t program, const f_string_statics_t arguments, f_status_t *status) { if (F_status_is_error(*status)) return 1; - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%s", program.string); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%s", program.string); for (f_array_length_t i = 0; i < arguments.used; i++) { if (!arguments.array[i].used) continue; - fprintf(data.output.stream, " %s", arguments.array[i].string); + fprintf(main.output.stream, " %s", arguments.array[i].string); } // for - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); // flush to stdout before executing command. - fflush(data.output.stream); + fflush(main.output.stream); } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return 0; } @@ -45,7 +45,7 @@ extern "C" { *status = fll_execute_program(program.string, arguments, ¶meter, 0, (void *) &return_code); - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return 0; } @@ -65,15 +65,15 @@ extern "C" { return_code = 1; if (F_status_set_fine(*status) == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sFailed to find program '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", program.used ? program.string : f_string_empty_s); - f_color_print(data.error.to.stream, data.context.set.error, "' for executing.%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to find program '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", program.used ? program.string : f_string_empty_s); + f_color_print(main.error.to.stream, main.context.set.error, "' for executing.%c", f_string_eol_s[0]); } } else { - fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_program", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_execute_program", F_true); } } @@ -82,12 +82,12 @@ extern "C" { #endif // _di_fake_execute_ #ifndef _di_fake_file_buffer_ - f_status_t fake_file_buffer(const fake_data_t data, const f_string_t path_file, f_string_dynamic_t *buffer) { + f_status_t fake_file_buffer(const fake_main_t main, const f_string_t path_file, f_string_dynamic_t *buffer) { f_file_t file = f_file_t_initialize; f_string_t name_function = "f_file_exists"; f_status_t status = F_none; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { return F_status_set_error(F_signal); } @@ -108,7 +108,7 @@ extern "C" { f_macro_string_dynamic_t_resize((status), (*buffer), size_file); if (F_status_is_error(status)) { - fll_error_file_print(data.error, F_status_set_fine(status), name_function, F_true, path_file, "allocate buffer size for", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(status), name_function, F_true, path_file, "allocate buffer size for", fll_error_file_type_file); f_macro_string_dynamic_t_delete_simple((*buffer)); return status; @@ -121,7 +121,7 @@ extern "C" { name_function = "f_file_open"; status = f_file_stream_open(path_file, 0, &file); - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { if (file.id) { f_file_stream_close(F_true, &file); } @@ -141,7 +141,7 @@ extern "C" { } if (F_status_is_error(status)) { - fll_error_file_print(data.error, F_status_set_fine(status), name_function, F_true, path_file, "read", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(status), name_function, F_true, path_file, "read", fll_error_file_type_file); f_macro_string_dynamic_t_delete_simple((*buffer)); } @@ -151,15 +151,15 @@ extern "C" { #endif // _di_fake_file_buffer_ #ifndef _di_fake_path_generate_ - f_status_t fake_path_generate(fake_data_t *data) { + f_status_t fake_path_generate(fake_main_t *main) { f_status_t status = F_none; uint8_t i = 0; { const f_string_dynamic_t *parameters_source[] = { - &data->path_build, - &data->path_data, - &data->path_sources, + &main->path_build, + &main->path_data, + &main->path_sources, }; const uint8_t parameters_length[] = { @@ -169,25 +169,25 @@ extern "C" { }; f_string_dynamic_t *parameters_value_0[] = { - &data->path_build_documents, - &data->path_build_includes, - &data->path_build_libraries, - &data->path_build_objects, - &data->path_build_programs, - &data->path_build_settings, - &data->path_build_stage, + &main->path_build_documents, + &main->path_build_includes, + &main->path_build_libraries, + &main->path_build_objects, + &main->path_build_programs, + &main->path_build_settings, + &main->path_build_stage, }; f_string_dynamic_t *parameters_value_1[] = { - &data->path_data_build, - &data->path_data_settings, + &main->path_data_build, + &main->path_data_settings, }; f_string_dynamic_t *parameters_value_2[] = { - &data->path_sources_bash, - &data->path_sources_c, - &data->path_sources_cpp, - &data->path_sources_script, + &main->path_sources_bash, + &main->path_sources_c, + &main->path_sources_cpp, + &main->path_sources_script, }; f_string_dynamic_t **const parameters_value[] = { @@ -197,10 +197,10 @@ extern "C" { }; for (i = 0; i < 3; i++) { - status = fake_path_generate_string_dynamic(data, *parameters_source[i], parameters_value[i], parameters_length[i]); + status = fake_path_generate_string_dynamic(main, *parameters_source[i], parameters_value[i], parameters_length[i]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); return status; } } // for @@ -244,28 +244,28 @@ extern "C" { }; f_string_dynamic_t * const parameters_value[] = { - &data->path_build_documents, - &data->path_build_includes, - &data->path_build_libraries, - &data->path_build_objects, - &data->path_build_programs, - &data->path_build_settings, - &data->path_build_stage, - &data->path_data_build, - &data->path_data_settings, - &data->path_documents, - &data->path_licenses, - &data->path_sources_bash, - &data->path_sources_c, - &data->path_sources_cpp, - &data->path_sources_script, + &main->path_build_documents, + &main->path_build_includes, + &main->path_build_libraries, + &main->path_build_objects, + &main->path_build_programs, + &main->path_build_settings, + &main->path_build_stage, + &main->path_data_build, + &main->path_data_settings, + &main->path_documents, + &main->path_licenses, + &main->path_sources_bash, + &main->path_sources_c, + &main->path_sources_cpp, + &main->path_sources_script, }; for (i = 0; i < 15; i++) { status = f_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); return status; } } // for @@ -273,10 +273,10 @@ extern "C" { { const f_string_dynamic_t *parameters_source[] = { - &data->path_build_libraries, - &data->path_build_programs, - &data->path_data_build, - &data->path_documents, + &main->path_build_libraries, + &main->path_build_programs, + &main->path_data_build, + &main->path_documents, }; const uint8_t parameters_length[] = { @@ -287,26 +287,26 @@ extern "C" { }; f_string_dynamic_t *parameters_value_0[] = { - &data->path_build_libraries_script, - &data->path_build_libraries_shared, - &data->path_build_libraries_static, + &main->path_build_libraries_script, + &main->path_build_libraries_shared, + &main->path_build_libraries_static, }; f_string_dynamic_t *parameters_value_1[] = { - &data->path_build_programs_script, - &data->path_build_programs_shared, - &data->path_build_programs_static, + &main->path_build_programs_script, + &main->path_build_programs_shared, + &main->path_build_programs_static, }; f_string_dynamic_t *parameters_value_2[] = { - &data->file_data_build_defines, - &data->file_data_build_dependencies, - &data->file_data_build_fakefile, - &data->file_data_build_settings, + &main->file_data_build_defines, + &main->file_data_build_dependencies, + &main->file_data_build_fakefile, + &main->file_data_build_settings, }; f_string_dynamic_t *parameters_value_3[] = { - &data->file_documents_readme, + &main->file_documents_readme, }; f_string_dynamic_t **const parameters_value[] = { @@ -317,22 +317,22 @@ extern "C" { }; for (i = 0; i < 4; i++) { - status = fake_path_generate_string_dynamic(data, *parameters_source[i], parameters_value[i], parameters_length[i]); + status = fake_path_generate_string_dynamic(main, *parameters_source[i], parameters_value[i], parameters_length[i]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); return status; } } // for } // When custom fakefile or settings are used and they are paths to a file, remove the default path. - if (f_path_is(data->fakefile.string, data->fakefile.used)) { - data->file_data_build_fakefile.used = 0; + if (f_path_is(main->fakefile.string, main->fakefile.used)) { + main->file_data_build_fakefile.used = 0; } - if (f_path_is(data->settings.string, data->settings.used)) { - data->file_data_build_settings.used = 0; + if (f_path_is(main->settings.string, main->settings.used)) { + main->file_data_build_settings.used = 0; } { @@ -345,8 +345,8 @@ extern "C" { fake_path_part_static, fake_file_defines, fake_file_dependencies, - data->fakefile.string, - data->settings.string, + main->fakefile.string, + main->settings.string, fake_file_readme, }; @@ -359,48 +359,48 @@ extern "C" { fake_path_part_static_length, fake_file_defines_length, fake_file_dependencies_length, - data->fakefile.used, - data->settings.used, + main->fakefile.used, + main->settings.used, fake_file_readme_length, }; f_string_dynamic_t * const parameters_value[] = { - &data->path_build_libraries_script, - &data->path_build_libraries_shared, - &data->path_build_libraries_static, - &data->path_build_programs_script, - &data->path_build_programs_shared, - &data->path_build_programs_static, - &data->file_data_build_defines, - &data->file_data_build_dependencies, - &data->file_data_build_fakefile, - &data->file_data_build_settings, - &data->file_documents_readme, + &main->path_build_libraries_script, + &main->path_build_libraries_shared, + &main->path_build_libraries_static, + &main->path_build_programs_script, + &main->path_build_programs_shared, + &main->path_build_programs_static, + &main->file_data_build_defines, + &main->file_data_build_dependencies, + &main->file_data_build_fakefile, + &main->file_data_build_settings, + &main->file_documents_readme, }; for (i = 0; i < 11; i++) { status = f_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); return status; } } // for } - if (data->path_work.used) { + if (main->path_work.used) { { f_string_dynamic_t * const parameters_value[] = { - &data->path_work_includes, - &data->path_work_libraries, - &data->path_work_programs, + &main->path_work_includes, + &main->path_work_libraries, + &main->path_work_programs, }; for (i = 0; i < 3; i++) { - status = f_string_dynamic_append_nulless(data->path_work, parameters_value[i]); + status = f_string_dynamic_append_nulless(main->path_work, parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); return status; } } // for @@ -420,16 +420,16 @@ extern "C" { }; f_string_dynamic_t * const parameters_value[] = { - &data->path_work_includes, - &data->path_work_libraries, - &data->path_work_programs, + &main->path_work_includes, + &main->path_work_libraries, + &main->path_work_programs, }; for (i = 0; i < 3; i++) { status = f_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); return status; } } // for @@ -437,8 +437,8 @@ extern "C" { { const f_string_dynamic_t *parameters_source[] = { - &data->path_work_libraries, - &data->path_work_programs, + &main->path_work_libraries, + &main->path_work_programs, }; const uint8_t parameters_length[] = { @@ -447,15 +447,15 @@ extern "C" { }; f_string_dynamic_t *parameters_value_0[] = { - &data->path_work_libraries_script, - &data->path_work_libraries_shared, - &data->path_work_libraries_static, + &main->path_work_libraries_script, + &main->path_work_libraries_shared, + &main->path_work_libraries_static, }; f_string_dynamic_t *parameters_value_1[] = { - &data->path_work_programs_script, - &data->path_work_programs_shared, - &data->path_work_programs_static, + &main->path_work_programs_script, + &main->path_work_programs_shared, + &main->path_work_programs_static, }; f_string_dynamic_t **const parameters_value[] = { @@ -464,10 +464,10 @@ extern "C" { }; for (i = 0; i < 2; i++) { - status = fake_path_generate_string_dynamic(data, *parameters_source[i], parameters_value[i], parameters_length[i]); + status = fake_path_generate_string_dynamic(main, *parameters_source[i], parameters_value[i], parameters_length[i]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); return status; } } // for @@ -493,19 +493,19 @@ extern "C" { }; f_string_dynamic_t * const parameters_value[] = { - &data->path_work_libraries_script, - &data->path_work_libraries_shared, - &data->path_work_libraries_static, - &data->path_work_programs_script, - &data->path_work_programs_shared, - &data->path_work_programs_static, + &main->path_work_libraries_script, + &main->path_work_libraries_shared, + &main->path_work_libraries_static, + &main->path_work_programs_script, + &main->path_work_programs_shared, + &main->path_work_programs_static, }; for (i = 0; i < 6; i++) { status = f_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); return status; } } // for @@ -514,40 +514,40 @@ extern "C" { { f_string_dynamic_t * const parameters_value[] = { - &data->path_build_documents, - &data->path_build_includes, - &data->path_build_libraries, - &data->path_build_libraries_script, - &data->path_build_libraries_shared, - &data->path_build_libraries_static, - &data->path_build_objects, - &data->path_build_programs, - &data->path_build_programs_script, - &data->path_build_programs_shared, - &data->path_build_programs_static, - &data->path_build_settings, - &data->path_build_stage, - &data->path_data_build, - &data->path_data_settings, - &data->path_licenses, - &data->path_sources_bash, - &data->path_sources_c, - &data->path_sources_cpp, - &data->path_sources_script, - &data->path_work_includes, - &data->path_work_libraries, - &data->path_work_libraries_script, - &data->path_work_libraries_shared, - &data->path_work_libraries_static, - &data->path_work_programs, - &data->path_work_programs_script, - &data->path_work_programs_shared, - &data->path_work_programs_static, - &data->file_data_build_defines, - &data->file_data_build_dependencies, - &data->file_data_build_fakefile, - &data->file_data_build_settings, - &data->file_documents_readme, + &main->path_build_documents, + &main->path_build_includes, + &main->path_build_libraries, + &main->path_build_libraries_script, + &main->path_build_libraries_shared, + &main->path_build_libraries_static, + &main->path_build_objects, + &main->path_build_programs, + &main->path_build_programs_script, + &main->path_build_programs_shared, + &main->path_build_programs_static, + &main->path_build_settings, + &main->path_build_stage, + &main->path_data_build, + &main->path_data_settings, + &main->path_licenses, + &main->path_sources_bash, + &main->path_sources_c, + &main->path_sources_cpp, + &main->path_sources_script, + &main->path_work_includes, + &main->path_work_libraries, + &main->path_work_libraries_script, + &main->path_work_libraries_shared, + &main->path_work_libraries_static, + &main->path_work_programs, + &main->path_work_programs_script, + &main->path_work_programs_shared, + &main->path_work_programs_static, + &main->file_data_build_defines, + &main->file_data_build_dependencies, + &main->file_data_build_fakefile, + &main->file_data_build_settings, + &main->file_documents_readme, }; for (i = 0; i < 34; i++) { @@ -556,7 +556,7 @@ extern "C" { status = f_string_dynamic_terminate_after(parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); return status; } } // for @@ -567,7 +567,7 @@ extern "C" { #endif // _di_fake_path_generate_ #ifndef _di_fake_path_generate_string_dynamic_ - f_status_t fake_path_generate_string_dynamic(fake_data_t *data, const f_string_dynamic_t source, f_string_dynamic_t *destination[], const uint8_t length) { + f_status_t fake_path_generate_string_dynamic(fake_main_t *main, const f_string_dynamic_t source, f_string_dynamic_t *destination[], const uint8_t length) { f_status_t status = F_none; for (uint8_t i = 0; i < length; i++) { @@ -580,7 +580,7 @@ extern "C" { #endif // _di_fake_path_generate_string_dynamic_ #ifndef _di_fake_process_console_parameters_ - f_status_t fake_process_console_parameters(const f_console_arguments_t arguments, fake_data_t *data) { + f_status_t fake_process_console_parameters(const f_console_arguments_t arguments, fake_main_t *main) { f_status_t status = F_none; // @todo move as many of the inline error printing code into more general functions where possible to provide more accurate error reporting. @@ -611,9 +611,9 @@ extern "C" { }; f_string_dynamic_t * const parameters_value[] = { - &data->fakefile, - &data->process, - &data->settings, + &main->fakefile, + &main->process, + &main->settings, }; bool parameters_validate_word[] = { @@ -624,17 +624,17 @@ extern "C" { for (uint8_t i = 0; i < 3; i++) { - if (data->parameters[parameters_id[i]].result == f_console_result_found) { - fake_print_error_parameter_missing_value(*data, parameters_name[i]); + if (main->parameters[parameters_id[i]].result == f_console_result_found) { + fake_print_error_parameter_missing_value(*main, 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]].locations.used > 1) { - fake_print_error_parameter_too_many(*data, parameters_name[i]); + else if (main->parameters[parameters_id[i]].result == f_console_result_additional) { + if (main->parameters[parameters_id[i]].locations.used > 1) { + fake_print_error_parameter_too_many(*main, parameters_name[i]); return F_status_set_error(F_parameter); } - f_array_length_t location = data->parameters[parameters_id[i]].values.array[0]; + f_array_length_t location = main->parameters[parameters_id[i]].values.array[0]; f_array_length_t length = strnlen(arguments.argv[location], f_console_parameter_size); if (length > 0) { @@ -648,24 +648,24 @@ extern "C" { status = f_utf_is_word_dash_plus(arguments.argv[location] + j, width_max, F_false); if (F_status_is_error(status)) { - if (fll_error_print(data->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_process); - f_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol_s[0]); + if (fll_error_print(main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to process the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_process); + f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]); } return status; } if (status == F_false) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_process); - f_color_print(data->error.to.stream, data->context.set.error, "' parameters value '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s", arguments.argv[location]); - f_color_print(data->error.to.stream, data->context.set.error, "' contains non-word, non-dash, and non-plus characters.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_process); + f_color_print(main->error.to.stream, main->context.set.error, "' parameters value '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s", arguments.argv[location]); + f_color_print(main->error.to.stream, main->context.set.error, "' contains non-word, non-dash, and non-plus characters.%c", f_string_eol_s[0]); } return F_status_set_error(F_parameter); @@ -677,15 +677,15 @@ extern "C" { if (F_status_is_error(status)) { if (status == F_status_set_error(F_string_too_large)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameters_name[i]); - f_color_print(data->error.to.stream, data->context.set.error, "' is too long.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameters_name[i]); + f_color_print(main->error.to.stream, main->context.set.error, "' is too long.%c", f_string_eol_s[0]); } } else { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true); } return status; @@ -696,11 +696,11 @@ extern "C" { } if (length == 0 || status == F_data_not) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameters_name[i]); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be empty and must not contain only whitespace.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameters_name[i]); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty and must not contain only whitespace.%c", f_string_eol_s[0]); } } } @@ -708,7 +708,7 @@ extern "C" { f_macro_string_dynamic_t_resize(status, (*parameters_value[i]), parameter_default_lengths[i]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_macro_string_dynamic_t_resize", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_macro_string_dynamic_t_resize", F_true); return status; } @@ -718,8 +718,8 @@ extern "C" { } // for } - if (data->parameters[fake_parameter_define].result == f_console_result_found) { - fake_print_error_parameter_missing_value(*data, fake_long_define); + if (main->parameters[fake_parameter_define].result == f_console_result_found) { + fake_print_error_parameter_missing_value(*main, fake_long_define); return F_status_set_error(F_parameter); } @@ -753,32 +753,32 @@ extern "C" { }; f_string_dynamic_t * const parameters_value[] = { - &data->path_build, - &data->path_data, - &data->path_sources, - &data->path_work, + &main->path_build, + &main->path_data, + &main->path_sources, + &main->path_work, }; 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, parameters_name[i]); + if (main->parameters[parameters_id[i]].result == f_console_result_found) { + fake_print_error_parameter_missing_value(*main, 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]].values.used > 1) { - fake_print_error_parameter_too_many(*data, parameters_name[i]); + else if (main->parameters[parameters_id[i]].result == f_console_result_additional) { + if (main->parameters[parameters_id[i]].values.used > 1) { + fake_print_error_parameter_too_many(*main, 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]].values.array[0]], parameters_value[i]); + status = fl_console_parameter_to_string_dynamic_directory(arguments.argv[main->parameters[parameters_id[i]].values.array[0]], parameters_value[i]); if (F_status_is_error(status)) { - if (fll_error_print(data->error, F_status_set_fine(status), "fl_console_parameter_to_string_dynamic_directory", F_false) == F_known_not && data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameters_name[i]); - f_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol_s[0]); + if (fll_error_print(main->error, F_status_set_fine(status), "fl_console_parameter_to_string_dynamic_directory", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to process parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameters_name[i]); + f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]); } return status; @@ -788,11 +788,11 @@ extern "C" { f_macro_string_dynamic_t_resize(status, (*parameters_value[i]), parameter_default_lengths[i]); if (F_status_is_error(status)) { - if (fll_error_print(data->error, F_status_set_fine(status), " f_macro_string_dynamic_t_resize", F_false) == F_known_not && data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to load default for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameters_name[i]); - f_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol_s[0]); + if (fll_error_print(main->error, F_status_set_fine(status), " f_macro_string_dynamic_t_resize", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to load default for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameters_name[i]); + f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]); } return status; @@ -804,15 +804,15 @@ extern "C" { } // for } - if (data->parameters[fake_parameter_define].result == f_console_result_additional) { - status = fll_program_parameter_additional_rip(arguments.argv, data->parameters[fake_parameter_define].values, &data->define); + if (main->parameters[fake_parameter_define].result == f_console_result_additional) { + status = fll_program_parameter_additional_rip(arguments.argv, main->parameters[fake_parameter_define].values, &main->define); if (F_status_is_error(status)) { - if (fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_define); - f_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol_s[0]); + if (fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to process the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_define); + f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]); } return status; @@ -822,33 +822,33 @@ extern "C" { f_array_length_t j = 0; f_array_length_t width_max = 0; - for (; i < data->define.used; i++) { + for (; i < main->define.used; i++) { - for (j = 0; j < data->define.array[i].used; j++) { + for (j = 0; j < main->define.array[i].used; j++) { - width_max = data->define.array[i].used - j; + width_max = main->define.array[i].used - j; - status = f_utf_is_word(data->define.array[i].string + j, width_max, F_false); + status = f_utf_is_word(main->define.array[i].string + j, width_max, F_false); if (F_status_is_error(status)) { - if (fll_error_print(data->error, F_status_set_fine(status), "f_utf_is_word", F_false) == F_known_not && data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_define); - f_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol_s[0]); + if (fll_error_print(main->error, F_status_set_fine(status), "f_utf_is_word", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to process the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_define); + f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]); } return status; } if (status == F_false) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_define); - f_color_print(data->error.to.stream, data->context.set.error, "' parameters value '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s", data->define.array[i].string); - f_color_print(data->error.to.stream, data->context.set.error, "' contains non-word characters.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_define); + f_color_print(main->error.to.stream, main->context.set.error, "' parameters value '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s", main->define.array[i].string); + f_color_print(main->error.to.stream, main->context.set.error, "' contains non-word characters.%c", f_string_eol_s[0]); } return F_status_set_error(F_parameter); @@ -857,19 +857,19 @@ extern "C" { } // for } - if (data->parameters[fake_parameter_mode].result == f_console_result_found) { - fake_print_error_parameter_missing_value(*data, fake_long_mode); + if (main->parameters[fake_parameter_mode].result == f_console_result_found) { + fake_print_error_parameter_missing_value(*main, 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].values, &data->mode); + else if (main->parameters[fake_parameter_mode].result == f_console_result_additional) { + status = fll_program_parameter_additional_rip(arguments.argv, main->parameters[fake_parameter_mode].values, &main->mode); if (F_status_is_error(status)) { - if (fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_mode); - f_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol_s[0]); + if (fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to process the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_mode); + f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]); } return status; @@ -879,33 +879,33 @@ extern "C" { f_array_length_t j = 0; f_array_length_t width_max = 0; - for (; i < data->mode.used; i++) { + for (; i < main->mode.used; i++) { - for (j = 0; j < data->mode.array[i].used; j++) { + for (j = 0; j < main->mode.array[i].used; j++) { - width_max = data->mode.array[i].used - j; + width_max = main->mode.array[i].used - j; - status = f_utf_is_word_dash_plus(data->mode.array[i].string + j, width_max, F_false); + status = f_utf_is_word_dash_plus(main->mode.array[i].string + j, width_max, F_false); if (F_status_is_error(status)) { - if (fll_error_print(data->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_mode); - f_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol_s[0]); + if (fll_error_print(main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to process the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_mode); + f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]); } return status; } if (status == F_false) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_mode); - f_color_print(data->error.to.stream, data->context.set.error, "' parameters value '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s", data->mode.array[i].string); - f_color_print(data->error.to.stream, data->context.set.error, "' contains non-word, non-dash, and non-plus characters.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fake_long_mode); + f_color_print(main->error.to.stream, main->context.set.error, "' parameters value '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s", main->mode.array[i].string); + f_color_print(main->error.to.stream, main->context.set.error, "' contains non-word, non-dash, and non-plus characters.%c", f_string_eol_s[0]); } return F_status_set_error(F_parameter); @@ -919,9 +919,9 @@ extern "C" { #endif // _di_fake_process_console_parameters_ #ifndef _di_fake_signal_read_ - f_status_t fake_signal_received(const fake_data_t data) { + f_status_t fake_signal_received(const fake_main_t main) { - if (!data.signal.id) { + if (!main.signal.id) { return F_false; } @@ -931,7 +931,7 @@ extern "C" { memset(&information, 0, sizeof(struct signalfd_siginfo)); - status = f_signal_read(data.signal, &information); + status = f_signal_read(main.signal, &information); if (status == F_signal) { switch (information.ssi_signo) { @@ -941,10 +941,10 @@ extern "C" { case F_signal_quit: case F_signal_termination: - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "ALERT: An appropriate exit signal has been received, now aborting."); - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "ALERT: An appropriate exit signal has been received, now aborting."); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); } return F_true; @@ -956,9 +956,9 @@ extern "C" { #endif // _di_fake_signal_read_ #ifndef _di_fake_validate_directories_ - f_status_t fake_validate_parameter_directories(const f_console_arguments_t arguments, const fake_data_t data) { + f_status_t fake_validate_parameter_directories(const f_console_arguments_t arguments, const fake_main_t main) { - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { return F_signal; } @@ -981,9 +981,9 @@ extern "C" { }; const f_string_dynamic_t *parameters_value[] = { - &data.path_build, - &data.path_data, - &data.path_work, + &main.path_build, + &main.path_data, + &main.path_work, }; const bool parameters_required[] = { @@ -997,7 +997,7 @@ extern "C" { for (uint8_t i = 0; i < 3; i++) { - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { return F_status_set_error(F_signal); } @@ -1010,17 +1010,17 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) != F_directory_found_not || parameters_required[i]) { - fll_error_file_print(data.error, F_status_set_fine(status), "f_file_stat", F_true, parameters_value[i]->string, "access", fll_error_file_type_directory); + fll_error_file_print(main.error, F_status_set_fine(status), "f_file_stat", F_true, parameters_value[i]->string, "access", fll_error_file_type_directory); return status; } } } else if (parameters_required[i]) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sNo valid path for the (required) directory parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameters_name[i]); - f_color_print(data.error.to.stream, data.context.set.error, "' was found.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sNo valid path for the (required) directory parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameters_name[i]); + f_color_print(main.error.to.stream, main.context.set.error, "' was found.%c", f_string_eol_s[0]); return F_status_set_error(F_directory_found_not); } diff --git a/level_3/fake/c/private-fake.h b/level_3/fake/c/private-fake.h index 1c18b04..4e77124 100644 --- a/level_3/fake/c/private-fake.h +++ b/level_3/fake/c/private-fake.h @@ -27,8 +27,8 @@ extern "C" { * * Will print the command if in verbose mode. * - * @param data - * The program data. + * @param main + * The main data. * @param environment * The environment variable data. * @param program @@ -43,14 +43,14 @@ extern "C" { * A value of 1 is returned if status has the error bit set. */ #ifndef _di_fake_execute_ - extern int fake_execute(const fake_data_t data, const f_string_maps_t environment, const f_string_static_t program, const f_string_statics_t arguments, f_status_t *status) f_attribute_visibility_internal; + extern int fake_execute(const fake_main_t main, const f_string_maps_t environment, const f_string_static_t program, const f_string_statics_t arguments, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_execute_ /** * Load the contents of a file into the given buffer, handling all potential errors. * - * @param data - * The program data. + * @param main + * The main data. * @param path_file * The path to the file to load. * @param buffer @@ -62,14 +62,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_file_buffer_ - extern f_status_t fake_file_buffer(const fake_data_t data, const f_string_t path_file, f_string_dynamic_t *buffer) f_attribute_visibility_internal; + extern f_status_t fake_file_buffer(const fake_main_t main, const f_string_t path_file, f_string_dynamic_t *buffer) f_attribute_visibility_internal; #endif // _di_fake_file_buffer_ /** * Generate all appropriate paths based on runtime information. * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -77,14 +77,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_path_generate_ - extern f_status_t fake_path_generate(fake_data_t *data) f_attribute_visibility_internal; + extern f_status_t fake_path_generate(fake_main_t *main) f_attribute_visibility_internal; #endif // _di_fake_path_generate_ /** * Generate all appropriate paths based on runtime information from dynamic strings. * - * @param data - * The program data. + * @param main + * The main data. * @param source * The string to copy from. * @param destination @@ -98,7 +98,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_path_generate_string_dynamic_ - extern f_status_t fake_path_generate_string_dynamic(fake_data_t *data, const f_string_dynamic_t source, f_string_dynamic_t *destination[], const uint8_t size) f_attribute_visibility_internal; + extern f_status_t fake_path_generate_string_dynamic(fake_main_t *main, const f_string_dynamic_t source, f_string_dynamic_t *destination[], const uint8_t size) f_attribute_visibility_internal; #endif // _di_fake_path_generate_string_dynamic_ /** @@ -106,8 +106,8 @@ extern "C" { * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -115,14 +115,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_process_console_parameters_ - extern f_status_t fake_process_console_parameters(const f_console_arguments_t arguments, fake_data_t *data) f_attribute_visibility_internal; + extern f_status_t fake_process_console_parameters(const f_console_arguments_t arguments, fake_main_t *main) f_attribute_visibility_internal; #endif // _di_validate_console_parameters_ /** * Check to see if a termination signal has been received. * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_true if a termination signal is received. @@ -131,7 +131,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_signal_read_ - extern f_status_t fake_signal_received(const fake_data_t data) f_attribute_visibility_internal; + extern f_status_t fake_signal_received(const fake_main_t main) f_attribute_visibility_internal; #endif // _di_fake_signal_read_ /** @@ -141,8 +141,8 @@ extern "C" { * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -150,7 +150,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_validate_parameter_directories_ - extern f_status_t fake_validate_parameter_directories(const f_console_arguments_t arguments, const fake_data_t data) f_attribute_visibility_internal; + extern f_status_t fake_validate_parameter_directories(const f_console_arguments_t arguments, const fake_main_t main) f_attribute_visibility_internal; #endif // _di_fake_validate_parameter_directories_ /** diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index 7f21923..49d182d 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -11,7 +11,7 @@ extern "C" { #endif #ifndef _di_fake_make_assure_inside_project_ - f_status_t fake_make_assure_inside_project(const fake_data_t data, const f_string_static_t path, fake_make_data_t *data_make) { + f_status_t fake_make_assure_inside_project(const fake_main_t main, const f_string_static_t path, fake_make_data_t *data_make) { data_make->path_cache.used = 0; @@ -44,7 +44,7 @@ extern "C" { #endif // _di_fake_make_assure_inside_project_ #ifndef _di_fake_make_get_id_group_ - f_status_t fake_make_get_id_group(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, gid_t *id) { + f_status_t fake_make_get_id_group(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, gid_t *id) { const f_string_range_t range = f_macro_string_range_t_initialize(buffer.used); f_number_unsigned_t number = 0; @@ -62,7 +62,7 @@ extern "C" { return F_status_set_error(status); } else if (status == F_exist_not) { - if (data.error.verbosity != f_console_verbosity_quiet) { + if (main.error.verbosity != f_console_verbosity_quiet) { fprintf(error.to.stream, "%c", f_string_eol_s[0]); f_color_print(error.to.stream, error.context, "%sThe group name '", error.prefix); f_color_print(error.to.stream, error.notable, "%s", buffer.string); @@ -79,7 +79,7 @@ extern "C" { return F_status_set_error(status); } else if (number > f_type_size_32_unsigned) { - if (data.error.verbosity != f_console_verbosity_quiet) { + if (main.error.verbosity != f_console_verbosity_quiet) { fprintf(error.to.stream, "%c", f_string_eol_s[0]); f_color_print(error.to.stream, error.context, "%sThe number '", error.prefix); f_color_print(error.to.stream, error.notable, "%llu", number); @@ -93,16 +93,16 @@ extern "C" { #endif // _di_fake_make_get_id_group_ #ifndef _di_fake_make_get_id_mode_ - f_status_t fake_make_get_id_mode(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, f_file_mode_t *mode, uint8_t *replace) { + f_status_t fake_make_get_id_mode(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, f_file_mode_t *mode, uint8_t *replace) { if (!buffer.used) { fll_error_print(error, F_parameter, "fake_make_get_id_mode", F_true); return F_status_set_error(F_parameter); } - f_status_t status = f_file_mode_from_string(buffer.string, data.umask, mode, replace); + f_status_t status = f_file_mode_from_string(buffer.string, main.umask, mode, replace); if (F_status_is_error(status)) { - if (data.error.verbosity != f_console_verbosity_quiet) { + if (main.error.verbosity != f_console_verbosity_quiet) { if (F_status_set_fine(status) == F_syntax) { fprintf(error.to.stream, "%c", f_string_eol_s[0]); f_color_print(error.to.stream, error.context, "%sThe mode '", error.prefix); @@ -122,7 +122,7 @@ extern "C" { #endif // _di_fake_make_get_id_mode_ #ifndef _di_fake_make_get_id_owner_ - f_status_t fake_make_get_id_owner(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, uid_t *id) { + f_status_t fake_make_get_id_owner(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, uid_t *id) { const f_string_range_t range = f_macro_string_range_t_initialize(buffer.used); f_number_unsigned_t number = 0; @@ -140,7 +140,7 @@ extern "C" { return F_status_set_error(status); } else if (status == F_exist_not) { - if (data.error.verbosity != f_console_verbosity_quiet) { + if (main.error.verbosity != f_console_verbosity_quiet) { fprintf(error.to.stream, "%c", f_string_eol_s[0]); f_color_print(error.to.stream, error.context, "%sThe user '", error.prefix); f_color_print(error.to.stream, error.notable, "%s", buffer.string); @@ -157,7 +157,7 @@ extern "C" { return F_status_set_error(status); } else if (number > f_type_size_32_unsigned) { - if (data.error.verbosity != f_console_verbosity_quiet) { + if (main.error.verbosity != f_console_verbosity_quiet) { fprintf(error.to.stream, "%c", f_string_eol_s[0]); f_color_print(error.to.stream, error.context, "%sThe number '", error.prefix); f_color_print(error.to.stream, error.notable, "%llu", number); @@ -171,28 +171,28 @@ extern "C" { #endif // _di_fake_make_get_id_owner_ #ifndef _di_fake_make_load_fakefile_ - void fake_make_load_fakefile(const fake_data_t data, fake_make_data_t *data_make, f_status_t *status) { + void fake_make_load_fakefile(const fake_main_t main, fake_make_data_t *data_make, f_status_t *status) { if (F_status_is_error(*status)) return; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return; } - *status = fake_file_buffer(data, data.file_data_build_fakefile.string, &data_make->buffer); + *status = fake_file_buffer(main, main.file_data_build_fakefile.string, &data_make->buffer); if (F_status_is_error(*status)) return; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return; } if (!data_make->buffer.used) { - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.warning, "%sthe fakefile '", fll_error_print_warning); - f_color_print(data.output.stream, data.context.set.notable, "%s", data.file_data_build_fakefile.string); - f_color_print(data.output.stream, data.context.set.warning, "' is empty."); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.warning, "%sthe fakefile '", fll_error_print_warning); + f_color_print(main.output.stream, main.context.set.notable, "%s", main.file_data_build_fakefile.string); + f_color_print(main.output.stream, main.context.set.warning, "' is empty."); } return; @@ -209,13 +209,13 @@ extern "C" { *status = fll_fss_basic_list_read(data_make->buffer, &range, &list_objects, &list_contents, &delimits, 0, &comments); if (F_status_is_error(*status)) { - fake_print_error_fss(data, *status, "fll_fss_basic_list_read", data.file_data_build_fakefile.string, range, F_true); + fake_print_error_fss(main, *status, "fll_fss_basic_list_read", main.file_data_build_fakefile.string, range, F_true); } else { *status = fl_fss_apply_delimit(delimits, &data_make->buffer); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); } } @@ -243,7 +243,7 @@ extern "C" { f_macro_fss_nameds_t_resize((*status), data_make->fakefile, list_objects.used); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_macro_fss_nameds_t_resize", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_macro_fss_nameds_t_resize", F_true); f_macro_fss_set_t_delete_simple(settings); f_macro_fss_objects_t_delete_simple(list_objects); @@ -257,7 +257,7 @@ extern "C" { for (f_array_length_t i = 0; i < list_objects.used; i++) { - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); break; } @@ -265,7 +265,7 @@ extern "C" { 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_settings_object_multiple(data, data.file_data_build_fakefile.string, "list", name_settings.string); + fake_print_warning_settings_object_multiple(main, main.file_data_build_fakefile.string, "list", name_settings.string); continue; } @@ -275,14 +275,14 @@ extern "C" { *status = fll_fss_extended_read(data_make->buffer, &content_range, &settings.objects, &settings.contents, 0, 0, &delimits, 0); if (F_status_is_error(*status)) { - fake_print_error_fss(data, F_status_set_fine(*status), "fll_fss_extended_read", data.file_data_build_fakefile.string, content_range, F_true); + fake_print_error_fss(main, F_status_set_fine(*status), "fll_fss_extended_read", main.file_data_build_fakefile.string, content_range, F_true); break; } *status = fl_fss_apply_delimit(delimits, &data_make->buffer); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); break; } @@ -291,7 +291,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_settings_object_multiple(data, data.file_data_build_fakefile.string, "list", name_main.string); + fake_print_warning_settings_object_multiple(main, main.file_data_build_fakefile.string, "list", name_main.string); continue; } @@ -307,14 +307,14 @@ 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].quotess, &delimits, 0); if (F_status_is_error(*status)) { - fake_print_error_fss(data, F_status_set_fine(*status), "fll_fss_extended_read", data.file_data_build_fakefile.string, content_range, F_true); + fake_print_error_fss(main, F_status_set_fine(*status), "fll_fss_extended_read", main.file_data_build_fakefile.string, content_range, F_true); break; } *status = fl_fss_apply_delimit(delimits, &data_make->buffer); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); break; } @@ -334,13 +334,13 @@ extern "C" { } if (missing_main) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.error.context, "%sThe fakefile '", data.error.prefix); - f_color_print(data.error.to.stream, data.error.notable, "%s", data.file_data_build_fakefile.string); - f_color_print(data.error.to.stream, data.error.context, "' is missing the required '"); - f_color_print(data.error.to.stream, data.error.notable, "%s", fake_make_section_main); - f_color_print(data.error.to.stream, data.error.context, "' object.%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.error.context, "%sThe fakefile '", main.error.prefix); + f_color_print(main.error.to.stream, main.error.notable, "%s", main.file_data_build_fakefile.string); + f_color_print(main.error.to.stream, main.error.context, "' is missing the required '"); + f_color_print(main.error.to.stream, main.error.notable, "%s", fake_make_section_main); + f_color_print(main.error.to.stream, main.error.context, "' object.%c", f_string_eol_s[0]); } *status = F_status_set_error(F_failure); @@ -378,7 +378,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), function_name, F_true); + fll_error_print(main.error, F_status_set_fine(*status), function_name, F_true); f_macro_fss_set_t_delete_simple(settings); return; @@ -400,18 +400,18 @@ extern "C" { if (fl_string_dynamic_partial_compare_string(fake_make_setting_compiler, data_make->buffer, fake_make_setting_compiler_length, settings.objects.array[i]) == F_equal_to) { if (range_compiler) { - fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_compiler); + fake_print_warning_settings_content_multiple(main, main.file_data_build_fakefile.string, fake_make_setting_compiler); } else { if (settings.contents.array[i].used) { range_compiler = &settings.contents.array[i].array[0]; if (settings.contents.array[i].used > 1) { - fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_compiler); + fake_print_warning_settings_content_multiple(main, main.file_data_build_fakefile.string, fake_make_setting_compiler); } } else { - fake_print_warning_settings_content_empty(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings); + fake_print_warning_settings_content_empty(main, main.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings); } } } @@ -426,14 +426,14 @@ extern "C" { *status = f_string_dynamic_partial_append_nulless(data_make->buffer, settings.contents.array[i].array[j], &name_define); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_partial_append_nulless", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_partial_append_nulless", F_true); break; } *status = f_string_dynamic_terminate_after(&name_define); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } @@ -449,7 +449,7 @@ extern "C" { *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->setting_build.environment); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); break; } } @@ -460,7 +460,7 @@ extern "C" { *status = f_string_dynamic_append(name_define, &data_make->setting_build.environment.array[data_make->setting_build.environment.used]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); break; } @@ -468,18 +468,18 @@ extern "C" { data_make->setting_build.environment.array[data_make->setting_build.environment.used].used--; data_make->setting_build.environment.used++; } - else if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.warning, "%sThe environment name '", fll_error_print_warning); - f_color_print(data.output.stream, data.context.set.notable, "%s", name_define.string); - f_color_print(data.output.stream, data.context.set.warning, "' is already added.%c", f_string_eol_s[0]); + else if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.warning, "%sThe environment name '", fll_error_print_warning); + f_color_print(main.output.stream, main.context.set.notable, "%s", name_define.string); + f_color_print(main.output.stream, main.context.set.warning, "' is already added.%c", f_string_eol_s[0]); } } - else if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.warning, "%sThe environment name '", fll_error_print_warning); - f_color_print(data.output.stream, data.context.set.notable, "%s", name_define.string); - f_color_print(data.output.stream, data.context.set.warning, "' is invalid, ignoring.%c", f_string_eol_s[0]); + else if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.warning, "%sThe environment name '", fll_error_print_warning); + f_color_print(main.output.stream, main.context.set.notable, "%s", name_define.string); + f_color_print(main.output.stream, main.context.set.warning, "' is invalid, ignoring.%c", f_string_eol_s[0]); } name_define.used = 0; @@ -506,37 +506,37 @@ extern "C" { data_make->setting_make.fail = fake_make_operation_fail_type_ignore; } else { - fake_print_warning_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); + fake_print_warning_settings_content_invalid(main, main.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], settings.contents.array[i].array[0], fake_make_section_settings); } if (settings.contents.array[i].used > 1) { - fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_fail); + fake_print_warning_settings_content_multiple(main, main.file_data_build_fakefile.string, fake_make_setting_fail); } unmatched_fail = F_false; } else { - fake_print_warning_settings_content_empty(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings); + fake_print_warning_settings_content_empty(main, main.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings); } } else { - fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_fail); + fake_print_warning_settings_content_multiple(main, main.file_data_build_fakefile.string, fake_make_setting_fail); } } else if (fl_string_dynamic_partial_compare_string(fake_make_setting_linker, data_make->buffer, fake_make_setting_linker_length, settings.objects.array[i]) == F_equal_to) { if (range_linker) { - fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_linker); + fake_print_warning_settings_content_multiple(main, main.file_data_build_fakefile.string, fake_make_setting_linker); } else { if (settings.contents.array[i].used) { range_linker = &settings.contents.array[i].array[0]; if (settings.contents.array[i].used > 1) { - fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_linker); + fake_print_warning_settings_content_multiple(main, main.file_data_build_fakefile.string, fake_make_setting_linker); } } else { - fake_print_warning_settings_content_empty(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings); + fake_print_warning_settings_content_empty(main, main.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings); } } } @@ -550,21 +550,21 @@ extern "C" { data_make->setting_make.load_build = F_false; } else { - fake_print_warning_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); + fake_print_warning_settings_content_invalid(main, main.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, data.file_data_build_fakefile.string, fake_make_setting_load_build); + fake_print_warning_settings_content_multiple(main, main.file_data_build_fakefile.string, fake_make_setting_load_build); } } else { - fake_print_warning_settings_content_empty(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings); + fake_print_warning_settings_content_empty(main, main.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings); } } else { - fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_load_build); + fake_print_warning_settings_content_multiple(main, main.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) { @@ -592,7 +592,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), function_name, F_true); + fll_error_print(main.error, F_status_set_fine(*status), function_name, F_true); break; } } // for @@ -604,7 +604,7 @@ extern "C" { } } else { - fake_print_warning_settings_content_empty(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings); + fake_print_warning_settings_content_empty(main, main.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings); } } } // for @@ -616,17 +616,17 @@ extern "C" { } } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); } if (F_status_is_error_not(*status) && data_make->setting_make.load_build) { f_string_static_t stub = f_string_static_t_initialize; - fake_build_load_setting(data, stub, &data_make->setting_build, status); + fake_build_load_setting(main, stub, &data_make->setting_build, status); if (F_status_is_error(*status) && *status != F_status_set_error(F_signal)) { - fll_error_print(data.error, F_status_set_fine(*status), "fake_build_load_setting", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fake_build_load_setting", F_true); } } @@ -647,7 +647,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_partial_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_partial_append", F_true); f_macro_fss_set_t_delete_simple(settings); return; @@ -655,11 +655,11 @@ extern "C" { f_string_map_multis_t define = f_string_map_multis_t_initialize; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); } else { - fake_build_load_setting_process(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects, settings.contents, &data_make->setting_build, status); + fake_build_load_setting_process(main, main.file_data_build_fakefile.string, data_make->buffer, settings.objects, settings.contents, &data_make->setting_build, status); } if (F_status_is_error_not(*status) && settings.objects.used) { @@ -681,7 +681,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)) { - fll_error_print(data.error, F_status_set_fine(*status), "fll_fss_snatch_map_apart", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "fll_fss_snatch_map_apart", F_true); f_macro_string_map_multis_t_delete_simple(define); f_macro_fss_set_t_delete_simple(settings); @@ -705,7 +705,7 @@ extern "C" { *status = f_string_dynamic_mash(f_string_space_s, 1, define.array[i].value.array[j], &combined); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_mash_nulless", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_mash_nulless", F_true); break; } } // for @@ -714,31 +714,31 @@ extern "C" { *status = f_string_dynamic_terminate_after(&combined); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); break; } - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); break; } *status = f_environment_set(define.array[i].name.string, combined.string, F_true); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_environment_set", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_environment_set", F_true); break; } } else { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid characters in the define setting name '", fll_error_print_error); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid characters in the define setting name '", fll_error_print_error); - f_color_print_code(data.error.to.stream, *data.error.notable.before); - f_print_dynamic(data.error.to.stream, define.array[i].name); - f_color_print_code(data.error.to.stream, *data.error.notable.after); + f_color_print_code(main.error.to.stream, *main.error.notable.before); + f_print_dynamic(main.error.to.stream, define.array[i].name); + f_color_print_code(main.error.to.stream, *main.error.notable.after); - f_color_print(data.error.to.stream, data.context.set.error, "', only alpha-numeric ASCII characters and underscore (without a leading digit) is %c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "', only alpha-numeric ASCII characters and underscore (without a leading digit) is %c", f_string_eol_s[0]); } *status = F_status_set_error(F_failure); @@ -755,29 +755,29 @@ extern "C" { #endif // _di_fake_make_load_fakefile_ #ifndef _di_fake_make_load_parameters_ - void fake_make_load_parameters(const fake_data_t data, fake_make_data_t *data_make, f_status_t *status) { + void fake_make_load_parameters(const fake_main_t main, fake_make_data_t *data_make, f_status_t *status) { if (F_status_is_error(*status)) return; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { *status = F_status_set_error(F_signal); return; } - if (data.context.mode != f_color_mode_none) { + if (main.context.mode != f_color_mode_none) { if (data_make->parameter.color.used >= data_make->parameter.color.size) { *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->parameter.color); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); return; } } - if (data.context.mode == f_color_mode_no_color) { - if (data.parameters[fake_parameter_no_color].type == f_console_type_normal) { + if (main.context.mode == f_color_mode_no_color) { + if (main.parameters[fake_parameter_no_color].type == f_console_type_normal) { *status = f_string_append(f_console_symbol_short_enable_s, 1, &data_make->parameter.color.array[data_make->parameter.color.used]); } - else if (data.parameters[fake_parameter_no_color].type == f_console_type_inverse) { + else if (main.parameters[fake_parameter_no_color].type == f_console_type_inverse) { *status = f_string_append(f_console_symbol_short_disable_s, 1, &data_make->parameter.color.array[data_make->parameter.color.used]); } @@ -785,11 +785,11 @@ extern "C" { *status = f_string_append(f_console_standard_short_no_color_s, 1, &data_make->parameter.color.array[data_make->parameter.color.used]); } } - else if (data.context.mode == f_color_mode_dark) { - if (data.parameters[fake_parameter_dark].type == f_console_type_normal) { + else if (main.context.mode == f_color_mode_dark) { + if (main.parameters[fake_parameter_dark].type == f_console_type_normal) { *status = f_string_append(f_console_symbol_short_enable_s, 1, &data_make->parameter.color.array[data_make->parameter.color.used]); } - else if (data.parameters[fake_parameter_dark].type == f_console_type_inverse) { + else if (main.parameters[fake_parameter_dark].type == f_console_type_inverse) { *status = f_string_append(f_console_symbol_short_disable_s, 1, &data_make->parameter.color.array[data_make->parameter.color.used]); } @@ -797,11 +797,11 @@ extern "C" { *status = f_string_append(f_console_standard_short_dark_s, 1, &data_make->parameter.color.array[data_make->parameter.color.used]); } } - else if (data.context.mode == f_color_mode_light) { - if (data.parameters[fake_parameter_light].type == f_console_type_normal) { + else if (main.context.mode == f_color_mode_light) { + if (main.parameters[fake_parameter_light].type == f_console_type_normal) { *status = f_string_append(f_console_symbol_short_enable_s, 1, &data_make->parameter.color.array[data_make->parameter.color.used]); } - else if (data.parameters[fake_parameter_light].type == f_console_type_inverse) { + else if (main.parameters[fake_parameter_light].type == f_console_type_inverse) { *status = f_string_append(f_console_symbol_short_disable_s, 1, &data_make->parameter.color.array[data_make->parameter.color.used]); } @@ -811,7 +811,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append", F_true); return; } else { @@ -819,21 +819,21 @@ extern "C" { } } - if (data.error.verbosity != f_console_verbosity_normal) { + if (main.error.verbosity != f_console_verbosity_normal) { if (data_make->parameter.verbosity.used >= data_make->parameter.verbosity.size) { *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->parameter.verbosity); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); return; } } - if (data.error.verbosity == f_console_verbosity_quiet) { - if (data.parameters[fake_parameter_verbosity_quiet].type == f_console_type_normal) { + if (main.error.verbosity == f_console_verbosity_quiet) { + if (main.parameters[fake_parameter_verbosity_quiet].type == f_console_type_normal) { *status = f_string_append(f_console_symbol_short_enable_s, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (data.parameters[fake_parameter_verbosity_quiet].type == f_console_type_inverse) { + else if (main.parameters[fake_parameter_verbosity_quiet].type == f_console_type_inverse) { *status = f_string_append(f_console_symbol_short_disable_s, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } @@ -841,11 +841,11 @@ extern "C" { *status = f_string_append(f_console_standard_short_quiet_s, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } } - else if (data.error.verbosity == f_console_verbosity_verbose) { - if (data.parameters[fake_parameter_verbosity_verbose].type == f_console_type_normal) { + else if (main.error.verbosity == f_console_verbosity_verbose) { + if (main.parameters[fake_parameter_verbosity_verbose].type == f_console_type_normal) { *status = f_string_append(f_console_symbol_short_enable_s, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (data.parameters[fake_parameter_verbosity_verbose].type == f_console_type_inverse) { + else if (main.parameters[fake_parameter_verbosity_verbose].type == f_console_type_inverse) { *status = f_string_append(f_console_symbol_short_disable_s, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } @@ -853,11 +853,11 @@ extern "C" { *status = f_string_append(f_console_standard_short_verbose_s, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } } - else if (data.error.verbosity == f_console_verbosity_debug) { - if (data.parameters[fake_parameter_verbosity_debug].type == f_console_type_normal) { + else if (main.error.verbosity == f_console_verbosity_debug) { + if (main.parameters[fake_parameter_verbosity_debug].type == f_console_type_normal) { *status = f_string_append(f_console_symbol_short_enable_s, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (data.parameters[fake_parameter_verbosity_debug].type == f_console_type_inverse) { + else if (main.parameters[fake_parameter_verbosity_debug].type == f_console_type_inverse) { *status = f_string_append(f_console_symbol_short_disable_s, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } @@ -867,7 +867,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append", F_true); return; } else { @@ -882,13 +882,13 @@ extern "C" { }; const f_console_parameter_t *console[] = { - &data.parameters[fake_parameter_define], - &data.parameters[fake_parameter_mode], + &main.parameters[fake_parameter_define], + &main.parameters[fake_parameter_mode], }; const f_string_dynamics_t *source[] = { - &data.define, - &data.mode, + &main.define, + &main.mode, }; f_string_dynamics_t * const destination[] = { @@ -907,7 +907,7 @@ extern "C" { *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); return; } } @@ -924,7 +924,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append", F_true); return; } else { @@ -935,7 +935,7 @@ extern "C" { *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); return; } } @@ -943,7 +943,7 @@ extern "C" { *status = f_string_dynamic_append(source[i]->array[j], &destination[i]->array[destination[i]->used]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); return; } else { @@ -965,23 +965,23 @@ extern "C" { }; const f_console_parameter_t *console[] = { - &data.parameters[fake_parameter_fakefile], - &data.parameters[fake_parameter_path_build], - &data.parameters[fake_parameter_path_data], - &data.parameters[fake_parameter_path_sources], - &data.parameters[fake_parameter_path_work], - &data.parameters[fake_parameter_process], - &data.parameters[fake_parameter_settings], + &main.parameters[fake_parameter_fakefile], + &main.parameters[fake_parameter_path_build], + &main.parameters[fake_parameter_path_data], + &main.parameters[fake_parameter_path_sources], + &main.parameters[fake_parameter_path_work], + &main.parameters[fake_parameter_process], + &main.parameters[fake_parameter_settings], }; const f_string_dynamic_t *source[] = { - &data.fakefile, - &data.path_build, - &data.path_data, - &data.path_sources, - &data.path_work, - &data.process, - &data.settings, + &main.fakefile, + &main.path_build, + &main.path_data, + &main.path_sources, + &main.path_work, + &main.process, + &main.settings, }; f_string_dynamics_t * const destination[] = { @@ -1000,7 +1000,7 @@ extern "C" { *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); return; } } @@ -1017,7 +1017,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_append", F_true); return; } else { @@ -1028,7 +1028,7 @@ extern "C" { *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamics_increase_by", F_true); return; } } @@ -1036,7 +1036,7 @@ extern "C" { *status = f_string_dynamic_append(*source[i], &destination[i]->array[destination[i]->used]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); + fll_error_print(main.error, F_status_set_fine(*status), "f_string_dynamic_append", F_true); return; } else { @@ -1048,15 +1048,15 @@ extern "C" { #endif // _di_fake_make_load_parameters_ #ifndef _di_fake_make_operate_ - f_status_t fake_make_operate(fake_data_t *data) { + f_status_t fake_make_operate(fake_main_t *main) { - if (fake_signal_received(*data)) { + if (fake_signal_received(*main)) { return F_signal; } - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - f_color_print(data->output.stream, data->context.set.important, "Making project.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + f_color_print(main->output.stream, main->context.set.important, "Making project.%c", f_string_eol_s[0]); } f_status_t status = F_none; @@ -1068,11 +1068,11 @@ extern "C" { status = f_string_dynamics_increase(&data_make.path.stack); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true); return status; } - if (fake_signal_received(*data)) { + if (fake_signal_received(*main)) { fake_macro_make_data_t_delete_simple(data_make); return F_signal; } @@ -1080,7 +1080,7 @@ extern "C" { status = f_path_current(F_true, &data_make.path.stack.array[0]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_path_current", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_path_current", F_true); fake_macro_make_data_t_delete_simple(data_make); return status; @@ -1089,7 +1089,7 @@ extern "C" { status = f_directory_open(data_make.path.stack.array[0].string, F_false, &data_make.path.top.id); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_directory_open", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_directory_open", F_true); fake_macro_make_data_t_delete_simple(data_make); return status; @@ -1097,11 +1097,11 @@ extern "C" { data_make.path.stack.used = 1; - f_macro_mode_t_set_default_umask(mode, data->umask); + f_macro_mode_t_set_default_umask(mode, main->umask); - fake_make_load_parameters(*data, &data_make, &status); + fake_make_load_parameters(*main, &data_make, &status); - fake_make_load_fakefile(*data, &data_make, &status); + fake_make_load_fakefile(*main, &data_make, &status); if (F_status_is_error(status)) { fake_macro_make_data_t_delete_simple(data_make); @@ -1116,15 +1116,15 @@ extern "C" { if (data_make.setting_make.fail == fake_make_operation_fail_type_exit) { data_make.error.prefix = fll_error_print_error_s; - data_make.error.context = data->context.set.error; - data_make.error.notable = data->context.set.notable; + data_make.error.context = main->context.set.error; + data_make.error.notable = main->context.set.notable; data_make.error.to.stream = f_type_error; data_make.error.to.id = f_type_descriptor_error; } else if (data_make.setting_make.fail == fake_make_operation_fail_type_warn) { data_make.error.prefix = fll_error_print_warning_s; - data_make.error.context = data->context.set.warning; - data_make.error.notable = data->context.set.notable; + data_make.error.context = main->context.set.warning; + data_make.error.notable = main->context.set.notable; data_make.error.to.stream = f_type_warning; data_make.error.to.id = f_type_descriptor_warning; } @@ -1134,10 +1134,10 @@ extern "C" { } { - const int result = fake_make_operate_section(data_make.main, data, &data_make, §ion_stack, &status); + const int result = fake_make_operate_section(data_make.main, main, &data_make, §ion_stack, &status); if (status == F_child) { - data->child = result; + main->child = result; } } @@ -1148,13 +1148,13 @@ extern "C" { { f_status_t status_path = f_path_change_at(data_make.path.top.id); - if (F_status_is_error(status_path) && data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - f_color_print(data->output.stream, data->context.set.warning, "%sFailed change back to orignal path '", fll_error_print_warning); - f_color_print(data->output.stream, data->context.set.notable, "%s", data_make.path.stack.array[0].string); - f_color_print(data->output.stream, data->context.set.warning, "', status code = "); - f_color_print(data->output.stream, data->context.set.notable, "%llu", F_status_set_fine(status_path)); - f_color_print(data->output.stream, data->context.set.warning, ".%c", f_string_eol_s[0]); + if (F_status_is_error(status_path) && main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + f_color_print(main->output.stream, main->context.set.warning, "%sFailed change back to orignal path '", fll_error_print_warning); + f_color_print(main->output.stream, main->context.set.notable, "%s", data_make.path.stack.array[0].string); + f_color_print(main->output.stream, main->context.set.warning, "', status code = "); + f_color_print(main->output.stream, main->context.set.notable, "%llu", F_status_set_fine(status_path)); + f_color_print(main->output.stream, main->context.set.warning, ".%c", f_string_eol_s[0]); } } @@ -1173,7 +1173,7 @@ extern "C" { #endif // _di_fake_make_operate_ #ifndef _di_fake_make_operate_expand_ - void fake_make_operate_expand(const fake_data_t data, const f_string_range_t section_name, const f_array_length_t operation, const f_string_static_t operation_name, const f_fss_content_t content, const f_fss_quotes_t quotes, fake_make_data_t *data_make, f_string_dynamics_t *arguments, f_status_t *status) { + void fake_make_operate_expand(const fake_main_t main, const f_string_range_t section_name, const f_array_length_t operation, const f_string_static_t operation_name, const f_fss_content_t content, const f_fss_quotes_t quotes, fake_make_data_t *data_make, f_string_dynamics_t *arguments, f_status_t *status) { if (F_status_is_error(*status)) return; if (!content.used) return; @@ -1470,7 +1470,7 @@ extern "C" { if (F_status_is_error(*status)) break; if (unmatched) { - *status = fake_make_operate_expand_build(data, quotes.array[i], iki_content.array[j], data_make, arguments); + *status = fake_make_operate_expand_build(main, quotes.array[i], iki_content.array[j], data_make, arguments); if (F_status_is_error(*status)) { fll_error_print(data_make->error, F_status_set_fine(*status), "fake_make_operate_expand_build", F_true); @@ -1479,7 +1479,7 @@ extern "C" { } } else if (define_is && data_make->setting_make.load_build) { - *status = fake_make_operate_expand_environment(data, quotes.array[i], iki_content.array[j], data_make, arguments); + *status = fake_make_operate_expand_environment(main, quotes.array[i], iki_content.array[j], data_make, arguments); if (F_status_is_error(*status)) { fll_error_print(data_make->error, F_status_set_fine(*status), "fake_make_operate_expand_environment", F_true); @@ -1552,7 +1552,7 @@ extern "C" { #endif // _di_fake_make_operate_expand_ #ifndef _di_fake_make_operate_expand_build_ - f_status_t fake_make_operate_expand_build(const fake_data_t data, const f_fss_quote_t quoted, const f_string_range_t range_name, fake_make_data_t *data_make, f_string_dynamics_t *arguments) { + f_status_t fake_make_operate_expand_build(const fake_main_t main, const f_fss_quote_t quoted, const f_string_range_t range_name, fake_make_data_t *data_make, f_string_dynamics_t *arguments) { f_status_t status = F_none; f_string_dynamic_t value = f_string_dynamic_t_initialize; @@ -1833,7 +1833,7 @@ extern "C" { #endif // _di_fake_make_operate_expand_build_ #ifndef _di_fake_make_operate_expand_environment_ - f_status_t fake_make_operate_expand_environment(const fake_data_t data, const f_fss_quote_t quoted, const f_string_range_t range_name, fake_make_data_t *data_make, f_string_dynamics_t *arguments) { + f_status_t fake_make_operate_expand_environment(const fake_main_t main, const f_fss_quote_t quoted, const f_string_range_t range_name, fake_make_data_t *data_make, f_string_dynamics_t *arguments) { f_status_t status = F_none; f_string_dynamic_t value = f_string_dynamic_t_initialize; @@ -1889,10 +1889,10 @@ extern "C" { #endif // _di_fake_make_operate_expand_environment_ #ifndef _di_fake_make_operate_section_ - int fake_make_operate_section(const f_array_length_t id_section, fake_data_t *data, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) { - if (F_status_is_error(*status) || *status == F_child) return data->child; + int fake_make_operate_section(const f_array_length_t id_section, fake_main_t *main, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) { + if (F_status_is_error(*status) || *status == F_child) return main->child; - if (fake_signal_received(*data)) { + if (fake_signal_received(*main)) { *status = F_status_set_error(F_signal); return 0; } @@ -1919,16 +1919,16 @@ extern "C" { const f_fss_named_t *section = &data_make->fakefile.array[id_section]; - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); - f_color_print(data->output.stream, data->context.set.important, "Processing Section '"); + f_color_print(main->output.stream, main->context.set.important, "Processing Section '"); - f_color_print_code(data->output.stream, *data->context.set.notable.before); - f_print_dynamic_partial(data->output.stream, data_make->buffer, section->name); - f_color_print_code(data->output.stream, *data->context.set.notable.after); + f_color_print_code(main->output.stream, *main->context.set.notable.before); + f_print_dynamic_partial(main->output.stream, data_make->buffer, section->name); + f_color_print_code(main->output.stream, *main->context.set.notable.after); - f_color_print(data->output.stream, data->context.set.important, "'.%c", f_string_eol_s[0]); + f_color_print(main->output.stream, main->context.set.important, "'.%c", f_string_eol_s[0]); } if (!section->objects.used) { @@ -2058,7 +2058,7 @@ extern "C" { operation = 0; operation_name = 0; - if (fake_signal_received(*data)) { + if (fake_signal_received(*main)) { *status = F_status_set_error(F_signal); break; } @@ -2073,13 +2073,13 @@ extern "C" { } // for if (!operation) { - fake_print_message_section_operation_unknown(*data, data_make->error, data_make->buffer, section->name, section->objects.array[i]); + fake_print_message_section_operation_unknown(*main, data_make->error, data_make->buffer, section->name, section->objects.array[i]); *status = F_status_set_error(F_valid_not); } else if (operation == fake_make_operation_type_operate) { if (section_stack->used == fake_make_section_stack_max) { - fake_print_message_section_operation_stack_max(*data, data_make->error, data_make->buffer, section->name, section->objects.array[i], fake_make_section_stack_max); + fake_print_message_section_operation_stack_max(*main, data_make->error, data_make->buffer, section->name, section->objects.array[i], fake_make_section_stack_max); *status = F_status_set_error(F_recurse); } @@ -2088,7 +2088,7 @@ extern "C" { if (F_status_is_error_not(*status)) { operations[i] = operation; - fake_make_operate_expand(*data, section->name, operation, *operation_name, section->contents.array[i], section->quotess.array[i], data_make, &arguments[i], status); + fake_make_operate_expand(*main, section->name, operation, *operation_name, section->contents.array[i], section->quotess.array[i], data_make, &arguments[i], status); } if (operation_if == fake_make_operation_if_type_true_next) { @@ -2101,7 +2101,7 @@ extern "C" { operation_if = fake_make_operation_if_type_false_always; } - fake_make_operate_validate(*data, section->name, operation, *operation_name, arguments[i], &operation_if, data_make, section_stack, status); + fake_make_operate_validate(*main, section->name, operation, *operation_name, arguments[i], &operation_if, data_make, section_stack, status); if (F_status_is_error_not(*status)) { @@ -2118,7 +2118,7 @@ extern "C" { continue; } - const int result = fake_make_operate_process(section->name, operation, *operation_name, arguments[i], success, &operation_if, data, data_make, section_stack, status); + const int result = fake_make_operate_process(section->name, operation, *operation_name, arguments[i], success, &operation_if, main, data_make, section_stack, status); if (*status == F_child) { return result; @@ -2182,13 +2182,13 @@ extern "C" { if (F_status_set_fine(*status) == F_signal_abort && !section_stack->used) { data_make->setting_make.fail = fake_make_operation_fail_type_exit; data_make->error.prefix = fll_error_print_error; - data_make->error.context = data->context.set.error; - data_make->error.notable = data->context.set.notable; + data_make->error.context = main->context.set.error; + data_make->error.notable = main->context.set.notable; data_make->error.to.stream = f_type_error; data_make->error.to.id = f_type_descriptor_error; } - fake_print_message_section_operation_failed(*data, data_make->error, data_make->buffer, section->name, section->objects.array[i]); + fake_print_message_section_operation_failed(*main, data_make->error, data_make->buffer, section->name, section->objects.array[i]); // F_signal_abort is used by the break section operation. if (F_status_set_fine(*status) == F_signal_abort) { @@ -2240,7 +2240,7 @@ extern "C" { if (i == section->objects.used && (operation_if == fake_make_operation_if_type_true_next || operation_if == fake_make_operation_if_type_false_next || operation_if == fake_make_operation_if_type_else_true || operation_if == fake_make_operation_if_type_else_false)) { - if (data->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { const char *type_name = 0; if (operation_if == fake_make_operation_if_type_true_next || operation_if == fake_make_operation_if_type_false_next) { @@ -2256,7 +2256,7 @@ extern "C" { f_color_print(data_make->error.to.stream, data_make->error.context, "' at end of section.%c", f_string_eol_s[0]); } - fake_print_message_section_operation_failed(*data, data_make->error, data_make->buffer, section->name, section->objects.array[section->objects.used - 1]); + fake_print_message_section_operation_failed(*main, data_make->error, data_make->buffer, section->name, section->objects.array[section->objects.used - 1]); *status = F_status_set_error(F_failure); } @@ -2277,11 +2277,11 @@ extern "C" { #endif // _di_fake_make_operate_section_ #ifndef _di_fake_make_operate_process_ - int fake_make_operate_process(const f_string_range_t section_name, const uint8_t operation, const f_string_static_t operation_name, const f_string_dynamics_t arguments, const bool success, uint8_t *operation_if, fake_data_t *data, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) { - if (*status == F_child) return data->child; + int fake_make_operate_process(const f_string_range_t section_name, const uint8_t operation, const f_string_static_t operation_name, const f_string_dynamics_t arguments, const bool success, uint8_t *operation_if, fake_main_t *main, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) { + if (*status == F_child) return main->child; if (operation == fake_make_operation_type_index) { - const f_status_t result = fake_execute(*data, data_make->environment, data_make->setting_build.build_indexer, arguments, status); + const f_status_t result = fake_execute(*main, data_make->environment, data_make->setting_build.build_indexer, arguments, status); if (F_status_is_error(*status)) { fll_error_print(data_make->error, F_status_set_fine(*status), "fake_execute", F_true); @@ -2291,7 +2291,7 @@ extern "C" { return result; } - fake_make_operate_process_return(*data, result, data_make, status); + fake_make_operate_process_return(*main, result, data_make, status); return 0; } @@ -2308,10 +2308,10 @@ extern "C" { return 0; } - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Breaking as '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.used ? arguments.array[0].string : fake_make_operation_argument_success); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Breaking as '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.used ? arguments.array[0].string : fake_make_operation_argument_success); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } return 0; @@ -2320,7 +2320,7 @@ extern "C" { if (operation == fake_make_operation_type_build) { f_string_static_t stub = f_string_static_t_initialize; - *status = fake_build_operate(arguments.used ? arguments.array[0] : stub, data); + *status = fake_build_operate(arguments.used ? arguments.array[0] : stub, main); if (F_status_set_fine(*status) == F_signal) { *status = F_status_set_error(F_signal); @@ -2328,17 +2328,17 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_make_operate_process_return(*data, 1, data_make, status); + fake_make_operate_process_return(*main, 1, data_make, status); } else { - fake_make_operate_process_return(*data, 0, data_make, status); + fake_make_operate_process_return(*main, 0, data_make, status); } return 0; } if (operation == fake_make_operation_type_clean) { - *status = fake_clean_operate(*data); + *status = fake_clean_operate(*main); if (F_status_set_fine(*status) == F_signal) { *status = F_status_set_error(F_signal); @@ -2346,10 +2346,10 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_make_operate_process_return(*data, 1, data_make, status); + fake_make_operate_process_return(*main, 1, data_make, status); } else { - fake_make_operate_process_return(*data, 0, data_make, status); + fake_make_operate_process_return(*main, 0, data_make, status); } return 0; @@ -2363,8 +2363,8 @@ extern "C" { f_array_length_t destination_length = 0; - if (data->error.verbosity == f_console_verbosity_verbose) { - recurse.output = data->output; + if (main->error.verbosity == f_console_verbosity_verbose) { + recurse.output = main->output; recurse.verbose = fake_verbose_print_clone; } @@ -2421,12 +2421,12 @@ extern "C" { fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_file_clone", F_true, arguments.array[i].string, "clone", fll_error_file_type_file); *status = F_status_set_error(F_failure); } - else if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Cloned '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "' to '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", destination); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + else if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Cloned '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "' to '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", destination); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } } else if (F_status_is_error(status_file)) { @@ -2440,7 +2440,7 @@ extern "C" { } if (operation == fake_make_operation_type_compile) { - const int result = fake_execute(*data, data_make->environment, data_make->setting_build.build_compiler, arguments, status); + const int result = fake_execute(*main, data_make->environment, data_make->setting_build.build_compiler, arguments, status); if (F_status_is_error(*status)) { fll_error_print(data_make->error, F_status_set_fine(*status), "fake_execute", F_true); @@ -2450,7 +2450,7 @@ extern "C" { return result; } - fake_make_operate_process_return(*data, result, data_make, status); + fake_make_operate_process_return(*main, result, data_make, status); return 0; } @@ -2465,10 +2465,10 @@ extern "C" { f_mode_t mode = f_mode_t_initialize; - f_macro_mode_t_set_default_umask(mode, data->umask); + f_macro_mode_t_set_default_umask(mode, main->umask); - if (data->error.verbosity == f_console_verbosity_verbose) { - recurse.output = data->output; + if (main->error.verbosity == f_console_verbosity_verbose) { + recurse.output = main->output; recurse.verbose = fake_verbose_print_copy; } @@ -2525,12 +2525,12 @@ extern "C" { fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_file_copy", F_true, arguments.array[i].string, "copy", fll_error_file_type_file); *status = F_status_set_error(F_failure); } - else if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Copied '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "' to '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", destination); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + else if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Copied '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "' to '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", destination); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } } else if (F_status_is_error(status_file)) { @@ -2555,10 +2555,10 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(data_make->error, F_status_set_fine(*status), "f_environment_set", F_true); } - else if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Defined environment variable '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.array[0].string); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + else if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Defined environment variable '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.array[0].string); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } return 0; @@ -2575,11 +2575,11 @@ extern "C" { if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found_not) { - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - f_color_print(data->output.stream, data->context.set.warning, "%sthe file '", fll_error_print_warning); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.array[i].string); - f_color_print(data->output.stream, data->context.set.warning, "' was not found.%c", f_string_eol_s[0]); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + f_color_print(main->output.stream, main->context.set.warning, "%sthe file '", fll_error_print_warning); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.array[i].string); + f_color_print(main->output.stream, main->context.set.warning, "' was not found.%c", f_string_eol_s[0]); } *status = F_none; @@ -2590,7 +2590,7 @@ extern "C" { } } else if (f_macro_file_type_is_directory(file_stat.st_mode)) { - if (data->error.verbosity == f_console_verbosity_verbose) { + if (main->error.verbosity == f_console_verbosity_verbose) { *status = f_directory_remove_custom(arguments.array[i].string, recursion_max, F_false, fake_clean_remove_recursively_verbosely); } else { @@ -2598,10 +2598,10 @@ extern "C" { } if (F_status_set_fine(*status) == F_file_found_not) { - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "The directory '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "' does not exist.%c", f_string_eol_s[0]); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "The directory '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "' does not exist.%c", f_string_eol_s[0]); } *status = F_none; @@ -2611,20 +2611,20 @@ extern "C" { fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_directory_remove", F_true, arguments.array[i].string, "delete", fll_error_file_type_directory); return 0; } - else if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Removed '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + else if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Removed '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } } else { *status = f_file_remove(arguments.array[i].string); if (F_status_set_fine(*status) == F_file_found_not) { - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "The file '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "' does not exist.%c", f_string_eol_s[0]); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "The file '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "' does not exist.%c", f_string_eol_s[0]); } *status = F_none; @@ -2634,10 +2634,10 @@ extern "C" { fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_remove", F_true, arguments.array[i].string, "delete", fll_error_file_type_file); return 0; } - else if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Removed '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + else if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Removed '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } } } // for @@ -2668,8 +2668,8 @@ extern "C" { // forcing exit forces fail mode. data_make->setting_make.fail = fake_make_operation_fail_type_exit; data_make->error.prefix = fll_error_print_error; - data_make->error.context = data->context.set.error; - data_make->error.notable = data->context.set.notable; + data_make->error.context = main->context.set.error; + data_make->error.notable = main->context.set.notable; data_make->error.to.stream = f_type_error; data_make->error.to.id = f_type_descriptor_error; } @@ -2677,10 +2677,10 @@ extern "C" { return 0; } - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Exiting as '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.used ? arguments.array[0].string : fake_make_operation_argument_success); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Exiting as '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.used ? arguments.array[0].string : fake_make_operation_argument_success); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } return 0; @@ -2691,16 +2691,16 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_exit, arguments.array[0], fake_make_operation_argument_exit_length) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_type_exit; data_make->error.prefix = fll_error_print_error; - data_make->error.context = data->context.set.error; - data_make->error.notable = data->context.set.notable; + data_make->error.context = main->context.set.error; + data_make->error.notable = main->context.set.notable; data_make->error.to.stream = f_type_error; data_make->error.to.id = f_type_descriptor_error; } else if (fl_string_dynamic_compare_string(fake_make_operation_argument_warn, arguments.array[0], fake_make_operation_argument_warn_length) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_type_warn; data_make->error.prefix = fll_error_print_warning; - data_make->error.context = data->context.set.warning; - data_make->error.notable = data->context.set.notable; + data_make->error.context = main->context.set.warning; + data_make->error.notable = main->context.set.notable; data_make->error.to.stream = f_type_warning; data_make->error.to.id = f_type_descriptor_warning; } @@ -2710,20 +2710,20 @@ extern "C" { data_make->error.to.id = -1; } - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Set failure state to '"); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Set failure state to '"); if (data_make->setting_make.fail == fake_make_operation_fail_type_exit) { - f_color_print(data->output.stream, data->context.set.notable, "%s", fake_make_operation_argument_exit); + f_color_print(main->output.stream, main->context.set.notable, "%s", fake_make_operation_argument_exit); } else if (data_make->setting_make.fail == fake_make_operation_fail_type_warn) { - f_color_print(data->output.stream, data->context.set.notable, "%s", fake_make_operation_argument_warn); + f_color_print(main->output.stream, main->context.set.notable, "%s", fake_make_operation_argument_warn); } else if (data_make->setting_make.fail == fake_make_operation_fail_type_ignore) { - f_color_print(data->output.stream, data->context.set.notable, "%s", fake_make_operation_argument_ignore); + f_color_print(main->output.stream, main->context.set.notable, "%s", fake_make_operation_argument_ignore); } - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } return 0; @@ -2732,19 +2732,19 @@ extern "C" { if (operation == fake_make_operation_type_group) { gid_t id = 0; - *status = fake_make_get_id_group(*data, data_make->error, arguments.array[0], &id); + *status = fake_make_get_id_group(*main, data_make->error, arguments.array[0], &id); if (F_status_is_error(*status)) return 0; f_status_t status_file = F_none; for (f_array_length_t i = 1; i < arguments.used; i++) { - status_file = fake_make_assure_inside_project(*data, arguments.array[i], data_make); + status_file = fake_make_assure_inside_project(*main, arguments.array[i], data_make); if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_section_operation_path_outside(*data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); + fake_print_message_section_operation_path_outside(*main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); continue; } @@ -2756,12 +2756,12 @@ extern "C" { fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_role_change", F_true, arguments.array[i].string, "change group of", fll_error_file_type_file); } - else if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Changed group of '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "' to "); - f_color_print(data->output.stream, data->context.set.notable, "%llu", id); - fprintf(data->output.stream, ".%c", f_string_eol_s[0]); + else if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Changed group of '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "' to "); + f_color_print(main->output.stream, main->context.set.notable, "%llu", id); + fprintf(main->output.stream, ".%c", f_string_eol_s[0]); } } // for @@ -2771,19 +2771,19 @@ extern "C" { if (operation == fake_make_operation_type_groups) { gid_t id = 0; - *status = fake_make_get_id_group(*data, data_make->error, arguments.array[0], &id); + *status = fake_make_get_id_group(*main, data_make->error, arguments.array[0], &id); if (F_status_is_error(*status)) return 0; f_status_t status_file = F_none; for (f_array_length_t i = 1; i < arguments.used; i++) { - status_file = fake_make_assure_inside_project(*data, arguments.array[i], data_make); + status_file = fake_make_assure_inside_project(*main, arguments.array[i], data_make); if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_section_operation_path_outside(*data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); + fake_print_message_section_operation_path_outside(*main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); continue; } @@ -2795,12 +2795,12 @@ extern "C" { fll_error_file_print(data_make->error, F_status_set_fine(*status), "fll_file_role_change_all", F_true, arguments.array[i].string, "change group of", fll_error_file_type_file); } - else if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Changed group of '"); - f_color_print(data->output.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "' to "); - f_color_print(data->output.stream, data->context.set.notable, "%llu", id); - fprintf(data->output.stream, ".%c", f_string_eol_s[0]); + else if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Changed group of '"); + f_color_print(main->output.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "' to "); + f_color_print(main->output.stream, main->context.set.notable, "%llu", id); + fprintf(main->output.stream, ".%c", f_string_eol_s[0]); } } // for @@ -2834,7 +2834,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_group) { uid_t id = 0; - *status = fake_make_get_id_group(*data, data_make->error, arguments.array[1], &id); + *status = fake_make_get_id_group(*main, data_make->error, arguments.array[1], &id); if (F_status_is_error(*status)) return 0; uid_t id_file = 0; @@ -2872,7 +2872,7 @@ extern "C" { { uint8_t mode_replace = 0; - *status = fake_make_get_id_mode(*data, data_make->error, arguments.array[2], &mode_rule, &mode_replace); + *status = fake_make_get_id_mode(*main, data_make->error, arguments.array[2], &mode_rule, &mode_replace); if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; @@ -2922,7 +2922,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_owner) { uid_t id = 0; - *status = fake_make_get_id_owner(*data, data_make->error, arguments.array[1], &id); + *status = fake_make_get_id_owner(*main, data_make->error, arguments.array[1], &id); if (F_status_is_error(*status)) return 0; uid_t id_file = 0; @@ -3263,18 +3263,18 @@ extern "C" { *status = F_status_set_error(F_failure); *operation_if = fake_make_operation_if_type_false_always_next; - if (data->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); if ((i == 1 && number_left > f_number_t_size_unsigned) || (i > 1 && number_right > f_number_t_size_unsigned)) { - f_color_print(data->error.to.stream, data_make->error.context, "%sThe number '", data_make->error.prefix); - f_color_print(data->error.to.stream, data_make->error.notable, "%c%s", arguments.array[i].string); - f_color_print(data->error.to.stream, data_make->error.context, "' may only be between the ranges -%llu to %llu.%c", f_number_t_size_unsigned, f_number_t_size_unsigned, f_string_eol_s[0]); + f_color_print(main->error.to.stream, data_make->error.context, "%sThe number '", data_make->error.prefix); + f_color_print(main->error.to.stream, data_make->error.notable, "%c%s", arguments.array[i].string); + f_color_print(main->error.to.stream, data_make->error.context, "' may only be between the ranges -%llu to %llu.%c", f_number_t_size_unsigned, f_number_t_size_unsigned, f_string_eol_s[0]); } else { - f_color_print(data->error.to.stream, data_make->error.context, "%sInvalid or unsupported number provided '", data_make->error.prefix); - f_color_print(data->error.to.stream, data_make->error.notable, "%s", arguments.array[i].string); - f_color_print(data->error.to.stream, data_make->error.context, "'.%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, data_make->error.context, "%sInvalid or unsupported number provided '", data_make->error.prefix); + f_color_print(main->error.to.stream, data_make->error.notable, "%s", arguments.array[i].string); + f_color_print(main->error.to.stream, data_make->error.context, "'.%c", f_string_eol_s[0]); } } } @@ -3291,12 +3291,12 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_link", F_true, arguments.array[1].string, "create link", fll_error_file_type_file); } - else if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Created symbolic link from '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s", arguments.array[1].string); - fprintf(data->output.stream, "' to '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s", arguments.array[0].string); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + else if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Created symbolic link from '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s", arguments.array[1].string); + fprintf(main->output.stream, "' to '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s", arguments.array[0].string); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } return 0; @@ -3306,7 +3306,7 @@ extern "C" { f_file_mode_t mode_rule = 0; uint8_t replace = 0; - *status = fake_make_get_id_mode(*data, data_make->error, arguments.array[0], &mode_rule, &replace); + *status = fake_make_get_id_mode(*main, data_make->error, arguments.array[0], &mode_rule, &replace); if (F_status_is_error(*status)) return 0; mode_t mode = 0; @@ -3336,12 +3336,12 @@ extern "C" { break; } - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Changed mode of '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "' to "); - f_color_print(data->error.to.stream, data->context.set.notable, "%#o", mode); - fprintf(data->output.stream, ".%c", f_string_eol_s[0]); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Changed mode of '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "' to "); + f_color_print(main->error.to.stream, main->context.set.notable, "%#o", mode); + fprintf(main->output.stream, ".%c", f_string_eol_s[0]); } } // for @@ -3352,7 +3352,7 @@ extern "C" { f_file_mode_t mode_rule = 0; uint8_t replace = 0; - *status = fake_make_get_id_mode(*data, data_make->error, arguments.array[0], &mode_rule, &replace); + *status = fake_make_get_id_mode(*main, data_make->error, arguments.array[0], &mode_rule, &replace); if (F_status_is_error(*status)) return 0; mode_t mode = 0; @@ -3382,12 +3382,12 @@ extern "C" { break; } - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Changed mode of '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "' to "); - f_color_print(data->error.to.stream, data->context.set.notable, "%#o", mode); - fprintf(data->output.stream, ".%c", f_string_eol_s[0]); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Changed mode of '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "' to "); + f_color_print(main->error.to.stream, main->context.set.notable, "%#o", mode); + fprintf(main->output.stream, ".%c", f_string_eol_s[0]); } } // for @@ -3402,8 +3402,8 @@ extern "C" { f_array_length_t destination_length = 0; - if (data->error.verbosity == f_console_verbosity_verbose) { - recurse.output = data->output; + if (main->error.verbosity == f_console_verbosity_verbose) { + recurse.output = main->output; recurse.verbose = fake_verbose_print_move; } @@ -3469,7 +3469,7 @@ extern "C" { return 0; } - const int result = fake_make_operate_section(id_section, data, data_make, section_stack, status); + const int result = fake_make_operate_section(id_section, main, data_make, section_stack, status); // Ensure that a break only happens within its active operation stack. if (*status == F_signal_abort) { @@ -3485,19 +3485,19 @@ extern "C" { if (operation == fake_make_operation_type_owner) { uid_t id = 0; - *status = fake_make_get_id_owner(*data, data_make->error, arguments.array[0], &id); + *status = fake_make_get_id_owner(*main, data_make->error, arguments.array[0], &id); if (F_status_is_error(*status)) return 0; f_status_t status_file = F_none; for (f_array_length_t i = 1; i < arguments.used; i++) { - status_file = fake_make_assure_inside_project(*data, arguments.array[i], data_make); + status_file = fake_make_assure_inside_project(*main, arguments.array[i], data_make); if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_section_operation_path_outside(*data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); + fake_print_message_section_operation_path_outside(*main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); continue; } @@ -3510,12 +3510,12 @@ extern "C" { fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_role_change", F_true, arguments.array[i].string, "change owner of", fll_error_file_type_file); break; } - else if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Changed owner of '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "' to "); - f_color_print(data->error.to.stream, data->context.set.notable, "%d", id); - fprintf(data->output.stream, ".%c", f_string_eol_s[0]); + else if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Changed owner of '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "' to "); + f_color_print(main->error.to.stream, main->context.set.notable, "%d", id); + fprintf(main->output.stream, ".%c", f_string_eol_s[0]); } } // for @@ -3525,19 +3525,19 @@ extern "C" { if (operation == fake_make_operation_type_owners) { uid_t id = 0; - *status = fake_make_get_id_owner(*data, data_make->error, arguments.array[0], &id); + *status = fake_make_get_id_owner(*main, data_make->error, arguments.array[0], &id); if (F_status_is_error(*status)) return 0; f_status_t status_file = F_none; for (f_array_length_t i = 1; i < arguments.used; i++) { - status_file = fake_make_assure_inside_project(*data, arguments.array[i], data_make); + status_file = fake_make_assure_inside_project(*main, arguments.array[i], data_make); if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_section_operation_path_outside(*data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); + fake_print_message_section_operation_path_outside(*main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); continue; } @@ -3549,12 +3549,12 @@ extern "C" { fll_error_file_print(data_make->error, F_status_set_fine(*status), "fll_file_role_change_all", F_true, arguments.array[i].string, "change owner of", fll_error_file_type_file); } - else if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Changed owner of '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s", arguments.array[i].string); - fprintf(data->output.stream, "' to "); - f_color_print(data->error.to.stream, data->context.set.notable, "%d", id); - fprintf(data->output.stream, ".%c", f_string_eol_s[0]); + else if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Changed owner of '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s", arguments.array[i].string); + fprintf(main->output.stream, "' to "); + f_color_print(main->error.to.stream, main->context.set.notable, "%d", id); + fprintf(main->output.stream, ".%c", f_string_eol_s[0]); } } // for @@ -3569,23 +3569,23 @@ extern "C" { *status = f_path_change(data_make->path.stack.array[data_make->path.stack.used - 1].string); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_stack_max(*data, data_make->error, F_status_set_fine(*status), "f_path_change", data_make->path.stack.array[data_make->path.stack.used - 1].string); + fake_print_message_section_operation_path_stack_max(*main, data_make->error, F_status_set_fine(*status), "f_path_change", data_make->path.stack.array[data_make->path.stack.used - 1].string); return 0; } - if (data->error.verbosity == f_console_verbosity_verbose) { - *status = fake_make_path_relative(*data, data_make->path.stack.array[data_make->path.stack.used - 1], data_make); + if (main->error.verbosity == f_console_verbosity_verbose) { + *status = fake_make_path_relative(*main, data_make->path.stack.array[data_make->path.stack.used - 1], data_make); if (F_status_is_error(*status)) { fll_error_print(data_make->error, F_status_set_fine(*status), "fake_make_path_relative", F_true); return 0; } - fprintf(data->output.stream, "Changed to project path '"); - f_color_print_code(data->output.stream, *data->context.set.notable.before); - f_print_dynamic(data->output.stream, data_make->path_cache); - f_color_print_code(data->output.stream, *data->context.set.notable.after); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(main->output.stream, "Changed to project path '"); + f_color_print_code(main->output.stream, *main->context.set.notable.before); + f_print_dynamic(main->output.stream, data_make->path_cache); + f_color_print_code(main->output.stream, *main->context.set.notable.after); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } return 0; @@ -3593,29 +3593,29 @@ extern "C" { if (operation == fake_make_operation_type_print) { for (f_array_length_t i = 0; i < arguments.used; i++) { - f_print_dynamic(data->output.stream, arguments.array[i]); + f_print_dynamic(main->output.stream, arguments.array[i]); if (i + 1 < arguments.used) { - fprintf(data->output.stream, "%s", f_string_space_s); + fprintf(main->output.stream, "%s", f_string_space_s); } } // for - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); return 0; } if (operation == fake_make_operation_type_run) { - *status = fake_make_operate_process_run(*data, arguments, F_false, data_make); + *status = fake_make_operate_process_run(*main, arguments, F_false, data_make); return 0; } if (operation == fake_make_operation_type_shell) { - *status = fake_make_operate_process_run(*data, arguments, F_true, data_make); + *status = fake_make_operate_process_run(*main, arguments, F_true, data_make); return 0; } if (operation == fake_make_operation_type_skeleton) { - *status = fake_skeleton_operate(*data); + *status = fake_skeleton_operate(*main); if (F_status_set_fine(*status) == F_signal) { *status = F_status_set_error(F_signal); @@ -3623,20 +3623,20 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_make_operate_process_return(*data, 1, data_make, status); + fake_make_operate_process_return(*main, 1, data_make, status); } else { - fake_make_operate_process_return(*data, 0, data_make, status); + fake_make_operate_process_return(*main, 0, data_make, status); } return 0; } if (operation == fake_make_operation_type_to) { - *status = fake_make_assure_inside_project(*data, arguments.array[0], data_make); + *status = fake_make_assure_inside_project(*main, arguments.array[0], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(*data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[0].string); + fake_print_message_section_operation_path_outside(*main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[0].string); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -3648,14 +3648,14 @@ extern "C" { *status = f_path_change(arguments.array[0].string); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_stack_max(*data, data_make->error, F_status_set_fine(*status), "f_path_change", arguments.array[0].string); + fake_print_message_section_operation_path_stack_max(*main, data_make->error, F_status_set_fine(*status), "f_path_change", arguments.array[0].string); } else { if (data_make->path.stack.used == data_make->path.stack.size) { *status = f_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->path.stack); if (F_status_set_fine(*status) == F_array_too_large) { - fake_print_message_section_operation_path_stack_max(*data, data_make->error, F_array_too_large, "f_string_dynamics_increase_by", "path stack"); + fake_print_message_section_operation_path_stack_max(*main, data_make->error, F_array_too_large, "f_string_dynamics_increase_by", "path stack"); return 0; } else if (F_status_is_error(*status)) { @@ -3674,19 +3674,19 @@ extern "C" { return 0; } - if (data->error.verbosity == f_console_verbosity_verbose) { - *status = fake_make_path_relative(*data, data_make->path.stack.array[data_make->path.stack.used], data_make); + if (main->error.verbosity == f_console_verbosity_verbose) { + *status = fake_make_path_relative(*main, data_make->path.stack.array[data_make->path.stack.used], data_make); if (F_status_is_error(*status)) { fll_error_print(data_make->error, F_status_set_fine(*status), "fake_make_path_relative", F_true); return 0; } - fprintf(data->output.stream, "Changed to project path '"); - f_color_print_code(data->output.stream, *data->context.set.notable.before); - f_print_dynamic(data->output.stream, data_make->path_cache); - f_color_print_code(data->output.stream, *data->context.set.notable.after); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(main->output.stream, "Changed to project path '"); + f_color_print_code(main->output.stream, *main->context.set.notable.before); + f_print_dynamic(main->output.stream, data_make->path_cache); + f_color_print_code(main->output.stream, *main->context.set.notable.after); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } data_make->path.stack.used++; @@ -3700,12 +3700,12 @@ extern "C" { *status = f_path_change_at(data_make->path.top.id); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_stack_max(*data, data_make->error, F_status_set_fine(*status), "f_path_change", arguments.array[0].string); + fake_print_message_section_operation_path_stack_max(*main, data_make->error, F_status_set_fine(*status), "f_path_change", arguments.array[0].string); return 0; } - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Changed to project path ''.%c", f_string_eol_s[0]); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Changed to project path ''.%c", f_string_eol_s[0]); } // clear stack, except for the project root. @@ -3720,7 +3720,7 @@ extern "C" { if (operation == fake_make_operation_type_touch) { f_mode_t mode = f_mode_t_initialize; - f_macro_mode_t_set_default_umask(mode, data->umask); + f_macro_mode_t_set_default_umask(mode, main->umask); for (f_array_length_t i = 1; i < arguments.used; i++) { @@ -3753,12 +3753,12 @@ extern "C" { } } - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->output.stream, "Touched %s '", arguments.array[0].string); - f_color_print_code(data->output.stream, *data->context.set.notable.before); - f_print_dynamic(data->output.stream, arguments.array[i]); - f_color_print_code(data->output.stream, *data->context.set.notable.after); - fprintf(data->output.stream, "'.%c", f_string_eol_s[0]); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->output.stream, "Touched %s '", arguments.array[0].string); + f_color_print_code(main->output.stream, *main->context.set.notable.before); + f_print_dynamic(main->output.stream, arguments.array[i]); + f_color_print_code(main->output.stream, *main->context.set.notable.after); + fprintf(main->output.stream, "'.%c", f_string_eol_s[0]); } } // for @@ -3769,9 +3769,9 @@ extern "C" { #endif // _di_fake_make_operate_process_ #ifndef _di_fake_make_operate_process_execute_ - f_status_t fake_make_operate_process_execute(const fake_data_t data, const f_string_static_t program, const f_string_statics_t arguments, const bool as_shell, fake_make_data_t *data_make) { + f_status_t fake_make_operate_process_execute(const fake_main_t main, const f_string_static_t program, const f_string_statics_t arguments, const bool as_shell, fake_make_data_t *data_make) { - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { return F_status_set_error(F_signal); } @@ -3793,19 +3793,19 @@ extern "C" { return status; } - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "%s", program.string); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "%s", program.string); for (f_array_length_t i = 0; i < arguments.used; i++) { if (!arguments.array[i].used) continue; - fprintf(data.output.stream, " %s", arguments.array[i].string); + fprintf(main.output.stream, " %s", arguments.array[i].string); } // for - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); // flush to stdout before executing command. - fflush(data.output.stream); + fflush(main.output.stream); } int return_code = 0; @@ -3825,11 +3825,11 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data_make->error.context, "%sFailed to find program '", data_make->error.prefix); - f_color_print(data.error.to.stream, data_make->error.notable, "%s", program.string); - f_color_print(data.error.to.stream, data_make->error.context, "' for executing.%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, data_make->error.context, "%sFailed to find program '", data_make->error.prefix); + f_color_print(main.error.to.stream, data_make->error.notable, "%s", program.string); + f_color_print(main.error.to.stream, data_make->error.context, "' for executing.%c", f_string_eol_s[0]); } } else if (F_status_set_fine(status) != F_failure) { @@ -3837,14 +3837,14 @@ extern "C" { } } - fake_make_operate_process_return(data, return_code, data_make, &status); + fake_make_operate_process_return(main, return_code, data_make, &status); return status; } #endif // _di_fake_make_operate_process_execute_ #ifndef _di_fake_make_operate_process_return_ - void fake_make_operate_process_return(const fake_data_t data, const int return_code, fake_make_data_t *data_make, f_status_t *status) { + void fake_make_operate_process_return(const fake_main_t main, const int return_code, fake_make_data_t *data_make, f_status_t *status) { f_status_t status2 = F_none; data_make->setting_make.parameter.array[0].value.array[0].used = 0; @@ -3899,11 +3899,11 @@ extern "C" { return; } - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data_make->error.context, "%sFailed with return code '", data_make->error.prefix); - f_color_print(data.error.to.stream, data_make->error.notable, "%s", data_make->setting_make.parameter.array[0].value.array[0].string); - f_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, data_make->error.context, "%sFailed with return code '", data_make->error.prefix); + f_color_print(main.error.to.stream, data_make->error.notable, "%s", data_make->setting_make.parameter.array[0].value.array[0].string); + f_color_print(main.error.to.stream, data_make->error.context, "'.%c", f_string_eol_s[0]); } if (data_make->setting_make.fail == fake_make_operation_fail_type_exit) { @@ -3916,7 +3916,7 @@ extern "C" { #endif // _di_fake_make_operate_process_return_ #ifndef _di_fake_make_operate_process_run_ - f_status_t fake_make_operate_process_run(const fake_data_t data, const f_string_statics_t arguments, const bool as_shell, fake_make_data_t *data_make) { + f_status_t fake_make_operate_process_run(const fake_main_t main, const f_string_statics_t arguments, const bool as_shell, fake_make_data_t *data_make) { const f_string_static_t *program = &arguments.array[0]; f_status_t status = F_none; @@ -3954,7 +3954,7 @@ extern "C" { } // for } - status = fake_make_operate_process_execute(data, *program, args, as_shell, data_make); + status = fake_make_operate_process_execute(main, *program, args, as_shell, data_make); f_macro_string_dynamics_t_delete_simple(args); return status; @@ -3962,12 +3962,12 @@ extern "C" { #endif // _di_fake_make_operate_process_run_ #ifndef _di_fake_make_operate_validate_ - void fake_make_operate_validate(const fake_data_t data, const f_string_range_t section_name, const f_array_length_t operation, const f_string_static_t operation_name, const f_string_dynamics_t arguments, uint8_t *operation_if, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) { + void fake_make_operate_validate(const fake_main_t main, const f_string_range_t section_name, const f_array_length_t operation, const f_string_static_t operation_name, const f_string_dynamics_t arguments, uint8_t *operation_if, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) { if (F_status_is_error(*status)) return; if (operation == fake_make_operation_type_index || operation == fake_make_operation_type_run || operation == fake_make_operation_type_shell) { if (!arguments.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -3977,7 +3977,7 @@ extern "C" { else if (operation == fake_make_operation_type_index) { if (!data_make->setting_build.build_indexer.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sNo indexer has been specified, cannot perform '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, fake_make_operation_index); @@ -3993,7 +3993,7 @@ extern "C" { if (operation == fake_make_operation_type_break) { if (arguments.used > 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sHas too many arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4004,7 +4004,7 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_success, arguments.array[0], fake_make_operation_argument_success_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_failure, arguments.array[0], fake_make_operation_argument_failure_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sUnsupported break type '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[0].string); @@ -4021,7 +4021,7 @@ extern "C" { if (operation == fake_make_operation_type_build) { if (arguments.used > 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sHas too many arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4030,17 +4030,17 @@ extern "C" { } else if (arguments.used) { if (arguments.array[0].used) { - char path_file[data.path_data_build.used + arguments.array[0].used + 1]; + char path_file[main.path_data_build.used + arguments.array[0].used + 1]; - memcpy(path_file, data.path_data_build.string, data.path_data_build.used); - memcpy(path_file + data.path_data_build.used, arguments.array[0].string, arguments.array[0].used); + memcpy(path_file, main.path_data_build.string, main.path_data_build.used); + memcpy(path_file + main.path_data_build.used, arguments.array[0].string, arguments.array[0].used); - path_file[data.path_data_build.used + arguments.array[0].used] = 0; + path_file[main.path_data_build.used + arguments.array[0].used] = 0; f_status_t status_file = f_file_is(path_file, f_file_type_regular, F_false); if (status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sFailed to find file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", path_file); @@ -4054,7 +4054,7 @@ extern "C" { *status = status_file; } else if (!status_file) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sThe file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", path_file); @@ -4065,7 +4065,7 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sFilename argument must not be an empty string.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4079,7 +4079,7 @@ extern "C" { if (operation == fake_make_operation_type_clean || operation == fake_make_operation_type_pop || operation == fake_make_operation_type_top || operation == fake_make_operation_type_skeleton) { if (arguments.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sHas too many arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4089,7 +4089,7 @@ extern "C" { else if (operation == fake_make_operation_type_pop) { if (data_make->path.stack.used == 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sMust not attempt to pop project root off of path stack.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4105,10 +4105,10 @@ extern "C" { if (arguments.used > 1) { for (f_array_length_t i = 0; i < arguments.used; i++) { - *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); + *status = fake_make_assure_inside_project(main, arguments.array[i], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); + fake_print_message_section_operation_path_outside(main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4119,7 +4119,7 @@ extern "C" { for (f_array_length_t i = 0; i < arguments.used - 1; i++) { if (f_file_exists(arguments.array[i].string) != F_true) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sFailed to find file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[i].string); @@ -4136,7 +4136,7 @@ extern "C" { f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); if (status_file == F_false || status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sThe last file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[arguments.used - 1].string); @@ -4159,7 +4159,7 @@ extern "C" { status_file = f_directory_is(arguments.array[1].string); if (status_file == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sThe last file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[1].string); @@ -4172,7 +4172,7 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4185,7 +4185,7 @@ extern "C" { if (operation == fake_make_operation_type_compile) { if (!arguments.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4193,7 +4193,7 @@ extern "C" { *status = F_status_set_error(F_failure); } else if (data_make->setting_build.build_compiler.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sNo compiler has been specified, cannot perform '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, fake_make_operation_compile); @@ -4210,10 +4210,10 @@ extern "C" { if (arguments.used > 1) { for (f_array_length_t i = 0; i < arguments.used; i++) { - *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); + *status = fake_make_assure_inside_project(main, arguments.array[i], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); + fake_print_message_section_operation_path_outside(main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4224,7 +4224,7 @@ extern "C" { for (f_array_length_t i = 0; i < arguments.used - 1; i++) { if (f_file_exists(arguments.array[i].string) != F_true) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sFailed to find file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[i].string); @@ -4241,7 +4241,7 @@ extern "C" { f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); if (status_file == F_false || status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sThe last file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[arguments.used - 1].string); @@ -4264,7 +4264,7 @@ extern "C" { status_file = f_directory_is(arguments.array[1].string); if (status_file == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sThe last file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[1].string); @@ -4277,7 +4277,7 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4292,10 +4292,10 @@ extern "C" { if (arguments.used) { for (f_array_length_t i = 0; i < arguments.used; i++) { - *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); + *status = fake_make_assure_inside_project(main, arguments.array[i], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); + fake_print_message_section_operation_path_outside(main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4304,7 +4304,7 @@ extern "C" { } // for } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4320,7 +4320,7 @@ extern "C" { *status = fake_make_operate_validate_define_name(arguments.array[0]); if (*status == F_none) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sDefine name must not be an empty string.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4328,7 +4328,7 @@ extern "C" { *status = F_status_set_error(F_failure); } else if (*status == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sInvalid characters in the define setting name '", data_make->error.prefix); @@ -4343,7 +4343,7 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4356,7 +4356,7 @@ extern "C" { if (operation == fake_make_operation_type_else) { if (*operation_if == fake_make_operation_if_type_else_true || *operation_if == fake_make_operation_if_type_else_false) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sMust not be used after another '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "else"); @@ -4370,7 +4370,7 @@ extern "C" { } if (*operation_if == fake_make_operation_if_type_true || *operation_if == fake_make_operation_if_type_false || *operation_if == fake_make_operation_if_type_false_always) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sMust not be used inside an ", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "if"); @@ -4384,7 +4384,7 @@ extern "C" { } if (*operation_if != fake_make_operation_if_type_else_true_next && *operation_if != fake_make_operation_if_type_else_false_next && *operation_if != fake_make_operation_if_type_else_false_next_always) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sHas no preceding if condition.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4396,7 +4396,7 @@ extern "C" { } if (arguments.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sHas too many arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4410,7 +4410,7 @@ extern "C" { if (operation == fake_make_operation_type_exit) { if (arguments.used > 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sHas too many arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4421,7 +4421,7 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_success, arguments.array[0], fake_make_operation_argument_success_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_failure, arguments.array[0], fake_make_operation_argument_failure_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sUnsupported exit type '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[0].string); @@ -4442,7 +4442,7 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_warn, arguments.array[0], fake_make_operation_argument_warn_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_ignore, arguments.array[0], fake_make_operation_argument_ignore_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sUnsupported fail type '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[0].string); @@ -4455,7 +4455,7 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4475,7 +4475,7 @@ extern "C" { status_file = f_file_is(arguments.array[i].string, f_file_type_regular, F_false); if (status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sFailed to find file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[i].string); @@ -4485,7 +4485,7 @@ extern "C" { *status = F_status_set_error(status_file); } else if (F_status_is_error(status_file)) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_is", F_true, arguments.array[i].string, "find", fll_error_file_type_directory); } @@ -4496,7 +4496,7 @@ extern "C" { return; } - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4508,7 +4508,7 @@ extern "C" { if (operation == fake_make_operation_type_if) { if (*operation_if == fake_make_operation_if_type_true || *operation_if == fake_make_operation_if_type_false || *operation_if == fake_make_operation_if_type_false_always) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sMust not be used after another '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "if"); @@ -4601,7 +4601,7 @@ extern "C" { } // for if (i == 14) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sUnsupported if type '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[0].string); @@ -4617,7 +4617,7 @@ extern "C" { if (arguments.used >= if_type_minimum[i]) { if (*operation_if == fake_make_operation_if_type_if_success || *operation_if == fake_make_operation_if_type_if_failure) { if (arguments.used > if_type_minimum[i]) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sHas too many arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4634,7 +4634,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_mode) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_is, arguments.array[1], fake_make_operation_argument_is_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_has, arguments.array[1], fake_make_operation_argument_has_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sUnsupported mode type '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[1].string); @@ -4649,7 +4649,7 @@ extern "C" { f_file_mode_t mode_rule = 0; uint8_t replace = 0; - *status = fake_make_get_id_mode(data, data_make->error, arguments.array[2], &mode_rule, &replace); + *status = fake_make_get_id_mode(main, data_make->error, arguments.array[2], &mode_rule, &replace); if (F_status_is_error(*status)) return; i = 3; @@ -4658,7 +4658,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_owner) { uid_t id = 0; - *status = fake_make_get_id_owner(data, data_make->error, arguments.array[1], &id); + *status = fake_make_get_id_owner(main, data_make->error, arguments.array[1], &id); if (F_status_is_error(*status)) return; i = 2; @@ -4667,7 +4667,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_group) { gid_t id = 0; - *status = fake_make_get_id_group(data, data_make->error, arguments.array[1], &id); + *status = fake_make_get_id_group(main, data_make->error, arguments.array[1], &id); if (F_status_is_error(*status)) return; i = 2; @@ -4709,7 +4709,7 @@ extern "C" { type_file |= 0x40; } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sUnsupported file type '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[i].string); @@ -4735,10 +4735,10 @@ extern "C" { if (i < arguments.used) { for (f_status_t status_file = F_none; i < arguments.used; i++) { - status_file = fake_make_assure_inside_project(data, arguments.array[i], data_make); + status_file = fake_make_assure_inside_project(main, arguments.array[i], data_make); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data, data_make->error, F_status_set_fine(status_file), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); + fake_print_message_section_operation_path_outside(main, data_make->error, F_status_set_fine(status_file), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); *operation_if = fake_make_operation_if_type_false_always_next; @@ -4780,7 +4780,7 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_environment, arguments.array[1], fake_make_operation_argument_environment_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_parameter, arguments.array[1], fake_make_operation_argument_parameter_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sUnsupported define type '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[1].string); @@ -4796,7 +4796,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_equal || *operation_if == fake_make_operation_if_type_if_equal_not) { if (arguments.used < 3) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4809,7 +4809,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_greater || *operation_if == fake_make_operation_if_type_if_greater_equal || *operation_if == fake_make_operation_if_type_if_less || *operation_if == fake_make_operation_if_type_if_less_equal) { if (arguments.used < 3) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4852,7 +4852,7 @@ extern "C" { if (F_status_is_error(status_number)) { *status = F_status_set_error(F_failure); - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); if (number > f_number_t_size_unsigned) { @@ -4874,7 +4874,7 @@ extern "C" { } } - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4887,7 +4887,7 @@ extern "C" { if (operation == fake_make_operation_type_link) { if (arguments.used > 2) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sHas too many arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4895,20 +4895,20 @@ extern "C" { *status = F_status_set_error(F_failure); } else if (arguments.used == 2) { - *status = fake_make_assure_inside_project(data, arguments.array[0], data_make); + *status = fake_make_assure_inside_project(main, arguments.array[0], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[0].string); + fake_print_message_section_operation_path_outside(main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[0].string); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); } } - *status = fake_make_assure_inside_project(data, arguments.array[1], data_make); + *status = fake_make_assure_inside_project(main, arguments.array[1], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[1].string); + fake_print_message_section_operation_path_outside(main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[1].string); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4916,7 +4916,7 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -4931,10 +4931,10 @@ extern "C" { if (arguments.used > 1) { for (f_array_length_t i = 0; i < arguments.used; i++) { - *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); + *status = fake_make_assure_inside_project(main, arguments.array[i], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); + fake_print_message_section_operation_path_outside(main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4945,7 +4945,7 @@ extern "C" { for (f_array_length_t i = 0; i < arguments.used - 1; i++) { if (f_file_exists(arguments.array[i].string) != F_true) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sFailed to find file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[i].string); @@ -4962,7 +4962,7 @@ extern "C" { f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); if (status_file == F_false || status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sThe last file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[arguments.used - 1].string); @@ -4985,7 +4985,7 @@ extern "C" { status_file = f_directory_is(arguments.array[1].string); if (status_file == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sThe last file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[1].string); @@ -4998,7 +4998,7 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -5011,7 +5011,7 @@ extern "C" { if (operation == fake_make_operation_type_operate) { if (arguments.used > 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sHas too many arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -5054,7 +5054,7 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -5066,7 +5066,7 @@ extern "C" { if (operation == fake_make_operation_type_to) { if (arguments.used > 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sHas too many arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -5078,7 +5078,7 @@ extern "C" { f_status_t status_file = f_file_is(arguments.array[0].string, f_file_type_directory, F_false); if (status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sFailed to find file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[0].string); @@ -5088,14 +5088,14 @@ extern "C" { *status = F_status_set_error(status_file); } else if (F_status_is_error(status_file)) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_is", F_true, data.file_data_build_fakefile.string, "find", fll_error_file_type_file); + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fll_error_file_print(data_make->error, F_status_set_fine(*status), "f_file_is", F_true, main.file_data_build_fakefile.string, "find", fll_error_file_type_file); } *status = status_file; } else if (!status_file) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sThe file '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[0].string); @@ -5106,14 +5106,14 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sFilename argument must not be an empty string.%c", data_make->error.prefix, f_string_eol_s[0]); } } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -5129,7 +5129,7 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_file, arguments.array[0], fake_make_operation_argument_file_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_directory, arguments.array[0], fake_make_operation_argument_directory_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sUnsupported file type '", data_make->error.prefix); f_color_print(data_make->error.to.stream, data_make->error.notable, "%s", arguments.array[0].string); @@ -5142,10 +5142,10 @@ extern "C" { for (f_array_length_t i = 1; i < arguments.used; i++) { - *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); + *status = fake_make_assure_inside_project(main, arguments.array[i], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); + fake_print_message_section_operation_path_outside(main, data_make->error, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -5154,7 +5154,7 @@ extern "C" { } // for } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + if (main.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { fprintf(data_make->error.to.stream, "%c", f_string_eol_s[0]); f_color_print(data_make->error.to.stream, data_make->error.context, "%sRequires more arguments.%c", data_make->error.prefix, f_string_eol_s[0]); } @@ -5189,7 +5189,7 @@ extern "C" { #endif // _di_fake_make_operate_validate_define_name_ #ifndef _di_fake_make_path_relative_ - f_status_t fake_make_path_relative(const fake_data_t data, const f_string_static_t path, fake_make_data_t *data_make) { + f_status_t fake_make_path_relative(const fake_main_t main, const f_string_static_t path, fake_make_data_t *data_make) { data_make->path_cache.used = 0; if (!path.used || path.used == data_make->path.stack.array[0].used) { diff --git a/level_3/fake/c/private-make.h b/level_3/fake/c/private-make.h index bf74540..92a9572 100644 --- a/level_3/fake/c/private-make.h +++ b/level_3/fake/c/private-make.h @@ -381,25 +381,25 @@ extern "C" { 0, \ } - #define fake_macro_make_data_t_delete_simple(data) \ - fake_macro_build_setting_t_delete_simple(data.setting_build) \ - fake_macro_make_setting_t_delete_simple(data.setting_make) \ - f_macro_string_maps_t_delete_simple(data.environment); \ - fake_macro_make_parameter_delete_simple(data.parameter) \ - fake_macro_make_path_delete_simple(data.path) \ - f_macro_fss_nameds_t_delete_simple(data.fakefile) \ - f_macro_string_dynamic_t_delete_simple(data.buffer); \ - f_macro_string_dynamic_t_delete_simple(data.path_cache); + #define fake_macro_make_data_t_delete_simple(structure) \ + fake_macro_build_setting_t_delete_simple(structure.setting_build) \ + fake_macro_make_setting_t_delete_simple(structure.setting_make) \ + f_macro_string_maps_t_delete_simple(structure.environment); \ + fake_macro_make_parameter_delete_simple(structure.parameter) \ + fake_macro_make_path_delete_simple(structure.path) \ + f_macro_fss_nameds_t_delete_simple(structure.fakefile) \ + f_macro_string_dynamic_t_delete_simple(structure.buffer); \ + f_macro_string_dynamic_t_delete_simple(structure.path_cache); #endif // _di_fake_make_data_t_ /** * Assure that a path is within the project root path. * - * @param data - * The program data. + * @param main + * The main data. * @param path * file path to get the real path of. - * @param data_make + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * The data_make.path_cache will be updated to reflect the full path to this file. * @@ -410,14 +410,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_assure_inside_project_ - extern f_status_t fake_make_assure_inside_project(const fake_data_t data, const f_string_static_t path, fake_make_data_t *data_make) f_attribute_visibility_internal; + extern f_status_t fake_make_assure_inside_project(const fake_main_t main, const f_string_static_t path, fake_make_data_t *data_make) f_attribute_visibility_internal; #endif // _di_fake_make_assure_inside_project_ /** * Get the group id from either a string representing the number or a string representing the name. * - * @param data - * The program data. + * @param main + * The main data. * @param error * The error/warning print data. * @param buffer @@ -432,14 +432,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_get_id_group_ - f_status_t fake_make_get_id_group(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, gid_t *id) f_attribute_visibility_internal; + f_status_t fake_make_get_id_group(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, gid_t *id) f_attribute_visibility_internal; #endif // _di_fake_make_get_id_group_ /** * Get the mode id from either a string representing the number or a string representing the mode. * - * @param data - * The program data. + * @param main + * The main data. * @param error * The error/warning print data. * @param buffer @@ -458,14 +458,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_get_id_mode_ - f_status_t fake_make_get_id_mode(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, f_file_mode_t *mode, uint8_t *replace) f_attribute_visibility_internal; + f_status_t fake_make_get_id_mode(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, f_file_mode_t *mode, uint8_t *replace) f_attribute_visibility_internal; #endif // _di_fake_make_get_id_mode_ /** * Get the user id from either a string representing the number or a string representing the name. * - * @param data - * The program data. + * @param main + * The main data. * @param error * The error/warning print data. * @param buffer @@ -480,7 +480,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_get_id_owner_ - f_status_t fake_make_get_id_owner(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, uid_t *id) f_attribute_visibility_internal; + f_status_t fake_make_get_id_owner(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, uid_t *id) f_attribute_visibility_internal; #endif // _di_fake_make_get_id_owner_ /** @@ -488,9 +488,9 @@ extern "C" { * * This will process any additional files as necessary, such as the build settings file. * - * @param data - * The program data. - * @param data_make + * @param main + * The main data. + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * @param status * The return status. @@ -502,15 +502,15 @@ extern "C" { * @see fake_build_load_setting() */ #ifndef _di_fake_make_load_fakefile_ - extern void fake_make_load_fakefile(const fake_data_t data, fake_make_data_t *data_make, f_status_t *status) f_attribute_visibility_internal; + extern void fake_make_load_fakefile(const fake_main_t main, fake_make_data_t *data_make, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_make_load_fakefile_ /** * Load the environment variables into a structure more readily available for using in parameter expansion. * - * @param data - * The program data. - * @param data_make + * @param main + * The main data. + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * @param status * The return status. @@ -520,7 +520,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_load_parameters_ - extern void fake_make_load_parameters(const fake_data_t data, fake_make_data_t *data_make, f_status_t *status) f_attribute_visibility_internal; + extern void fake_make_load_parameters(const fake_main_t main, fake_make_data_t *data_make, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_make_load_parameters_ /** @@ -529,8 +529,8 @@ extern "C" { * The first section operated on is the 'main' section. * The 'settings' section is only loaded into settings and is never operated on. * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -538,7 +538,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_operate_ - extern f_status_t fake_make_operate(fake_data_t *data) f_attribute_visibility_internal; + extern f_status_t fake_make_operate(fake_main_t *main) f_attribute_visibility_internal; #endif // _di_fake_make_operate_ /** @@ -546,8 +546,8 @@ extern "C" { * * This prints errors via data_make.error. * - * @param data - * The program data. + * @param main + * The main data. * @param section_name * The section name. * @param operation @@ -558,7 +558,7 @@ extern "C" { * The content array. * @param quoteds * The array of quoted associated with the content. - * @param data_make + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * @param arguments * The expanded arguments. @@ -568,19 +568,19 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_operate_expand_ - extern void fake_make_operate_expand(const fake_data_t data, const f_string_range_t section_name, const f_array_length_t operation, const f_string_static_t operation_name, const f_fss_content_t content, const f_fss_quotes_t quoteds, fake_make_data_t *data_make, f_string_dynamics_t *arguments, f_status_t *status) f_attribute_visibility_internal; + extern void fake_make_operate_expand(const fake_main_t main, const f_string_range_t section_name, const f_array_length_t operation, const f_string_static_t operation_name, const f_fss_content_t content, const f_fss_quotes_t quoteds, fake_make_data_t *data_make, f_string_dynamics_t *arguments, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_make_operate_expand_ /** * Perform the expand operation, specifically for the environment variables. * - * @param data - * The program data. + * @param main + * The main data. * @param quoted * The quoted associated with the content. * @param range_name * The range representing the variable content name string within the data_make->buffer. - * @param data_make + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * @param arguments * The expanded arguments. @@ -592,19 +592,19 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_operate_expand_environment_ - extern f_status_t fake_make_operate_expand_environment(const fake_data_t data, const f_fss_quote_t quoted, const f_string_range_t range_name, fake_make_data_t *data_make, f_string_dynamics_t *arguments) f_attribute_visibility_internal; + extern f_status_t fake_make_operate_expand_environment(const fake_main_t main, const f_fss_quote_t quoted, const f_string_range_t range_name, fake_make_data_t *data_make, f_string_dynamics_t *arguments) f_attribute_visibility_internal; #endif // _di_fake_make_operate_expand_environment_ /** * Perform the expand operation, specifically for the build settings. * - * @param data - * The program data. + * @param main + * The main data. * @param quoted * The quoted associated with the content. * @param range_name * The range representing the variable content name string within the data_make->buffer. - * @param data_make + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * @param arguments * The expanded arguments. @@ -616,7 +616,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_operate_expand_build_ - extern f_status_t fake_make_operate_expand_build(const fake_data_t data, const f_fss_quote_t quoted, const f_string_range_t range_name, fake_make_data_t *data_make, f_string_dynamics_t *arguments) f_attribute_visibility_internal; + extern f_status_t fake_make_operate_expand_build(const fake_main_t main, const f_fss_quote_t quoted, const f_string_range_t range_name, fake_make_data_t *data_make, f_string_dynamics_t *arguments) f_attribute_visibility_internal; #endif // _di_fake_make_operate_expand_build_ /** @@ -624,9 +624,9 @@ extern "C" { * * @param id_section * The array location id within the fakefile of the section to operate on. - * @param data - * The program data. - * @param data_make + * @param main + * The main data. + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * @param section_stack * The current operation stack. @@ -642,7 +642,7 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ #ifndef _di_fake_make_operate_section_ - int fake_make_operate_section(const f_array_length_t id_section, fake_data_t *data, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) f_attribute_visibility_internal; + int fake_make_operate_section(const f_array_length_t id_section, fake_main_t *main, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_make_operate_section_ /** @@ -660,9 +660,9 @@ extern "C" { * Whether or not a previous section operation succeeded or failed. * @param operation_if * The if-condition status for the current operation. - * @param data - * The program data. - * @param data_make + * @param main + * The main data. + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * @param section_stack * The current operation stack. @@ -676,14 +676,14 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ #ifndef _di_fake_make_operate_process_ - extern int fake_make_operate_process(const f_string_range_t section_name, const uint8_t operation, const f_string_static_t operation_name, const f_string_dynamics_t arguments, const bool success, uint8_t *operation_if, fake_data_t *data, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) f_attribute_visibility_internal; + extern int fake_make_operate_process(const f_string_range_t section_name, const uint8_t operation, const f_string_static_t operation_name, const f_string_dynamics_t arguments, const bool success, uint8_t *operation_if, fake_main_t *main, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_make_operate_process_ /** * Execute either the run operation or the shell operation. * - * @param data - * The program data. + * @param main + * The main data. * @param program * The program to be executed. * @param arguments @@ -691,24 +691,24 @@ extern "C" { * @param as_shell * When TRUE, this is a shell operation. * When FALSE, this is a run operation. - * @param data_make + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * * @return * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_operate_process_execute_ - extern f_status_t fake_make_operate_process_execute(const fake_data_t data, const f_string_static_t program, const f_string_statics_t arguments, const bool as_shell, fake_make_data_t *data_make) f_attribute_visibility_internal; + extern f_status_t fake_make_operate_process_execute(const fake_main_t main, const f_string_static_t program, const f_string_statics_t arguments, const bool as_shell, fake_make_data_t *data_make) f_attribute_visibility_internal; #endif // _di_fake_make_operate_process_execute_ /** * Handle the return code, converting it to a number. * - * @param data - * The program data. + * @param main + * The main data. * @param return_code * The return code to process. - * @param data_make + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * @param status * The return status. @@ -716,27 +716,27 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_operate_process_return_ - extern void fake_make_operate_process_return(const fake_data_t data, const int return_code, fake_make_data_t *data_make, f_status_t *status) f_attribute_visibility_internal; + extern void fake_make_operate_process_return(const fake_main_t main, const int return_code, fake_make_data_t *data_make, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_make_operate_process_return_ /** * Execute either the run operation or the shell operation. * - * @param data - * The program data. + * @param main + * The main data. * @param arguments * The arguments for the run or shell operation. * @param as_shell * When TRUE, this is a shell operation. * When FALSE, this is a run operation. - * @param data_make + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * * @return * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_operate_process_run_ - extern f_status_t fake_make_operate_process_run(const fake_data_t data, const f_string_statics_t arguments, const bool as_shell, fake_make_data_t *data_make) f_attribute_visibility_internal; + extern f_status_t fake_make_operate_process_run(const fake_main_t main, const f_string_statics_t arguments, const bool as_shell, fake_make_data_t *data_make) f_attribute_visibility_internal; #endif // _di_fake_make_operate_process_run_ /** @@ -745,8 +745,8 @@ extern "C" { * This performs pre-operation validations. * Additional issues may occure when running operations that are not detected nor detectable by this. * - * @param data - * The program data. + * @param main + * The main data. * @param section_name * The section name. * @param operation @@ -757,7 +757,7 @@ extern "C" { * The expanded arguments. * @param operation_if * The if-condition status for the current operation. - * @param data_make + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * @param section_stack * The current operation stack. @@ -767,7 +767,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_operate_validate_ - extern void fake_make_operate_validate(const fake_data_t data, const f_string_range_t section_name, const f_array_length_t operation, const f_string_static_t operation_name, const f_string_dynamics_t arguments, uint8_t *operation_if, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) f_attribute_visibility_internal; + extern void fake_make_operate_validate(const fake_main_t main, const f_string_range_t section_name, const f_array_length_t operation, const f_string_static_t operation_name, const f_string_dynamics_t arguments, uint8_t *operation_if, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) f_attribute_visibility_internal; #endif // _di_fake_make_operate_validate_ /** @@ -794,11 +794,11 @@ extern "C" { /** * Get a path, relative to the project root. * - * @param data - * The program data. + * @param main + * The main data. * @param path * The NULL terminated path to get the relative path of. - * @param data_make + * @param main_make * All make related setting data, including data from the fakefile and optionally build settings file. * The relative path is stored in data_make.path_cache. * @@ -806,7 +806,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_path_relative_ - extern f_status_t fake_make_path_relative(const fake_data_t data, const f_string_static_t path, fake_make_data_t *data_make) f_attribute_visibility_internal; + extern f_status_t fake_make_path_relative(const fake_main_t main, const f_string_static_t path, fake_make_data_t *data_make) f_attribute_visibility_internal; #endif // _di_fake_make_path_relative_ #ifdef __cplusplus diff --git a/level_3/fake/c/private-print.c b/level_3/fake/c/private-print.c index 107ff66..06ca369 100644 --- a/level_3/fake/c/private-print.c +++ b/level_3/fake/c/private-print.c @@ -10,220 +10,220 @@ extern "C" { #endif #ifndef _di_fake_print_error_build_operation_file_ - bool fake_print_error_build_operation_file(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t operation, const f_string_t how, const f_string_t source, const f_string_t destination, const bool fallback) { + bool fake_print_error_build_operation_file(const fake_main_t main, const f_status_t status, const f_string_t function, const f_string_t operation, const f_string_t how, const f_string_t source, const f_string_t destination, const bool fallback) { if (status == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sFailed to find '", fll_error_print_error); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to find '", fll_error_print_error); if (f_file_exists(source) == F_true) { - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } else { - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); } - f_color_print(data.error.to.stream, data.context.set.error, "' while trying to %s '", operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + f_color_print(main.error.to.stream, main.context.set.error, "' while trying to %s '", operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_false; } if (status == F_parameter) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling ", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", function); - f_color_print(data.error.to.stream, data.context.set.error, "() to %s '", operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling ", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", function); + f_color_print(main.error.to.stream, main.context.set.error, "() to %s '", operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_false; } if (status == F_name) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid name for '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid name for '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' or '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' or '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_false; } if (status == F_memory_not) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory, while trying to %s '", fll_error_print_error, operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory, while trying to %s '", fll_error_print_error, operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_false; } if (status == F_number_overflow) { - if (data.error.verbosity != f_console_verbosity_quiet) { + if (main.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sOverflow while trying to %s '", fll_error_print_error, operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sOverflow while trying to %s '", fll_error_print_error, operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_false; } if (status == F_directory) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid directory while trying to %s '", fll_error_print_error, operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid directory while trying to %s '", fll_error_print_error, operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_false; } if (status == F_access_denied) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sAccess denied while trying to %s '", fll_error_print_error, operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAccess denied while trying to %s '", fll_error_print_error, operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_false; } if (status == F_loop) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sLoop while trying to %s '", fll_error_print_error, operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sLoop while trying to %s '", fll_error_print_error, operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_false; } if (status == F_prohibited) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sProhibited by system while trying to %s '", fll_error_print_error, operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sProhibited by system while trying to %s '", fll_error_print_error, operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_false; } if (status == F_directory_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sFailed to %s '", fll_error_print_error, operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to %s '", fll_error_print_error, operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "' due to an invalid directory in the path.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "' due to an invalid directory in the path.%c", f_string_eol_s[0]); } return F_false; } if (status == F_failure) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sFailed to %s '", fll_error_print_error, operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to %s '", fll_error_print_error, operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_false; } - if (fll_error_print(data.error, status, function, F_false) == F_known_not && fallback && data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "UNKNOWN %s(", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", status); - f_color_print(data.error.to.stream, data.context.set.error, ") occurred while trying to %s '", operation); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", source); + if (fll_error_print(main.error, status, function, F_false) == F_known_not && fallback && main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "UNKNOWN %s(", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", status); + f_color_print(main.error.to.stream, main.context.set.error, ") occurred while trying to %s '", operation); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", source); if (destination) { - f_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); + f_color_print(main.error.to.stream, main.context.set.error, "' %s '", how); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", destination); } - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } return F_true; @@ -231,41 +231,41 @@ extern "C" { #endif // _di_fake_print_error_build_operation_file_ #ifndef _di_fake_print_error_fss - bool fake_print_error_fss(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path_file, const f_string_range_t range, const bool fallback) { + bool fake_print_error_fss(const fake_main_t main, const f_status_t status, const f_string_t function, const f_string_t path_file, const f_string_range_t range, const bool fallback) { if (status == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%serror occurred on invalid UTF-8 character at stop position (at ", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%d", range.start); - f_color_print(data.error.to.stream, data.context.set.error, " of setting file '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file); - f_color_print(data.error.to.stream, data.context.set.error, "').%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%serror occurred on invalid UTF-8 character at stop position (at ", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%d", range.start); + f_color_print(main.error.to.stream, main.context.set.error, " of setting file '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", path_file); + f_color_print(main.error.to.stream, main.context.set.error, "').%c", f_string_eol_s[0]); } return F_false; } if (status == F_status_set_error(F_complete_not_utf_stop)) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%serror occurred on invalid UTF-8 character at end of string (at ", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%d", range.start); - f_color_print(data.error.to.stream, data.context.set.error, " of setting file '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file); - f_color_print(data.error.to.stream, data.context.set.error, "').%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%serror occurred on invalid UTF-8 character at end of string (at ", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%d", range.start); + f_color_print(main.error.to.stream, main.context.set.error, " of setting file '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", path_file); + f_color_print(main.error.to.stream, main.context.set.error, "').%c", f_string_eol_s[0]); } return F_false; } - if (fll_error_print(data.error, status, function, F_false) == F_known_not && fallback && data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "UNKNOWN %s(", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", status); - f_color_print(data.error.to.stream, data.context.set.error, ") in function "); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", function); - f_color_print(data.error.to.stream, data.context.set.error, "().%c", f_string_eol_s[0]); + if (fll_error_print(main.error, status, function, F_false) == F_known_not && fallback && main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "UNKNOWN %s(", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", status); + f_color_print(main.error.to.stream, main.context.set.error, ") in function "); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", function); + f_color_print(main.error.to.stream, main.context.set.error, "().%c", f_string_eol_s[0]); } return F_true; @@ -273,91 +273,91 @@ extern "C" { #endif // _di_fake_print_error_fss #ifndef _di_fake_print_error_parameter_missing_value_ - void fake_print_error_parameter_missing_value(const fake_data_t data, const f_string_t parameter) { - if (data.error.verbosity == f_console_verbosity_quiet) return; + void fake_print_error_parameter_missing_value(const fake_main_t main, const f_string_t parameter) { + if (main.error.verbosity == f_console_verbosity_quiet) return; - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter); - f_color_print(data.error.to.stream, data.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } #endif // _di_fake_print_error_parameter_missing_value_ #ifndef _di_fake_print_error_parameter_too_many_ - void fake_print_error_parameter_too_many(const fake_data_t data, const f_string_t parameter) { - if (data.error.verbosity == f_console_verbosity_quiet) return; + void fake_print_error_parameter_too_many(const fake_main_t main, const f_string_t parameter) { + if (main.error.verbosity == f_console_verbosity_quiet) return; - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter); - f_color_print(data.error.to.stream, data.context.set.error, "' specified too many times.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "' specified too many times.%c", f_string_eol_s[0]); } #endif // _di_fake_print_error_parameter_too_many_ #ifndef _di_fake_print_message_section_operation_failed_ - void fake_print_message_section_operation_failed(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { - if (data.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; + void fake_print_message_section_operation_failed(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { + if (main.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; f_array_length_t line = 1; f_fss_count_lines(buffer, operation_name.start, &line); fprintf(error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(error.to.stream, data.error.context, "%sThe section operation '", data.error.prefix); + f_color_print(error.to.stream, main.error.context, "%sThe section operation '", main.error.prefix); - f_color_print_code(error.to.stream, data.context.notable); + f_color_print_code(error.to.stream, main.context.notable); f_print_dynamic_partial(error.to.stream, buffer, operation_name); - f_color_print_code(error.to.stream, data.context.reset); + f_color_print_code(error.to.stream, main.context.reset); - f_color_print(error.to.stream, data.error.context, "' from section '"); + f_color_print(error.to.stream, main.error.context, "' from section '"); - f_color_print_code(error.to.stream, data.context.notable); + f_color_print_code(error.to.stream, main.context.notable); f_print_dynamic_partial(error.to.stream, buffer, section_name); - f_color_print_code(error.to.stream, data.context.reset); + f_color_print_code(error.to.stream, main.context.reset); - f_color_print(error.to.stream, data.error.context, "' on line "); - f_color_print(error.to.stream, data.context.set.notable, "%llu", line); - f_color_print(error.to.stream, data.error.context, " failed.%c", f_string_eol_s[0]); + f_color_print(error.to.stream, main.error.context, "' on line "); + f_color_print(error.to.stream, main.context.set.notable, "%llu", line); + f_color_print(error.to.stream, main.error.context, " failed.%c", f_string_eol_s[0]); } #endif // _di_fake_print_message_section_operation_failed_ #ifndef _di_fake_print_message_section_operation_path_outside_ - void fake_print_message_section_operation_path_outside(const fake_data_t data, const fll_error_print_t error, const f_status_t status, const f_string_t function, const f_string_t path) { - if (data.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; + void fake_print_message_section_operation_path_outside(const fake_main_t main, const fll_error_print_t error, const f_status_t status, const f_string_t function, const f_string_t path) { + if (main.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; if (F_status_set_fine(status) == F_false) { fprintf(error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(error.to.stream, data.error.context, "%sThe path '", data.error.prefix); - f_color_print(error.to.stream, data.context.set.notable, "%s", path); - f_color_print(error.to.stream, data.error.context, "' is outside the project root.%c", f_string_eol_s[0]); + f_color_print(error.to.stream, main.error.context, "%sThe path '", main.error.prefix); + f_color_print(error.to.stream, main.context.set.notable, "%s", path); + f_color_print(error.to.stream, main.error.context, "' is outside the project root.%c", f_string_eol_s[0]); } else { - fll_error_file_print(data.error, F_status_set_fine(status), function, F_true, path, "determine real path of", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(status), function, F_true, path, "determine real path of", fll_error_file_type_file); } } #endif // _di_fake_print_message_section_operation_path_outside_ #ifndef _di_fake_print_message_section_operation_path_stack_max_ - void fake_print_message_section_operation_path_stack_max(const fake_data_t data, fll_error_print_t error, const f_status_t status, const f_string_t function, const f_string_t path) { - if (data.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; + void fake_print_message_section_operation_path_stack_max(const fake_main_t main, fll_error_print_t error, const f_status_t status, const f_string_t function, const f_string_t path) { + if (main.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; if (status == F_array_too_large) { fprintf(error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(error.to.stream, data.error.context, "%s: Maximum stack size reached while processing path '", data.error.prefix); - f_color_print(error.to.stream, data.context.set.notable, "%s", path); - f_color_print(error.to.stream, data.error.context, "'"); + f_color_print(error.to.stream, main.error.context, "%s: Maximum stack size reached while processing path '", main.error.prefix); + f_color_print(error.to.stream, main.context.set.notable, "%s", path); + f_color_print(error.to.stream, main.error.context, "'"); if (function) { - f_color_print(error.to.stream, data.error.context, " while calling "); - f_color_print(error.to.stream, data.context.set.notable, "%s", function); - f_color_print(error.to.stream, data.error.context, "()"); + f_color_print(error.to.stream, main.error.context, " while calling "); + f_color_print(error.to.stream, main.context.set.notable, "%s", function); + f_color_print(error.to.stream, main.error.context, "()"); } - f_color_print(error.to.stream, data.error.context, ".%c", f_string_eol_s[0]); + f_color_print(error.to.stream, main.error.context, ".%c", f_string_eol_s[0]); } else { fll_error_file_print(error, status, function, F_true, path, "change path to", fll_error_file_type_directory); @@ -366,134 +366,134 @@ extern "C" { #endif // _di_fake_print_message_section_operation_path_stack_max_ #ifndef _di_fake_print_message_section_operation_stack_max_ - void fake_print_message_section_operation_stack_max(const fake_data_t data, fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max) { - if (data.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; + void fake_print_message_section_operation_stack_max(const fake_main_t main, fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max) { + if (main.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; f_array_length_t line = 1; f_fss_count_lines(buffer, operation_name.start, &line); fprintf(error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(error.to.stream, data.error.context, "The section operation '", data.error.prefix); + f_color_print(error.to.stream, main.error.context, "The section operation '", main.error.prefix); - f_color_print_code(error.to.stream, data.context.notable); + f_color_print_code(error.to.stream, main.context.notable); f_print_dynamic_partial(error.to.stream, buffer, operation_name); - f_color_print_code(error.to.stream, data.context.reset); + f_color_print_code(error.to.stream, main.context.reset); - f_color_print(error.to.stream, data.error.context, "' from section '"); + f_color_print(error.to.stream, main.error.context, "' from section '"); - f_color_print_code(error.to.stream, data.context.notable); + f_color_print_code(error.to.stream, main.context.notable); f_print_dynamic_partial(error.to.stream, buffer, section_name); - f_color_print_code(error.to.stream, data.context.reset); + f_color_print_code(error.to.stream, main.context.reset); - f_color_print(error.to.stream, data.error.context, "' on line "); - f_color_print(error.to.stream, data.context.set.notable, "%llu", line); - f_color_print(error.to.stream, data.error.context, " cannot be processed because the max stack depth of "); - f_color_print(error.to.stream, data.context.set.notable, "%llu", stack_max); - f_color_print(error.to.stream, data.error.context, " has been reached.%c", f_string_eol_s[0]); + f_color_print(error.to.stream, main.error.context, "' on line "); + f_color_print(error.to.stream, main.context.set.notable, "%llu", line); + f_color_print(error.to.stream, main.error.context, " cannot be processed because the max stack depth of "); + f_color_print(error.to.stream, main.context.set.notable, "%llu", stack_max); + f_color_print(error.to.stream, main.error.context, " has been reached.%c", f_string_eol_s[0]); } #endif // _di_fake_print_message_section_operation_stack_max_ #ifndef _di_fake_print_message_section_operation_unknown_ - void fake_print_message_section_operation_unknown(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { - if (data.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; + void fake_print_message_section_operation_unknown(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { + if (main.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; f_array_length_t line = 1; f_fss_count_lines(buffer, operation_name.start, &line); fprintf(error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(error.to.stream, data.error.context, "%sThe section operation '", data.error.prefix); + f_color_print(error.to.stream, main.error.context, "%sThe section operation '", main.error.prefix); - f_color_print_code(error.to.stream, data.context.notable); + f_color_print_code(error.to.stream, main.context.notable); f_print_dynamic_partial(error.to.stream, buffer, operation_name); - f_color_print_code(error.to.stream, data.context.reset); + f_color_print_code(error.to.stream, main.context.reset); - f_color_print(error.to.stream, data.error.context, "' from section '"); + f_color_print(error.to.stream, main.error.context, "' from section '"); - f_color_print_code(error.to.stream, data.context.notable); + f_color_print_code(error.to.stream, main.context.notable); f_print_dynamic_partial(error.to.stream, buffer, section_name); - f_color_print_code(error.to.stream, data.context.reset); + f_color_print_code(error.to.stream, main.context.reset); - f_color_print(error.to.stream, data.error.context, "' on line "); - f_color_print(error.to.stream, data.context.set.notable, "%llu", line); - f_color_print(error.to.stream, data.error.context, " is not a known operation name.%c", f_string_eol_s[0]); + f_color_print(error.to.stream, main.error.context, "' on line "); + f_color_print(error.to.stream, main.context.set.notable, "%llu", line); + f_color_print(error.to.stream, main.error.context, " is not a known operation name.%c", f_string_eol_s[0]); } #endif // _di_fake_print_message_section_operation_unknown_ #ifndef _di_fake_print_warning_settings_content_empty_ - void fake_print_warning_settings_content_empty(const fake_data_t data, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_t settings_name) { - if (data.error.verbosity == f_console_verbosity_quiet) return; + void fake_print_warning_settings_content_empty(const fake_main_t main, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_t settings_name) { + if (main.error.verbosity == f_console_verbosity_quiet) return; - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(f_type_warning, data.context.set.warning, "%sthe fakefile '", fll_error_print_warning); - f_color_print(f_type_warning, data.context.set.notable, "%s", path_file); - f_color_print(f_type_warning, data.context.set.warning, "' has empty content for the '"); - f_color_print(f_type_warning, data.context.set.notable, "%s", settings_name); - f_color_print(f_type_warning, data.context.set.warning, "' object '"); + f_color_print(f_type_warning, main.context.set.warning, "%sthe fakefile '", fll_error_print_warning); + f_color_print(f_type_warning, main.context.set.notable, "%s", path_file); + f_color_print(f_type_warning, main.context.set.warning, "' has empty content for the '"); + f_color_print(f_type_warning, main.context.set.notable, "%s", settings_name); + f_color_print(f_type_warning, main.context.set.warning, "' object '"); - f_color_print_code(f_type_warning, data.context.notable); + f_color_print_code(f_type_warning, main.context.notable); f_print_dynamic_partial(f_type_warning, buffer, range_object); - f_color_print_code(f_type_warning, data.context.reset); + f_color_print_code(f_type_warning, main.context.reset); - f_color_print(f_type_warning, data.context.set.warning, "'.%c", f_string_eol_s[0]); + f_color_print(f_type_warning, main.context.set.warning, "'.%c", f_string_eol_s[0]); } #endif // _di_fake_print_warning_settings_content_empty_ #ifndef _di_fake_print_warning_settings_content_invalid_ - void fake_print_warning_settings_content_invalid(const fake_data_t data, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_t settings_name) { - if (data.error.verbosity == f_console_verbosity_quiet) return; + void fake_print_warning_settings_content_invalid(const fake_main_t main, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_t settings_name) { + if (main.error.verbosity == f_console_verbosity_quiet) return; - fprintf(data.output.stream, "%c", f_string_eol_s[0]); + fprintf(main.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.warning, "%sthe fakefile '", fll_error_print_warning); - f_color_print(data.output.stream, data.context.set.notable, "%s", path_file); - f_color_print(data.output.stream, data.context.set.warning, "' has an invalid content '"); + f_color_print(main.output.stream, main.context.set.warning, "%sthe fakefile '", fll_error_print_warning); + f_color_print(main.output.stream, main.context.set.notable, "%s", path_file); + f_color_print(main.output.stream, main.context.set.warning, "' has an invalid content '"); - f_color_print_code(data.output.stream, data.context.notable); - f_print_dynamic_partial(data.output.stream, buffer, range_content); - f_color_print_code(data.output.stream, data.context.reset); + f_color_print_code(main.output.stream, main.context.notable); + f_print_dynamic_partial(main.output.stream, buffer, range_content); + f_color_print_code(main.output.stream, main.context.reset); - f_color_print(data.output.stream, data.context.set.warning, "' for the '"); - f_color_print(data.output.stream, data.context.set.notable, "%s", settings_name); - f_color_print(data.output.stream, data.context.set.warning, "' object '"); + f_color_print(main.output.stream, main.context.set.warning, "' for the '"); + f_color_print(main.output.stream, main.context.set.notable, "%s", settings_name); + f_color_print(main.output.stream, main.context.set.warning, "' object '"); - f_color_print_code(data.output.stream, data.context.notable); - f_print_dynamic_partial(data.output.stream, buffer, range_object); - f_color_print_code(data.output.stream, data.context.reset); + f_color_print_code(main.output.stream, main.context.notable); + f_print_dynamic_partial(main.output.stream, buffer, range_object); + f_color_print_code(main.output.stream, main.context.reset); - f_color_print(data.output.stream, data.context.set.warning, "'.%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.warning, "'.%c", f_string_eol_s[0]); } #endif // _di_fake_print_warning_settings_content_invalid_ #ifndef _di_fake_print_warning_settings_content_multiple_ - void fake_print_warning_settings_content_multiple(const fake_data_t data, const f_string_t path_file, const f_string_t name_object) { - if (data.error.verbosity != f_console_verbosity_verbose) return; + void fake_print_warning_settings_content_multiple(const fake_main_t main, const f_string_t path_file, const f_string_t name_object) { + if (main.error.verbosity != f_console_verbosity_verbose) return; - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(f_type_warning, data.context.set.warning, "%sthe setting '", fll_error_print_warning); - f_color_print(f_type_warning, data.context.set.notable, "%s", name_object); - f_color_print(f_type_warning, data.context.set.warning, "' in the file '"); - f_color_print(f_type_warning, data.context.set.notable, "%s", path_file); + f_color_print(f_type_warning, main.context.set.warning, "%sthe setting '", fll_error_print_warning); + f_color_print(f_type_warning, main.context.set.notable, "%s", name_object); + f_color_print(f_type_warning, main.context.set.warning, "' in the file '"); + f_color_print(f_type_warning, main.context.set.notable, "%s", path_file); - f_color_print(f_type_warning, data.context.set.warning, "' may only have a single property, only using the first.%c", f_string_eol_s[0]); + f_color_print(f_type_warning, main.context.set.warning, "' may only have a single property, only using the first.%c", f_string_eol_s[0]); } #endif // _di_fake_print_warning_settings_content_multiple_ #ifndef _di_fake_print_warning_settings_object_multiple_ - void fake_print_warning_settings_object_multiple(const fake_data_t data, const f_string_t path_file, const f_string_t label, const f_string_t name_object) { - if (data.error.verbosity != f_console_verbosity_verbose) return; + void fake_print_warning_settings_object_multiple(const fake_main_t main, const f_string_t path_file, const f_string_t label, const f_string_t name_object) { + if (main.error.verbosity != f_console_verbosity_verbose) return; - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(f_type_warning, data.context.set.warning, "%sthe %s object '", fll_error_print_warning, label); - f_color_print(f_type_warning, data.context.set.notable, "%s", name_object); - f_color_print(f_type_warning, data.context.set.warning, "' in the file '"); - f_color_print(f_type_warning, data.context.set.notable, "%s", path_file); + f_color_print(f_type_warning, main.context.set.warning, "%sthe %s object '", fll_error_print_warning, label); + f_color_print(f_type_warning, main.context.set.notable, "%s", name_object); + f_color_print(f_type_warning, main.context.set.warning, "' in the file '"); + f_color_print(f_type_warning, main.context.set.notable, "%s", path_file); - f_color_print(f_type_warning, data.context.set.warning, "' may only be specified once, only using the first.%c", f_string_eol_s[0]); + f_color_print(f_type_warning, main.context.set.warning, "' may only be specified once, only using the first.%c", f_string_eol_s[0]); } #endif // _di_fake_print_warning_settings_object_multiple_ diff --git a/level_3/fake/c/private-print.h b/level_3/fake/c/private-print.h index fe01ba5..15321a7 100644 --- a/level_3/fake/c/private-print.h +++ b/level_3/fake/c/private-print.h @@ -15,8 +15,8 @@ extern "C" { /** * Print build operation file error messages. * - * @param data - * The program data. + * @param main + * The main data. * @param status * The error status code to report on. * @param function @@ -41,14 +41,14 @@ 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 fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t operation, const f_string_t source, const f_string_t destination, const f_string_t how, const bool fallback) f_attribute_visibility_internal; + extern bool fake_print_error_build_operation_file(const fake_main_t main, const f_status_t status, const f_string_t function, const f_string_t operation, const f_string_t source, const f_string_t destination, const f_string_t how, const bool fallback) f_attribute_visibility_internal; #endif // _di_fake_print_error_operation_file_ /** * Print FSS error messages. * - * @param data - * The program data. + * @param main + * The main data. * @param status * The error status code to report on. * @param function @@ -65,38 +65,38 @@ 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 fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path_file, const f_string_range_t range, const bool fallback) f_attribute_visibility_internal; + extern bool fake_print_error_fss(const fake_main_t main, const f_status_t status, const f_string_t function, const f_string_t path_file, const f_string_range_t range, const bool fallback) f_attribute_visibility_internal; #endif // _di_fake_print_error_fss_ /** * Print an error message for when the parameter is missing its accompanying value. * - * @param data - * The program data. + * @param main + * The main data. * @param parameter * The parameter name. */ #ifndef _di_fake_print_error_parameter_missing_value_ - extern void fake_print_error_parameter_missing_value(const fake_data_t data, const f_string_t parameter) f_attribute_visibility_internal; + extern void fake_print_error_parameter_missing_value(const fake_main_t main, const f_string_t parameter) f_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 data - * The program data. + * @param main + * The main data. * @param parameter * The parameter name. */ #ifndef _di_fake_print_error_parameter_too_many_ - extern void fake_print_error_parameter_too_many(const fake_data_t data, const f_string_t parameter) f_attribute_visibility_internal; + extern void fake_print_error_parameter_too_many(const fake_main_t main, const f_string_t parameter) f_attribute_visibility_internal; #endif // _di_fake_print_error_parameter_too_many_ /** * Print error messages when processing some fakefile section, for a specific line and operation, and that operation failed. * - * @param data - * The program data. + * @param main + * The main data. * @param error * Designates how the section error/warning should be printed. * @param buffer @@ -107,14 +107,14 @@ extern "C" { * The range within the buffer representing the operation name within the section. */ #ifndef _di_fake_print_message_section_operation_failed_ - extern void fake_print_message_section_operation_failed(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) f_attribute_visibility_internal; + extern void fake_print_message_section_operation_failed(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) f_attribute_visibility_internal; #endif // _di_fake_print_message_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 data - * The program data. + * @param main + * The main data. * @param error * Designates how the section error/warning should be printed. * @param status @@ -125,14 +125,14 @@ extern "C" { * The path that is outside of the project path. */ #ifndef _di_fake_print_message_section_operation_path_outside_ - extern void fake_print_message_section_operation_path_outside(const fake_data_t data, const fll_error_print_t error, const f_status_t status, const f_string_t function, const f_string_t path) f_attribute_visibility_internal; + extern void fake_print_message_section_operation_path_outside(const fake_main_t main, const fll_error_print_t error, const f_status_t status, const f_string_t function, const f_string_t path) f_attribute_visibility_internal; #endif // _fake_print_message_section_operation_path_outside_ /** * Print error messages when processing some fakefile section, for a specific line and operation. * - * @param data - * The program data. + * @param main + * The main data. * @param error * Designates how the section error/warning should be printed. * @param status @@ -144,14 +144,14 @@ extern "C" { * The path to the directory. */ #ifndef _di_fake_print_message_section_operation_path_stack_max_ - extern void fake_print_message_section_operation_path_stack_max(const fake_data_t data, fll_error_print_t error, const f_status_t status, const f_string_t function, const f_string_t path) f_attribute_visibility_internal; + extern void fake_print_message_section_operation_path_stack_max(const fake_main_t main, fll_error_print_t error, const f_status_t status, const f_string_t function, const f_string_t path) f_attribute_visibility_internal; #endif // _di_fake_print_message_section_operation_path_stack_max_ /** * Print error messages when processing some fakefile section, for a specific line and operation, and that the max stack depth is reached. * - * @param data - * The program data. + * @param main + * The main data. * @param error * Designates how the section error/warning should be printed. * @param buffer @@ -164,14 +164,14 @@ extern "C" { * The max stack depth. */ #ifndef _di_fake_print_message_section_operation_stack_max_ - extern void fake_print_message_section_operation_stack_max(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max) f_attribute_visibility_internal; + extern void fake_print_message_section_operation_stack_max(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max) f_attribute_visibility_internal; #endif // _di_fake_print_message_section_operation_stack_max_ /** * Print error messages when processing some fakefile section, for a specific line and operation, and that operation is invalid. * - * @param data - * The program data. + * @param main + * The main data. * @param error * Designates how the section error/warning should be printed. * @param buffer @@ -182,14 +182,14 @@ extern "C" { * The range within the buffer representing the operation name within the section. */ #ifndef _di_fake_print_message_section_operation_unknown_ - extern void fake_print_message_section_operation_unknown(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) f_attribute_visibility_internal; + extern void fake_print_message_section_operation_unknown(const fake_main_t main, const fll_error_print_t error, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) f_attribute_visibility_internal; #endif // _di_fake_print_message_section_operation_unknown_ /** * Print message when fake settings content is empty. * - * @param data - * The program data. + * @param main + * The main data. * @param path_file * The path to the fakefile. * @param buffer @@ -200,14 +200,14 @@ extern "C" { * The name of the setting that has an invalid value. */ #ifndef _di_fake_print_warning_settings_content_empty_ - extern void fake_print_warning_settings_content_empty(const fake_data_t data, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_t settings_name) f_attribute_visibility_internal; + extern void fake_print_warning_settings_content_empty(const fake_main_t main, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_t settings_name) f_attribute_visibility_internal; #endif // _di_fake_print_warning_settings_content_empty_ /** * Print warning message when fake settings content is invalid. * - * @param data - * The program data. + * @param main + * The main data. * @param path_file * The path to the fakefile. * @param buffer @@ -220,14 +220,14 @@ extern "C" { * The name of the setting that has an invalid value. */ #ifndef _di_fake_print_warning_settings_content_invalid_ - extern void fake_print_warning_settings_content_invalid(const fake_data_t data, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_t settings_name) f_attribute_visibility_internal; + extern void fake_print_warning_settings_content_invalid(const fake_main_t main, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_t settings_name) f_attribute_visibility_internal; #endif // _di_fake_print_warning_settings_content_invalid_ /** * Print warning message when settings content has too many values. * - * @param data - * The program data. + * @param main + * The main data. * @param path_file * The path to the fakefile. * @param buffer @@ -236,14 +236,14 @@ extern "C" { * The name of the object. */ #ifndef _di_fake_print_warning_settings_content_multiple_ - extern void fake_print_warning_settings_content_multiple(const fake_data_t data, const f_string_t path_file, const f_string_t name_object) f_attribute_visibility_internal; + extern void fake_print_warning_settings_content_multiple(const fake_main_t main, const f_string_t path_file, const f_string_t name_object) f_attribute_visibility_internal; #endif // _di_fake_print_warning_settings_content_multiple_ /** * Print warning message when fakefile has too many objects with the same name. * - * @param data - * The program data. + * @param main + * The main data. * @param path_file * The path to the fakefile. * @param buffer @@ -254,7 +254,7 @@ extern "C" { * The name of the object. */ #ifndef _di_fake_print_warning_settings_object_multiple_ - extern void fake_print_warning_settings_object_multiple(const fake_data_t data, const f_string_t path_file, const f_string_t label, const f_string_t name_object) f_attribute_visibility_internal; + extern void fake_print_warning_settings_object_multiple(const fake_main_t main, const f_string_t path_file, const f_string_t label, const f_string_t name_object) f_attribute_visibility_internal; #endif // _di_fake_print_warning_settings_object_multiple_ #ifdef __cplusplus diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index 1193cf8..f02c2e9 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -10,53 +10,53 @@ extern "C" { #endif #ifndef _di_fake_skeleton_operate_ - f_status_t fake_skeleton_operate(const fake_data_t data) { + f_status_t fake_skeleton_operate(const fake_main_t main) { - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { return F_signal; } f_status_t status = F_none; - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.output.stream, "%c", f_string_eol_s[0]); - f_color_print(data.output.stream, data.context.set.important, "Generating skeleton structure.%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.output.stream, "%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.important, "Generating skeleton structure.%c", f_string_eol_s[0]); } { const f_string_dynamic_t *parameters_value[] = { - &data.path_build, - &data.path_data, - &data.path_data_build, - &data.path_data_settings, - &data.path_documents, - &data.path_licenses, - &data.path_sources, - &data.path_sources_bash, - &data.path_sources_c, - &data.path_sources_cpp, - &data.path_work, - &data.path_work_includes, - &data.path_work_libraries, - &data.path_work_libraries_script, - &data.path_work_libraries_shared, - &data.path_work_libraries_static, - &data.path_work_programs, - &data.path_work_programs_script, - &data.path_work_programs_shared, - &data.path_work_programs_static, + &main.path_build, + &main.path_data, + &main.path_data_build, + &main.path_data_settings, + &main.path_documents, + &main.path_licenses, + &main.path_sources, + &main.path_sources_bash, + &main.path_sources_c, + &main.path_sources_cpp, + &main.path_work, + &main.path_work_includes, + &main.path_work_libraries, + &main.path_work_libraries_script, + &main.path_work_libraries_shared, + &main.path_work_libraries_static, + &main.path_work_programs, + &main.path_work_programs_script, + &main.path_work_programs_shared, + &main.path_work_programs_static, }; for (uint8_t i = 0; i < 20; i++) { - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { return F_status_set_error(F_signal); } - status = fake_skeleton_operate_directory_create(data, *parameters_value[i]); + status = fake_skeleton_operate_directory_create(main, *parameters_value[i]); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fake_skeleton_operate_directory_create", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fake_skeleton_operate_directory_create", F_true); return status; } } // for @@ -66,7 +66,7 @@ extern "C" { f_string_dynamic_t file_data_build_process_pre = f_string_dynamic_t_initialize; f_string_dynamic_t content = f_string_dynamic_t_initialize; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { status = F_status_set_error(F_signal); } @@ -75,7 +75,7 @@ extern "C" { content.used = fake_make_skeleton_content_defines_length; content.size = content.used; - status = fake_skeleton_operate_file_create(data, data.file_data_build_defines, F_false, content); + status = fake_skeleton_operate_file_create(main, main.file_data_build_defines, F_false, content); content.used = 0; } @@ -85,27 +85,27 @@ extern "C" { content.used = fake_make_skeleton_content_dependencies_length; content.size = content.used; - status = fake_skeleton_operate_file_create(data, data.file_data_build_dependencies, F_false, content); + status = fake_skeleton_operate_file_create(main, main.file_data_build_dependencies, F_false, content); content.used = 0; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { status = F_status_set_error(F_signal); } } if (F_status_is_error_not(status)) { - status = fake_skeleton_operate_file_create(data, file_data_build_process_post, F_true, content); + status = fake_skeleton_operate_file_create(main, file_data_build_process_post, F_true, content); - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { status = F_status_set_error(F_signal); } } if (F_status_is_error_not(status)) { - status = fake_skeleton_operate_file_create(data, file_data_build_process_pre, F_true, content); + status = fake_skeleton_operate_file_create(main, file_data_build_process_pre, F_true, content); - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { status = F_status_set_error(F_signal); } } @@ -115,19 +115,19 @@ extern "C" { content.used = fake_make_skeleton_content_settings_length; content.size = content.used; - status = fake_skeleton_operate_file_create(data, data.file_data_build_settings, F_false, content); + status = fake_skeleton_operate_file_create(main, main.file_data_build_settings, F_false, content); content.used = 0; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { status = F_status_set_error(F_signal); } } if (F_status_is_error_not(status)) { - status = fake_skeleton_operate_file_create(data, data.file_documents_readme, F_false, content); + status = fake_skeleton_operate_file_create(main, main.file_documents_readme, F_false, content); - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { status = F_status_set_error(F_signal); } } @@ -137,11 +137,11 @@ extern "C" { content.used = fake_make_skeleton_content_fakefile_length; content.size = content.used; - status = fake_skeleton_operate_file_create(data, data.file_data_build_fakefile, F_false, content); + status = fake_skeleton_operate_file_create(main, main.file_data_build_fakefile, F_false, content); content.used = 0; - if (fake_signal_received(data)) { + if (fake_signal_received(main)) { status = F_status_set_error(F_signal); } } @@ -157,7 +157,7 @@ extern "C" { #endif // _di_fake_skeleton_operate_ #ifndef _di_fake_skeleton_operate_directory_create_ - f_status_t fake_skeleton_operate_directory_create(const fake_data_t data, const f_string_dynamic_t path) { + f_status_t fake_skeleton_operate_directory_create(const fake_main_t main, const f_string_dynamic_t path) { f_status_t status = F_none; if (!path.used) return F_none; @@ -165,19 +165,19 @@ extern "C" { status = f_directory_exists(path.string); if (status == F_true) { - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "Directory '%s' already exists.%c", path.string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "Directory '%s' already exists.%c", path.string, f_string_eol_s[0]); } return F_none; } if (status == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe path '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", path.string); - f_color_print(data.error.to.stream, data.context.set.error, "' exists but is not a directory.%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe path '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", path.string); + f_color_print(main.error.to.stream, main.context.set.error, "' exists but is not a directory.%c", f_string_eol_s[0]); } return F_status_set_warning(F_failure); @@ -187,24 +187,24 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe path '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", path.string); - f_color_print(data.error.to.stream, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe path '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", path.string); + f_color_print(main.error.to.stream, main.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol_s[0]); } else { - fll_error_file_print(data.error, F_status_set_fine(status), "f_directory_create", F_true, path.string, "create", fll_error_file_type_directory); + fll_error_file_print(main.error, F_status_set_fine(status), "f_directory_create", F_true, path.string, "create", fll_error_file_type_directory); } return status; } - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "Directory '%s' created.%c", path.string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "Directory '%s' created.%c", path.string, f_string_eol_s[0]); } } else if (F_status_is_error(status)) { - fll_error_file_print(data.error, F_status_set_fine(status), "f_directory_exists", F_true, path.string, "create", fll_error_file_type_directory); + fll_error_file_print(main.error, F_status_set_fine(status), "f_directory_exists", F_true, path.string, "create", fll_error_file_type_directory); return status; } @@ -213,7 +213,7 @@ extern "C" { #endif // _di_fake_skeleton_operate_directory_create_ #ifndef _di_fake_skeleton_operate_file_create_ - f_status_t fake_skeleton_operate_file_create(const fake_data_t data, const f_string_dynamic_t path, const bool executable, const f_string_static_t content) { + f_status_t fake_skeleton_operate_file_create(const fake_main_t main, const f_string_dynamic_t path, const bool executable, const f_string_static_t content) { f_status_t status = F_none; if (!path.used) return F_none; @@ -221,8 +221,8 @@ extern "C" { status = f_file_is(path.string, f_file_type_regular, F_false); if (status == F_true) { - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "File '%s' already exists.%c", path.string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "File '%s' already exists.%c", path.string, f_string_eol_s[0]); } return F_none; @@ -233,8 +233,8 @@ extern "C" { status = f_file_is(path.string, f_file_type_link, F_false); if (status == F_true) { - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "File '%s' already exists (as a symbolic link).%c", path.string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "File '%s' already exists (as a symbolic link).%c", path.string, f_string_eol_s[0]); } return F_none; @@ -242,8 +242,8 @@ extern "C" { } if (status == F_false) { - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "File '%s' already exists but is not a regular file (or symbolic link).%c", path.string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "File '%s' already exists but is not a regular file (or symbolic link).%c", path.string, f_string_eol_s[0]); } return F_status_set_warning(F_none); @@ -259,20 +259,20 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe file '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s", path.string); - f_color_print(data.error.to.stream, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe file '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s", path.string); + f_color_print(main.error.to.stream, main.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol_s[0]); } else { - fll_error_file_print(data.error, F_status_set_fine(status), "f_file_create", F_true, path.string, "create", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(status), "f_file_create", F_true, path.string, "create", fll_error_file_type_file); } return status; } - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "File '%s' created.%c", path.string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "File '%s' created.%c", path.string, f_string_eol_s[0]); } if (content.used) { @@ -284,7 +284,7 @@ extern "C" { status = f_file_open(path.string, 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(data.error, F_status_set_fine(status), "f_file_open", F_true, path.string, "pre-populate", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(status), "f_file_open", F_true, path.string, "pre-populate", fll_error_file_type_file); return status; } @@ -292,21 +292,21 @@ extern "C" { status = f_file_write(file, content, 0); if (F_status_is_error(status)) { - fll_error_file_print(data.error, F_status_set_fine(status), "f_file_write", F_true, path.string, "pre-populate", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(status), "f_file_write", F_true, path.string, "pre-populate", fll_error_file_type_file); f_file_stream_close(F_true, &file); return status; } - if (data.error.verbosity == f_console_verbosity_verbose) { - fprintf(data.output.stream, "File '%s' pre-populated.%c", path.string, f_string_eol_s[0]); + if (main.error.verbosity == f_console_verbosity_verbose) { + fprintf(main.output.stream, "File '%s' pre-populated.%c", path.string, f_string_eol_s[0]); } f_file_stream_close(F_true, &file); } } else if (F_status_is_error(status)) { - fll_error_file_print(data.error, F_status_set_fine(status), "f_file_is", F_true, path.string, "create", fll_error_file_type_file); + fll_error_file_print(main.error, F_status_set_fine(status), "f_file_is", F_true, path.string, "create", fll_error_file_type_file); return status; } diff --git a/level_3/fake/c/private-skeleton.h b/level_3/fake/c/private-skeleton.h index 29bdd43..ceeb41e 100644 --- a/level_3/fake/c/private-skeleton.h +++ b/level_3/fake/c/private-skeleton.h @@ -27,8 +27,8 @@ extern "C" { /** * Execute the skeleton operation. * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -36,14 +36,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_skeleton_operate_ - extern f_status_t fake_skeleton_operate(const fake_data_t data) f_attribute_visibility_internal; + extern f_status_t fake_skeleton_operate(const fake_main_t main) f_attribute_visibility_internal; #endif // _di_fake_skeleton_operate_ /** * Create a directory if it does not exist, ignore it if it does, and warn if path exists but is not a directory. * - * @param data - * The program data. + * @param main + * The main data. * @param path * The file path for the directory to create. * @@ -54,14 +54,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_skeleton_operate_directory_create_ - extern f_status_t fake_skeleton_operate_directory_create(const fake_data_t data, const f_string_dynamic_t path) f_attribute_visibility_internal; + extern f_status_t fake_skeleton_operate_directory_create(const fake_main_t main, const f_string_dynamic_t path) f_attribute_visibility_internal; #endif // _di_fake_skeleton_operate_directory_create_ /** * Create a file if it does not exist, ignore it if it does, and warn if path exists but is not a file. * - * @param data - * The program data. + * @param main + * The main data. * @param path * The file path for the directory to create. * @param executable @@ -77,7 +77,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_skeleton_operate_file_create_ - extern f_status_t fake_skeleton_operate_file_create(const fake_data_t data, const f_string_dynamic_t path, const bool executable, const f_string_static_t content) f_attribute_visibility_internal; + extern f_status_t fake_skeleton_operate_file_create(const fake_main_t main, const f_string_dynamic_t path, const bool executable, const f_string_static_t content) f_attribute_visibility_internal; #endif // _di_fake_skeleton_operate_file_create_ #ifdef __cplusplus diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index d704f15..2211e9b 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -56,7 +56,7 @@ extern "C" { #endif // _di_firewall_print_help_ #ifndef _di_firewall_main_ - f_status_t firewall_main(const f_console_arguments_t arguments, firewall_data_t *data) { + f_status_t firewall_main(const f_console_arguments_t arguments, firewall_main_t *data) { f_status_t status = F_none; { @@ -79,7 +79,7 @@ extern "C" { } if (F_status_is_error(status)) { - firewall_data_delete(data); + firewall_main_delete(data); return F_status_set_error(status); } } @@ -93,7 +93,7 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -117,14 +117,14 @@ extern "C" { if (data->parameters[firewall_parameter_help].result == f_console_result_found) { firewall_print_help(data->output, data->context); - firewall_data_delete(data); + firewall_main_delete(data); return F_none; } if (data->parameters[firewall_parameter_version].result == f_console_result_found) { fll_program_print_version(data->output, firewall_version); - firewall_data_delete(data); + firewall_main_delete(data); return F_none; } @@ -232,7 +232,7 @@ extern "C" { if (F_status_is_error(status)) { f_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -374,7 +374,7 @@ extern "C" { f_macro_string_dynamics_t_delete_simple( parameters); firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -395,7 +395,7 @@ extern "C" { } firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return F_status_set_error(status); } @@ -423,7 +423,7 @@ extern "C" { if (F_status_is_error(status)) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -455,7 +455,7 @@ extern "C" { if (F_status_is_error(status)) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -470,14 +470,14 @@ extern "C" { status = firewall_process_rules(&input, &local, data); firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } else { f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to perform lock request because the lock instructions are missing from: %s.%c", fll_error_print_error, network_path firewall_file_other, f_string_eol_s[0]); firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return F_status_set_error(F_data); } } @@ -492,7 +492,7 @@ extern "C" { if (F_status_is_error(status)) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -509,7 +509,7 @@ extern "C" { if (F_status_is_error(status) || command == firewall_parameter_command_stop) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } } @@ -517,7 +517,7 @@ extern "C" { f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to perform stop request because the lock instructions are missing from: %s.", fll_error_print_error, network_path firewall_file_other, f_string_eol_s[0]); firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return F_status_set_error(F_data); } } @@ -530,7 +530,7 @@ extern "C" { if (F_status_is_error(status)) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -543,7 +543,7 @@ extern "C" { if (F_status_is_error(status)) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } } @@ -552,7 +552,7 @@ extern "C" { if (F_status_is_error(status)) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -574,7 +574,7 @@ extern "C" { if (F_status_is_error(status) || command == firewall_parameter_command_stop) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -594,7 +594,7 @@ extern "C" { if (F_status_is_error(status)) { f_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -620,7 +620,7 @@ extern "C" { continue; } - firewall_data_delete(data); + firewall_main_delete(data); return F_status_set_error(status); } @@ -628,7 +628,7 @@ extern "C" { if (F_status_is_error(status)) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -650,7 +650,7 @@ extern "C" { if (F_status_is_error(status) || command == firewall_parameter_command_stop) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } } // for @@ -662,7 +662,7 @@ extern "C" { if (F_status_is_error(status)) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -672,7 +672,7 @@ extern "C" { f_status_t status2 = F_none; firewall_macro_delete_fss_buffers(status2, local.buffer, local.chain_objects, local.chain_contents) - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -694,7 +694,7 @@ extern "C" { if (F_status_is_error(status) || command == firewall_parameter_command_stop) { firewall_delete_local_data(&local); - firewall_data_delete(data); + firewall_main_delete(data); return status; } @@ -710,13 +710,13 @@ extern "C" { status = F_status_set_error(F_parameter); } - firewall_data_delete(data); + firewall_main_delete(data); return status; } #endif // _di_firewall_main_ -#ifndef _di_firewall_data_delete_ - f_status_t firewall_data_delete(firewall_data_t *data) { +#ifndef _di_firewall_main_delete_ + f_status_t firewall_main_delete(firewall_main_t *data) { for (f_array_length_t i = 0; i < firewall_total_parameters; i++) { f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); @@ -732,7 +732,7 @@ extern "C" { return F_none; } -#endif // _di_firewall_data_delete_ +#endif // _di_firewall_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/firewall/c/firewall.h b/level_3/firewall/c/firewall.h index c8a27d9..3d64d44 100644 --- a/level_3/firewall/c/firewall.h +++ b/level_3/firewall/c/firewall.h @@ -264,7 +264,7 @@ extern "C" { #define firewall_total_parameters 14 #endif // _di_firewall_defines_ -#ifndef _di_firewall_data_t_ +#ifndef _di_firewall_main_t_ typedef struct { f_console_parameter_t parameters[firewall_total_parameters]; @@ -278,9 +278,9 @@ extern "C" { f_string_dynamics_t devices; f_color_context_t context; - } firewall_data_t; + } firewall_main_t; - #define firewall_data_t_initialize \ + #define firewall_main_t_initialize \ { \ firewall_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -291,7 +291,7 @@ extern "C" { f_string_dynamics_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_firewall_data_t_ +#endif // _di_firewall_main_t_ /** * Print help. @@ -311,22 +311,22 @@ extern "C" { /** * Execute main program. * - * Be sure to call firewall_data_delete() after executing this. + * Be sure to call firewall_main_delete() after executing this. * * @param arguments * The parameters passed to the process. * @param data - * The program data. + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see firewall_data_delete() + * @see firewall_main_delete() */ #ifndef _di_firewall_main_ - extern f_status_t firewall_main(const f_console_arguments_t arguments, firewall_data_t *data); + extern f_status_t firewall_main(const f_console_arguments_t arguments, firewall_main_t *data); #endif // _di_firewall_main_ /** @@ -335,7 +335,7 @@ extern "C" { * Be sure to call this after executing firewall_main(). * * @param data - * The program data. + * The main data. * * @return * F_none on success. @@ -344,9 +344,9 @@ extern "C" { * * @see firewall_main() */ -#ifndef _di_firewall_data_delete_ - extern f_status_t firewall_data_delete(firewall_data_t *data); -#endif // _di_firewall_data_delete_ +#ifndef _di_firewall_main_delete_ + extern f_status_t firewall_main_delete(firewall_main_t *data); +#endif // _di_firewall_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/firewall/c/main.c b/level_3/firewall/c/main.c index 1949f03..b0bd369 100644 --- a/level_3/firewall/c/main.c +++ b/level_3/firewall/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - firewall_data_t data = firewall_data_t_initialize; + firewall_main_t main = firewall_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - if (F_status_is_error(firewall_main(arguments, &data))) { + if (F_status_is_error(firewall_main(arguments, &main))) { return 1; } diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index fcf474c..fddcfeb 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -5,7 +5,7 @@ extern "C" { #endif -f_status_t firewall_perform_commands(const firewall_local_data_t local, const firewall_data_t data) { +f_status_t firewall_perform_commands(const firewall_local_data_t local, const firewall_main_t main) { f_status_t status = F_none; f_array_length_t i = 0; @@ -40,8 +40,8 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi device_all = F_true; } else { - if (data.devices.array[local.device].used > 0) { - f_macro_string_dynamic_t_resize(status, device, data.devices.array[local.device].used); + if (main.devices.array[local.device].used > 0) { + f_macro_string_dynamic_t_resize(status, device, main.devices.array[local.device].used); if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(device); @@ -49,8 +49,8 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi return status; } - firewall_macro_concat_string(device.string, data.devices.array[local.device].string, data.devices.array[local.device].used); - device.used = data.devices.array[local.device].used; + firewall_macro_concat_string(device.string, main.devices.array[local.device].string, main.devices.array[local.device].used); + device.used = main.devices.array[local.device].used; } } @@ -141,16 +141,16 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi continue; } else if (length >= firewall_device_this_length && fl_string_compare(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string_t) firewall_device_this, length, firewall_device_this_length) == F_equal_to) { - if (data.devices.array[local.device].used > 0) { - if (data.devices.array[local.device].used > device.size) { - f_macro_string_dynamic_t_resize(status, device, data.devices.array[local.device].used); + if (main.devices.array[local.device].used > 0) { + if (main.devices.array[local.device].used > device.size) { + f_macro_string_dynamic_t_resize(status, device, main.devices.array[local.device].used); if (F_status_is_error(status)) break; } - firewall_macro_concat_string(device.string, data.devices.array[local.device].string, data.devices.array[local.device].used); + firewall_macro_concat_string(device.string, main.devices.array[local.device].string, main.devices.array[local.device].used); - device.used = data.devices.array[local.device].used; + device.used = main.devices.array[local.device].used; } else { f_macro_string_dynamic_t_delete_simple(device); @@ -282,11 +282,11 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi // process rule rule, if the remaining rule does not match as firewall_rule, then it is an invalid rule. else if (length < firewall_rule_length || fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_rule, length, firewall_rule_length) == F_equal_to_not) { if (length > 0) { - f_color_print_code(f_type_warning, data.context.warning); + f_color_print_code(f_type_warning, main.context.warning); fprintf(f_type_warning, "%sAt line %llu, the object '", fll_error_print_warning, i); f_print(f_type_warning, local.buffer.string + local.rule_objects.array[i].start, length); fprintf(f_type_warning, "' is invalid"); - f_color_print_code(f_type_warning, data.context.reset); + f_color_print_code(f_type_warning, main.context.reset); } else { fprintf(f_type_warning, "%sAt line %llu, the object is missing", fll_error_print_warning, i); @@ -300,17 +300,17 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi length = firewall_macro_structure_size(local.rule_objects, i); if (length > 0) { - f_color_print_code(f_type_warning, data.context.warning); + f_color_print_code(f_type_warning, main.context.warning); fprintf(f_type_warning, "%sAt line %llu, the object '", fll_error_print_warning, i); f_print(f_type_warning, local.buffer.string + local.rule_objects.array[i].start, length); fprintf(f_type_warning, "' has invalid content '"); f_print(f_type_warning, local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_macro_structure_size(local.rule_contents.array[i], 0)); fprintf(f_type_warning, "'"); - f_color_print_code(f_type_warning, data.context.reset); + f_color_print_code(f_type_warning, main.context.reset); fprintf(f_type_warning, "\n"); } else { - f_color_print(f_type_warning, data.context.set.warning, "%sAt line %llu, the object has no content%c", fll_error_print_warning, i, f_string_eol_s[0]); + f_color_print(f_type_warning, main.context.set.warning, "%sAt line %llu, the object has no content%c", fll_error_print_warning, i, f_string_eol_s[0]); } continue; @@ -375,13 +375,13 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi // process the chain, which is required by the action. if (chain == firewall_chain_custom_id) { - if (data.chains.array[local.chain_ids.array[local.chain]].used > 0) { - f_macro_string_dynamic_t_resize(status, argument, data.chains.array[local.chain_ids.array[local.chain]].used); + if (main.chains.array[local.chain_ids.array[local.chain]].used > 0) { + f_macro_string_dynamic_t_resize(status, argument, main.chains.array[local.chain_ids.array[local.chain]].used); if (F_status_is_error(status)) break; - firewall_macro_concat_string(argument.string, data.chains.array[local.chain_ids.array[local.chain]].string, data.chains.array[local.chain_ids.array[local.chain]].used); - argument.used = data.chains.array[local.chain_ids.array[local.chain]].used; + firewall_macro_concat_string(argument.string, main.chains.array[local.chain_ids.array[local.chain]].string, main.chains.array[local.chain_ids.array[local.chain]].used); + argument.used = main.chains.array[local.chain_ids.array[local.chain]].used; } } else if (chain == firewall_chain_forward_id) { @@ -552,11 +552,11 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi else { length = firewall_macro_structure_size(local.rule_objects, i); - f_color_print_code(f_type_warning, data.context.warning); + f_color_print_code(f_type_warning, main.context.warning); fprintf(f_type_warning, "%sAt line %llu, the object '", fll_error_print_warning, i); f_print(f_type_warning, local.buffer.string + local.rule_objects.array[i].start, length); fprintf(f_type_warning, "' has no content"); - f_color_print_code(f_type_warning, data.context.reset); + f_color_print_code(f_type_warning, main.context.reset); fprintf(f_type_warning, "\n"); break; @@ -587,24 +587,24 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi status = F_status_set_fine(status); if (status == F_parameter) { - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling f_file_open()%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling f_file_open()%c", fll_error_print_error, f_string_eol_s[0]); } else if (status == F_file_found_not) { // the file does not have to exist - f_color_print(f_type_warning, data.context.set.warning, "%sCannot find the file '%.*s'%c", fll_error_print_warning, file_path.used, file_path.string, f_string_eol_s[0]); + f_color_print(f_type_warning, main.context.set.warning, "%sCannot find the file '%.*s'%c", fll_error_print_warning, file_path.used, file_path.string, f_string_eol_s[0]); status = F_none; } else if (status == F_file_open) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to open the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to open the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); } else if (status == F_file_descriptor) { - f_color_print(data.error.to.stream, data.context.set.error, "%sFile descriptor error while trying to open the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sFile descriptor error while trying to open the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); } else if (status == F_memory_not) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); } else { - f_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open()%c", fll_error_print_error, status, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open()%c", fll_error_print_error, status, f_string_eol_s[0]); } if (status != F_file_found_not) { @@ -622,25 +622,25 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi status = F_status_set_fine(status); if (status == F_parameter) { - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling f_file_read()%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling f_file_read()%c", fll_error_print_error, f_string_eol_s[0]); } else if (status == F_number_overflow) { - f_color_print(data.error.to.stream, data.context.set.error, "%sInteger overflow while trying to buffer the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInteger overflow while trying to buffer the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); } else if (status == F_file_closed) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe file '%.*s' is no longer open%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe file '%.*s' is no longer open%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); } else if (status == F_file_seek) { - f_color_print(data.error.to.stream, data.context.set.error, "%sA seek error occurred while accessing the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sA seek error occurred while accessing the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); } else if (status == F_file_read) { - f_color_print(data.error.to.stream, data.context.set.error, "%sA read error occurred while accessing the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sA read error occurred while accessing the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); } else if (status == F_memory_not) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); } else { - f_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_read()%c", fll_error_print_error, status, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_read()%c", fll_error_print_error, status, f_string_eol_s[0]); } status = F_status_set_error(status); @@ -658,16 +658,16 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi status = F_status_set_fine(status); if (status == F_parameter) { - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_fss_basic_read() for the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_fss_basic_read() for the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]); } else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) { // empty files are to be silently ignored } else if (status == F_memory_not) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); } else { - f_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_fss_basic_read() for the file '%.*s'%c", fll_error_print_error, status, file_path.used, file_path.string, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_fss_basic_read() for the file '%.*s'%c", fll_error_print_error, status, file_path.used, file_path.string, f_string_eol_s[0]); } status = F_status_set_error(status); @@ -677,7 +677,7 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi status = fl_fss_apply_delimit(delimits, &local_buffer); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); } } @@ -709,7 +709,7 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi } if (F_status_is_error(status)) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); f_macro_string_dynamic_t_delete_simple(ip_list_action); } @@ -730,7 +730,7 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi f_macro_string_dynamic_t_resize(status, ip_argument, ip_length); if (F_status_is_error(status)) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); break; } @@ -740,15 +740,15 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi firewall_macro_append_argument_to_arguments(status, arguments, ip_argument) if (F_status_is_error(status)) break; - if (data.error.verbosity == f_console_verbosity_debug) { - f_color_print_code(f_type_debug, data.context.warning); + if (main.error.verbosity == f_console_verbosity_debug) { + f_color_print_code(f_type_debug, main.context.warning); fprintf(f_type_debug, "%s ", current_tool); for (f_array_length_t i = 0; i < arguments.used; i++) { fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string); } // for - f_color_print_code(f_type_debug, data.context.reset); + f_color_print_code(f_type_debug, main.context.reset); fprintf(f_type_debug, "\n"); } @@ -760,17 +760,17 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi } if (status == F_failure) { - f_color_print(data.error.to.stream, data.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, current_tool, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, current_tool, f_string_eol_s[0]); fprintf(f_type_error, " "); - f_color_print_code(f_type_error, data.context.error); + f_color_print_code(f_type_error, main.context.error); fprintf(f_type_error, "%s ", current_tool); for (f_array_length_t i = 0; i < arguments.used; i++) { fprintf(f_type_error, "%.*s ", arguments.array[i].used, arguments.array[i].string); } // for - f_color_print_code(f_type_error, data.context.reset); + f_color_print_code(f_type_error, main.context.reset); fprintf(f_type_error, "\n"); // remove ip_argument from arguments string. @@ -780,7 +780,7 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi break; } else if (status == F_parameter) { - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); // remove ip_argument from arguments string. f_macro_string_dynamic_t_delete_simple(arguments.array[arguments.used]); @@ -814,15 +814,15 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi if (status == F_failure || status == F_parameter) break; } else { - if (data.error.verbosity == f_console_verbosity_debug) { - f_color_print_code(f_type_debug, data.context.warning); + if (main.error.verbosity == f_console_verbosity_debug) { + f_color_print_code(f_type_debug, main.context.warning); fprintf(f_type_debug, "%s ", current_tool); for (f_array_length_t i = 0; i < arguments.used; i++) { fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string); } // for - f_color_print_code(f_type_debug, data.context.reset); + f_color_print_code(f_type_debug, main.context.reset); fprintf(f_type_debug, "\n"); } @@ -834,22 +834,22 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi } if (status == F_failure) { - f_color_print(data.error.to.stream, data.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, current_tool, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, current_tool, f_string_eol_s[0]); fprintf(f_type_error, " "); - f_color_print_code(f_type_error, data.context.error); + f_color_print_code(f_type_error, main.context.error); fprintf(f_type_error, "%s ", current_tool); for (f_array_length_t i = 0; i < arguments.used; i++) { fprintf(f_type_error, "%.*s ", arguments.array[i].used, arguments.array[i].string); } // for - f_color_print_code(f_type_error, data.context.reset); + f_color_print_code(f_type_error, main.context.reset); fprintf(f_type_error, "\n"); break; } else if (status == F_parameter) { - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); break; } } @@ -866,7 +866,7 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi return status; } -f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, firewall_local_data_t *local, firewall_data_t *data) { +f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, firewall_local_data_t *local, firewall_main_t *main) { f_status_t status = F_none; uint8_t tool = firewall_program_iptables; @@ -969,11 +969,11 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f f_macro_string_dynamic_t_clear(fixed_string); if (new_chain) { - while (j < data->chains.used) { + while (j < main->chains.used) { range.start = 0; - range.stop = data->chains.array[j].used - 1; + range.stop = main->chains.array[j].used - 1; - if (fl_string_dynamic_partial_compare(local->buffer, data->chains.array[j], local->chain_objects.array[i], range) == F_equal_to) { + if (fl_string_dynamic_partial_compare(local->buffer, main->chains.array[j], local->chain_objects.array[i], range) == F_equal_to) { new_chain = F_false; local->chain_ids.array[i] = j; @@ -985,8 +985,8 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f } if (new_chain) { - if (data->chains.used == data->chains.size) { - f_macro_string_dynamics_t_resize(status, data->chains, data->chains.used + firewall_default_allocation_step); + if (main->chains.used == main->chains.size) { + f_macro_string_dynamics_t_resize(status, main->chains, main->chains.used + firewall_default_allocation_step); if (F_status_is_error(status)) { f_macro_string_dynamics_t_delete_simple(arguments); @@ -1009,7 +1009,7 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f } } - f_macro_string_dynamic_t_resize(status, data->chains.array[data->chains.used], length); + f_macro_string_dynamic_t_resize(status, main->chains.array[main->chains.used], length); if (F_status_is_error(status)) { f_macro_string_dynamics_t_delete_simple(arguments); @@ -1017,8 +1017,8 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f return status; } - data->chains.array[data->chains.used].used = 0; - local->chain_ids.array[i] = data->chains.used; + main->chains.array[main->chains.used].used = 0; + local->chain_ids.array[i] = main->chains.used; arguments.array[1].used = 0; j = local->chain_objects.array[i].start; @@ -1030,8 +1030,8 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f continue; } - data->chains.array[data->chains.used].string[data->chains.array[data->chains.used].used] = local->buffer.string[j]; - data->chains.array[data->chains.used].used++; + main->chains.array[main->chains.used].string[main->chains.array[main->chains.used].used] = local->buffer.string[j]; + main->chains.array[main->chains.used].used++; arguments.array[1].string[arguments.array[1].used] = local->buffer.string[j]; arguments.array[1].used++; j++; @@ -1054,15 +1054,15 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f } if (create_chain) { - if (data->error.verbosity == f_console_verbosity_debug) { - f_color_print_code(f_type_debug, data->context.warning); + if (main->error.verbosity == f_console_verbosity_debug) { + f_color_print_code(f_type_debug, main->context.warning); fprintf(f_type_debug, "%s ", firewall_tool_iptables); for (f_array_length_t i = 0; i < arguments.used; i++) { fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string); } // for - f_color_print_code(f_type_debug, data->context.reset); + f_color_print_code(f_type_debug, main->context.reset); fprintf(f_type_debug, "\n"); } @@ -1075,15 +1075,15 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f } if (F_status_is_error_not(status)) { - if (data->error.verbosity == f_console_verbosity_debug) { - f_color_print_code(f_type_debug, data->context.warning); + if (main->error.verbosity == f_console_verbosity_debug) { + f_color_print_code(f_type_debug, main->context.warning); fprintf(f_type_debug, "%s ", firewall_tool_ip6tables); for (f_array_length_t i = 0; i < arguments.used; i++) { fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string); } // for - f_color_print_code(f_type_debug, data->context.reset); + f_color_print_code(f_type_debug, main->context.reset); fprintf(f_type_debug, "\n"); } @@ -1101,14 +1101,14 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f if (status == F_failure) { if (tool == firewall_program_iptables) { - f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, firewall_tool_iptables, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, firewall_tool_iptables, f_string_eol_s[0]); } else if (tool == firewall_program_ip6tables) { - f_color_print(data->error.to.stream, data->context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, firewall_tool_ip6tables, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, firewall_tool_ip6tables, f_string_eol_s[0]); } fprintf(f_type_error, " "); - f_color_print_code(f_type_error, data->context.error); + f_color_print_code(f_type_error, main->context.error); if (tool == firewall_program_iptables) { fprintf(f_type_error, "%s ", firewall_tool_iptables); @@ -1121,14 +1121,14 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f fprintf(f_type_error, "%.*s ", arguments.array[i].used, arguments.array[i].string); } // for - f_color_print_code(f_type_error, data->context.reset); + f_color_print_code(f_type_error, main->context.reset); fprintf(f_type_error, "\n"); } else if (status == F_parameter) { - f_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]); } f_macro_string_dynamics_t_delete_simple(arguments); @@ -1136,7 +1136,7 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f } } - data->chains.used++; + main->chains.used++; } i++; @@ -1147,7 +1147,7 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f return status; } -f_status_t firewall_delete_chains(const firewall_data_t data) { +f_status_t firewall_delete_chains(const firewall_main_t main) { const f_string_t tools[2] = { firewall_tool_iptables, firewall_tool_ip6tables }; f_status_t status = F_none; @@ -1164,15 +1164,15 @@ f_status_t firewall_delete_chains(const firewall_data_t data) { arguments.size = 1; arguments.used = 1; - if (data.error.verbosity == f_console_verbosity_debug) { - f_color_print_code(f_type_debug, data.context.warning); + if (main.error.verbosity == f_console_verbosity_debug) { + f_color_print_code(f_type_debug, main.context.warning); fprintf(f_type_debug, "%s ", tools[i]); for (f_array_length_t i = 0; i < arguments.used; i++) { fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string); } // for - f_color_print_code(f_type_debug, data.context.reset); + f_color_print_code(f_type_debug, main.context.reset); fprintf(f_type_debug, "\n"); } @@ -1187,24 +1187,24 @@ f_status_t firewall_delete_chains(const firewall_data_t data) { status = F_status_set_fine(status); if (status == F_failure) { - f_color_print(data.error.to.stream, data.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, tools[i], f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, tools[i], f_string_eol_s[0]); fprintf(f_type_error, " "); - f_color_print_code(f_type_error, data.context.error); + f_color_print_code(f_type_error, main.context.error); fprintf(f_type_error, "%s ", tools[i]); for (f_array_length_t i = 0; i < arguments.used; i++) { fprintf(f_type_error, "%.*s ", arguments.array[i].used, arguments.array[i].string); } // for - f_color_print_code(f_type_error, data.context.reset); + f_color_print_code(f_type_error, main.context.reset); fprintf(f_type_error, "\n"); } else if (status == F_parameter) { - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); } else { - f_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]); } return status; @@ -1224,15 +1224,15 @@ f_status_t firewall_delete_chains(const firewall_data_t data) { arguments.size = 1; arguments.used = 1; - if (data.error.verbosity == f_console_verbosity_debug) { - f_color_print_code(f_type_debug, data.context.warning); + if (main.error.verbosity == f_console_verbosity_debug) { + f_color_print_code(f_type_debug, main.context.warning); fprintf(f_type_debug, "%s ", tools[i]); for (f_array_length_t j = 0; j < arguments.used; j++) { fprintf(f_type_debug, "%.*s ", arguments.array[j].used, arguments.array[j].string); } // for - f_color_print_code(f_type_debug, data.context.reset); + f_color_print_code(f_type_debug, main.context.reset); fprintf(f_type_debug, "\n"); } @@ -1247,24 +1247,24 @@ f_status_t firewall_delete_chains(const firewall_data_t data) { status = F_status_set_fine(status); if (status == F_failure) { - f_color_print(data.error.to.stream, data.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, tools[i], f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, tools[i], f_string_eol_s[0]); fprintf(f_type_error, " "); - f_color_print_code(f_type_error, data.context.error); + f_color_print_code(f_type_error, main.context.error); fprintf(f_type_error, "%s ", tools[i]); for (f_array_length_t j = 0; j < arguments.used; j++) { fprintf(f_type_error, "%.*s ", arguments.array[j].used, arguments.array[j].string); } // for - f_color_print_code(f_type_error, data.context.reset); + f_color_print_code(f_type_error, main.context.reset); fprintf(f_type_error, "\n"); } else if (status == F_parameter) { - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); } else { - f_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]); } return status; @@ -1274,7 +1274,7 @@ f_status_t firewall_delete_chains(const firewall_data_t data) { return status; } -f_status_t firewall_default_lock(const firewall_data_t data) { +f_status_t firewall_default_lock(const firewall_main_t main) { const f_string_t chains[3] = { firewall_chain_input, firewall_chain_output, firewall_chain_forward }; const f_string_t tools[2] = { firewall_tool_iptables, firewall_tool_ip6tables }; @@ -1306,15 +1306,15 @@ f_status_t firewall_default_lock(const firewall_data_t data) { int return_code = 0; // print command when debugging. - if (data.error.verbosity == f_console_verbosity_debug) { - f_color_print_code(f_type_debug, data.context.warning); + if (main.error.verbosity == f_console_verbosity_debug) { + f_color_print_code(f_type_debug, main.context.warning); fprintf(f_type_debug, "%s ", tools[j]); for (f_array_length_t k = 0; k < arguments.used; k++) { fprintf(f_type_debug, "%.*s ", arguments.array[k].used, arguments.array[k].string); } // for - f_color_print_code(f_type_debug, data.context.reset); + f_color_print_code(f_type_debug, main.context.reset); fprintf(f_type_debug, "\n"); } @@ -1329,24 +1329,24 @@ f_status_t firewall_default_lock(const firewall_data_t data) { status = F_status_set_fine(status); if (status == F_failure) { - f_color_print(data.error.to.stream, data.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, tools[j], f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, tools[j], f_string_eol_s[0]); fprintf(f_type_error, " "); - f_color_print_code(f_type_error, data.context.error); + f_color_print_code(f_type_error, main.context.error); fprintf(f_type_error, "%s ", tools[j]); for (f_array_length_t k = 0; k < arguments.used; k++) { fprintf(f_type_error, "%.*s ", arguments.array[k].used, arguments.array[k].string); } // for - f_color_print_code(f_type_error, data.context.reset); + f_color_print_code(f_type_error, main.context.reset); fprintf(f_type_error, "\n"); } else if (status == F_parameter) { - f_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]); } else { - f_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]); } return status; @@ -1357,7 +1357,7 @@ f_status_t firewall_default_lock(const firewall_data_t data) { return status; } -f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, firewall_local_data_t *local, firewall_data_t *data) { +f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, firewall_local_data_t *local, firewall_main_t *main) { f_file_t file = f_file_t_initialize; f_status_t status = f_file_open(filename, 0, &file); @@ -1367,26 +1367,26 @@ f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, if (optional) { if (status == F_parameter) { - f_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_open().%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sInvalid parameter when calling f_file_open().%c", fll_error_print_error, f_string_eol_s[0]); } else if (status != F_file_found_not && status != F_file_open && status != F_file_descriptor) { - f_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open().%c", fll_error_print_error, status, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open().%c", fll_error_print_error, status, f_string_eol_s[0]); } } else { if (status == F_parameter) { - f_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_open().%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sInvalid parameter when calling f_file_open().%c", fll_error_print_error, f_string_eol_s[0]); } else if (status == F_file_found_not) { - f_color_print(data->error.to.stream, data->context.set.error, "%sUnable to find the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to find the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); } else if (status == F_file_open) { - f_color_print(data->error.to.stream, data->context.set.error, "%sUnable to open the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to open the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); } else if (status == F_file_descriptor) { - f_color_print(data->error.to.stream, data->context.set.error, "%sFile descriptor error while trying to open the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sFile descriptor error while trying to open the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open().%c", fll_error_print_error, status, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open().%c", fll_error_print_error, status, f_string_eol_s[0]); } } @@ -1401,25 +1401,25 @@ f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, status = F_status_set_fine(status); if (status == F_parameter) { - f_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_read().%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sInvalid parameter when calling f_file_read().%c", fll_error_print_error, f_string_eol_s[0]); } else if (status == F_number_overflow) { - f_color_print(data->error.to.stream, data->context.set.error, "%sInteger overflow while trying to buffer the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sInteger overflow while trying to buffer the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); } else if (status == F_file_closed) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe file '%s' is no longer open.%c", fll_error_print_error, filename, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe file '%s' is no longer open.%c", fll_error_print_error, filename, f_string_eol_s[0]); } else if (status == F_file_seek) { - f_color_print(data->error.to.stream, data->context.set.error, "%sA seek error occurred while accessing the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sA seek error occurred while accessing the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); } else if (status == F_file_read) { - f_color_print(data->error.to.stream, data->context.set.error, "%sA read error occurred while accessing the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sA read error occurred while accessing the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); } else if (status == F_memory_not) { - f_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_read().%c", fll_error_print_error, status, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_read().%c", fll_error_print_error, status, f_string_eol_s[0]); } return status; @@ -1438,23 +1438,23 @@ f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, status = F_status_set_fine(status); if (status == F_parameter) { - f_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling fll_fss_basic_list_read() for the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sInvalid parameter when calling fll_fss_basic_list_read() for the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); } else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) { - f_color_print(data->error.to.stream, data->context.set.error, "%sNo relevant data was found within the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sNo relevant main was found within the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]); } else if (status == F_memory_not) { - f_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", fll_error_print_error, status, filename, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", fll_error_print_error, status, filename, f_string_eol_s[0]); } } else { status = fl_fss_apply_delimit(delimits, &local->buffer); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); } } @@ -1464,7 +1464,7 @@ f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, return status; } -f_status_t firewall_process_rules(f_string_range_t *range, firewall_local_data_t *local, firewall_data_t *data) { +f_status_t firewall_process_rules(f_string_range_t *range, firewall_local_data_t *local, firewall_main_t *main) { f_fss_delimits_t delimits = f_fss_delimits_t_initialize; f_status_t status = fll_fss_extended_read(local->buffer, range, &local->rule_objects, &local->rule_contents, 0, 0, &delimits, 0); @@ -1473,26 +1473,26 @@ f_status_t firewall_process_rules(f_string_range_t *range, firewall_local_data_t status = fl_fss_apply_delimit(delimits, &local->buffer); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); } } f_macro_fss_delimits_t_delete_simple(delimits); if (F_status_is_error_not(status)) { - status = firewall_perform_commands(*local, *data); + status = firewall_perform_commands(*local, *main); if (F_status_is_error(status)) { status = F_status_set_fine(status); if (status == F_memory_not) { - f_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); } else if (status == F_failure) { // the error message has already been displayed. } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling firewall_perform_commands().%c", fll_error_print_error, status, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling firewall_perform_commands().%c", fll_error_print_error, status, f_string_eol_s[0]); } f_macro_fss_objects_t_delete_simple(local->rule_objects); diff --git a/level_3/firewall/c/private-firewall.h b/level_3/firewall/c/private-firewall.h index fdbef24..4f2b2ef 100644 --- a/level_3/firewall/c/private-firewall.h +++ b/level_3/firewall/c/private-firewall.h @@ -85,7 +85,7 @@ typedef struct { (structure.array[index].stop - structure.array[index].start) + 1 // TODO: temporarily added, convert this to a function below. -// TODO: also report: f_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol_s[0]); +// TODO: also report: f_color_print(main.error.to.stream, main.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol_s[0]); #define firewall_macro_append_argument_to_arguments(status, arguments, argument) \ if (arguments.used == arguments.size) { \ f_macro_string_dynamics_t_resize(status, arguments, arguments.used + firewall_default_allocation_step); \ @@ -105,15 +105,15 @@ typedef struct { * * @param local * Local firewall settings. - * @param data - * Firewall data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. */ -f_status_t firewall_perform_commands(const firewall_local_data_t local, const firewall_data_t data) f_attribute_visibility_internal; +f_status_t firewall_perform_commands(const firewall_local_data_t local, const firewall_main_t main) f_attribute_visibility_internal; /** * Create custom chains. @@ -122,41 +122,41 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi * firewall chains. * @param local * Local firewall settings. - * @param data - * Firewall data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. */ -f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, firewall_local_data_t *local, firewall_data_t *data) f_attribute_visibility_internal; +f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, firewall_local_data_t *local, firewall_main_t *main) f_attribute_visibility_internal; /** * Deallocate chains. * - * @param data - * Firewall data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. */ -f_status_t firewall_delete_chains(const firewall_data_t data) f_attribute_visibility_internal; +f_status_t firewall_delete_chains(const firewall_main_t main) f_attribute_visibility_internal; /** * Lock the firewall. * - * @param data - * Firewall data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. */ -f_status_t firewall_default_lock(const firewall_data_t data) f_attribute_visibility_internal; +f_status_t firewall_default_lock(const firewall_main_t main) f_attribute_visibility_internal; /** * Buffer firewall rules. @@ -168,15 +168,15 @@ f_status_t firewall_default_lock(const firewall_data_t data) f_attribute_visibil * FALSE otherwise (more are errors returned when not optional). * @param local * Local firewall settings. - * @param data - * Firewall data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. */ -f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, firewall_local_data_t *local, firewall_data_t *data) f_attribute_visibility_internal; +f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, firewall_local_data_t *local, firewall_main_t *main) f_attribute_visibility_internal; /** * Process buffered rules. @@ -185,18 +185,18 @@ f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, * The current position within the buffer and the stop point. * @param local * Local firewall settings. - * @param data - * Firewall data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. */ -f_status_t firewall_process_rules(f_string_range_t *range, firewall_local_data_t *local, firewall_data_t *data) f_attribute_visibility_internal; +f_status_t firewall_process_rules(f_string_range_t *range, firewall_local_data_t *local, firewall_main_t *main) f_attribute_visibility_internal; /** - * Delete allocated data. + * Delete allocated local data. * * @param local * Local firewall settings. diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index 2bcd2df..74efe97 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -41,7 +41,7 @@ extern "C" { fprintf(output.stream, "%c", f_string_eol_s[0]); - fprintf(output.stream, " This program will print the content associated with the given object and content data based on the FSS-0002 Basic List standard.%c", f_string_eol_s[0]); + fprintf(output.stream, " This program will print the content associated with the given object and content main based on the FSS-0002 Basic List standard.%c", f_string_eol_s[0]); fprintf(output.stream, "%c", f_string_eol_s[0]); @@ -159,30 +159,30 @@ extern "C" { #endif // _di_fss_basic_list_read_print_help_ #ifndef _di_fss_basic_list_read_main_ - f_status_t fss_basic_list_read_main(const f_console_arguments_t arguments, fss_basic_list_read_data_t *data) { + f_status_t fss_basic_list_read_main(const f_console_arguments_t arguments, fss_basic_list_read_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_basic_list_read_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_basic_list_read_total_parameters); { f_console_parameter_id_t ids[3] = { fss_basic_list_read_parameter_no_color, fss_basic_list_read_parameter_light, fss_basic_list_read_parameter_dark }; const f_console_parameter_ids_t choices = { ids, 3 }; - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_basic_list_read_data_delete(data); + fss_basic_list_read_main_delete(main); return F_status_set_error(status); } } @@ -196,142 +196,142 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_basic_list_read_data_delete(data); + fss_basic_list_read_main_delete(main); return status; } if (choice == fss_basic_list_read_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_basic_list_read_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_basic_list_read_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_basic_list_read_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_basic_list_read_parameter_help].result == f_console_result_found) { - fss_basic_list_read_print_help(data->output, data->context); + if (main->parameters[fss_basic_list_read_parameter_help].result == f_console_result_found) { + fss_basic_list_read_print_help(main->output, main->context); - fss_basic_list_read_data_delete(data); + fss_basic_list_read_main_delete(main); return status; } - if (data->parameters[fss_basic_list_read_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_basic_list_read_version); + if (main->parameters[fss_basic_list_read_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_basic_list_read_version); - fss_basic_list_read_data_delete(data); + fss_basic_list_read_main_delete(main); return status; } - if (data->remaining.used > 0 || data->process_pipe) { - if (data->parameters[fss_basic_list_read_parameter_at].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_at); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (main->remaining.used > 0 || main->process_pipe) { + if (main->parameters[fss_basic_list_read_parameter_at].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_at); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_basic_list_read_parameter_depth].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_list_read_parameter_depth].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_line); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_list_read_parameter_line].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_line); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_basic_list_read_parameter_name].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_name); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_list_read_parameter_name].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_name); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a string.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_basic_list_read_parameter_select].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_select); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_list_read_parameter_select].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_select); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { - if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_line); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { + if (main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_line); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } } - if (F_status_is_error_not(status) && data->parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { - if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { + if (main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_list_read_parameter_delimit].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a value.%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_list_read_parameter_delimit].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a value.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_list_read_parameter_delimit].result == f_console_result_additional) { - const f_array_length_t location = data->parameters[fss_basic_list_read_parameter_delimit].values.array[0]; + else if (main->parameters[fss_basic_list_read_parameter_delimit].result == f_console_result_additional) { + const f_array_length_t location = main->parameters[fss_basic_list_read_parameter_delimit].values.array[0]; f_array_length_t length = strnlen(arguments.argv[location], f_console_parameter_size); if (length == 0) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be empty.%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } else if (fl_string_compare(arguments.argv[location], fss_basic_list_read_delimit_mode_name_none, length, fss_basic_list_read_delimit_mode_name_none_length) == F_equal_to) { - data->delimit_mode = fss_basic_list_read_delimit_mode_none; + main->delimit_mode = fss_basic_list_read_delimit_mode_none; } else if (fl_string_compare(arguments.argv[location], fss_basic_list_read_delimit_mode_name_all, length, fss_basic_list_read_delimit_mode_name_all_length) == F_equal_to) { - data->delimit_mode = fss_basic_list_read_delimit_mode_all; + main->delimit_mode = fss_basic_list_read_delimit_mode_all; } else { - data->delimit_mode = fss_basic_list_read_delimit_mode_depth; + main->delimit_mode = fss_basic_list_read_delimit_mode_depth; if (arguments.argv[location][length - 1] == fss_basic_list_read_delimit_mode_name_greater[0]) { - data->delimit_mode = fss_basic_list_read_delimit_mode_depth_greater; + main->delimit_mode = fss_basic_list_read_delimit_mode_depth_greater; // shorten the length to better convert the remainder to a number. length--; } else if (arguments.argv[location][length - 1] == fss_basic_list_read_delimit_mode_name_lesser[0]) { - data->delimit_mode = fss_basic_list_read_delimit_mode_depth_lesser; + main->delimit_mode = fss_basic_list_read_delimit_mode_depth_lesser; // shorten the length to better convert the remainder to a number. length--; @@ -344,10 +344,10 @@ extern "C" { range.start++; } - status = fl_conversion_string_to_number_unsigned(arguments.argv[location], range, &data->delimit_depth); + status = fl_conversion_string_to_number_unsigned(arguments.argv[location], range, &main->delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_delimit, arguments.argv[location]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_delimit, arguments.argv[location]); } } } @@ -358,13 +358,13 @@ extern "C" { f_fss_delimits_t delimits = f_fss_delimits_t_initialize; f_fss_comments_t comments = f_fss_comments_t_initialize; - f_array_length_t original_size = data->quantity.total; + f_array_length_t original_size = main->quantity.total; if (F_status_is_error_not(status)) { - status = fss_basic_list_read_main_preprocess_depth(arguments, *data, &depths); + status = fss_basic_list_read_main_preprocess_depth(arguments, *main, &depths); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fss_basic_list_read_main_preprocess_depth", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fss_basic_list_read_main_preprocess_depth", F_true); } } @@ -374,73 +374,73 @@ extern "C" { f_macro_fss_delimits_t_delete_simple(delimits); f_macro_fss_comments_t_delete_simple(comments); - if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } - fss_basic_list_read_data_delete(data); + fss_basic_list_read_main_delete(main); return F_none; } - if (F_status_is_error_not(status) && data->parameters[fss_basic_list_read_parameter_select].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_select); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_list_read_parameter_select].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_select); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->process_pipe) { + if (F_status_is_error_not(status) && main->process_pipe) { f_file_t file = f_file_t_initialize; file.id = f_type_descriptor_input; - status = f_file_read(file, &data->buffer); + status = f_file_read(file, &main->buffer); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe); } else { - status = fss_basic_list_read_main_process_file(arguments, data, "-", depths, &delimits, &comments); + status = fss_basic_list_read_main_process_file(arguments, main, "-", depths, &delimits, &comments); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "fss_basic_list_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_basic_list_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe); } } // Clear buffers before continuing. - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); } - if (F_status_is_error_not(status) && data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { + if (F_status_is_error_not(status) && main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { f_file_t file = f_file_t_initialize; - status = f_file_open(arguments.argv[data->remaining.array[i]], 0, &file); + status = f_file_open(arguments.argv[main->remaining.array[i]], 0, &file); - data->quantity.total = original_size; + main->quantity.total = original_size; if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[data->remaining.array[i]], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[main->remaining.array[i]], "open", fll_error_file_type_file); break; } - if (!data->quantity.total) { - status = f_file_size_by_id(file.id, &data->quantity.total); + if (!main->quantity.total) { + status = f_file_size_by_id(file.id, &main->quantity.total); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); f_file_stream_close(F_true, &file); break; } // Skip past empty files. - if (!data->quantity.total) { - if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (!main->quantity.total) { + if (main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } f_file_stream_close(F_true, &file); @@ -448,32 +448,32 @@ extern "C" { } } - status = f_file_read_until(file, data->quantity.total, &data->buffer); + status = f_file_read_until(file, main->quantity.total, &main->buffer); f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); break; } - status = fss_basic_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[i]], depths, &delimits, &comments); + status = fss_basic_list_read_main_process_file(arguments, main, arguments.argv[main->remaining.array[i]], depths, &delimits, &comments); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "fss_basic_list_read_main_process_file", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_basic_list_read_main_process_file", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); break; } // Clear buffers before repeating the loop. - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); } // for if (F_status_is_error(status)) { - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); } } @@ -482,34 +482,34 @@ extern "C" { f_macro_fss_comments_t_delete_simple(comments); } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - fss_basic_list_read_data_delete(data); + fss_basic_list_read_main_delete(main); return status; } #endif // _di_fss_basic_list_read_main_ -#ifndef _di_fss_basic_list_read_data_delete_ - f_status_t fss_basic_list_read_data_delete(fss_basic_list_read_data_t *data) { +#ifndef _di_fss_basic_list_read_main_delete_ + f_status_t fss_basic_list_read_main_delete(fss_basic_list_read_main_t *main) { for (f_array_length_t i = 0; i < fss_basic_list_read_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_basic_list_read_data_delete_ +#endif // _di_fss_basic_list_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.h b/level_3/fss_basic_list_read/c/fss_basic_list_read.h index 9dc9351..c0c8c6a 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.h +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.h @@ -7,7 +7,7 @@ * * This is the FSS Basic List Read program * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_basic_list_read_data_t. + * This program processes files or other input in fss format and stores the results in the fss_basic_list_read_main_t. * * This processes in accordance to the FSS-0002 Basic List specification. */ @@ -165,7 +165,7 @@ extern "C" { }; #endif // _di_fss_basic_list_read_delimit_modes_ -#ifndef _di_fss_basic_list_read_data_t_ +#ifndef _di_fss_basic_list_read_main_t_ typedef struct { f_console_parameter_t parameters[fss_basic_list_read_total_parameters]; @@ -184,9 +184,9 @@ extern "C" { f_array_length_t delimit_depth; f_color_context_t context; - } fss_basic_list_read_data_t; + } fss_basic_list_read_main_t; - #define fss_basic_list_read_data_t_initialize \ + #define fss_basic_list_read_main_t_initialize \ { \ fss_basic_list_read_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -201,7 +201,7 @@ extern "C" { 0, \ f_color_context_t_initialize, \ } -#endif // _di_fss_basic_list_read_data_t_ +#endif // _di_fss_basic_list_read_main_t_ /** * Print help. @@ -221,31 +221,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_basic_list_read_data_delete() after executing this. + * Be sure to call fss_basic_list_read_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see fss_basic_list_read_data_delete() + * @see fss_basic_list_read_main_delete() */ #ifndef _di_fss_basic_list_read_main_ - extern f_status_t fss_basic_list_read_main(const f_console_arguments_t arguments, fss_basic_list_read_data_t *data); + extern f_status_t fss_basic_list_read_main(const f_console_arguments_t arguments, fss_basic_list_read_main_t *main); #endif // _di_fss_basic_list_read_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_basic_list_read_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -254,9 +254,9 @@ extern "C" { * * @see fss_basic_list_read_main() */ -#ifndef _di_fss_basic_list_read_data_delete_ - extern f_status_t fss_basic_list_read_data_delete(fss_basic_list_read_data_t *data); -#endif // _di_fss_basic_list_read_data_delete_ +#ifndef _di_fss_basic_list_read_main_delete_ + extern f_status_t fss_basic_list_read_main_delete(fss_basic_list_read_main_t *main); +#endif // _di_fss_basic_list_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_list_read/c/main.c b/level_3/fss_basic_list_read/c/main.c index caab106..9881dcf 100644 --- a/level_3/fss_basic_list_read/c/main.c +++ b/level_3/fss_basic_list_read/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_basic_list_read_data_t data = fss_basic_list_read_data_t_initialize; + fss_basic_list_read_main_t main = fss_basic_list_read_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_basic_list_read_main(arguments, &data); + const f_status_t status = fss_basic_list_read_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c index cb0527c..19c212c 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c @@ -6,20 +6,20 @@ extern "C" { #endif #ifndef _di_fss_basic_list_read_main_preprocess_depth_ - f_status_t fss_basic_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_basic_list_read_data_t data, fss_basic_list_read_depths_t *depths) { + f_status_t fss_basic_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_basic_list_read_main_t main, fss_basic_list_read_depths_t *depths) { f_status_t status = F_none; { f_array_length_t depth_size = 1; - if (data.parameters[fss_basic_list_read_parameter_depth].result == f_console_result_additional) { - depth_size = data.parameters[fss_basic_list_read_parameter_depth].values.used; + if (main.parameters[fss_basic_list_read_parameter_depth].result == f_console_result_additional) { + depth_size = main.parameters[fss_basic_list_read_parameter_depth].values.used; } fss_basic_list_read_macro_depths_t_resize(status, (*depths), depth_size); if (F_status_is_error(status)) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); return status; } @@ -38,60 +38,60 @@ extern "C" { f_macro_string_dynamic_t_clear(depths->array[i].value_name); - if (!data.parameters[fss_basic_list_read_parameter_depth].values.used) { + if (!main.parameters[fss_basic_list_read_parameter_depth].values.used) { position_depth = 0; } else { - position_depth = data.parameters[fss_basic_list_read_parameter_depth].values.array[i]; + position_depth = main.parameters[fss_basic_list_read_parameter_depth].values.array[i]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[position_depth])); status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], range, &depths->array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_depth, arguments.argv[position_depth]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_depth, arguments.argv[position_depth]); return status; } } - if (data.parameters[fss_basic_list_read_parameter_at].result == f_console_result_additional) { - for (; position_at < data.parameters[fss_basic_list_read_parameter_at].values.used; position_at++) { + if (main.parameters[fss_basic_list_read_parameter_at].result == f_console_result_additional) { + for (; position_at < main.parameters[fss_basic_list_read_parameter_at].values.used; position_at++) { - if (data.parameters[fss_basic_list_read_parameter_at].values.array[position_at] < position_depth) { + if (main.parameters[fss_basic_list_read_parameter_at].values.array[position_at] < position_depth) { continue; } - if (i + 1 < depths->used && data.parameters[fss_basic_list_read_parameter_at].values.array[position_at] > data.parameters[fss_basic_list_read_parameter_depth].values.array[i + 1]) { + if (i + 1 < depths->used && main.parameters[fss_basic_list_read_parameter_at].values.array[position_at] > main.parameters[fss_basic_list_read_parameter_depth].values.array[i + 1]) { break; } - depths->array[i].index_at = data.parameters[fss_basic_list_read_parameter_at].values.array[position_at]; + depths->array[i].index_at = main.parameters[fss_basic_list_read_parameter_at].values.array[position_at]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[depths->array[i].index_at])); status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], range, &depths->array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_at, arguments.argv[depths->array[i].index_at]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_at, arguments.argv[depths->array[i].index_at]); return status; } } // for } - if (data.parameters[fss_basic_list_read_parameter_name].result == f_console_result_additional) { - for (; position_name < data.parameters[fss_basic_list_read_parameter_name].values.used; position_name++) { + if (main.parameters[fss_basic_list_read_parameter_name].result == f_console_result_additional) { + for (; position_name < main.parameters[fss_basic_list_read_parameter_name].values.used; position_name++) { - if (data.parameters[fss_basic_list_read_parameter_name].values.array[position_name] < position_depth) { + if (main.parameters[fss_basic_list_read_parameter_name].values.array[position_name] < position_depth) { continue; } - if (i + 1 < depths->used && data.parameters[fss_basic_list_read_parameter_name].values.array[position_name] > data.parameters[fss_basic_list_read_parameter_depth].values.array[i + 1]) { + if (i + 1 < depths->used && main.parameters[fss_basic_list_read_parameter_name].values.array[position_name] > main.parameters[fss_basic_list_read_parameter_depth].values.array[i + 1]) { break; } - depths->array[i].index_name = data.parameters[fss_basic_list_read_parameter_name].values.array[position_name]; + depths->array[i].index_name = main.parameters[fss_basic_list_read_parameter_name].values.array[position_name]; - if (data.parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { status = fl_string_rip(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } else { @@ -103,34 +103,34 @@ extern "C" { // @todo: move error printing into common function. if (status_code == F_memory_not) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); } else if (status_code == F_string_too_large) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to process '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_trim); - f_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to process '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_trim); + f_color_print(main.error.to.stream, main.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol_s[0]); } else { f_string_t function = "f_string_append"; - if (data.parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { function = "fl_string_rip"; } - f_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code); - f_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling "); - f_color_print(data.error.to.stream, data.context.set.notable, "%s()", function); - f_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%u", status_code); + f_color_print(main.error.to.stream, main.context.set.error, ") has occurred while calling "); + f_color_print(main.error.to.stream, main.context.set.notable, "%s()", function); + f_color_print(main.error.to.stream, main.context.set.error, ".%c", f_string_eol_s[0]); } return status; } if (!depths->array[i].value_name.used) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_name); - f_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_name); + f_color_print(main.error.to.stream, main.context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } @@ -143,22 +143,22 @@ extern "C" { for (f_array_length_t j = i + 1; j < depths->used; j++) { if (depths->array[i].depth == depths->array[j].depth) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe value '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); - f_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe value '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth); + f_color_print(main.error.to.stream, main.context.set.error, "' may only be specified once for the parameter '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } else if (depths->array[i].depth > depths->array[j].depth) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth); - f_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); - f_color_print(data.error.to.stream, data.context.set.error, "' before the value '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[j].depth); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth); + f_color_print(main.error.to.stream, main.context.set.error, "' may not have the value '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth); + f_color_print(main.error.to.stream, main.context.set.error, "' before the value '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[j].depth); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } @@ -170,36 +170,36 @@ extern "C" { #endif // _di_fss_basic_list_read_main_preprocess_depth_ #ifndef _di_fss_basic_list_read_main_process_file_ - f_status_t fss_basic_list_read_main_process_file(const f_console_arguments_t arguments, fss_basic_list_read_data_t *data, const f_string_t filename, const fss_basic_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { + f_status_t fss_basic_list_read_main_process_file(const f_console_arguments_t arguments, fss_basic_list_read_main_t *main, const f_string_t filename, const fss_basic_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { f_status_t status = F_none; const f_array_lengths_t except_none = f_array_lengths_t_initialize; bool delimited = F_true; // for this standard, delimits would always be applied, except for when delimit_depth is greater than 0. - if (data->delimit_mode == fss_basic_list_read_delimit_mode_none || (data->delimit_depth && (data->delimit_mode == fss_basic_list_read_delimit_mode_depth || data->delimit_mode == fss_basic_list_read_delimit_mode_depth_greater))) { + if (main->delimit_mode == fss_basic_list_read_delimit_mode_none || (main->delimit_depth && (main->delimit_mode == fss_basic_list_read_delimit_mode_depth || main->delimit_mode == fss_basic_list_read_delimit_mode_depth_greater))) { delimited = F_false; } { - f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used); + f_string_range_t input = f_macro_string_range_t_initialize(main->buffer.used); delimits->used = 0; comments->used = 0; - status = fll_fss_basic_list_read(data->buffer, &input, &data->objects, &data->contents, delimits, 0, comments); + status = fll_fss_basic_list_read(main->buffer, &input, &main->objects, &main->contents, delimits, 0, comments); if (F_status_is_error(status)) { // @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate. - fll_error_file_print(data->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, filename, "process", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, filename, "process", fll_error_file_type_file); } else if (status == F_data_not_stop || status == F_data_not_eos) { - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); - if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); return F_none; } @@ -207,9 +207,9 @@ extern "C" { } if (F_status_is_error(status)) { - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); return status; } @@ -220,21 +220,21 @@ extern "C" { // comments are not to be part of the file, so remove them. for (; i < comments->used; ++i) { for (j = comments->array[i].start; j <= comments->array[i].stop; ++j) { - data->buffer.string[j] = f_fss_delimit_placeholder; + main->buffer.string[j] = f_fss_delimit_placeholder; } // for } // for } f_number_unsigned_t select = 0; - if (data->parameters[fss_basic_list_read_parameter_select].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_basic_list_read_parameter_select].values.array[data->parameters[fss_basic_list_read_parameter_select].values.used - 1]; + if (main->parameters[fss_basic_list_read_parameter_select].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_basic_list_read_parameter_select].values.array[main->parameters[fss_basic_list_read_parameter_select].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &select); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_select, arguments.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_select, arguments.argv[index]); return status; } @@ -246,75 +246,75 @@ extern "C" { f_array_length_t line = 0; - if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_basic_list_read_parameter_line].values.array[data->parameters[fss_basic_list_read_parameter_line].values.used - 1]; + if (main->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_basic_list_read_parameter_line].values.array[main->parameters[fss_basic_list_read_parameter_line].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &line); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_line, arguments.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_line, arguments.argv[index]); return status; } } - bool names[data->objects.used]; + bool names[main->objects.used]; f_array_length_t i = 0; f_array_length_t j = 0; if (depths.array[0].index_name > 0) { - memset(names, 0, sizeof(bool) * data->objects.used); + memset(names, 0, sizeof(bool) * main->objects.used); - if (data->parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { - for (i = 0; i < data->objects.used; i++) { + if (main->parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { + for (i = 0; i < main->objects.used; i++) { - if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, *delimits) == F_equal_to) { + if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[0].value_name, main->buffer, main->objects.array[i], except_none, *delimits) == F_equal_to) { names[i] = 1; } } // for } else { - for (i = 0; i < data->objects.used; i++) { - if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, *delimits) == F_equal_to) { + for (i = 0; i < main->objects.used; i++) { + if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[0].value_name, main->buffer, main->objects.array[i], except_none, *delimits) == F_equal_to) { names[i] = 1; } } // for } } else { - memset(names, 1, sizeof(bool) * data->objects.used); + memset(names, 1, sizeof(bool) * main->objects.used); } bool include_empty = 0; - if (data->parameters[fss_basic_list_read_parameter_empty].result == f_console_result_found) { + if (main->parameters[fss_basic_list_read_parameter_empty].result == f_console_result_found) { include_empty = 1; } - if (data->parameters[fss_basic_list_read_parameter_object].result == f_console_result_found) { - if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + if (main->parameters[fss_basic_list_read_parameter_object].result == f_console_result_found) { + if (main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { if (depths.array[0].index_at > 0) { - if (depths.array[0].value_at < data->objects.used && names[depths.array[0].value_at]) { - fprintf(data->output.stream, "1%c", f_string_eol_s[0]); + if (depths.array[0].value_at < main->objects.used && names[depths.array[0].value_at]) { + fprintf(main->output.stream, "1%c", f_string_eol_s[0]); } else { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } } else if (depths.array[0].index_name > 0) { f_array_length_t total = 0; - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { if (!names[i]) continue; total++; } // for - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); } else { - fprintf(data->output.stream, "%llu%c", data->objects.used, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", main->objects.used, f_string_eol_s[0]); } return F_none; @@ -322,7 +322,7 @@ extern "C" { f_status_t (*print_object)(FILE *, const f_string_static_t, const f_string_range_t, const f_array_lengths_t) = &f_print_except_dynamic_partial; - if (data->parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { + if (main->parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { print_object = &fl_print_trim_except_dynamic_partial; } @@ -330,23 +330,23 @@ extern "C" { f_array_length_t at = 0; f_array_length_t i = 0; - for (; i < data->objects.used; i++) { + for (; i < main->objects.used; i++) { if (names[i]) { if (at == depths.array[0].value_at) { - print_object(data->output.stream, data->buffer, data->objects.array[i], delimited ? *delimits : except_none); + print_object(main->output.stream, main->buffer, main->objects.array[i], delimited ? *delimits : except_none); - fss_basic_list_read_print_object_end(*data); + fss_basic_list_read_print_object_end(*main); - if (data->parameters[fss_basic_list_read_parameter_content].result == f_console_result_found) { - if (data->contents.array[i].used) { - fss_basic_list_read_print_content_ignore(*data); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); - fss_basic_list_read_print_content_ignore(*data); + if (main->parameters[fss_basic_list_read_parameter_content].result == f_console_result_found) { + if (main->contents.array[i].used) { + fss_basic_list_read_print_content_ignore(*main); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_basic_list_read_print_content_ignore(*main); } } - fss_basic_list_read_print_set_end(*data); + fss_basic_list_read_print_set_end(*main); break; } @@ -357,32 +357,32 @@ extern "C" { return F_none; } - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { if (!names[i]) continue; - print_object(data->output.stream, data->buffer, data->objects.array[i], delimited ? *delimits : except_none); + print_object(main->output.stream, main->buffer, main->objects.array[i], delimited ? *delimits : except_none); - fss_basic_list_read_print_object_end(*data); + fss_basic_list_read_print_object_end(*main); - if (data->parameters[fss_basic_list_read_parameter_content].result == f_console_result_found) { - if (data->contents.array[i].used) { - fss_basic_list_read_print_content_ignore(*data); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); - fss_basic_list_read_print_content_ignore(*data); + if (main->parameters[fss_basic_list_read_parameter_content].result == f_console_result_found) { + if (main->contents.array[i].used) { + fss_basic_list_read_print_content_ignore(*main); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_basic_list_read_print_content_ignore(*main); } } - fss_basic_list_read_print_set_end(*data); + fss_basic_list_read_print_set_end(*main); } // for return F_none; } if (depths.array[0].index_at > 0) { - if (depths.array[0].value_at >= data->objects.used) { - if (names[depths.array[0].value_at] && data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (depths.array[0].value_at >= main->objects.used) { + if (names[depths.array[0].value_at] && main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } return F_none; @@ -392,73 +392,73 @@ extern "C" { f_array_length_t total = 0; f_array_length_t line_current = 0; - for (; i < data->objects.used; i++) { + for (; i < main->objects.used; i++) { if (names[i]) { if (at == depths.array[0].value_at) { - if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { - if (!data->contents.array[i].used) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + if (!main->contents.array[i].used) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } else { total = 1; - for (j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) { - if (!data->buffer.string[j]) continue; + for (j = main->contents.array[i].array[0].start; j <= main->contents.array[i].array[0].stop; j++) { + if (!main->buffer.string[j]) continue; - if (data->buffer.string[j] == f_string_eol_s[0]) { + if (main->buffer.string[j] == f_string_eol_s[0]) { total++; } } // for - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); } return F_none; } - if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { - if (!data->contents.array[i].used) { + if (main->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { + if (!main->contents.array[i].used) { if (include_empty && !line) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fss_basic_list_read_print_set_end(*data); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fss_basic_list_read_print_set_end(*main); } } else { - i = data->contents.array[i].array[0].start; + i = main->contents.array[i].array[0].start; if (!line) { - for (; i <= data->contents.array[i].array[0].stop; i++) { - if (!data->buffer.string[i]) continue; - if (data->buffer.string[i] == f_string_eol_s[0]) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + for (; i <= main->contents.array[i].array[0].stop; i++) { + if (!main->buffer.string[i]) continue; + if (main->buffer.string[i] == f_string_eol_s[0]) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); break; } - fprintf(data->output.stream, "%c", data->buffer.string[i]); + fprintf(main->output.stream, "%c", main->buffer.string[i]); } // for } else { line_current = 0; - for (; i <= data->contents.array[i].array[0].stop; i++) { - if (!data->buffer.string[i]) continue; + for (; i <= main->contents.array[i].array[0].stop; i++) { + if (!main->buffer.string[i]) continue; - if (data->buffer.string[i] == f_string_eol_s[0]) { + if (main->buffer.string[i] == f_string_eol_s[0]) { line_current++; if (line_current == line) { i++; - for (; i <= data->contents.array[i].array[0].stop; i++) { - if (!data->buffer.string[i]) continue; + for (; i <= main->contents.array[i].array[0].stop; i++) { + if (!main->buffer.string[i]) continue; - if (data->buffer.string[i] == f_string_eol_s[0]) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + if (main->buffer.string[i] == f_string_eol_s[0]) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); break; } - fprintf(data->output.stream, "%c", data->buffer.string[i]); + fprintf(main->output.stream, "%c", main->buffer.string[i]); } // for break; @@ -471,16 +471,16 @@ extern "C" { return F_none; } - if (data->contents.array[i].used > 0) { - fss_basic_list_read_print_content_ignore(*data); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); - fss_basic_list_read_print_content_ignore(*data); + if (main->contents.array[i].used > 0) { + fss_basic_list_read_print_content_ignore(*main); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_basic_list_read_print_content_ignore(*main); - fss_basic_list_read_print_set_end(*data); + fss_basic_list_read_print_set_end(*main); } else if (include_empty) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fss_basic_list_read_print_set_end(*data); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fss_basic_list_read_print_set_end(*main); } break; @@ -493,13 +493,13 @@ extern "C" { return F_none; } - if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + if (main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { f_array_length_t total = 0; - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { if (!names[i]) continue; - if (!data->contents.array[i].used) { + if (!main->contents.array[i].used) { if (include_empty) { total++; } @@ -507,28 +507,28 @@ extern "C" { continue; } - for (j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) { - if (!data->buffer.string[j]) continue; + for (j = main->contents.array[i].array[0].start; j <= main->contents.array[i].array[0].stop; j++) { + if (!main->buffer.string[j]) continue; - if (data->buffer.string[j] == f_string_eol_s[0]) { + if (main->buffer.string[j] == f_string_eol_s[0]) { total++; } } // for } // for - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); return F_none; } - if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { - for (f_array_length_t line_current = 0; i < data->contents.used; i++) { + if (main->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { + for (f_array_length_t line_current = 0; i < main->contents.used; i++) { if (!names[i]) continue; - if (!data->contents.array[i].used) { + if (!main->contents.array[i].used) { if (include_empty) { if (line_current == line) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fss_basic_list_read_print_set_end(*data); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fss_basic_list_read_print_set_end(*main); break; } @@ -538,12 +538,12 @@ extern "C" { continue; } - j = data->contents.array[i].array[0].start; + j = main->contents.array[i].array[0].start; if (line_current != line) { - for (; j <= data->contents.array[i].array[0].stop; j++) { + for (; j <= main->contents.array[i].array[0].stop; j++) { - if (data->buffer.string[j] == f_string_eol_s[0]) { + if (main->buffer.string[j] == f_string_eol_s[0]) { line_current++; if (line_current == line) { @@ -555,17 +555,17 @@ extern "C" { } if (line_current == line) { - if (j > data->contents.array[i].array[0].stop) continue; + if (j > main->contents.array[i].array[0].stop) continue; - for (; j <= data->contents.array[i].array[0].stop; j++) { - if (!data->buffer.string[j]) continue; + for (; j <= main->contents.array[i].array[0].stop; j++) { + if (!main->buffer.string[j]) continue; - if (data->buffer.string[j] == f_string_eol_s[0]) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + if (main->buffer.string[j] == f_string_eol_s[0]) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); break; } - fprintf(data->output.stream, "%c", data->buffer.string[j]); + fprintf(main->output.stream, "%c", main->buffer.string[j]); } // for break; @@ -575,23 +575,23 @@ extern "C" { return F_none; } - for (i = 0; i < data->contents.used; i++) { + for (i = 0; i < main->contents.used; i++) { if (!names[i]) continue; - if (!data->contents.array[i].used) { + if (!main->contents.array[i].used) { if (include_empty) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fss_basic_list_read_print_set_end(*data); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fss_basic_list_read_print_set_end(*main); } continue; } - fss_basic_list_read_print_content_ignore(*data); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); - fss_basic_list_read_print_content_ignore(*data); + fss_basic_list_read_print_content_ignore(*main); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_basic_list_read_print_content_ignore(*main); - fss_basic_list_read_print_set_end(*data); + fss_basic_list_read_print_set_end(*main); } // for return F_none; @@ -599,45 +599,45 @@ extern "C" { #endif // _di_fss_basic_list_read_main_process_file_ #ifndef _di_fss_basic_list_read_print_object_end_ - void fss_basic_list_read_print_object_end(const fss_basic_list_read_data_t data) { + void fss_basic_list_read_print_object_end(const fss_basic_list_read_main_t main) { - if (data.parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_basic_list_read_pipe_content_start); + if (main.parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_basic_list_read_pipe_content_start); } else { - if (data.parameters[fss_basic_list_read_parameter_content].result == f_console_result_found) { - fprintf(data.output.stream, "%c%c", f_fss_basic_list_open, f_fss_basic_list_open_end); + if (main.parameters[fss_basic_list_read_parameter_content].result == f_console_result_found) { + fprintf(main.output.stream, "%c%c", f_fss_basic_list_open, f_fss_basic_list_open_end); } else { - fprintf(data.output.stream, "%c", f_fss_eol); + fprintf(main.output.stream, "%c", f_fss_eol); } } } #endif // _di_fss_basic_list_read_print_object_end_ #ifndef _di_fss_basic_list_read_print_content_end_ - void fss_basic_list_read_print_content_end(const fss_basic_list_read_data_t data) { + void fss_basic_list_read_print_content_end(const fss_basic_list_read_main_t main) { - if (data.parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_basic_list_read_pipe_content_start); + if (main.parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_basic_list_read_pipe_content_start); } } #endif // _di_fss_basic_list_read_print_content_end_ #ifndef _di_fss_basic_list_read_print_content_ignore_ - void fss_basic_list_read_print_content_ignore(const fss_basic_list_read_data_t data) { + void fss_basic_list_read_print_content_ignore(const fss_basic_list_read_main_t main) { - if (data.parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_basic_list_read_pipe_content_ignore); + if (main.parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_basic_list_read_pipe_content_ignore); } } #endif // _di_fss_basic_list_read_print_content_ignore_ #ifndef _di_fss_basic_list_read_print_set_end_ - void fss_basic_list_read_print_set_end(const fss_basic_list_read_data_t data) { + void fss_basic_list_read_print_set_end(const fss_basic_list_read_main_t main) { - if (data.parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_basic_list_read_pipe_content_end); + if (main.parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_basic_list_read_pipe_content_end); } } #endif // _di_fss_basic_list_read_print_set_end_ diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h index ba2b29a..ffd4dab 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h @@ -116,8 +116,8 @@ extern "C" { * * @param arguments * The console arguments to pre-process. - * @param data - * The program specific data. + * @param main + * The main data. * @param depths * This stores the pre-processed depth parameters. * @@ -127,7 +127,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fss_basic_list_read_main_preprocess_depth_ - extern f_status_t fss_basic_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_basic_list_read_data_t data, fss_basic_list_read_depths_t *depths) f_attribute_visibility_internal; + extern f_status_t fss_basic_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_basic_list_read_main_t main, fss_basic_list_read_depths_t *depths) f_attribute_visibility_internal; #endif // _di_fss_basic_list_read_main_preprocess_depth_ /** @@ -135,8 +135,8 @@ extern "C" { * * @param arguments * The console arguments passed to the program. - * @param data - * The program specific data. + * @param main + * The main data. * @param file_name * The name of the file being processed. * @param depths @@ -155,17 +155,17 @@ extern "C" { * @see fss_basic_list_read_main_preprocess_depth() */ #ifndef _di_fss_basic_list_read_main_process_file_ - extern f_status_t fss_basic_list_read_main_process_file(const f_console_arguments_t arguments, fss_basic_list_read_data_t *data, const f_string_t file_name, const fss_basic_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) f_attribute_visibility_internal; + extern f_status_t fss_basic_list_read_main_process_file(const f_console_arguments_t arguments, fss_basic_list_read_main_t *main, const f_string_t file_name, const fss_basic_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) f_attribute_visibility_internal; #endif // _di_fss_basic_list_read_main_process_file_ /** * Print the end of an object (which is essentially the start of a content). * - * @param data - * The program specific data. + * @param main + * The main data. */ #ifndef _di_fss_basic_list_read_print_object_end_ - extern void fss_basic_list_read_print_object_end(const fss_basic_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_basic_list_read_print_object_end(const fss_basic_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_list_read_print_object_end_ /** @@ -173,31 +173,31 @@ extern "C" { * * This is only used in pipe output mode. * - * @param data - * The program specific data. + * @param main + * The main data. */ #ifndef _di_fss_basic_list_read_print_content_ignore_ - extern void fss_basic_list_read_print_content_ignore(const fss_basic_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_basic_list_read_print_content_ignore(const fss_basic_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_list_read_print_content_ignore_ /** * Print the end of an content. * - * @param data - * The program specific data. + * @param main + * The main data. */ #ifndef _di_fss_basic_list_read_print_content_end_ - extern void fss_basic_list_read_print_content_end(const fss_basic_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_basic_list_read_print_content_end(const fss_basic_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_list_read_print_content_end_ /** * Print the end of an object/content set. * - * @param data - * The program specific data. + * @param main + * The main data. */ #ifndef _di_fss_basic_list_read_print_set_end_ - extern void fss_basic_list_read_print_set_end(const fss_basic_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_basic_list_read_print_set_end(const fss_basic_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_list_read_print_set_end_ #ifdef __cplusplus diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index af0ee24..3e56c23 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -86,30 +86,30 @@ extern "C" { #endif // _di_fss_basic_list_write_print_help_ #ifndef _di_fss_basic_list_write_main_ - f_status_t fss_basic_list_write_main(const f_console_arguments_t arguments, fss_basic_list_write_data_t *data) { + f_status_t fss_basic_list_write_main(const f_console_arguments_t arguments, fss_basic_list_write_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_basic_list_write_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_basic_list_write_total_parameters); { f_console_parameter_id_t ids[3] = { fss_basic_list_write_parameter_no_color, fss_basic_list_write_parameter_light, fss_basic_list_write_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_basic_list_write_data_delete(data); + fss_basic_list_write_main_delete(main); return F_status_set_error(status); } } @@ -123,103 +123,103 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_basic_list_write_data_delete(data); + fss_basic_list_write_main_delete(main); return status; } if (choice == fss_basic_list_write_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_basic_list_write_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_basic_list_write_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_basic_list_write_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_basic_list_write_parameter_help].result == f_console_result_found) { - fss_basic_list_write_print_help(data->output, data->context); + if (main->parameters[fss_basic_list_write_parameter_help].result == f_console_result_found) { + fss_basic_list_write_print_help(main->output, main->context); - fss_basic_list_write_data_delete(data); + fss_basic_list_write_main_delete(main); return status; } - if (data->parameters[fss_basic_list_write_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_basic_list_write_version); + if (main->parameters[fss_basic_list_write_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_basic_list_write_version); - fss_basic_list_write_data_delete(data); + fss_basic_list_write_main_delete(main); return status; } f_file_t output = f_file_t_initialize; output.id = f_type_descriptor_output; - output.stream = data->output.stream; + output.stream = main->output.stream; output.flag = f_file_flag_create | f_file_flag_write_only | f_file_flag_append; if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_list_write_parameter_file].result == f_console_result_additional) { - if (data->parameters[fss_basic_list_write_parameter_file].values.used > 1) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_file); - f_color_print(data->error.to.stream, data->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_list_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[fss_basic_list_write_parameter_file].values.used > 1) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_file); + f_color_print(main->error.to.stream, main->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } else { - const f_array_length_t location = data->parameters[fss_basic_list_write_parameter_file].values.array[0]; + const f_array_length_t location = main->parameters[fss_basic_list_write_parameter_file].values.array[0]; output.id = -1; output.stream = 0; status = f_file_stream_open(arguments.argv[location], 0, &output); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); } } } - else if (data->parameters[fss_basic_list_write_parameter_file].result == f_console_result_found) { - fss_basic_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_basic_list_write_long_file); + else if (main->parameters[fss_basic_list_write_parameter_file].result == f_console_result_found) { + fss_basic_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_basic_list_write_long_file); status = F_status_set_error(F_parameter); } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_list_write_parameter_object].locations.used || data->parameters[fss_basic_list_write_parameter_content].locations.used) { - if (data->parameters[fss_basic_list_write_parameter_object].locations.used) { - if (data->parameters[fss_basic_list_write_parameter_object].locations.used != data->parameters[fss_basic_list_write_parameter_object].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_basic_list_write_long_object); + if (main->parameters[fss_basic_list_write_parameter_object].locations.used || main->parameters[fss_basic_list_write_parameter_content].locations.used) { + if (main->parameters[fss_basic_list_write_parameter_object].locations.used) { + if (main->parameters[fss_basic_list_write_parameter_object].locations.used != main->parameters[fss_basic_list_write_parameter_object].values.used) { + fss_basic_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_basic_list_write_long_object); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_list_write_parameter_content].locations.used != data->parameters[fss_basic_list_write_parameter_content].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_basic_list_write_long_content); + else if (main->parameters[fss_basic_list_write_parameter_content].locations.used != main->parameters[fss_basic_list_write_parameter_content].values.used) { + fss_basic_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_basic_list_write_long_content); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_list_write_parameter_object].locations.used != data->parameters[fss_basic_list_write_parameter_content].locations.used && data->parameters[fss_basic_list_write_parameter_partial].result == f_console_result_none) { - fss_basic_list_write_error_parameter_same_times_print(*data); + else if (main->parameters[fss_basic_list_write_parameter_object].locations.used != main->parameters[fss_basic_list_write_parameter_content].locations.used && main->parameters[fss_basic_list_write_parameter_partial].result == f_console_result_none) { + fss_basic_list_write_error_parameter_same_times_print(*main); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_list_write_parameter_content].locations.used && data->parameters[fss_basic_list_write_parameter_partial].locations.used) { - if (data->parameters[fss_basic_list_write_parameter_content].result == f_console_result_additional) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_partial); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter only allows either the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter or the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter, but not both.%c", f_string_eol_s[0]); + else if (main->parameters[fss_basic_list_write_parameter_content].locations.used && main->parameters[fss_basic_list_write_parameter_partial].locations.used) { + if (main->parameters[fss_basic_list_write_parameter_content].result == f_console_result_additional) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_partial); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter only allows either the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter or the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter, but not both.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -227,26 +227,26 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_list_write_parameter_content].result == f_console_result_additional) { + if (main->parameters[fss_basic_list_write_parameter_content].result == f_console_result_additional) { f_array_length_t location_object = 0; f_array_length_t location_content = 0; f_array_length_t location_sub_object = 0; f_array_length_t location_sub_content = 0; - for (f_array_length_t i = 0; i < data->parameters[fss_basic_list_write_parameter_object].locations.used; i++) { - location_object = data->parameters[fss_basic_list_write_parameter_object].locations.array[i]; - location_content = data->parameters[fss_basic_list_write_parameter_content].locations.array[i]; - location_sub_object = data->parameters[fss_basic_list_write_parameter_object].locations_sub.array[i]; - location_sub_content = data->parameters[fss_basic_list_write_parameter_content].locations_sub.array[i]; + for (f_array_length_t i = 0; i < main->parameters[fss_basic_list_write_parameter_object].locations.used; i++) { + location_object = main->parameters[fss_basic_list_write_parameter_object].locations.array[i]; + location_content = main->parameters[fss_basic_list_write_parameter_content].locations.array[i]; + location_sub_object = main->parameters[fss_basic_list_write_parameter_object].locations_sub.array[i]; + location_sub_content = main->parameters[fss_basic_list_write_parameter_content].locations_sub.array[i]; if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sEach ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter must be specified before a '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sEach ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter must be specified before a '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -256,37 +256,37 @@ extern "C" { } } } - else if (data->parameters[fss_basic_list_write_parameter_content].locations.used) { - if (data->parameters[fss_basic_list_write_parameter_content].locations.used != data->parameters[fss_basic_list_write_parameter_content].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_basic_list_write_long_content); + else if (main->parameters[fss_basic_list_write_parameter_content].locations.used) { + if (main->parameters[fss_basic_list_write_parameter_content].locations.used != main->parameters[fss_basic_list_write_parameter_content].values.used) { + fss_basic_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_basic_list_write_long_content); status = F_status_set_error(F_parameter); } - else if (!data->parameters[fss_basic_list_write_parameter_partial].locations.used) { - fss_basic_list_write_error_parameter_same_times_print(*data); + else if (!main->parameters[fss_basic_list_write_parameter_partial].locations.used) { + fss_basic_list_write_error_parameter_same_times_print(*main); status = F_status_set_error(F_parameter); } } } - else if (!data->process_pipe) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThis requires either piped data or the use of the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + else if (!main->process_pipe) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThis requires either piped main or the use of the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->process_pipe) { - if (data->parameters[fss_basic_list_write_parameter_partial].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_partial); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter cannot be used when processing a pipe.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->process_pipe) { + if (main->parameters[fss_basic_list_write_parameter_partial].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_partial); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter cannot be used when processing a pipe.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -295,38 +295,38 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_list_write_parameter_prepend].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_list_write_parameter_prepend].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_list_write_parameter_prepend].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_basic_list_write_parameter_prepend].values.array[data->parameters[fss_basic_list_write_parameter_prepend].values.used - 1]; + else if (main->parameters[fss_basic_list_write_parameter_prepend].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_basic_list_write_parameter_prepend].values.array[main->parameters[fss_basic_list_write_parameter_prepend].values.used - 1]; const f_array_length_t length = strnlen(arguments.argv[index], f_console_parameter_size); if (length) { f_string_range_t range = f_macro_string_range_t_initialize(length); - data->prepend.string = arguments.argv[index]; - data->prepend.used = length; - data->prepend.size = length; + main->prepend.string = arguments.argv[index]; + main->prepend.used = length; + main->prepend.size = length; for (; range.start < length; range.start++) { - status = f_fss_is_space(data->prepend, range); + status = f_fss_is_space(main->prepend, range); if (F_status_is_error(status)) break; if (status == F_false) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' must only contain whitespace.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' must only contain whitespace.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -335,11 +335,11 @@ extern "C" { } // for } else { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -348,25 +348,25 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_list_write_parameter_ignore].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no values were given.%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_list_write_parameter_ignore].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no values were given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_list_write_parameter_ignore].result == f_console_result_additional) { - const f_array_length_t total_locations = data->parameters[fss_basic_list_write_parameter_ignore].locations.used; - const f_array_length_t total_arguments = data->parameters[fss_basic_list_write_parameter_ignore].values.used; + else if (main->parameters[fss_basic_list_write_parameter_ignore].result == f_console_result_additional) { + const f_array_length_t total_locations = main->parameters[fss_basic_list_write_parameter_ignore].locations.used; + const f_array_length_t total_arguments = main->parameters[fss_basic_list_write_parameter_ignore].values.used; if (total_locations * 2 > total_arguments) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore); - f_color_print(data->error.to.stream, data->context.set.error, "' requires two values.%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore); + f_color_print(main->error.to.stream, main->context.set.error, "' requires two values.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } @@ -376,14 +376,14 @@ extern "C" { f_fss_quote_t quote = f_fss_delimit_quote_double; if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_list_write_parameter_double].result == f_console_result_found) { - if (data->parameters[fss_basic_list_write_parameter_single].result == f_console_result_found) { - if (data->parameters[fss_basic_list_write_parameter_double].location < data->parameters[fss_basic_list_write_parameter_single].location) { + if (main->parameters[fss_basic_list_write_parameter_double].result == f_console_result_found) { + if (main->parameters[fss_basic_list_write_parameter_single].result == f_console_result_found) { + if (main->parameters[fss_basic_list_write_parameter_double].location < main->parameters[fss_basic_list_write_parameter_single].location) { quote = f_fss_delimit_quote_single; } } } - else if (data->parameters[fss_basic_list_write_parameter_single].result == f_console_result_found) { + else if (main->parameters[fss_basic_list_write_parameter_single].result == f_console_result_found) { quote = f_fss_delimit_quote_single; } } @@ -395,72 +395,72 @@ extern "C" { if (F_status_is_error_not(status)) { f_string_dynamic_t escaped = f_string_dynamic_t_initialize; - if (data->process_pipe) { - status = fss_basic_list_write_process_pipe(*data, output, quote, &buffer); + if (main->process_pipe) { + status = fss_basic_list_write_process_pipe(*main, output, quote, &buffer); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sWhile processing the ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "input pipe"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sWhile processing the ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "input pipe"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); } } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_list_write_parameter_partial].result == f_console_result_found) { + if (main->parameters[fss_basic_list_write_parameter_partial].result == f_console_result_found) { - if (data->parameters[fss_basic_list_write_parameter_object].result == f_console_result_additional) { - for (f_array_length_t i = 0; i < data->parameters[fss_basic_list_write_parameter_object].values.used; i++) { + if (main->parameters[fss_basic_list_write_parameter_object].result == f_console_result_additional) { + for (f_array_length_t i = 0; i < main->parameters[fss_basic_list_write_parameter_object].values.used; i++) { - object.string = arguments.argv[data->parameters[fss_basic_list_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[fss_basic_list_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; - status = fss_basic_list_write_process(*data, output, quote, &object, 0, &buffer); + status = fss_basic_list_write_process(*main, output, quote, &object, 0, &buffer); if (F_status_is_error(status)) break; } // for } else { - for (f_array_length_t i = 0; i < data->parameters[fss_basic_list_write_parameter_content].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[fss_basic_list_write_parameter_content].values.used; i++) { - content.string = arguments.argv[data->parameters[fss_basic_list_write_parameter_content].values.array[i]]; + content.string = arguments.argv[main->parameters[fss_basic_list_write_parameter_content].values.array[i]]; content.used = strnlen(content.string, f_console_parameter_size); content.size = content.used; - status = fss_basic_list_write_process(*data, output, quote, 0, &content, &buffer); + status = fss_basic_list_write_process(*main, output, quote, 0, &content, &buffer); if (F_status_is_error(status)) break; } // for } } else { - for (f_array_length_t i = 0; i < data->parameters[fss_basic_list_write_parameter_object].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[fss_basic_list_write_parameter_object].values.used; i++) { - object.string = arguments.argv[data->parameters[fss_basic_list_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[fss_basic_list_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; - content.string = arguments.argv[data->parameters[fss_basic_list_write_parameter_content].values.array[i]]; + content.string = arguments.argv[main->parameters[fss_basic_list_write_parameter_content].values.array[i]]; content.used = strnlen(content.string, f_console_parameter_size); content.size = content.used; - status = fss_basic_list_write_process(*data, output, quote, &object, &content, &buffer); + status = fss_basic_list_write_process(*main, output, quote, &object, &content, &buffer); if (F_status_is_error(status)) break; } // for } if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sWhile processing the ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "input arguments"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sWhile processing the ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "input arguments"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); } } - else if (data->error.verbosity != f_console_verbosity_quiet && data->parameters[fss_basic_list_write_parameter_file].result == f_console_result_none) { + else if (main->error.verbosity != f_console_verbosity_quiet && main->parameters[fss_basic_list_write_parameter_file].result == f_console_result_none) { // ensure there is always a newline at the end, unless in quiet mode. - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); } } @@ -476,43 +476,43 @@ extern "C" { content.size = 0; } - if (data->parameters[fss_basic_list_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[fss_basic_list_write_parameter_file].result == f_console_result_additional) { if (output.id != -1) { f_file_stream_close(F_true, &output); } } // ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (data->error.verbosity != f_console_verbosity_quiet) { + if (main->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status)) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } } f_macro_string_dynamic_t_delete_simple(buffer); f_macro_string_dynamic_t_delete_simple(object); f_macro_string_dynamic_t_delete_simple(content); - fss_basic_list_write_data_delete(data); + fss_basic_list_write_main_delete(main); return status; } #endif // _di_fss_basic_list_write_main_ -#ifndef _di_fss_basic_list_write_data_delete_ - f_status_t fss_basic_list_write_data_delete(fss_basic_list_write_data_t *data) { +#ifndef _di_fss_basic_list_write_main_delete_ + f_status_t fss_basic_list_write_main_delete(fss_basic_list_write_main_t *main) { for (f_array_length_t i = 0; i < fss_basic_list_write_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_basic_list_write_data_delete_ +#endif // _di_fss_basic_list_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.h b/level_3/fss_basic_list_write/c/fss_basic_list_write.h index edff41f..c11550f 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.h +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.h @@ -126,7 +126,7 @@ extern "C" { #define fss_basic_list_write_total_parameters 18 #endif // _di_fss_basic_list_write_defines_ -#ifndef _di_fss_basic_list_write_data_t_ +#ifndef _di_fss_basic_list_write_main_t_ typedef struct { f_console_parameter_t parameters[fss_basic_list_write_total_parameters]; @@ -138,9 +138,9 @@ extern "C" { f_string_static_t prepend; f_color_context_t context; - } fss_basic_list_write_data_t; + } fss_basic_list_write_main_t; - #define fss_basic_list_write_data_t_initialize \ + #define fss_basic_list_write_main_t_initialize \ { \ fss_basic_list_write_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -150,7 +150,7 @@ extern "C" { f_string_static_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_fss_basic_list_write_data_t_ +#endif // _di_fss_basic_list_write_main_t_ /** * Print help. @@ -170,31 +170,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_basic_list_write_data_delete() after executing this. + * Be sure to call fss_basic_list_write_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see fss_basic_list_write_data_delete() + * @see fss_basic_list_write_main_delete() */ #ifndef _di_fss_basic_list_write_main_ - extern f_status_t fss_basic_list_write_main(const f_console_arguments_t arguments, fss_basic_list_write_data_t *data); + extern f_status_t fss_basic_list_write_main(const f_console_arguments_t arguments, fss_basic_list_write_main_t *main); #endif // _di_fss_basic_list_write_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_basic_list_write_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -203,9 +203,9 @@ extern "C" { * * @see fss_basic_list_write_main() */ -#ifndef _di_fss_basic_list_write_data_delete_ - extern f_status_t fss_basic_list_write_data_delete(fss_basic_list_write_data_t *data); -#endif // _di_fss_basic_list_write_data_delete_ +#ifndef _di_fss_basic_list_write_main_delete_ + extern f_status_t fss_basic_list_write_main_delete(fss_basic_list_write_main_t *main); +#endif // _di_fss_basic_list_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_list_write/c/main.c b/level_3/fss_basic_list_write/c/main.c index 3ebf995..b4e82b4 100644 --- a/level_3/fss_basic_list_write/c/main.c +++ b/level_3/fss_basic_list_write/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_basic_list_write_data_t data = fss_basic_list_write_data_t_initialize; + fss_basic_list_write_main_t main = fss_basic_list_write_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_basic_list_write_main(arguments, &data); + const f_status_t status = fss_basic_list_write_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_basic_list_write/c/private-fss_basic_list_write.c b/level_3/fss_basic_list_write/c/private-fss_basic_list_write.c index c44f94a..22b3612 100644 --- a/level_3/fss_basic_list_write/c/private-fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/private-fss_basic_list_write.c @@ -6,53 +6,53 @@ extern "C" { #endif #ifndef _di_fss_basic_list_write_error_parameter_same_times_print_ - void fss_basic_list_write_error_parameter_same_times_print(const fss_basic_list_write_data_t data) { + void fss_basic_list_write_error_parameter_same_times_print(const fss_basic_list_write_main_t main) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sMust specify both the '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_object); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter and the '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_content); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter the same number of times when not specifying the "); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_partial); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sMust specify both the '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_object); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter and the '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_content); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter the same number of times when not specifying the "); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_write_long_partial); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter.%c", f_string_eol_s[0]); } #endif // _di_fss_basic_list_write_error_parameter_same_times_print_ #ifndef _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ - void fss_basic_list_write_error_parameter_unsupported_eol_print(const fss_basic_list_write_data_t data) { + void fss_basic_list_write_error_parameter_unsupported_eol_print(const fss_basic_list_write_main_t main) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThis standard does not support end of line character '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "\\n"); - f_color_print(data.error.to.stream, data.context.set.error, "' in objects.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThis standard does not support end of line character '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "\\n"); + f_color_print(main.error.to.stream, main.context.set.error, "' in objects.%c", f_string_eol_s[0]); } #endif // _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_basic_list_write_error_parameter_value_missing_print_ - void fss_basic_list_write_error_parameter_value_missing_print(const fss_basic_list_write_data_t data, const f_string_t symbol, const f_string_t parameter) { + void fss_basic_list_write_error_parameter_value_missing_print(const fss_basic_list_write_main_t main, const f_string_t symbol, const f_string_t parameter) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", symbol, parameter); - f_color_print(data.error.to.stream, data.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", symbol, parameter); + f_color_print(main.error.to.stream, main.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } #endif // _di_fss_basic_list_write_error_parameter_value_missing_print_ #ifndef _di_fss_basic_list_write_process_ - f_status_t fss_basic_list_write_process(const fss_basic_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { + f_status_t fss_basic_list_write_process(const fss_basic_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_string_range_t range = f_string_range_t_initialize; @@ -70,7 +70,7 @@ extern "C" { } if (content) { - if (data.parameters[fss_basic_list_write_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_basic_list_write_parameter_trim].result == f_console_result_found) { complete = f_fss_complete_full_trim; } else { @@ -81,13 +81,13 @@ extern "C" { status = fl_fss_basic_list_object_write_string(*object, complete, &range, buffer); if (F_status_set_fine(status) == F_none_eol) { - fss_basic_list_write_error_parameter_unsupported_eol_print(data); + fss_basic_list_write_error_parameter_unsupported_eol_print(main); return F_status_set_error(F_supported_not); } if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_basic_list_object_write_string", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_basic_list_object_write_string", F_true); return status; } } @@ -96,10 +96,10 @@ extern "C" { range.start = 0; range.stop = content->used - 1; - status = fl_fss_basic_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &data.prepend, &range, buffer); + status = fl_fss_basic_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &main.prepend, &range, buffer); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_basic_list_content_write_string", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_basic_list_content_write_string", F_true); return status; } } @@ -108,7 +108,7 @@ extern "C" { status = f_string_append(f_string_eol, 1, buffer); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true); return status; } } @@ -121,7 +121,7 @@ extern "C" { #endif // _di_fss_basic_list_write_process_ #ifndef _di_fss_basic_list_write_process_pipe_ - f_status_t fss_basic_list_write_process_pipe(const fss_basic_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { + f_status_t fss_basic_list_write_process_pipe(const fss_basic_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_status_t status_pipe = F_none; @@ -151,7 +151,7 @@ extern "C" { status_pipe = f_file_read_block(input, &block); if (F_status_is_error(status_pipe)) { - fll_error_print(data.error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); + fll_error_print(main.error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); status_pipe = F_status_set_error(F_pipe); break; @@ -175,7 +175,7 @@ extern "C" { status = f_string_dynamic_increase_by(block.used, &object); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); break; } } @@ -224,7 +224,7 @@ extern "C" { status = f_string_dynamic_increase_by(total, &content); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); break; } } @@ -232,9 +232,9 @@ extern "C" { for (; range.start <= range.stop; range.start++) { if (block.string[range.start] == fss_basic_list_write_pipe_content_start) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThis standard only supports one content per object.%c", fll_error_print_error, f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThis standard only supports one content per object.%c", fll_error_print_error, f_string_eol_s[0]); } status = F_status_set_error(F_supported_not); @@ -263,7 +263,7 @@ extern "C" { } if (state == 0x3) { - status = fss_basic_list_write_process(data, output, quote, &object, &content, buffer); + status = fss_basic_list_write_process(main, output, quote, &object, &content, buffer); if (F_status_is_error(status)) break; state = 0; @@ -272,7 +272,7 @@ extern "C" { // if the pipe ended before finishing, then attempt to wrap up. if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) { - status = fss_basic_list_write_process(data, output, quote, &object, &content, buffer); + status = fss_basic_list_write_process(main, output, quote, &object, &content, buffer); } f_macro_string_dynamic_t_delete_simple(block); diff --git a/level_3/fss_basic_list_write/c/private-fss_basic_list_write.h b/level_3/fss_basic_list_write/c/private-fss_basic_list_write.h index 8782939..f81a888 100644 --- a/level_3/fss_basic_list_write/c/private-fss_basic_list_write.h +++ b/level_3/fss_basic_list_write/c/private-fss_basic_list_write.h @@ -15,42 +15,42 @@ extern "C" { /** * Print an message about the object and content parameters not being specified the same number of times. * - * @param data - * The program data. + * @param main + * The main data. */ #ifndef _di_fss_basic_list_write_error_parameter_same_times_print_ - void fss_basic_list_write_error_parameter_same_times_print(const fss_basic_list_write_data_t data) f_attribute_visibility_internal; + void fss_basic_list_write_error_parameter_same_times_print(const fss_basic_list_write_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_list_write_error_parameter_same_times_print_ /** * Print an message about a parameter EOL being unsupported. * - * @param data - * The program data. + * @param main + * The main data. */ #ifndef _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ - void fss_basic_list_write_error_parameter_unsupported_eol_print(const fss_basic_list_write_data_t data) f_attribute_visibility_internal; + void fss_basic_list_write_error_parameter_unsupported_eol_print(const fss_basic_list_write_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ /** * Print an message about a parameter missing a value. * - * @param data - * The program data. + * @param main + * The main data. * @param symbol * The console symbol, such as "--" in "--help". * @param parameter * The parameter name, such as "help" in "--help". */ #ifndef _di_fss_basic_list_write_error_parameter_value_missing_print_ - void fss_basic_list_write_error_parameter_value_missing_print(const fss_basic_list_write_data_t data, const f_string_t symbol, const f_string_t parameter) f_attribute_visibility_internal; + void fss_basic_list_write_error_parameter_value_missing_print(const fss_basic_list_write_main_t main, const f_string_t symbol, const f_string_t parameter) f_attribute_visibility_internal; #endif // _di_fss_basic_list_write_error_parameter_value_missing_print_ /** * Process a given object and content, printing the FSS if valid or an error if invalid. * - * @param data - * The program data. + * @param main + * The main data. * @param output * The file to output to. * @param quote @@ -70,14 +70,14 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_basic_list_write_process_ - extern f_status_t fss_basic_list_write_process(const fss_basic_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) f_attribute_visibility_internal; + extern f_status_t fss_basic_list_write_process(const fss_basic_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) f_attribute_visibility_internal; #endif // _di_fss_basic_list_write_process_ /** * Process the pipe, reading from the pipe and writing to the output. * - * @param data - * The program data. + * @param main + * The main data. * @param output * The file to output to. * @param quote @@ -91,7 +91,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_basic_list_write_process_pipe_ - extern f_status_t fss_basic_list_write_process_pipe(const fss_basic_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) f_attribute_visibility_internal; + extern f_status_t fss_basic_list_write_process_pipe(const fss_basic_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) f_attribute_visibility_internal; #endif // _di_fss_basic_list_write_process_pipe_ #ifdef __cplusplus diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index 17f5aff..71861d3 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -41,7 +41,7 @@ extern "C" { fprintf(output.stream, "%c", f_string_eol_s[0]); - fprintf(output.stream, " This program will print the content associated with the given object and content data based on the FSS-0000 Basic standard.%c", f_string_eol_s[0]); + fprintf(output.stream, " This program will print the content associated with the given object and content main based on the FSS-0000 Basic standard.%c", f_string_eol_s[0]); fprintf(output.stream, "%c", f_string_eol_s[0]); @@ -159,30 +159,30 @@ extern "C" { #endif // _di_fss_basic_read_print_help_ #ifndef _di_fss_basic_read_main_ - f_status_t fss_basic_read_main(const f_console_arguments_t arguments, fss_basic_read_data_t *data) { + f_status_t fss_basic_read_main(const f_console_arguments_t arguments, fss_basic_read_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_basic_read_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_basic_read_total_parameters); { f_console_parameter_id_t ids[3] = { fss_basic_read_parameter_no_color, fss_basic_read_parameter_light, fss_basic_read_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_basic_read_data_delete(data); + fss_basic_read_main_delete(main); return F_status_set_error(status); } } @@ -196,130 +196,130 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_basic_read_data_delete(data); + fss_basic_read_main_delete(main); return status; } if (choice == fss_basic_read_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_basic_read_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_basic_read_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_basic_read_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_basic_read_parameter_help].result == f_console_result_found) { - fss_basic_read_print_help(data->output, data->context); + if (main->parameters[fss_basic_read_parameter_help].result == f_console_result_found) { + fss_basic_read_print_help(main->output, main->context); - fss_basic_read_data_delete(data); + fss_basic_read_main_delete(main); return status; } - if (data->parameters[fss_basic_read_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_basic_read_version); + if (main->parameters[fss_basic_read_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_basic_read_version); - fss_basic_read_data_delete(data); + fss_basic_read_main_delete(main); return status; } - if (data->remaining.used > 0 || data->process_pipe) { - if (data->parameters[fss_basic_read_parameter_at].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_at); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (main->remaining.used > 0 || main->process_pipe) { + if (main->parameters[fss_basic_read_parameter_at].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_at); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_basic_read_parameter_depth].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_read_parameter_depth].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_basic_read_parameter_line].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_line); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_read_parameter_line].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_line); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_basic_read_parameter_name].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_name); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_read_parameter_name].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_name); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a string.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_basic_read_parameter_select].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_select); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_read_parameter_select].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_select); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (data->parameters[fss_basic_read_parameter_pipe].result == f_console_result_found) { - if (F_status_is_error_not(status) && data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_pipe); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_read_parameter_pipe].result == f_console_result_found) { + if (F_status_is_error_not(status) && main->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_pipe); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_read_parameter_delimit].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_delimit); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a value.%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_read_parameter_delimit].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_delimit); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a value.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_read_parameter_delimit].result == f_console_result_additional) { - const f_array_length_t location = data->parameters[fss_basic_read_parameter_delimit].values.array[0]; + else if (main->parameters[fss_basic_read_parameter_delimit].result == f_console_result_additional) { + const f_array_length_t location = main->parameters[fss_basic_read_parameter_delimit].values.array[0]; f_array_length_t length = strnlen(arguments.argv[location], f_console_parameter_size); if (length == 0) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_delimit); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be empty.%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_delimit); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } else if (fl_string_compare(arguments.argv[location], fss_basic_read_delimit_mode_name_none, length, fss_basic_read_delimit_mode_name_none_length) == F_equal_to) { - data->delimit_mode = fss_basic_read_delimit_mode_none; + main->delimit_mode = fss_basic_read_delimit_mode_none; } else if (fl_string_compare(arguments.argv[location], fss_basic_read_delimit_mode_name_all, length, fss_basic_read_delimit_mode_name_all_length) == F_equal_to) { - data->delimit_mode = fss_basic_read_delimit_mode_all; + main->delimit_mode = fss_basic_read_delimit_mode_all; } else { - data->delimit_mode = fss_basic_read_delimit_mode_depth; + main->delimit_mode = fss_basic_read_delimit_mode_depth; if (arguments.argv[location][length - 1] == fss_basic_read_delimit_mode_name_greater[0]) { - data->delimit_mode = fss_basic_read_delimit_mode_depth_greater; + main->delimit_mode = fss_basic_read_delimit_mode_depth_greater; // shorten the length to better convert the remainder to a number. length--; } else if (arguments.argv[location][length - 1] == fss_basic_read_delimit_mode_name_lesser[0]) { - data->delimit_mode = fss_basic_read_delimit_mode_depth_lesser; + main->delimit_mode = fss_basic_read_delimit_mode_depth_lesser; // shorten the length to better convert the remainder to a number. length--; @@ -332,10 +332,10 @@ extern "C" { range.start++; } - status = fl_conversion_string_to_number_unsigned(arguments.argv[location], range, &data->delimit_depth); + status = fl_conversion_string_to_number_unsigned(arguments.argv[location], range, &main->delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_delimit, arguments.argv[location]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_delimit, arguments.argv[location]); } } } @@ -346,10 +346,10 @@ extern "C" { f_fss_delimits_t delimits = f_fss_delimits_t_initialize; if (F_status_is_error_not(status)) { - status = fss_basic_read_depth_process(arguments, *data, &depths); + status = fss_basic_read_depth_process(arguments, *main, &depths); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fss_basic_read_depth_process", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fss_basic_read_depth_process", F_true); } } @@ -358,57 +358,57 @@ extern "C" { fss_basic_read_macro_depths_t_delete_simple(depths); f_macro_fss_delimits_t_delete_simple(delimits); - if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } - fss_basic_read_data_delete(data); + fss_basic_read_main_delete(main); return F_none; } - if (F_status_is_error_not(status) && data->parameters[fss_basic_read_parameter_select].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_select); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_basic_read_parameter_select].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_select); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]); fss_basic_read_macro_depths_t_delete_simple(depths); status = F_status_set_error(F_parameter); } // Provide a range designating where within the buffer a particular file exists, using a statically allocated array. @fixme make this a structure with - fss_basic_read_file_t files_array[data->remaining.used + 1]; + fss_basic_read_file_t files_array[main->remaining.used + 1]; fss_basic_read_files_t files = fss_basic_read_files_t_initialize; if (F_status_is_error_not(status)) { files.array = files_array; - files.size += data->remaining.used; + files.size += main->remaining.used; for (f_array_length_t i = 0; i < files.used; ++i) { f_macro_string_range_t_clear(files.array[i].range); } // for } - if (F_status_is_error_not(status) && data->process_pipe) { + if (F_status_is_error_not(status) && main->process_pipe) { file.id = f_type_descriptor_input; file.stream = f_type_input; files.array[0].name = 0; files.array[0].range.start = 0; - status = f_file_stream_read(file, 1, &data->buffer); + status = f_file_stream_read(file, 1, &main->buffer); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_stream_read", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, "-", "read", fll_error_file_type_pipe); } - else if (data->buffer.used) { - files.array[0].range.stop = data->buffer.used - 1; + else if (main->buffer.used) { + files.array[0].range.stop = main->buffer.used - 1; // This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter. // Guarantee that a newline exists at the end of the buffer. - status = f_string_append_assure(f_string_eol_s, 1, &data->buffer); + status = f_string_append_assure(f_string_eol_s, 1, &main->buffer); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe); } } else { @@ -416,41 +416,41 @@ extern "C" { } } - if (F_status_is_error_not(status) && data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { + if (F_status_is_error_not(status) && main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { - files.array[files.used].range.start = data->buffer.used; + files.array[files.used].range.start = main->buffer.used; file.stream = 0; file.id = -1; - status = f_file_stream_open(arguments.argv[data->remaining.array[i]], 0, &file); + status = f_file_stream_open(arguments.argv[main->remaining.array[i]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[data->remaining.array[i]], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[main->remaining.array[i]], "open", fll_error_file_type_file); f_file_stream_close(F_true, &file); break; } - status = f_file_stream_read(file, 1, &data->buffer); + status = f_file_stream_read(file, 1, &main->buffer); f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); break; } - else if (data->buffer.used > files.array[files.used].range.start) { - files.array[files.used].name = arguments.argv[data->remaining.array[i]]; - files.array[files.used++].range.stop = data->buffer.used - 1; + else if (main->buffer.used > files.array[files.used].range.start) { + files.array[files.used].name = arguments.argv[main->remaining.array[i]]; + files.array[files.used++].range.stop = main->buffer.used - 1; // This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter. // Guarantee that a newline exists at the end of the buffer. - status = f_string_append_assure(f_string_eol_s, 1, &data->buffer); + status = f_string_append_assure(f_string_eol_s, 1, &main->buffer); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, "-", "read", fll_error_file_type_pipe); } } else { @@ -460,45 +460,45 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = fss_basic_read_process(arguments, files, depths, data, &delimits); + status = fss_basic_read_process(arguments, files, depths, main, &delimits); } - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); fss_basic_read_macro_depths_t_delete_simple(depths); f_macro_fss_delimits_t_delete_simple(delimits); } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - fss_basic_read_data_delete(data); + fss_basic_read_main_delete(main); return status; } #endif // _di_fss_basic_read_main_ -#ifndef _di_fss_basic_read_data_delete_ - f_status_t fss_basic_read_data_delete(fss_basic_read_data_t *data) { +#ifndef _di_fss_basic_read_main_delete_ + f_status_t fss_basic_read_main_delete(fss_basic_read_main_t *main) { for (f_array_length_t i = 0; i < fss_basic_read_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_basic_read_data_delete_ +#endif // _di_fss_basic_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_read/c/fss_basic_read.h b/level_3/fss_basic_read/c/fss_basic_read.h index c04aa8b..ba4b19b 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.h +++ b/level_3/fss_basic_read/c/fss_basic_read.h @@ -7,7 +7,7 @@ * * This is the FSS Basic Read program * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_basic_read_data_t. + * This program processes files or other input in fss format and stores the results in the fss_basic_read_main_t. * * This processes in accordance to the FSS-0000 Basic specification. */ @@ -165,7 +165,7 @@ extern "C" { }; #endif // _di_fss_basic_read_delimit_modes_ -#ifndef _di_fss_basic_read_data_t_ +#ifndef _di_fss_basic_read_main_t_ typedef struct { f_console_parameter_t parameters[fss_basic_read_total_parameters]; @@ -183,9 +183,9 @@ extern "C" { f_array_length_t delimit_depth; f_color_context_t context; - } fss_basic_read_data_t; + } fss_basic_read_main_t; - #define fss_basic_read_data_t_initialize \ + #define fss_basic_read_main_t_initialize \ { \ fss_basic_read_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -199,7 +199,7 @@ extern "C" { 0, \ f_color_context_t_initialize, \ } -#endif // _di_fss_basic_read_data_t_ +#endif // _di_fss_basic_read_main_t_ /** * Print help. @@ -219,31 +219,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_basic_read_data_delete() after executing this. + * Be sure to call fss_basic_read_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see fss_basic_read_data_delete() + * @see fss_basic_read_main_delete() */ #ifndef _di_fss_basic_read_main_ - extern f_status_t fss_basic_read_main(const f_console_arguments_t arguments, fss_basic_read_data_t *data); + extern f_status_t fss_basic_read_main(const f_console_arguments_t arguments, fss_basic_read_main_t *main); #endif // _di_fss_basic_read_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_basic_read_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -252,9 +252,9 @@ extern "C" { * * @see fss_basic_read_main() */ -#ifndef _di_fss_basic_read_data_delete_ - extern f_status_t fss_basic_read_data_delete(fss_basic_read_data_t *data); -#endif // _di_fss_basic_read_data_delete_ +#ifndef _di_fss_basic_read_main_delete_ + extern f_status_t fss_basic_read_main_delete(fss_basic_read_main_t *main); +#endif // _di_fss_basic_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_read/c/main.c b/level_3/fss_basic_read/c/main.c index b436fe0..2af2ce9 100644 --- a/level_3/fss_basic_read/c/main.c +++ b/level_3/fss_basic_read/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_basic_read_data_t data = fss_basic_read_data_t_initialize; + fss_basic_read_main_t main = fss_basic_read_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_basic_read_main(arguments, &data); + const f_status_t status = fss_basic_read_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.c b/level_3/fss_basic_read/c/private-fss_basic_read.c index 1b0eafa..019cb5b 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.c +++ b/level_3/fss_basic_read/c/private-fss_basic_read.c @@ -6,21 +6,21 @@ extern "C" { #endif #ifndef _di_fss_basic_read_depth_process_ - f_status_t fss_basic_read_depth_process(const f_console_arguments_t arguments, const fss_basic_read_data_t data, fss_basic_read_depths_t *depths) { + f_status_t fss_basic_read_depth_process(const f_console_arguments_t arguments, const fss_basic_read_main_t main, fss_basic_read_depths_t *depths) { f_status_t status = F_none; { f_array_length_t depth_size = 1; - if (data.parameters[fss_basic_read_parameter_depth].result == f_console_result_additional) { - depth_size = data.parameters[fss_basic_read_parameter_depth].values.used; + if (main.parameters[fss_basic_read_parameter_depth].result == f_console_result_additional) { + depth_size = main.parameters[fss_basic_read_parameter_depth].values.used; } fss_basic_read_macro_depths_t_resize(status, (*depths), depth_size); if (F_status_is_error(status)) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); return status; } @@ -41,61 +41,61 @@ extern "C" { f_macro_string_dynamic_t_clear(depths->array[i].value_name); - if (!data.parameters[fss_basic_read_parameter_depth].values.used) { + if (!main.parameters[fss_basic_read_parameter_depth].values.used) { position_depth = 0; } else { - position_depth = data.parameters[fss_basic_read_parameter_depth].values.array[i]; + position_depth = main.parameters[fss_basic_read_parameter_depth].values.array[i]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[position_depth])); status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], range, &depths->array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_depth, arguments.argv[position_depth]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_depth, arguments.argv[position_depth]); return status; } } - if (data.parameters[fss_basic_read_parameter_at].result == f_console_result_additional) { - for (; position_at < data.parameters[fss_basic_read_parameter_at].values.used; position_at++) { + if (main.parameters[fss_basic_read_parameter_at].result == f_console_result_additional) { + for (; position_at < main.parameters[fss_basic_read_parameter_at].values.used; position_at++) { - if (data.parameters[fss_basic_read_parameter_at].values.array[position_at] < position_depth) { + if (main.parameters[fss_basic_read_parameter_at].values.array[position_at] < position_depth) { continue; } - if (i + 1 < depths->used && data.parameters[fss_basic_read_parameter_at].values.array[position_at] > data.parameters[fss_basic_read_parameter_depth].values.array[i + 1]) { + if (i + 1 < depths->used && main.parameters[fss_basic_read_parameter_at].values.array[position_at] > main.parameters[fss_basic_read_parameter_depth].values.array[i + 1]) { break; } - depths->array[i].index_at = data.parameters[fss_basic_read_parameter_at].values.array[position_at]; + depths->array[i].index_at = main.parameters[fss_basic_read_parameter_at].values.array[position_at]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[depths->array[i].index_at])); status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], range, &depths->array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_at, arguments.argv[depths->array[i].index_at]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_at, arguments.argv[depths->array[i].index_at]); return status; } } // for } - if (data.parameters[fss_basic_read_parameter_name].result == f_console_result_additional) { - for (; position_name < data.parameters[fss_basic_read_parameter_name].values.used; position_name++) { + if (main.parameters[fss_basic_read_parameter_name].result == f_console_result_additional) { + for (; position_name < main.parameters[fss_basic_read_parameter_name].values.used; position_name++) { - if (data.parameters[fss_basic_read_parameter_name].values.array[position_name] < position_depth) { + if (main.parameters[fss_basic_read_parameter_name].values.array[position_name] < position_depth) { continue; } - if (i + 1 < depths->used && data.parameters[fss_basic_read_parameter_name].values.array[position_name] > data.parameters[fss_basic_read_parameter_depth].values.array[i + 1]) { + if (i + 1 < depths->used && main.parameters[fss_basic_read_parameter_name].values.array[position_name] > main.parameters[fss_basic_read_parameter_depth].values.array[i + 1]) { break; } - depths->array[i].index_name = data.parameters[fss_basic_read_parameter_name].values.array[position_name]; + depths->array[i].index_name = main.parameters[fss_basic_read_parameter_name].values.array[position_name]; - if (data.parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { status = fl_string_rip(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } else { @@ -107,34 +107,34 @@ extern "C" { // @todo: move error printing into common function. if (status_code == F_memory_not) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); } else if (status_code == F_string_too_large) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to process '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_trim); - f_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to process '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_trim); + f_color_print(main.error.to.stream, main.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol_s[0]); } else { f_string_t function = "f_string_append"; - if (data.parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { function = "fl_string_rip"; } - f_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code); - f_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling "); - f_color_print(data.error.to.stream, data.context.set.notable, "%s()", function); - f_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%u", status_code); + f_color_print(main.error.to.stream, main.context.set.error, ") has occurred while calling "); + f_color_print(main.error.to.stream, main.context.set.notable, "%s()", function); + f_color_print(main.error.to.stream, main.context.set.error, ".%c", f_string_eol_s[0]); } return status; } if (!depths->array[i].value_name.used) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_name); - f_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_name); + f_color_print(main.error.to.stream, main.context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } @@ -147,22 +147,22 @@ extern "C" { for (f_array_length_t j = i + 1; j < depths->used; j++) { if (depths->array[i].depth == depths->array[j].depth) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe value '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); - f_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe value '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth); + f_color_print(main.error.to.stream, main.context.set.error, "' may only be specified once for the parameter '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } else if (depths->array[i].depth > depths->array[j].depth) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth); - f_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); - f_color_print(data.error.to.stream, data.context.set.error, "' before the value '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[j].depth); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth); + f_color_print(main.error.to.stream, main.context.set.error, "' may not have the value '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth); + f_color_print(main.error.to.stream, main.context.set.error, "' before the value '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[j].depth); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } @@ -188,16 +188,16 @@ extern "C" { #endif // _di_fss_basic_read_file_identify_ #ifndef _di_fss_basic_read_load_number_ - f_status_t fss_basic_read_load_number(const f_console_arguments_t arguments, const fss_basic_read_data_t data, const f_array_length_t parameter, const f_string_t name, f_number_unsigned_t *number) { + f_status_t fss_basic_read_load_number(const f_console_arguments_t arguments, const fss_basic_read_main_t main, const f_array_length_t parameter, const f_string_t name, f_number_unsigned_t *number) { - if (data.parameters[parameter].result == f_console_result_additional) { - const f_array_length_t index = data.parameters[parameter].values.array[data.parameters[parameter].values.used - 1]; + if (main.parameters[parameter].result == f_console_result_additional) { + const f_array_length_t index = main.parameters[parameter].values.array[main.parameters[parameter].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strnlen(arguments.argv[index], f_console_parameter_size)); const f_status_t status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, arguments.argv[index]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, arguments.argv[index]); return status; } @@ -208,79 +208,79 @@ extern "C" { #endif // _di_fss_basic_read_load_number_ #ifndef _di_fss_basic_read_print_at_ - void fss_basic_read_print_at(const fss_basic_read_data_t data, const f_array_length_t at, const bool include_empty, const f_fss_delimits_t delimits, const uint8_t print_this) { + void fss_basic_read_print_at(const fss_basic_read_main_t main, const f_array_length_t at, const bool include_empty, const f_fss_delimits_t delimits, const uint8_t print_this) { - if (at >= data.contents.used) { + if (at >= main.contents.used) { return; } - if (data.contents.array[at].used || include_empty) { + if (main.contents.array[at].used || include_empty) { f_status_t (*print_object)(FILE *, const f_string_static_t, const f_string_range_t, const f_array_lengths_t) = &f_print_except_dynamic_partial; - if (data.parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { print_object = &fl_print_trim_except_dynamic_partial; } const f_array_lengths_t except_none = f_array_lengths_t_initialize; - if (data.parameters[fss_basic_read_parameter_object].result == f_console_result_found) { - print_object(data.output.stream, data.buffer, data.objects.array[at], delimits); + if (main.parameters[fss_basic_read_parameter_object].result == f_console_result_found) { + print_object(main.output.stream, main.buffer, main.objects.array[at], delimits); if (print_this & 0x2) { - fss_basic_read_print_object_end(data); + fss_basic_read_print_object_end(main); } } - if ((print_this & 0x2) && data.contents.array[at].used) { - f_print_except_dynamic_partial(data.output.stream, data.buffer, data.contents.array[at].array[0], delimits); + if ((print_this & 0x2) && main.contents.array[at].used) { + f_print_except_dynamic_partial(main.output.stream, main.buffer, main.contents.array[at].array[0], delimits); } - if ((print_this & 0x1) || (print_this & 0x2) && (data.contents.array[at].used || include_empty)) { - fss_basic_read_print_set_end(data); + if ((print_this & 0x1) || (print_this & 0x2) && (main.contents.array[at].used || include_empty)) { + fss_basic_read_print_set_end(main); } } } #endif // _di_fss_basic_read_print_at_ #ifndef _di_fss_basic_read_print_object_end_ - void fss_basic_read_print_object_end(const fss_basic_read_data_t data) { + void fss_basic_read_print_object_end(const fss_basic_read_main_t main) { - if (data.parameters[fss_basic_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_basic_read_pipe_content_start); + if (main.parameters[fss_basic_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_basic_read_pipe_content_start); } else { - fprintf(data.output.stream, "%c", f_fss_space); + fprintf(main.output.stream, "%c", f_fss_space); } } #endif // _di_fss_basic_read_print_object_end_ #ifndef _di_fss_basic_read_print_one_ - void fss_basic_read_print_one(const fss_basic_read_data_t data) { - fprintf(data.output.stream, "1%c", f_string_eol_s[0]); + void fss_basic_read_print_one(const fss_basic_read_main_t main) { + fprintf(main.output.stream, "1%c", f_string_eol_s[0]); } #endif // _di_fss_basic_read_print_one_ #ifndef _di_fss_basic_read_print_set_end_ - void fss_basic_read_print_set_end(const fss_basic_read_data_t data) { + void fss_basic_read_print_set_end(const fss_basic_read_main_t main) { - if (data.parameters[fss_basic_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_basic_read_pipe_content_end); + if (main.parameters[fss_basic_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_basic_read_pipe_content_end); } else { - fprintf(data.output.stream, "%c", f_fss_eol); + fprintf(main.output.stream, "%c", f_fss_eol); } } #endif // _di_fss_basic_read_print_set_end_ #ifndef _di_fss_basic_read_print_zero_ - void fss_basic_read_print_zero(const fss_basic_read_data_t data) { - fprintf(data.output.stream, "0%c", f_string_eol_s[0]); + void fss_basic_read_print_zero(const fss_basic_read_main_t main) { + fprintf(main.output.stream, "0%c", f_string_eol_s[0]); } #endif // _di_fss_basic_read_print_zero_ #ifndef _di_fss_basic_read_process_ - f_status_t fss_basic_read_process(const f_console_arguments_t arguments, const fss_basic_read_files_t files, const fss_basic_read_depths_t depths, fss_basic_read_data_t *data, f_fss_delimits_t *delimits) { + f_status_t fss_basic_read_process(const f_console_arguments_t arguments, const fss_basic_read_files_t files, const fss_basic_read_depths_t depths, fss_basic_read_main_t *main, f_fss_delimits_t *delimits) { f_status_t status = F_none; @@ -290,34 +290,34 @@ extern "C" { f_number_unsigned_t select = 0; f_number_unsigned_t line = 0; - // @todo after changes to data, create a private data object for processing and using this and similar. + // @todo after changes to main, create a private main object for processing and using this and similar. // 0x1 = print object, 0x2 = print content. - uint8_t print_this = data->parameters[fss_basic_read_parameter_object].result == f_console_result_found; + uint8_t print_this = main->parameters[fss_basic_read_parameter_object].result == f_console_result_found; - if (!print_this || data->parameters[fss_basic_read_parameter_content].result == f_console_result_found) { + if (!print_this || main->parameters[fss_basic_read_parameter_content].result == f_console_result_found) { print_this |= 0x2; } - if (data->delimit_mode == fss_basic_read_delimit_mode_none || (data->delimit_depth && (data->delimit_mode == fss_basic_read_delimit_mode_depth || data->delimit_mode == fss_basic_read_delimit_mode_depth_greater))) { + if (main->delimit_mode == fss_basic_read_delimit_mode_none || (main->delimit_depth && (main->delimit_mode == fss_basic_read_delimit_mode_depth || main->delimit_mode == fss_basic_read_delimit_mode_depth_greater))) { delimited = F_false; } - if (data->parameters[fss_basic_read_parameter_empty].result == f_console_result_found) { + if (main->parameters[fss_basic_read_parameter_empty].result == f_console_result_found) { include_empty = F_true; } - status = fss_basic_read_load_number(arguments, *data, fss_basic_read_parameter_select, fss_basic_read_long_select, &select); + status = fss_basic_read_load_number(arguments, *main, fss_basic_read_parameter_select, fss_basic_read_long_select, &select); if (F_status_is_error(status)) return status; - status = fss_basic_read_load_number(arguments, *data, fss_basic_read_parameter_line, fss_basic_read_long_line, &line); + status = fss_basic_read_load_number(arguments, *main, fss_basic_read_parameter_line, fss_basic_read_long_line, &line); if (F_status_is_error(status)) return status; - if (data->parameters[fss_basic_read_parameter_select].result == f_console_result_additional) { + if (main->parameters[fss_basic_read_parameter_select].result == f_console_result_additional) { // This standard does not support multiple content groups. if (select) { - if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { - fss_basic_read_print_zero(*data); + if (main->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { + fss_basic_read_print_zero(*main); } return F_none; @@ -325,20 +325,20 @@ extern "C" { } { - f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used); + f_string_range_t input = f_macro_string_range_t_initialize(main->buffer.used); delimits->used = 0; - status = fll_fss_basic_read(data->buffer, &input, &data->objects, &data->contents, 0, delimits, 0); + status = fll_fss_basic_read(main->buffer, &input, &main->objects, &main->contents, 0, delimits, 0); if (F_status_is_error(status)) { const f_string_t file_name = fss_basic_read_file_identify(input.start, files); - fll_error_file_print(data->error, F_status_set_fine(status), "fll_fss_basic_read", F_true, file_name ? file_name : "-", "process", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_read", F_true, file_name ? file_name : "-", "process", fll_error_file_type_file); } else if (status == F_data_not_stop || status == F_data_not_eos) { - if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { - fss_basic_read_print_zero(*data); + if (main->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { + fss_basic_read_print_zero(*main); return F_none; } @@ -351,44 +351,44 @@ extern "C" { } } - bool names[data->objects.used]; + bool names[main->objects.used]; f_array_length_t i = 0; if (depths.array[0].index_name > 0) { - memset(names, 0, sizeof(bool) * data->objects.used); + memset(names, 0, sizeof(bool) * main->objects.used); - if (data->parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { - for (i = 0; i < data->objects.used; i++) { + if (main->parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { + for (i = 0; i < main->objects.used; i++) { - if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, *delimits) == F_equal_to) { + if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[0].value_name, main->buffer, main->objects.array[i], except_none, *delimits) == F_equal_to) { names[i] = 1; } } // for } else { - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { - if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, *delimits) == F_equal_to) { + if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[0].value_name, main->buffer, main->objects.array[i], except_none, *delimits) == F_equal_to) { names[i] = 1; } } // for } } else { - memset(names, 1, sizeof(bool) * data->objects.used); + memset(names, 1, sizeof(bool) * main->objects.used); } if (depths.array[0].index_at) { - if (depths.array[0].value_at >= data->objects.used) { - if (names[depths.array[0].value_at] && data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { - fss_basic_read_print_zero(*data); + if (depths.array[0].value_at >= main->objects.used) { + if (names[depths.array[0].value_at] && main->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { + fss_basic_read_print_zero(*main); } return F_none; } - if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { + if (main->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { if (line > 0) { return F_none; } @@ -396,36 +396,36 @@ extern "C" { f_array_length_t at = 0; - for (; i < data->objects.used; i++) { + for (; i < main->objects.used; i++) { if (!names[i]) continue; if (at == depths.array[0].value_at) { - if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { + if (main->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { // This standard only supports one Content per Object so when using "--at", the only valid line is line 0. - if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { + if (main->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { if (line) { - fss_basic_read_print_one(*data); + fss_basic_read_print_one(*main); } else { - fss_basic_read_print_zero(*data); + fss_basic_read_print_zero(*main); } } else if (!line) { - fss_basic_read_print_at(*data, i, include_empty, delimited ? *delimits : except_none, print_this); + fss_basic_read_print_at(*main, i, include_empty, delimited ? *delimits : except_none, print_this); } } - else if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { - if (!data->contents.array[i].used) { - fss_basic_read_print_zero(*data); + else if (main->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { + if (!main->contents.array[i].used) { + fss_basic_read_print_zero(*main); } else { - fss_basic_read_print_one(*data); + fss_basic_read_print_one(*main); } } else { - fss_basic_read_print_at(*data, i, include_empty, delimited ? *delimits : except_none, print_this); + fss_basic_read_print_at(*main, i, include_empty, delimited ? *delimits : except_none, print_this); } break; @@ -437,46 +437,46 @@ extern "C" { return F_none; } - if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { + if (main->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { f_array_length_t total = 0; - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { if (!names[i]) continue; - if (!(data->contents.array[i].used || include_empty)) { + if (!(main->contents.array[i].used || include_empty)) { continue; } total++; } // for - if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { + if (main->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { if (line < total) { - fss_basic_read_print_one(*data); + fss_basic_read_print_one(*main); } else { - fss_basic_read_print_zero(*data); + fss_basic_read_print_zero(*main); } } else { - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); } return F_none; } - if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { + if (main->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { f_array_length_t line_current = 0; - for (i = 0; i < data->contents.used; i++) { + for (i = 0; i < main->contents.used; i++) { if (!names[i]) continue; - if (!data->contents.array[i].used) { + if (!main->contents.array[i].used) { if (include_empty) { if (line_current == line) { - fss_basic_read_print_set_end(*data); + fss_basic_read_print_set_end(*main); break; } @@ -487,7 +487,7 @@ extern "C" { } if (line_current == line) { - fss_basic_read_print_at(*data, i, include_empty, delimited ? *delimits : except_none, print_this); + fss_basic_read_print_at(*main, i, include_empty, delimited ? *delimits : except_none, print_this); break; } @@ -498,11 +498,11 @@ extern "C" { return F_none; } - for (i = 0; i < data->contents.used; i++) { + for (i = 0; i < main->contents.used; i++) { if (!names[i]) continue; - fss_basic_read_print_at(*data, i, include_empty, delimited ? *delimits : except_none, print_this); + fss_basic_read_print_at(*main, i, include_empty, delimited ? *delimits : except_none, print_this); } // for return F_none; diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.h b/level_3/fss_basic_read/c/private-fss_basic_read.h index 553e163..62d3006 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.h +++ b/level_3/fss_basic_read/c/private-fss_basic_read.h @@ -169,8 +169,8 @@ extern "C" { * * @param arguments * The console arguments to pre-process. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param depths * This stores the pre-processed depth parameters. * @@ -180,7 +180,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fss_basic_read_depth_process_ - extern f_status_t fss_basic_read_depth_process(const f_console_arguments_t arguments, const fss_basic_read_data_t data, fss_basic_read_depths_t *depths) f_attribute_visibility_internal; + extern f_status_t fss_basic_read_depth_process(const f_console_arguments_t arguments, const fss_basic_read_main_t main, fss_basic_read_depths_t *depths) f_attribute_visibility_internal; #endif // _di_fss_basic_read_depth_process_ /** @@ -206,8 +206,8 @@ extern "C" { * * @param arguments * The console arguments passed to the program. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param parameter * An ID representing the parameter. * @param name @@ -221,7 +221,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fss_basic_read_load_number_ - extern f_status_t fss_basic_read_load_number(const f_console_arguments_t arguments, const fss_basic_read_data_t data, const f_array_length_t parameter, const f_string_t name, f_number_unsigned_t *number) f_attribute_visibility_internal; + extern f_status_t fss_basic_read_load_number(const f_console_arguments_t arguments, const fss_basic_read_main_t main, const f_array_length_t parameter, const f_string_t name, f_number_unsigned_t *number) f_attribute_visibility_internal; #endif // _di_fss_basic_read_load_number_ /** @@ -229,8 +229,8 @@ extern "C" { * * Only what is requested to print (Object, Content, both, or neither) will be printed, if there is something to print. * - * @param data - * The program specific data. + * @param main + * The program specific main. * @param at * The index in the Objects and Contents to print. * @param include_empty @@ -245,47 +245,47 @@ extern "C" { * This is a temporary parameter to be used until other structural changes are made and completed. */ #ifndef _di_fss_basic_read_print_at_ - extern void fss_basic_read_print_at(const fss_basic_read_data_t data, const f_array_length_t at, const bool include_empty, const f_fss_delimits_t delimits, const uint8_t print_this) f_attribute_visibility_internal; + extern void fss_basic_read_print_at(const fss_basic_read_main_t main, const f_array_length_t at, const bool include_empty, const f_fss_delimits_t delimits, const uint8_t print_this) f_attribute_visibility_internal; #endif // _di_fss_basic_read_print_at_ /** * Print the end of an object (which is essentially the start of a content). * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_basic_read_print_object_end_ - extern void fss_basic_read_print_object_end(const fss_basic_read_data_t data) f_attribute_visibility_internal; + extern void fss_basic_read_print_object_end(const fss_basic_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_read_print_object_end_ /** * Print the number one and a newline. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_basic_read_print_one_ - extern void fss_basic_read_print_one(const fss_basic_read_data_t data) f_attribute_visibility_internal; + extern void fss_basic_read_print_one(const fss_basic_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_read_print_one_ /** * Print the end of an object/content set. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_basic_read_print_set_end_ - extern void fss_basic_read_print_set_end(const fss_basic_read_data_t data) f_attribute_visibility_internal; + extern void fss_basic_read_print_set_end(const fss_basic_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_read_print_set_end_ /** * Print the number zero and a newline. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_basic_read_print_zero_ - extern void fss_basic_read_print_zero(const fss_basic_read_data_t data) f_attribute_visibility_internal; + extern void fss_basic_read_print_zero(const fss_basic_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_read_print_zero_ /** @@ -297,8 +297,8 @@ extern "C" { * An array representing the ranges in which a given file exists in the buffer. * @param depths * The processed depth parameters. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param delimits * An array of delimits detected during processing. * @@ -310,7 +310,7 @@ extern "C" { * @see fss_basic_read_load_setting() */ #ifndef _di_fss_basic_read_process_ - extern f_status_t fss_basic_read_process(const f_console_arguments_t arguments, const fss_basic_read_files_t files, const fss_basic_read_depths_t depths, fss_basic_read_data_t *data, f_fss_delimits_t *delimits) f_attribute_visibility_internal; + extern f_status_t fss_basic_read_process(const f_console_arguments_t arguments, const fss_basic_read_files_t files, const fss_basic_read_depths_t depths, fss_basic_read_main_t *main, f_fss_delimits_t *delimits) f_attribute_visibility_internal; #endif // _di_fss_basic_read_process_ #ifdef __cplusplus diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index 4122211..1870994 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -84,30 +84,30 @@ extern "C" { #endif // _di_fss_basic_write_print_help_ #ifndef _di_fss_basic_write_main_ - f_status_t fss_basic_write_main(const f_console_arguments_t arguments, fss_basic_write_data_t *data) { + f_status_t fss_basic_write_main(const f_console_arguments_t arguments, fss_basic_write_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_basic_write_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_basic_write_total_parameters); { f_console_parameter_id_t ids[3] = { fss_basic_write_parameter_no_color, fss_basic_write_parameter_light, fss_basic_write_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_basic_write_data_delete(data); + fss_basic_write_main_delete(main); return F_status_set_error(status); } } @@ -121,38 +121,38 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_basic_write_data_delete(data); + fss_basic_write_main_delete(main); return status; } if (choice == fss_basic_write_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_basic_write_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_basic_write_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_basic_write_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_basic_write_parameter_help].result == f_console_result_found) { - fss_basic_write_print_help(data->output, data->context); + if (main->parameters[fss_basic_write_parameter_help].result == f_console_result_found) { + fss_basic_write_print_help(main->output, main->context); - fss_basic_write_data_delete(data); + fss_basic_write_main_delete(main); return status; } - if (data->parameters[fss_basic_write_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_basic_write_version); + if (main->parameters[fss_basic_write_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_basic_write_version); - fss_basic_write_data_delete(data); + fss_basic_write_main_delete(main); return status; } @@ -163,61 +163,61 @@ extern "C" { output.flag = f_file_flag_create | f_file_flag_write_only | f_file_flag_append; if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_write_parameter_file].result == f_console_result_additional) { - if (data->parameters[fss_basic_write_parameter_file].values.used > 1) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_file); - f_color_print(data->error.to.stream, data->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[fss_basic_write_parameter_file].values.used > 1) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_file); + f_color_print(main->error.to.stream, main->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } else { - const f_array_length_t location = data->parameters[fss_basic_write_parameter_file].values.array[0]; + const f_array_length_t location = main->parameters[fss_basic_write_parameter_file].values.array[0]; output.id = -1; output.stream = 0; status = f_file_stream_open(arguments.argv[location], 0, &output); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); } } } - else if (data->parameters[fss_basic_write_parameter_file].result == f_console_result_found) { - fss_basic_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_basic_write_long_file); + else if (main->parameters[fss_basic_write_parameter_file].result == f_console_result_found) { + fss_basic_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_basic_write_long_file); status = F_status_set_error(F_parameter); } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_write_parameter_object].locations.used || data->parameters[fss_basic_write_parameter_content].locations.used) { - if (data->parameters[fss_basic_write_parameter_object].locations.used) { - if (data->parameters[fss_basic_write_parameter_object].locations.used != data->parameters[fss_basic_write_parameter_object].values.used) { - fss_basic_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_basic_write_long_object); + if (main->parameters[fss_basic_write_parameter_object].locations.used || main->parameters[fss_basic_write_parameter_content].locations.used) { + if (main->parameters[fss_basic_write_parameter_object].locations.used) { + if (main->parameters[fss_basic_write_parameter_object].locations.used != main->parameters[fss_basic_write_parameter_object].values.used) { + fss_basic_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_basic_write_long_object); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_write_parameter_content].locations.used != data->parameters[fss_basic_write_parameter_content].values.used) { - fss_basic_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_basic_write_long_content); + else if (main->parameters[fss_basic_write_parameter_content].locations.used != main->parameters[fss_basic_write_parameter_content].values.used) { + fss_basic_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_basic_write_long_content); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_write_parameter_object].locations.used != data->parameters[fss_basic_write_parameter_content].locations.used && data->parameters[fss_basic_write_parameter_partial].result == f_console_result_none) { - fss_basic_write_error_parameter_same_times_print(*data); + else if (main->parameters[fss_basic_write_parameter_object].locations.used != main->parameters[fss_basic_write_parameter_content].locations.used && main->parameters[fss_basic_write_parameter_partial].result == f_console_result_none) { + fss_basic_write_error_parameter_same_times_print(*main); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_write_parameter_content].locations.used && data->parameters[fss_basic_write_parameter_partial].locations.used) { - if (data->parameters[fss_basic_write_parameter_content].result == f_console_result_additional) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_partial); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter only allows either the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter or the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter, but not both.%c", f_string_eol_s[0]); + else if (main->parameters[fss_basic_write_parameter_content].locations.used && main->parameters[fss_basic_write_parameter_partial].locations.used) { + if (main->parameters[fss_basic_write_parameter_content].result == f_console_result_additional) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_partial); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter only allows either the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter or the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter, but not both.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -225,26 +225,26 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_write_parameter_content].result == f_console_result_additional) { + if (main->parameters[fss_basic_write_parameter_content].result == f_console_result_additional) { f_array_length_t location_object = 0; f_array_length_t location_content = 0; f_array_length_t location_sub_object = 0; f_array_length_t location_sub_content = 0; - for (f_array_length_t i = 0; i < data->parameters[fss_basic_write_parameter_object].locations.used; i++) { - location_object = data->parameters[fss_basic_write_parameter_object].locations.array[i]; - location_content = data->parameters[fss_basic_write_parameter_content].locations.array[i]; - location_sub_object = data->parameters[fss_basic_write_parameter_object].locations_sub.array[i]; - location_sub_content = data->parameters[fss_basic_write_parameter_content].locations_sub.array[i]; + for (f_array_length_t i = 0; i < main->parameters[fss_basic_write_parameter_object].locations.used; i++) { + location_object = main->parameters[fss_basic_write_parameter_object].locations.array[i]; + location_content = main->parameters[fss_basic_write_parameter_content].locations.array[i]; + location_sub_object = main->parameters[fss_basic_write_parameter_object].locations_sub.array[i]; + location_sub_content = main->parameters[fss_basic_write_parameter_content].locations_sub.array[i]; if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sEach ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter must be specified before a '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sEach ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter must be specified before a '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -254,37 +254,37 @@ extern "C" { } } } - else if (data->parameters[fss_basic_write_parameter_content].locations.used) { - if (data->parameters[fss_basic_write_parameter_content].locations.used != data->parameters[fss_basic_write_parameter_content].values.used) { - fss_basic_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_basic_write_long_content); + else if (main->parameters[fss_basic_write_parameter_content].locations.used) { + if (main->parameters[fss_basic_write_parameter_content].locations.used != main->parameters[fss_basic_write_parameter_content].values.used) { + fss_basic_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_basic_write_long_content); status = F_status_set_error(F_parameter); } - else if (!data->parameters[fss_basic_write_parameter_partial].locations.used) { - fss_basic_write_error_parameter_same_times_print(*data); + else if (!main->parameters[fss_basic_write_parameter_partial].locations.used) { + fss_basic_write_error_parameter_same_times_print(*main); status = F_status_set_error(F_parameter); } } } - else if (!data->process_pipe) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThis requires either piped data or the use of the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + else if (!main->process_pipe) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThis requires either piped main or the use of the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->process_pipe) { - if (data->parameters[fss_basic_write_parameter_partial].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_partial); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter cannot be used when processing a pipe.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->process_pipe) { + if (main->parameters[fss_basic_write_parameter_partial].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_partial); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter cannot be used when processing a pipe.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -293,18 +293,18 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_write_parameter_prepend].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_write_parameter_prepend].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_write_parameter_prepend].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_basic_write_parameter_prepend].values.array[data->parameters[fss_basic_write_parameter_prepend].values.used - 1]; + else if (main->parameters[fss_basic_write_parameter_prepend].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_basic_write_parameter_prepend].values.array[main->parameters[fss_basic_write_parameter_prepend].values.used - 1]; const f_array_length_t length = strnlen(arguments.argv[index], f_console_parameter_size); // Even though this standard does not utilize this parameter, provide the validation for consistency. @@ -318,11 +318,11 @@ extern "C" { if (F_status_is_error(status)) break; if (status == F_false) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' must only contain whitespace.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' must only contain whitespace.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -331,11 +331,11 @@ extern "C" { } // for } else { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -344,25 +344,25 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_write_parameter_ignore].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_ignore); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no values were given.%c", f_string_eol_s[0]); + if (main->parameters[fss_basic_write_parameter_ignore].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_ignore); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no values were given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_basic_write_parameter_ignore].result == f_console_result_additional) { - const f_array_length_t total_locations = data->parameters[fss_basic_write_parameter_ignore].locations.used; - const f_array_length_t total_arguments = data->parameters[fss_basic_write_parameter_ignore].values.used; + else if (main->parameters[fss_basic_write_parameter_ignore].result == f_console_result_additional) { + const f_array_length_t total_locations = main->parameters[fss_basic_write_parameter_ignore].locations.used; + const f_array_length_t total_arguments = main->parameters[fss_basic_write_parameter_ignore].values.used; if (total_locations * 2 > total_arguments) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_ignore); - f_color_print(data->error.to.stream, data->context.set.error, "' requires two values.%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_ignore); + f_color_print(main->error.to.stream, main->context.set.error, "' requires two values.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } @@ -372,14 +372,14 @@ extern "C" { f_fss_quote_t quote = f_fss_delimit_quote_double; if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_write_parameter_double].result == f_console_result_found) { - if (data->parameters[fss_basic_write_parameter_single].result == f_console_result_found) { - if (data->parameters[fss_basic_write_parameter_double].location < data->parameters[fss_basic_write_parameter_single].location) { + if (main->parameters[fss_basic_write_parameter_double].result == f_console_result_found) { + if (main->parameters[fss_basic_write_parameter_single].result == f_console_result_found) { + if (main->parameters[fss_basic_write_parameter_double].location < main->parameters[fss_basic_write_parameter_single].location) { quote = f_fss_delimit_quote_single; } } } - else if (data->parameters[fss_basic_write_parameter_single].result == f_console_result_found) { + else if (main->parameters[fss_basic_write_parameter_single].result == f_console_result_found) { quote = f_fss_delimit_quote_single; } } @@ -391,75 +391,75 @@ extern "C" { if (F_status_is_error_not(status)) { f_string_dynamic_t escaped = f_string_dynamic_t_initialize; - if (data->process_pipe) { - status = fss_basic_write_process_pipe(*data, output, quote, &buffer); + if (main->process_pipe) { + status = fss_basic_write_process_pipe(*main, output, quote, &buffer); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sWhile processing the ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "input pipe"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sWhile processing the ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "input pipe"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); } } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_basic_write_parameter_partial].result == f_console_result_found) { - if (data->parameters[fss_basic_write_parameter_object].result == f_console_result_additional) { + if (main->parameters[fss_basic_write_parameter_partial].result == f_console_result_found) { + if (main->parameters[fss_basic_write_parameter_object].result == f_console_result_additional) { content.used = 0; - for (f_array_length_t i = 0; i < data->parameters[fss_basic_write_parameter_object].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[fss_basic_write_parameter_object].values.used; i++) { - object.string = arguments.argv[data->parameters[fss_basic_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[fss_basic_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; - status = fss_basic_write_process(*data, output, quote, &object, 0, &buffer); + status = fss_basic_write_process(*main, output, quote, &object, 0, &buffer); if (F_status_is_error(status)) break; } // for } else { object.used = 0; - for (f_array_length_t i = 0; i < data->parameters[fss_basic_write_parameter_content].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[fss_basic_write_parameter_content].values.used; i++) { - content.string = arguments.argv[data->parameters[fss_basic_write_parameter_content].values.array[i]]; + content.string = arguments.argv[main->parameters[fss_basic_write_parameter_content].values.array[i]]; content.used = strnlen(content.string, f_console_parameter_size); content.size = content.used; - status = fss_basic_write_process(*data, output, quote, 0, &content, &buffer); + status = fss_basic_write_process(*main, output, quote, 0, &content, &buffer); if (F_status_is_error(status)) break; } // for } } else { - for (f_array_length_t i = 0; i < data->parameters[fss_basic_write_parameter_object].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[fss_basic_write_parameter_object].values.used; i++) { - object.string = arguments.argv[data->parameters[fss_basic_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[fss_basic_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; - content.string = arguments.argv[data->parameters[fss_basic_write_parameter_content].values.array[i]]; + content.string = arguments.argv[main->parameters[fss_basic_write_parameter_content].values.array[i]]; content.used = strnlen(content.string, f_console_parameter_size); content.size = content.used; - status = fss_basic_write_process(*data, output, quote, &object, &content, &buffer); + status = fss_basic_write_process(*main, output, quote, &object, &content, &buffer); if (F_status_is_error(status)) break; } // for } if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sWhile processing the ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "input arguments"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sWhile processing the ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "input arguments"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); } } - else if (data->error.verbosity != f_console_verbosity_quiet && data->parameters[fss_basic_write_parameter_file].result == f_console_result_none) { + else if (main->error.verbosity != f_console_verbosity_quiet && main->parameters[fss_basic_write_parameter_file].result == f_console_result_none) { // ensure there is always a newline at the end, unless in quiet mode. - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); } } @@ -475,43 +475,43 @@ extern "C" { content.size = 0; } - if (data->parameters[fss_basic_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[fss_basic_write_parameter_file].result == f_console_result_additional) { if (output.id != -1) { f_file_stream_close(F_true, &output); } } // ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (data->error.verbosity != f_console_verbosity_quiet) { + if (main->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status)) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } } f_macro_string_dynamic_t_delete_simple(buffer); f_macro_string_dynamic_t_delete_simple(object); f_macro_string_dynamic_t_delete_simple(content); - fss_basic_write_data_delete(data); + fss_basic_write_main_delete(main); return status; } #endif // _di_fss_basic_write_main_ -#ifndef _di_fss_basic_write_data_delete_ - f_status_t fss_basic_write_data_delete(fss_basic_write_data_t *data) { +#ifndef _di_fss_basic_write_main_delete_ + f_status_t fss_basic_write_main_delete(fss_basic_write_main_t *main) { for (f_array_length_t i = 0; i < fss_basic_write_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_basic_write_data_delete_ +#endif // _di_fss_basic_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_write/c/fss_basic_write.h b/level_3/fss_basic_write/c/fss_basic_write.h index 5cc4887..25ba8d4 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.h +++ b/level_3/fss_basic_write/c/fss_basic_write.h @@ -138,9 +138,9 @@ extern "C" { fll_error_print_t error; f_color_context_t context; - } fss_basic_write_data_t; + } fss_basic_write_main_t; - #define fss_basic_write_data_t_initialize \ + #define fss_basic_write_main_t_initialize \ { \ fss_basic_write_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -169,30 +169,30 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_basic_write_data_delete() after executing this. + * Be sure to call fss_basic_write_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * Status codes (with error bit) are returned on any problem. * - * @see fss_basic_write_data_delete() + * @see fss_basic_write_main_delete() */ #ifndef _di_fss_basic_write_main_ - extern f_status_t fss_basic_write_main(const f_console_arguments_t arguments, fss_basic_write_data_t *data); + extern f_status_t fss_basic_write_main(const f_console_arguments_t arguments, fss_basic_write_main_t *main); #endif // _di_fss_basic_write_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_basic_write_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -200,9 +200,9 @@ extern "C" { * * @see fss_basic_write_main() */ -#ifndef _di_fss_basic_write_data_delete_ - extern f_status_t fss_basic_write_data_delete(fss_basic_write_data_t *data); -#endif // _di_fss_basic_write_data_delete_ +#ifndef _di_fss_basic_write_main_delete_ + extern f_status_t fss_basic_write_main_delete(fss_basic_write_main_t *main); +#endif // _di_fss_basic_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_write/c/main.c b/level_3/fss_basic_write/c/main.c index 579e3f2..ef09cb4 100644 --- a/level_3/fss_basic_write/c/main.c +++ b/level_3/fss_basic_write/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_basic_write_data_t data = fss_basic_write_data_t_initialize; + fss_basic_write_main_t main = fss_basic_write_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_basic_write_main(arguments, &data); + const f_status_t status = fss_basic_write_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_basic_write/c/private-fss_basic_write.c b/level_3/fss_basic_write/c/private-fss_basic_write.c index ffc5fb6..cde73f9 100644 --- a/level_3/fss_basic_write/c/private-fss_basic_write.c +++ b/level_3/fss_basic_write/c/private-fss_basic_write.c @@ -6,53 +6,53 @@ extern "C" { #endif #ifndef _di_fss_basic_write_error_parameter_same_times_print_ - void fss_basic_write_error_parameter_same_times_print(const fss_basic_write_data_t data) { + void fss_basic_write_error_parameter_same_times_print(const fss_basic_write_main_t main) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sMust specify both the '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_object); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter and the '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_content); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter the same number of times when not specifying the "); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_partial); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sMust specify both the '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_object); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter and the '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_content); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter the same number of times when not specifying the "); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_write_long_partial); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter.%c", f_string_eol_s[0]); } #endif // _di_fss_basic_write_error_parameter_same_times_print_ #ifndef _di_fss_basic_write_error_parameter_value_missing_print_ - void fss_basic_write_error_parameter_value_missing_print(const fss_basic_write_data_t data, const f_string_t symbol, const f_string_t parameter) { + void fss_basic_write_error_parameter_value_missing_print(const fss_basic_write_main_t main, const f_string_t symbol, const f_string_t parameter) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", symbol, parameter); - f_color_print(data.error.to.stream, data.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", symbol, parameter); + f_color_print(main.error.to.stream, main.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } #endif // _di_fss_basic_write_error_parameter_value_missing_print_ #ifndef _di_fss_basic_write_error_parameter_unsupported_eol_print_ - void fss_basic_write_error_parameter_unsupported_eol_print(const fss_basic_write_data_t data) { + void fss_basic_write_error_parameter_unsupported_eol_print(const fss_basic_write_main_t main) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThis standard does not support end of line character '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "\\n"); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThis standard does not support end of line character '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "\\n"); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } #endif // _di_fss_basic_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_basic_write_process_ - f_status_t fss_basic_write_process(const fss_basic_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { + f_status_t fss_basic_write_process(const fss_basic_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_string_range_t range = f_string_range_t_initialize; @@ -70,7 +70,7 @@ extern "C" { } if (content) { - if (data.parameters[fss_basic_write_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_basic_write_parameter_trim].result == f_console_result_found) { complete = f_fss_complete_full_trim; } else { @@ -81,13 +81,13 @@ extern "C" { status = fl_fss_basic_object_write_string(*object, quote, complete, &range, buffer); if (F_status_set_fine(status) == F_none_eol) { - fss_basic_write_error_parameter_unsupported_eol_print(data); + fss_basic_write_error_parameter_unsupported_eol_print(main); return F_status_set_error(F_supported_not); } if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_basic_object_write_string", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_basic_object_write_string", F_true); return status; } } @@ -105,13 +105,13 @@ extern "C" { status = fl_fss_basic_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &range, buffer); if (F_status_set_fine(status) == F_none_eol) { - fss_basic_write_error_parameter_unsupported_eol_print(data); + fss_basic_write_error_parameter_unsupported_eol_print(main); return F_status_set_error(F_supported_not); } if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_basic_content_write_string", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_basic_content_write_string", F_true); return status; } } @@ -120,7 +120,7 @@ extern "C" { status = f_string_append(f_string_eol, 1, buffer); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true); return status; } } @@ -133,7 +133,7 @@ extern "C" { #endif // _di_fss_basic_write_process_ #ifndef _di_fss_basic_write_process_pipe_ - f_status_t fss_basic_write_process_pipe(const fss_basic_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { + f_status_t fss_basic_write_process_pipe(const fss_basic_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_status_t status_pipe = F_none; @@ -163,7 +163,7 @@ extern "C" { status_pipe = f_file_read_block(input, &block); if (F_status_is_error(status_pipe)) { - fll_error_print(data.error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); + fll_error_print(main.error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); status_pipe = F_status_set_error(F_pipe); break; @@ -187,7 +187,7 @@ extern "C" { status = f_string_dynamic_increase_by(block.used, &object); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); break; } } @@ -236,7 +236,7 @@ extern "C" { status = f_string_dynamic_increase_by(total, &content); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); break; } } @@ -244,9 +244,9 @@ extern "C" { for (; range.start <= range.stop; range.start++) { if (block.string[range.start] == fss_basic_write_pipe_content_start) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThis standard only supports one content per object.%c", fll_error_print_error, f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThis standard only supports one content per object.%c", fll_error_print_error, f_string_eol_s[0]); } status = F_status_set_error(F_supported_not); @@ -265,7 +265,7 @@ extern "C" { } if (F_status_set_fine(status) == F_none_eol) { - fss_basic_write_error_parameter_unsupported_eol_print(data); + fss_basic_write_error_parameter_unsupported_eol_print(main); status = F_status_set_error(F_supported_not); break; @@ -282,7 +282,7 @@ extern "C" { } if (state == 0x3) { - status = fss_basic_write_process(data, output, quote, &object, &content, buffer); + status = fss_basic_write_process(main, output, quote, &object, &content, buffer); if (F_status_is_error(status)) break; state = 0; @@ -291,7 +291,7 @@ extern "C" { // if the pipe ended before finishing, then attempt to wrap up. if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) { - status = fss_basic_write_process(data, output, quote, &object, &content, buffer); + status = fss_basic_write_process(main, output, quote, &object, &content, buffer); } f_macro_string_dynamic_t_delete_simple(block); diff --git a/level_3/fss_basic_write/c/private-fss_basic_write.h b/level_3/fss_basic_write/c/private-fss_basic_write.h index 6216257..3b3d775 100644 --- a/level_3/fss_basic_write/c/private-fss_basic_write.h +++ b/level_3/fss_basic_write/c/private-fss_basic_write.h @@ -15,42 +15,42 @@ extern "C" { /** * Print an message about the object and content parameters not being specified the same number of times. * - * @param data - * The program data. + * @param main + * The main data. */ #ifndef _di_fss_basic_write_error_parameter_same_times_print_ - void fss_basic_write_error_parameter_same_times_print(const fss_basic_write_data_t data) f_attribute_visibility_internal; + void fss_basic_write_error_parameter_same_times_print(const fss_basic_write_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_write_error_parameter_same_times_print_ /** * Print an message about a parameter missing a value. * - * @param data - * The program data. + * @param main + * The main data. * @param symbol * The console symbol, such as "--" in "--help". * @param parameter * The parameter name, such as "help" in "--help". */ #ifndef _di_fss_basic_write_error_parameter_value_missing_print_ - void fss_basic_write_error_parameter_value_missing_print(const fss_basic_write_data_t data, const f_string_t symbol, const f_string_t parameter) f_attribute_visibility_internal; + void fss_basic_write_error_parameter_value_missing_print(const fss_basic_write_main_t main, const f_string_t symbol, const f_string_t parameter) f_attribute_visibility_internal; #endif // _di_fss_basic_write_error_parameter_value_missing_print_ /** * Print an message about a parameter EOL being unsupported. * - * @param data - * The program data. + * @param main + * The main data. */ #ifndef _di_fss_basic_write_error_parameter_unsupported_eol_print_ - void fss_basic_write_error_parameter_unsupported_eol_print(const fss_basic_write_data_t data) f_attribute_visibility_internal; + void fss_basic_write_error_parameter_unsupported_eol_print(const fss_basic_write_main_t main) f_attribute_visibility_internal; #endif // _di_fss_basic_write_error_parameter_unsupported_eol_print_ /** * Process a given object and content, printing the FSS if valid or an error if invalid. * - * @param data - * The program data. + * @param main + * The main data. * @param output * The file to output to. * @param quote @@ -70,14 +70,14 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_basic_write_process_ - extern f_status_t fss_basic_write_process(const fss_basic_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) f_attribute_visibility_internal; + extern f_status_t fss_basic_write_process(const fss_basic_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) f_attribute_visibility_internal; #endif // _di_fss_basic_write_process_ /** * Process the pipe, reading from the pipe and writing to the output. * - * @param data - * The program data. + * @param main + * The main data. * @param output * The file to output to. * @param quote @@ -91,7 +91,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_basic_write_process_pipe_ - extern f_status_t fss_basic_write_process_pipe(const fss_basic_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) f_attribute_visibility_internal; + extern f_status_t fss_basic_write_process_pipe(const fss_basic_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) f_attribute_visibility_internal; #endif // _di_fss_basic_write_process_pipe_ #ifdef __cplusplus diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index 03c2152..e41fd42 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -41,7 +41,7 @@ extern "C" { fprintf(output.stream, "%c", f_string_eol_s[0]); - fprintf(output.stream, " This program will print the content associated with the given object and content data based on the FSS-0002 Basic List standard.%c", f_string_eol_s[0]); + fprintf(output.stream, " This program will print the content associated with the given object and content main based on the FSS-0002 Basic List standard.%c", f_string_eol_s[0]); fprintf(output.stream, "%c", f_string_eol_s[0]); @@ -159,30 +159,30 @@ extern "C" { #endif // _di_fss_embedded_list_read_print_help_ #ifndef _di_fss_embedded_list_read_main_ - f_status_t fss_embedded_list_read_main(const f_console_arguments_t arguments, fss_embedded_list_read_data_t *data) { + f_status_t fss_embedded_list_read_main(const f_console_arguments_t arguments, fss_embedded_list_read_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_embedded_list_read_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_embedded_list_read_total_parameters); { f_console_parameter_id_t ids[3] = { fss_embedded_list_read_parameter_no_color, fss_embedded_list_read_parameter_light, fss_embedded_list_read_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_embedded_list_read_data_delete(data); + fss_embedded_list_read_main_delete(main); return F_status_set_error(status); } } @@ -196,142 +196,142 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_embedded_list_read_data_delete(data); + fss_embedded_list_read_main_delete(main); return status; } if (choice == fss_embedded_list_read_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_embedded_list_read_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_embedded_list_read_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_embedded_list_read_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_embedded_list_read_parameter_help].result == f_console_result_found) { - fss_embedded_list_read_print_help(data->output, data->context); + if (main->parameters[fss_embedded_list_read_parameter_help].result == f_console_result_found) { + fss_embedded_list_read_print_help(main->output, main->context); - fss_embedded_list_read_data_delete(data); + fss_embedded_list_read_main_delete(main); return F_none; } - if (data->parameters[fss_embedded_list_read_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_embedded_list_read_version); + if (main->parameters[fss_embedded_list_read_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_embedded_list_read_version); - fss_embedded_list_read_data_delete(data); + fss_embedded_list_read_main_delete(main); return F_none; } - if (data->remaining.used > 0 || data->process_pipe) { - if (data->parameters[fss_embedded_list_read_parameter_at].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_at); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (main->remaining.used > 0 || main->process_pipe) { + if (main->parameters[fss_embedded_list_read_parameter_at].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_at); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_embedded_list_read_parameter_depth].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_depth].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_line); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_line); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_embedded_list_read_parameter_name].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_name); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_name].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_name); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a string.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_embedded_list_read_parameter_select].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_select].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (data->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_additional) { - if (F_status_is_error_not(status) && data->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_line); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_additional) { + if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_line); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } } - if (data->parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { - if (F_status_is_error_not(status) && data->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_pipe); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { + if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_pipe); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_embedded_list_read_parameter_delimit].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a value.%c", f_string_eol_s[0]); + if (main->parameters[fss_embedded_list_read_parameter_delimit].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a value.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_embedded_list_read_parameter_delimit].result == f_console_result_additional) { - const f_array_length_t location = data->parameters[fss_embedded_list_read_parameter_delimit].values.array[0]; + else if (main->parameters[fss_embedded_list_read_parameter_delimit].result == f_console_result_additional) { + const f_array_length_t location = main->parameters[fss_embedded_list_read_parameter_delimit].values.array[0]; f_array_length_t length = strnlen(arguments.argv[location], f_console_parameter_size); if (length == 0) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be empty.%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } else if (fl_string_compare(arguments.argv[location], fss_embedded_list_read_delimit_mode_name_none, length, fss_embedded_list_read_delimit_mode_name_none_length) == F_equal_to) { - data->delimit_mode = fss_embedded_list_read_delimit_mode_none; + main->delimit_mode = fss_embedded_list_read_delimit_mode_none; } else if (fl_string_compare(arguments.argv[location], fss_embedded_list_read_delimit_mode_name_all, length, fss_embedded_list_read_delimit_mode_name_all_length) == F_equal_to) { - data->delimit_mode = fss_embedded_list_read_delimit_mode_all; + main->delimit_mode = fss_embedded_list_read_delimit_mode_all; } else { - data->delimit_mode = fss_embedded_list_read_delimit_mode_depth; + main->delimit_mode = fss_embedded_list_read_delimit_mode_depth; if (arguments.argv[location][length - 1] == fss_embedded_list_read_delimit_mode_name_greater[0]) { - data->delimit_mode = fss_embedded_list_read_delimit_mode_depth_greater; + main->delimit_mode = fss_embedded_list_read_delimit_mode_depth_greater; // shorten the length to better convert the remainder to a number. length--; } else if (arguments.argv[location][length - 1] == fss_embedded_list_read_delimit_mode_name_lesser[0]) { - data->delimit_mode = fss_embedded_list_read_delimit_mode_depth_lesser; + main->delimit_mode = fss_embedded_list_read_delimit_mode_depth_lesser; // shorten the length to better convert the remainder to a number. length--; @@ -344,10 +344,10 @@ extern "C" { range.start++; } - status = fl_conversion_string_to_number_unsigned(arguments.argv[location], range, &data->delimit_depth); + status = fl_conversion_string_to_number_unsigned(arguments.argv[location], range, &main->delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_delimit, arguments.argv[location]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_delimit, arguments.argv[location]); } } } @@ -359,73 +359,73 @@ extern "C" { f_fss_delimits_t contents_delimits = f_fss_delimits_t_initialize; f_fss_comments_t comments = f_fss_comments_t_initialize; - f_array_length_t original_size = data->quantity.total; + f_array_length_t original_size = main->quantity.total; if (F_status_is_error_not(status)) { - status = fss_embedded_list_read_main_preprocess_depth(arguments, *data, &depths); + status = fss_embedded_list_read_main_preprocess_depth(arguments, *main, &depths); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fss_embedded_list_read_main_preprocess_depth", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_preprocess_depth", F_true); } } - if (F_status_is_error_not(status) && data->parameters[fss_embedded_list_read_parameter_select].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_select].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->process_pipe) { + if (F_status_is_error_not(status) && main->process_pipe) { f_file_t file = f_file_t_initialize; file.id = f_type_descriptor_input; - status = f_file_read(file, &data->buffer); + status = f_file_read(file, &main->buffer); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe); } else { - status = fss_embedded_list_read_main_process_file(arguments, data, "-", depths, &objects_delimits, &contents_delimits, &comments); + status = fss_embedded_list_read_main_process_file(arguments, main, "-", depths, &objects_delimits, &contents_delimits, &comments); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe); } } // Clear buffers before continuing. - f_macro_fss_nest_t_delete_simple(data->nest); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_nest_t_delete_simple(main->nest); + f_macro_string_dynamic_t_delete_simple(main->buffer); } - if (F_status_is_error_not(status) && data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { + if (F_status_is_error_not(status) && main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { f_file_t file = f_file_t_initialize; - status = f_file_open(arguments.argv[data->remaining.array[i]], 0, &file); + status = f_file_open(arguments.argv[main->remaining.array[i]], 0, &file); - data->quantity.total = original_size; + main->quantity.total = original_size; if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[data->remaining.array[i]], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[main->remaining.array[i]], "open", fll_error_file_type_file); break; } - if (!data->quantity.total) { - status = f_file_size_by_id(file.id, &data->quantity.total); + if (!main->quantity.total) { + status = f_file_size_by_id(file.id, &main->quantity.total); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); f_file_stream_close(F_true, &file); break; } // Skip past empty files. - if (!data->quantity.total) { - if (data->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (!main->quantity.total) { + if (main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } f_file_stream_close(F_true, &file); @@ -433,30 +433,30 @@ extern "C" { } } - status = f_file_read_until(file, data->quantity.total, &data->buffer); + status = f_file_read_until(file, main->quantity.total, &main->buffer); f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); break; } - status = fss_embedded_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments); + status = fss_embedded_list_read_main_process_file(arguments, main, arguments.argv[main->remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); break; } // Clear buffers before repeating the loop. - f_macro_fss_nest_t_delete_simple(data->nest); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_nest_t_delete_simple(main->nest); + f_macro_string_dynamic_t_delete_simple(main->buffer); } // for if (F_status_is_error(status)) { - f_macro_fss_nest_t_delete_simple(data->nest); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_nest_t_delete_simple(main->nest); + f_macro_string_dynamic_t_delete_simple(main->buffer); } } @@ -466,34 +466,34 @@ extern "C" { f_macro_fss_comments_t_delete_simple(comments); } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - fss_embedded_list_read_data_delete(data); + fss_embedded_list_read_main_delete(main); return status; } #endif // _di_fss_embedded_list_read_main_ -#ifndef _di_fss_embedded_list_read_data_delete_ - f_status_t fss_embedded_list_read_data_delete(fss_embedded_list_read_data_t *data) { +#ifndef _di_fss_embedded_list_read_main_delete_ + f_status_t fss_embedded_list_read_main_delete(fss_embedded_list_read_main_t *main) { for (f_array_length_t i = 0; i < fss_embedded_list_read_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_fss_nest_t_delete_simple(data->nest); + f_macro_fss_nest_t_delete_simple(main->nest); - f_macro_string_dynamic_t_delete_simple(data->buffer); - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_string_dynamic_t_delete_simple(main->buffer); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_embedded_list_read_data_delete_ +#endif // _di_fss_embedded_list_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h index df8de84..7c1316a 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h @@ -7,7 +7,7 @@ * * This is the FSS Basic List Read program * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_embedded_list_read_data_t. + * This program processes files or other input in fss format and stores the results in the fss_embedded_list_read_main_t. * * This processes in accordance to the FSS-0008 Embedded List specification. */ @@ -165,7 +165,7 @@ extern "C" { }; #endif // _di_fss_embedded_list_read_delimit_modes_ -#ifndef _di_fss_embedded_list_read_data_t_ +#ifndef _di_fss_embedded_list_read_main_t_ typedef struct { f_console_parameter_t parameters[fss_embedded_list_read_total_parameters]; @@ -183,9 +183,9 @@ extern "C" { f_array_length_t delimit_depth; f_color_context_t context; - } fss_embedded_list_read_data_t; + } fss_embedded_list_read_main_t; - #define fss_embedded_list_read_data_t_initialize \ + #define fss_embedded_list_read_main_t_initialize \ { \ fss_embedded_list_read_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -199,7 +199,7 @@ extern "C" { 0, \ f_color_context_t_initialize, \ } -#endif // _di_fss_embedded_list_read_data_t_ +#endif // _di_fss_embedded_list_read_main_t_ /** * Print help. @@ -219,31 +219,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_embedded_list_read_data_delete() after executing this. + * Be sure to call fss_embedded_list_read_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see fss_embedded_list_read_data_delete() + * @see fss_embedded_list_read_main_delete() */ #ifndef _di_fss_embedded_list_read_main_ - extern f_status_t fss_embedded_list_read_main(const f_console_arguments_t arguments, fss_embedded_list_read_data_t *data); + extern f_status_t fss_embedded_list_read_main(const f_console_arguments_t arguments, fss_embedded_list_read_main_t *main); #endif // _di_fss_embedded_list_read_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_embedded_list_read_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -252,9 +252,9 @@ extern "C" { * * @see fss_embedded_list_read_main() */ -#ifndef _di_fss_embedded_list_read_data_delete_ - extern f_status_t fss_embedded_list_read_data_delete(fss_embedded_list_read_data_t *data); -#endif // _di_fss_embedded_list_read_data_delete_ +#ifndef _di_fss_embedded_list_read_main_delete_ + extern f_status_t fss_embedded_list_read_main_delete(fss_embedded_list_read_main_t *main); +#endif // _di_fss_embedded_list_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_embedded_list_read/c/main.c b/level_3/fss_embedded_list_read/c/main.c index 744ea5f..850895b 100644 --- a/level_3/fss_embedded_list_read/c/main.c +++ b/level_3/fss_embedded_list_read/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_embedded_list_read_data_t data = fss_embedded_list_read_data_t_initialize; + fss_embedded_list_read_main_t main = fss_embedded_list_read_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_embedded_list_read_main(arguments, &data); + const f_status_t status = fss_embedded_list_read_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.c index b6eb894..9370d3a 100644 --- a/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.c @@ -6,10 +6,10 @@ extern "C" { #endif #ifndef _di_fss_embedded_list_read_main_preprocess_depth_ - f_status_t fss_embedded_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_embedded_list_read_data_t data, fss_embedded_list_read_depths_t *depths) { + f_status_t fss_embedded_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_embedded_list_read_main_t main, fss_embedded_list_read_depths_t *depths) { f_status_t status = F_none; - const f_array_length_t values_total = data.parameters[fss_embedded_list_read_parameter_depth].values.used + data.parameters[fss_embedded_list_read_parameter_at].values.used + data.parameters[fss_embedded_list_read_parameter_name].values.used; + const f_array_length_t values_total = main.parameters[fss_embedded_list_read_parameter_depth].values.used + main.parameters[fss_embedded_list_read_parameter_at].values.used + main.parameters[fss_embedded_list_read_parameter_name].values.used; f_array_length_t values_order[values_total]; f_array_length_t values_type[values_total]; @@ -24,24 +24,24 @@ extern "C" { f_array_length_t k = 0; f_array_length_t l = 0; - for (; j < data.parameters[fss_embedded_list_read_parameter_depth].values.used; ++j) { + for (; j < main.parameters[fss_embedded_list_read_parameter_depth].values.used; ++j) { - values_order[i] = data.parameters[fss_embedded_list_read_parameter_depth].values.array[j]; + values_order[i] = main.parameters[fss_embedded_list_read_parameter_depth].values.array[j]; values_type[i++] = fss_embedded_list_read_parameter_depth; } // for if (i) { - for (j = 0; j < data.parameters[fss_embedded_list_read_parameter_at].values.used; ++j) { + for (j = 0; j < main.parameters[fss_embedded_list_read_parameter_at].values.used; ++j) { for (k = 0; k < i; ++k) { - if (values_order[k] > data.parameters[fss_embedded_list_read_parameter_at].values.array[j]) { + if (values_order[k] > main.parameters[fss_embedded_list_read_parameter_at].values.array[j]) { for (l = i; l > k; --l) { values_order[l] = values_order[l - 1]; values_type[l] = values_type[l - 1]; } // for - values_order[k] = data.parameters[fss_embedded_list_read_parameter_at].values.array[j]; + values_order[k] = main.parameters[fss_embedded_list_read_parameter_at].values.array[j]; values_type[k] = fss_embedded_list_read_parameter_at; i++; break; @@ -49,31 +49,31 @@ extern "C" { } // for if (k == i) { - values_order[i] = data.parameters[fss_embedded_list_read_parameter_at].values.array[j]; + values_order[i] = main.parameters[fss_embedded_list_read_parameter_at].values.array[j]; values_type[i++] = fss_embedded_list_read_parameter_at; } } // for } else { - for (; j < data.parameters[fss_embedded_list_read_parameter_at].values.used; ++j) { + for (; j < main.parameters[fss_embedded_list_read_parameter_at].values.used; ++j) { - values_order[i] = data.parameters[fss_embedded_list_read_parameter_at].values.array[j]; + values_order[i] = main.parameters[fss_embedded_list_read_parameter_at].values.array[j]; values_type[i++] = fss_embedded_list_read_parameter_at; } // for } if (i) { - for (j = 0; j < data.parameters[fss_embedded_list_read_parameter_name].values.used; ++j) { + for (j = 0; j < main.parameters[fss_embedded_list_read_parameter_name].values.used; ++j) { for (k = 0; k < i; ++k) { - if (values_order[k] > data.parameters[fss_embedded_list_read_parameter_name].values.array[j]) { + if (values_order[k] > main.parameters[fss_embedded_list_read_parameter_name].values.array[j]) { for (l = i; l > k; --l) { values_order[l] = values_order[l - 1]; values_type[l] = values_type[l - 1]; } // for - values_order[k] = data.parameters[fss_embedded_list_read_parameter_name].values.array[j]; + values_order[k] = main.parameters[fss_embedded_list_read_parameter_name].values.array[j]; values_type[k] = fss_embedded_list_read_parameter_name; i++; break; @@ -81,15 +81,15 @@ extern "C" { } // for if (k == i) { - values_order[i] = data.parameters[fss_embedded_list_read_parameter_name].values.array[j]; + values_order[i] = main.parameters[fss_embedded_list_read_parameter_name].values.array[j]; values_type[i++] = fss_embedded_list_read_parameter_name; } } // for } else { - for (; j < data.parameters[fss_embedded_list_read_parameter_name].values.used; ++j) { + for (; j < main.parameters[fss_embedded_list_read_parameter_name].values.used; ++j) { - values_order[i] = data.parameters[fss_embedded_list_read_parameter_name].values.array[j]; + values_order[i] = main.parameters[fss_embedded_list_read_parameter_name].values.array[j]; values_type[i++] = fss_embedded_list_read_parameter_name; } // for } @@ -98,14 +98,14 @@ extern "C" { { i = 1; - if (data.parameters[fss_embedded_list_read_parameter_depth].result == f_console_result_additional) { - i = data.parameters[fss_embedded_list_read_parameter_depth].values.used + 1; + if (main.parameters[fss_embedded_list_read_parameter_depth].result == f_console_result_additional) { + i = main.parameters[fss_embedded_list_read_parameter_depth].values.used + 1; } fss_embedded_list_read_macro_depths_t_resize(status, (*depths), i); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fss_embedded_list_read_main_preprocess_depth", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fss_embedded_list_read_main_preprocess_depth", F_true); return status; } } @@ -128,7 +128,7 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[values_order[i]], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_depth, arguments.argv[values_order[i]]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_depth, arguments.argv[values_order[i]]); return status; } } @@ -160,11 +160,11 @@ extern "C" { depths->array[depths->used].index_name = values_order[i]; depths->array[depths->used].value_name.used = 0; - if (data.parameters[fss_embedded_list_read_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_embedded_list_read_parameter_trim].result == f_console_result_found) { status = fl_string_rip(arguments.argv[values_order[i]], strnlen(arguments.argv[values_order[i]], f_console_parameter_size), &depths->array[depths->used].value_name); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_rip", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_string_rip", F_true); return status; } } @@ -172,7 +172,7 @@ extern "C" { status = f_string_append(arguments.argv[values_order[i]], strnlen(arguments.argv[values_order[i]], f_console_parameter_size), &depths->array[depths->used].value_name); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true); return status; } } @@ -187,24 +187,24 @@ extern "C" { for (j = i + 1; j < depths->used; j++) { if (depths->array[i].depth == depths->array[j].depth) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe value '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); - f_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe value '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth); + f_color_print(main.error.to.stream, main.context.set.error, "' may only be specified once for the parameter '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } else if (depths->array[i].depth > depths->array[j].depth) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth); - f_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); - f_color_print(data.error.to.stream, data.context.set.error, "' before the value '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[j].depth); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth); + f_color_print(main.error.to.stream, main.context.set.error, "' may not have the value '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth); + f_color_print(main.error.to.stream, main.context.set.error, "' before the value '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[j].depth); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } @@ -216,28 +216,28 @@ extern "C" { #endif // _di_fss_embedded_list_read_main_preprocess_depth_ #ifndef _di_fss_embedded_list_read_main_process_file_ - f_status_t fss_embedded_list_read_main_process_file(const f_console_arguments_t arguments, fss_embedded_list_read_data_t *data, const f_string_t filename, const fss_embedded_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) { + f_status_t fss_embedded_list_read_main_process_file(const f_console_arguments_t arguments, fss_embedded_list_read_main_t *main, const f_string_t filename, const fss_embedded_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) { f_status_t status = F_none; { - f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used); + f_string_range_t input = f_macro_string_range_t_initialize(main->buffer.used); objects_delimits->used = 0; contents_delimits->used = 0; comments->used = 0; - status = fll_fss_embedded_list_read(data->buffer, &input, &data->nest, objects_delimits, contents_delimits, comments); + status = fll_fss_embedded_list_read(main->buffer, &input, &main->nest, objects_delimits, contents_delimits, comments); if (F_status_is_error(status)) { // @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate. - fll_error_file_print(data->error, F_status_set_fine(status), "fll_fss_embedded_list_read", F_true, filename, "process", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_embedded_list_read", F_true, filename, "process", fll_error_file_type_file); } else if (status == F_data_not_stop || status == F_data_not_eos) { - f_macro_fss_nest_t_delete_simple(data->nest); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_nest_t_delete_simple(main->nest); + f_macro_string_dynamic_t_delete_simple(main->buffer); - if (data->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); return F_none; } @@ -245,8 +245,8 @@ extern "C" { } if (F_status_is_error(status)) { - f_macro_fss_nest_t_delete_simple(data->nest); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_nest_t_delete_simple(main->nest); + f_macro_string_dynamic_t_delete_simple(main->buffer); return status; } @@ -257,15 +257,15 @@ extern "C" { // comments are not to be part of the file, so remove them. for (; i < comments->used; ++i) { for (j = comments->array[i].start; j <= comments->array[i].stop; ++j) { - data->buffer.string[j] = f_fss_delimit_placeholder; + main->buffer.string[j] = f_fss_delimit_placeholder; } // for } // for } // Requested depths cannot be greater than contents depth. - if (depths.used > data->nest.used) { - if (data->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (depths.used > main->nest.used) { + if (main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); return F_none; } @@ -275,14 +275,14 @@ extern "C" { { f_number_unsigned_t select = 0; - if (data->parameters[fss_embedded_list_read_parameter_select].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_embedded_list_read_parameter_select].values.array[data->parameters[fss_embedded_list_read_parameter_select].values.used - 1]; + if (main->parameters[fss_embedded_list_read_parameter_select].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_embedded_list_read_parameter_select].values.array[main->parameters[fss_embedded_list_read_parameter_select].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &select); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_select, arguments.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_select, arguments.argv[index]); return status; } @@ -295,30 +295,30 @@ extern "C" { f_array_length_t line = 0; - if (data->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_embedded_list_read_parameter_line].values.array[data->parameters[fss_embedded_list_read_parameter_line].values.used - 1]; + if (main->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_embedded_list_read_parameter_line].values.array[main->parameters[fss_embedded_list_read_parameter_line].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &line); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_line, arguments.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_line, arguments.argv[index]); return status; } } - fss_embedded_list_read_process_delimits(*data, objects_delimits, contents_delimits); + fss_embedded_list_read_process_delimits(*main, objects_delimits, contents_delimits); const fss_embedded_list_read_skip_t parents = fss_embedded_list_read_skip_t_initialize; - return fss_embedded_list_read_main_process_for_depth(arguments, filename, depths, 0, line, parents, data, objects_delimits, contents_delimits); + return fss_embedded_list_read_main_process_for_depth(arguments, filename, depths, 0, line, parents, main, objects_delimits, contents_delimits); } #endif // _di_fss_embedded_list_read_main_process_file_ #ifndef _di_fss_embedded_list_read_main_process_for_depth_ - f_status_t fss_embedded_list_read_main_process_for_depth(const f_console_arguments_t arguments, const f_string_t filename, const fss_embedded_list_read_depths_t depths, const f_array_length_t depths_index, const f_array_length_t line, const fss_embedded_list_read_skip_t parents, fss_embedded_list_read_data_t *data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { + f_status_t fss_embedded_list_read_main_process_for_depth(const f_console_arguments_t arguments, const f_string_t filename, const fss_embedded_list_read_depths_t depths, const f_array_length_t depths_index, const f_array_length_t line, const fss_embedded_list_read_skip_t parents, fss_embedded_list_read_main_t *main, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { - f_fss_items_t *items = &data->nest.depth[depths.array[depths_index].depth]; + f_fss_items_t *items = &main->nest.depth[depths.array[depths_index].depth]; bool skip[items->used]; @@ -357,14 +357,14 @@ extern "C" { if (depths.array[depths_index].value_at < items->used && !skip[depths.array[depths_index].value_at]) { if (depths.array[depths_index].index_name) { - if (data->parameters[fss_embedded_list_read_parameter_trim].result == f_console_result_found) { + if (main->parameters[fss_embedded_list_read_parameter_trim].result == f_console_result_found) { - if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) { + if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[depths_index].value_name, main->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) { skip[depths.array[depths_index].value_at] = F_true; } } else { - if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) { + if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[depths_index].value_name, main->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) { skip[depths.array[depths_index].value_at] = F_true; } } @@ -373,13 +373,13 @@ extern "C" { } else { - if (data->parameters[fss_embedded_list_read_parameter_trim].result == f_console_result_found) { + if (main->parameters[fss_embedded_list_read_parameter_trim].result == f_console_result_found) { for (i = 0; i < items->used; ++i) { if (skip[i]) continue; - if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) { + if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[depths_index].value_name, main->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) { skip[i] = F_true; } } // for @@ -390,7 +390,7 @@ extern "C" { if (skip[i]) continue; - if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) { + if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[depths_index].value_name, main->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) { skip[i] = F_true; } } // for @@ -415,7 +415,7 @@ extern "C" { // if the current depth is not the final depth, then recurse into the next depth. if (depths_index + 1 < depths.used) { - bool skip_next[data->nest.depth[depths.array[depths_index + 1].depth - 1].used]; + bool skip_next[main->nest.depth[depths.array[depths_index + 1].depth - 1].used]; fss_embedded_list_read_skip_t parents_next = fss_embedded_list_read_skip_t_initialize; @@ -428,11 +428,11 @@ extern "C" { const f_array_length_t depth_next = depths.array[depths_index + 1].depth; parents_next.skip = skip_next; - parents_next.used = data->nest.depth[parents_depth].used; + parents_next.used = main->nest.depth[parents_depth].used; memset(skip_next, F_true, sizeof(skip_next) * parents_next.used); - f_fss_items_t *items_next = &data->nest.depth[depth_next]; + f_fss_items_t *items_next = &main->nest.depth[depth_next]; f_fss_items_t *items_previous = 0; f_fss_item_t *item_previous = 0; @@ -444,12 +444,12 @@ extern "C" { j = depth_next; item_previous = &items_next->array[i]; - items_previous = &data->nest.depth[--j]; + items_previous = &main->nest.depth[--j]; while (j > depths.array[depths_index].depth) { item_previous = &items_previous->array[item_previous->parent]; - items_previous = &data->nest.depth[--j]; + items_previous = &main->nest.depth[--j]; } // while if (skip[item_previous->parent]) { @@ -461,15 +461,15 @@ extern "C" { } // for } - return fss_embedded_list_read_main_process_for_depth(arguments, filename, depths, depths_index + 1, line, parents_next, data, objects_delimits, contents_delimits); + return fss_embedded_list_read_main_process_for_depth(arguments, filename, depths, depths_index + 1, line, parents_next, main, objects_delimits, contents_delimits); } // process objects. f_array_length_t i = 0; f_array_length_t j = 0; - if (data->parameters[fss_embedded_list_read_parameter_object].result == f_console_result_found) { - if (data->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { + if (main->parameters[fss_embedded_list_read_parameter_object].result == f_console_result_found) { + if (main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { f_array_length_t total = 0; for (i = 0; i < items->used; i++) { @@ -478,14 +478,14 @@ extern "C" { total++; } // for - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); return F_none; } f_status_t (*print_object)(FILE *, const f_string_static_t, const f_string_range_t, const f_array_lengths_t) = &f_print_except_dynamic_partial; - if (data->parameters[fss_embedded_list_read_parameter_trim].result == f_console_result_found) { + if (main->parameters[fss_embedded_list_read_parameter_trim].result == f_console_result_found) { print_object = &fl_print_trim_except_dynamic_partial; } @@ -493,17 +493,17 @@ extern "C" { if (skip[i]) continue; - print_object(data->output.stream, data->buffer, items->array[i].object, *objects_delimits); + print_object(main->output.stream, main->buffer, items->array[i].object, *objects_delimits); - if (data->parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) { - fss_embedded_list_read_print_object_end(*data); + if (main->parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) { + fss_embedded_list_read_print_object_end(*main); if (items->array[i].content.used) { - f_print_except_dynamic_partial(data->output.stream, data->buffer, items->array[i].content.array[0], *contents_delimits); + f_print_except_dynamic_partial(main->output.stream, main->buffer, items->array[i].content.array[0], *contents_delimits); } } - fss_embedded_list_read_print_set_end(*data); + fss_embedded_list_read_print_set_end(*main); } // for return F_none; @@ -512,11 +512,11 @@ extern "C" { // process contents. bool include_empty = 0; - if (data->parameters[fss_embedded_list_read_parameter_empty].result == f_console_result_found) { + if (main->parameters[fss_embedded_list_read_parameter_empty].result == f_console_result_found) { include_empty = 1; } - if (data->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { + if (main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) { f_array_length_t total = 0; for (i = 0; i < items->used; ++i) { @@ -533,19 +533,19 @@ extern "C" { for (j = items->array[i].content.array[0].start; j <= items->array[i].content.array[0].stop; ++j) { - if (!data->buffer.string[j]) continue; + if (!main->buffer.string[j]) continue; - if (data->buffer.string[j] == f_string_eol_s[0]) { + if (main->buffer.string[j] == f_string_eol_s[0]) { total++; } } // for } // for - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); return F_none; } - if (data->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_additional) { + if (main->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_additional) { f_array_length_t line_current = 0; for (; i < items->used; ++i) { @@ -555,7 +555,7 @@ extern "C" { if (!items->array[i].content.used) { if (include_empty) { if (line_current == line) { - fss_embedded_list_read_print_set_end(*data); + fss_embedded_list_read_print_set_end(*main); break; } @@ -570,7 +570,7 @@ extern "C" { if (line_current != line) { for (; j <= items->array[i].content.array[0].stop; ++j) { - if (data->buffer.string[j] == f_string_eol_s[0]) { + if (main->buffer.string[j] == f_string_eol_s[0]) { line_current++; if (line_current == line) { @@ -586,14 +586,14 @@ extern "C" { for (; j <= items->array[i].content.array[0].stop; ++j) { - if (!data->buffer.string[j]) continue; + if (!main->buffer.string[j]) continue; - if (data->buffer.string[j] == f_string_eol_s[0]) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + if (main->buffer.string[j] == f_string_eol_s[0]) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); break; } - fprintf(data->output.stream, "%c", data->buffer.string[j]); + fprintf(main->output.stream, "%c", main->buffer.string[j]); } // for break; @@ -609,16 +609,16 @@ extern "C" { if (!items->array[i].content.used) { if (include_empty) { - fss_embedded_list_read_print_set_end(*data); + fss_embedded_list_read_print_set_end(*main); } continue; } - f_print_except_dynamic_partial(data->output.stream, data->buffer, items->array[i].content.array[0], *contents_delimits); + f_print_except_dynamic_partial(main->output.stream, main->buffer, items->array[i].content.array[0], *contents_delimits); - if (data->parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data->output.stream, "%c", fss_embedded_list_read_pipe_content_end); + if (main->parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main->output.stream, "%c", fss_embedded_list_read_pipe_content_end); } } // for @@ -627,83 +627,83 @@ extern "C" { #endif // _di_fss_embedded_list_read_main_process_for_depth_ #ifndef _di_fss_embedded_list_read_print_object_end_ - void fss_embedded_list_read_print_object_end(const fss_embedded_list_read_data_t data) { + void fss_embedded_list_read_print_object_end(const fss_embedded_list_read_main_t main) { - if (data.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_embedded_list_read_pipe_content_start); + if (main.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_embedded_list_read_pipe_content_start); } else { - if (data.parameters[fss_embedded_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) { - fprintf(data.output.stream, "%c%c", f_fss_embedded_list_open, f_fss_embedded_list_open_end); + if (main.parameters[fss_embedded_list_read_parameter_object].result == f_console_result_found && main.parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) { + fprintf(main.output.stream, "%c%c", f_fss_embedded_list_open, f_fss_embedded_list_open_end); } else { - fprintf(data.output.stream, "%c", f_fss_eol); + fprintf(main.output.stream, "%c", f_fss_eol); } } } #endif // _di_fss_embedded_list_read_print_object_end_ #ifndef _di_fss_embedded_list_read_print_content_end_ - void fss_embedded_list_read_print_content_end(const fss_embedded_list_read_data_t data) { + void fss_embedded_list_read_print_content_end(const fss_embedded_list_read_main_t main) { - if (data.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_embedded_list_read_pipe_content_start); + if (main.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_embedded_list_read_pipe_content_start); } else { - if (data.parameters[fss_embedded_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) { - fprintf(data.output.stream, "%c%c", f_fss_embedded_list_close, f_fss_embedded_list_close_end); + if (main.parameters[fss_embedded_list_read_parameter_object].result == f_console_result_found && main.parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) { + fprintf(main.output.stream, "%c%c", f_fss_embedded_list_close, f_fss_embedded_list_close_end); } else { - fprintf(data.output.stream, "%c", f_fss_eol); + fprintf(main.output.stream, "%c", f_fss_eol); } } } #endif // _di_fss_embedded_list_read_print_content_end_ #ifndef _di_fss_embedded_list_read_print_content_ignore_ - void fss_embedded_list_read_print_content_ignore(const fss_embedded_list_read_data_t data) { + void fss_embedded_list_read_print_content_ignore(const fss_embedded_list_read_main_t main) { - if (data.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_embedded_list_read_pipe_content_ignore); + if (main.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_embedded_list_read_pipe_content_ignore); } } #endif // _di_fss_embedded_list_read_print_content_ignore_ #ifndef _di_fss_embedded_list_read_print_set_end_ - void fss_embedded_list_read_print_set_end(const fss_embedded_list_read_data_t data) { + void fss_embedded_list_read_print_set_end(const fss_embedded_list_read_main_t main) { - if (data.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_embedded_list_read_pipe_content_end); + if (main.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_embedded_list_read_pipe_content_end); } else { - if (data.parameters[fss_embedded_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) { - fprintf(data.output.stream, "%c%c", f_fss_embedded_list_close, f_fss_embedded_list_close_end); + if (main.parameters[fss_embedded_list_read_parameter_object].result == f_console_result_found && main.parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) { + fprintf(main.output.stream, "%c%c", f_fss_embedded_list_close, f_fss_embedded_list_close_end); } else { - fprintf(data.output.stream, "%c", f_fss_eol); + fprintf(main.output.stream, "%c", f_fss_eol); } } } #endif // _di_fss_embedded_list_read_print_set_end_ #ifndef _di_fss_embedded_list_read_process_delimits_ - void fss_embedded_list_read_process_delimits(const fss_embedded_list_read_data_t data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { + void fss_embedded_list_read_process_delimits(const fss_embedded_list_read_main_t main, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { - if (!data.nest.used) return; + if (!main.nest.used) return; - if ((!objects_delimits->used && !contents_delimits->used) || data.delimit_mode == fss_embedded_list_read_delimit_mode_all) return; + if ((!objects_delimits->used && !contents_delimits->used) || main.delimit_mode == fss_embedded_list_read_delimit_mode_all) return; - if (data.delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser && data.nest.used < data.delimit_depth) return; - if (data.delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater && data.delimit_depth == 0) return; + if (main.delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser && main.nest.used < main.delimit_depth) return; + if (main.delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater && main.delimit_depth == 0) return; - if (data.delimit_mode == fss_embedded_list_read_delimit_mode_none) { + if (main.delimit_mode == fss_embedded_list_read_delimit_mode_none) { objects_delimits->used = 0; contents_delimits->used = 0; return; } - if (data.delimit_mode == fss_embedded_list_read_delimit_mode_depth || data.delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater) { - if (data.delimit_depth >= data.nest.used) { + if (main.delimit_mode == fss_embedded_list_read_delimit_mode_depth || main.delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater) { + if (main.delimit_depth >= main.nest.used) { objects_delimits->used = 0; contents_delimits->used = 0; return; @@ -722,37 +722,37 @@ extern "C" { objects_delimits->used = 0; contents_delimits->used = 0; - if (data.delimit_mode == fss_embedded_list_read_delimit_mode_depth) { + if (main.delimit_mode == fss_embedded_list_read_delimit_mode_depth) { // only depth 0 objects are stored in objects_delimits. - if (data.delimit_depth) { - fss_embedded_list_read_process_delimits_objects(data, data.delimit_depth, original_contents_delimits, original_contents_used, contents_delimits); + if (main.delimit_depth) { + fss_embedded_list_read_process_delimits_objects(main, main.delimit_depth, original_contents_delimits, original_contents_used, contents_delimits); } else { - fss_embedded_list_read_process_delimits_objects(data, data.delimit_depth, original_objects_delimits, original_objects_used, objects_delimits); + fss_embedded_list_read_process_delimits_objects(main, main.delimit_depth, original_objects_delimits, original_objects_used, objects_delimits); } - fss_embedded_list_read_process_delimits_contents(data, data.delimit_depth, original_contents_delimits, original_contents_used, contents_delimits); + fss_embedded_list_read_process_delimits_contents(main, main.delimit_depth, original_contents_delimits, original_contents_used, contents_delimits); } else { - if (data.delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser) { + if (main.delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser) { // only depth 0 objects are stored in objects_delimits. - fss_embedded_list_read_process_delimits_objects(data, 0, original_objects_delimits, original_objects_used, objects_delimits); - fss_embedded_list_read_process_delimits_contents(data, 0, original_contents_delimits, original_contents_used, contents_delimits); + fss_embedded_list_read_process_delimits_objects(main, 0, original_objects_delimits, original_objects_used, objects_delimits); + fss_embedded_list_read_process_delimits_contents(main, 0, original_contents_delimits, original_contents_used, contents_delimits); - for (f_array_length_t i = 1; i <= data.delimit_depth && i < data.nest.used; ++i) { + for (f_array_length_t i = 1; i <= main.delimit_depth && i < main.nest.used; ++i) { - fss_embedded_list_read_process_delimits_objects(data, i, original_contents_delimits, original_contents_used, contents_delimits); - fss_embedded_list_read_process_delimits_contents(data, i, original_contents_delimits, original_contents_used, contents_delimits); + fss_embedded_list_read_process_delimits_objects(main, i, original_contents_delimits, original_contents_used, contents_delimits); + fss_embedded_list_read_process_delimits_contents(main, i, original_contents_delimits, original_contents_used, contents_delimits); } // for } - else if (data.delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater) { - for (f_array_length_t i = data.delimit_depth; i < data.nest.used; ++i) { + else if (main.delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater) { + for (f_array_length_t i = main.delimit_depth; i < main.nest.used; ++i) { - fss_embedded_list_read_process_delimits_objects(data, i, original_contents_delimits, original_contents_used, contents_delimits); - fss_embedded_list_read_process_delimits_contents(data, i, original_contents_delimits, original_contents_used, contents_delimits); + fss_embedded_list_read_process_delimits_objects(main, i, original_contents_delimits, original_contents_used, contents_delimits); + fss_embedded_list_read_process_delimits_contents(main, i, original_contents_delimits, original_contents_used, contents_delimits); } // for } } @@ -760,11 +760,11 @@ extern "C" { #endif // _di_fss_embedded_list_read_process_delimits_ #ifndef _di_fss_embedded_list_read_process_delimits_contents_ - void fss_embedded_list_read_process_delimits_contents(const fss_embedded_list_read_data_t data, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) { + void fss_embedded_list_read_process_delimits_contents(const fss_embedded_list_read_main_t main, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) { if (!original_used) return; - f_fss_items_t *items = &data.nest.depth[depth]; + f_fss_items_t *items = &main.nest.depth[depth]; if (!items->used) return; @@ -793,7 +793,7 @@ extern "C" { delimits->array[m] = delimits->array[m - 1]; } // for - if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) { + if (fss_embedded_list_read_process_delimits_within_greater(main, depth, original_delimits[j]) == F_false) { delimits->array[l] = original_delimits[j]; delimits->used++; } @@ -801,7 +801,7 @@ extern "C" { break; } // for } - else if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) { + else if (fss_embedded_list_read_process_delimits_within_greater(main, depth, original_delimits[j]) == F_false) { delimits->array[0] = original_delimits[j]; delimits->used = 1; } @@ -813,11 +813,11 @@ extern "C" { #endif // _di_fss_embedded_list_read_process_delimits_contents_ #ifndef _di_fss_embedded_list_read_process_delimits_objects_ - void fss_embedded_list_read_process_delimits_objects(const fss_embedded_list_read_data_t data, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) { + void fss_embedded_list_read_process_delimits_objects(const fss_embedded_list_read_main_t main, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) { if (!original_used) return; - f_fss_items_t *items = &data.nest.depth[depth]; + f_fss_items_t *items = &main.nest.depth[depth]; if (!items->used) return; @@ -843,7 +843,7 @@ extern "C" { delimits->array[l] = delimits->array[l - 1]; } // for - if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) { + if (fss_embedded_list_read_process_delimits_within_greater(main, depth, original_delimits[j]) == F_false) { delimits->array[k] = original_delimits[j]; delimits->used++; } @@ -851,7 +851,7 @@ extern "C" { break; } // for } - else if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) { + else if (fss_embedded_list_read_process_delimits_within_greater(main, depth, original_delimits[j]) == F_false) { delimits->array[0] = original_delimits[j]; delimits->used = 1; } @@ -862,17 +862,17 @@ extern "C" { #endif // _di_fss_embedded_list_read_process_delimits_objects_ #ifndef _di_fss_embedded_list_read_process_delimits_within_greater_ - f_status_t fss_embedded_list_read_process_delimits_within_greater(const fss_embedded_list_read_data_t data, const f_array_length_t depth, const f_array_length_t location) { + f_status_t fss_embedded_list_read_process_delimits_within_greater(const fss_embedded_list_read_main_t main, const f_array_length_t depth, const f_array_length_t location) { - if (depth + 1 >= data.nest.used) return F_false; + if (depth + 1 >= main.nest.used) return F_false; f_fss_items_t *items = 0; f_array_length_t i = 0; f_array_length_t j = 0; - for (f_array_length_t d = depth + 1; d < data.nest.used; ++d) { - items = &data.nest.depth[d]; + for (f_array_length_t d = depth + 1; d < main.nest.used; ++d) { + items = &main.nest.depth[d]; for (i = 0; i < items->used; ++i) { diff --git a/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.h b/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.h index 1e47685..4dca429 100644 --- a/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.h +++ b/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.h @@ -141,8 +141,8 @@ extern "C" { * * @param arguments * The console arguments to pre-process. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param depths * This stores the pre-processed depth parameters. * @@ -152,7 +152,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fss_embedded_list_read_main_preprocess_depth_ - extern f_status_t fss_embedded_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_embedded_list_read_data_t data, fss_embedded_list_read_depths_t *depths) f_attribute_visibility_internal; + extern f_status_t fss_embedded_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_embedded_list_read_main_t main, fss_embedded_list_read_depths_t *depths) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_main_preprocess_depth_ /** @@ -160,8 +160,8 @@ extern "C" { * * @param arguments * The console arguments passed to the program. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param file_name * The name of the file being processed. * @param depths @@ -183,7 +183,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fss_embedded_list_read_main_process_file_ - extern f_status_t fss_embedded_list_read_main_process_file(const f_console_arguments_t arguments, fss_embedded_list_read_data_t *data, const f_string_t file_name, const fss_embedded_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) f_attribute_visibility_internal; + extern f_status_t fss_embedded_list_read_main_process_file(const f_console_arguments_t arguments, fss_embedded_list_read_main_t *main, const f_string_t file_name, const fss_embedded_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_main_process_file_ /** @@ -204,8 +204,8 @@ extern "C" { * @param parents * The skip status of any parent lists. * Set parents.length to 0 for depth 0. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param objects_delimits * An array of delimits detected during processing, for top-level objects. * @param contents_delimits @@ -219,17 +219,17 @@ extern "C" { * @see fss_embedded_list_read_main_process_file() */ #ifndef _di_fss_embedded_list_read_main_process_for_depth_ - extern f_status_t fss_embedded_list_read_main_process_for_depth(const f_console_arguments_t arguments, const f_string_t filename, const fss_embedded_list_read_depths_t depths, const f_array_length_t depths_index, const f_array_length_t line, const fss_embedded_list_read_skip_t parents, fss_embedded_list_read_data_t *data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) f_attribute_visibility_internal; + extern f_status_t fss_embedded_list_read_main_process_for_depth(const f_console_arguments_t arguments, const f_string_t filename, const fss_embedded_list_read_depths_t depths, const f_array_length_t depths_index, const f_array_length_t line, const fss_embedded_list_read_skip_t parents, fss_embedded_list_read_main_t *main, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_main_process_for_depth_ /** * Print the end of an content. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_embedded_list_read_print_content_end_ - extern void fss_embedded_list_read_print_content_end(const fss_embedded_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_embedded_list_read_print_content_end(const fss_embedded_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_print_content_end_ /** @@ -237,38 +237,38 @@ extern "C" { * * This is only used in pipe output mode. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_embedded_list_read_print_content_ignore_ - extern void fss_embedded_list_read_print_content_ignore(const fss_embedded_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_embedded_list_read_print_content_ignore(const fss_embedded_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_print_content_ignore_ /** * Print the end of an object (which is essentially the start of a content). * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_embedded_list_read_print_object_end_ - extern void fss_embedded_list_read_print_object_end(const fss_embedded_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_embedded_list_read_print_object_end(const fss_embedded_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_print_object_end_ /** * Print the end of an object/content set. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_embedded_list_read_print_set_end_ - extern void fss_embedded_list_read_print_set_end(const fss_embedded_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_embedded_list_read_print_set_end(const fss_embedded_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_print_set_end_ /** * Rewrite the object and content delimit ranges to be within the given depth range. * - * @param data - * The program specific data. + * @param main + * The program specific main. * @param objects_delimits * An array of delimits detected during processing, for top-level objects. * @param contents_delimits @@ -277,14 +277,14 @@ extern "C" { * @see fss_embedded_list_read_main_process_file() */ #ifndef _di_fss_embedded_list_read_process_delimits_ - extern void fss_embedded_list_read_process_delimits(const fss_embedded_list_read_data_t data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) f_attribute_visibility_internal; + extern void fss_embedded_list_read_process_delimits(const fss_embedded_list_read_main_t main, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_process_delimits_ /** * Write the given delimits at the given depth back into the new delimits array, specifically for contents. * - * @param data - * The program specific data. + * @param main + * The program specific main. * @param depth * The depth in which to process. * @param original_delimits @@ -297,14 +297,14 @@ extern "C" { * @see fss_embedded_list_read_process_delimits() */ #ifndef _di_fss_embedded_list_read_process_delimits_contents_ - extern void fss_embedded_list_read_process_delimits_contents(const fss_embedded_list_read_data_t data, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) f_attribute_visibility_internal; + extern void fss_embedded_list_read_process_delimits_contents(const fss_embedded_list_read_main_t main, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_process_delimits_contents_ /** * Write the given delimits at the given depth back into the new delimits array, specifically for objects. * - * @param data - * The program specific data. + * @param main + * The program specific main. * @param depth * The depth in which to process. * @param original_delimits @@ -317,14 +317,14 @@ extern "C" { * @see fss_embedded_list_read_process_delimits() */ #ifndef _di_fss_embedded_list_read_process_delimits_objects_ - extern void fss_embedded_list_read_process_delimits_objects(const fss_embedded_list_read_data_t data, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) f_attribute_visibility_internal; + extern void fss_embedded_list_read_process_delimits_objects(const fss_embedded_list_read_main_t main, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_process_delimits_objects_ /** * Determine if the given location is actually within another depth. * - * @param data - * The program specific data. + * @param main + * The program specific main. * @param depth * The depth in which to process. * @param location @@ -338,7 +338,7 @@ extern "C" { * @see fss_embedded_list_read_process_delimits_contents() */ #ifndef _di_fss_embedded_list_read_process_delimits_within_greater_ - extern f_status_t fss_embedded_list_read_process_delimits_within_greater(const fss_embedded_list_read_data_t data, const f_array_length_t depth, const f_array_length_t location) f_attribute_visibility_internal; + extern f_status_t fss_embedded_list_read_process_delimits_within_greater(const fss_embedded_list_read_main_t main, const f_array_length_t depth, const f_array_length_t location) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_read_process_delimits_within_greater_ #ifdef __cplusplus diff --git a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c index 0ae1045..7509b8a 100644 --- a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c +++ b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c @@ -92,30 +92,30 @@ extern "C" { #endif // _di_fss_embedded_list_write_print_help_ #ifndef _di_fss_embedded_list_write_main_ - f_status_t fss_embedded_list_write_main(const f_console_arguments_t arguments, fss_embedded_list_write_data_t *data) { + f_status_t fss_embedded_list_write_main(const f_console_arguments_t arguments, fss_embedded_list_write_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_embedded_list_write_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_embedded_list_write_total_parameters); { f_console_parameter_id_t ids[3] = { fss_embedded_list_write_parameter_no_color, fss_embedded_list_write_parameter_light, fss_embedded_list_write_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_embedded_list_write_data_delete(data); + fss_embedded_list_write_main_delete(main); return F_status_set_error(status); } } @@ -129,38 +129,38 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_embedded_list_write_data_delete(data); + fss_embedded_list_write_main_delete(main); return status; } if (choice == fss_embedded_list_write_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_embedded_list_write_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_embedded_list_write_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_embedded_list_write_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_embedded_list_write_parameter_help].result == f_console_result_found) { - fss_embedded_list_write_print_help(data->output, data->context); + if (main->parameters[fss_embedded_list_write_parameter_help].result == f_console_result_found) { + fss_embedded_list_write_print_help(main->output, main->context); - fss_embedded_list_write_data_delete(data); + fss_embedded_list_write_main_delete(main); return status; } - if (data->parameters[fss_embedded_list_write_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_embedded_list_write_version); + if (main->parameters[fss_embedded_list_write_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_embedded_list_write_version); - fss_embedded_list_write_data_delete(data); + fss_embedded_list_write_main_delete(main); return status; } @@ -171,61 +171,61 @@ extern "C" { output.flag = f_file_flag_create | f_file_flag_write_only | f_file_flag_append; if (F_status_is_error_not(status)) { - if (data->parameters[fss_embedded_list_write_parameter_file].result == f_console_result_additional) { - if (data->parameters[fss_embedded_list_write_parameter_file].values.used > 1) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_file); - f_color_print(data->error.to.stream, data->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); + if (main->parameters[fss_embedded_list_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[fss_embedded_list_write_parameter_file].values.used > 1) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_file); + f_color_print(main->error.to.stream, main->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } else { - const f_array_length_t location = data->parameters[fss_embedded_list_write_parameter_file].values.array[0]; + const f_array_length_t location = main->parameters[fss_embedded_list_write_parameter_file].values.array[0]; output.id = -1; output.stream = 0; status = f_file_stream_open(arguments.argv[location], 0, &output); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); } } } - else if (data->parameters[fss_embedded_list_write_parameter_file].result == f_console_result_found) { - fss_embedded_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_embedded_list_write_long_file); + else if (main->parameters[fss_embedded_list_write_parameter_file].result == f_console_result_found) { + fss_embedded_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_embedded_list_write_long_file); status = F_status_set_error(F_parameter); } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_embedded_list_write_parameter_object].locations.used || data->parameters[fss_embedded_list_write_parameter_content].locations.used) { - if (data->parameters[fss_embedded_list_write_parameter_object].locations.used) { - if (data->parameters[fss_embedded_list_write_parameter_object].locations.used != data->parameters[fss_embedded_list_write_parameter_object].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object); + if (main->parameters[fss_embedded_list_write_parameter_object].locations.used || main->parameters[fss_embedded_list_write_parameter_content].locations.used) { + if (main->parameters[fss_embedded_list_write_parameter_object].locations.used) { + if (main->parameters[fss_embedded_list_write_parameter_object].locations.used != main->parameters[fss_embedded_list_write_parameter_object].values.used) { + fss_embedded_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_embedded_list_write_parameter_content].locations.used != data->parameters[fss_embedded_list_write_parameter_content].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); + else if (main->parameters[fss_embedded_list_write_parameter_content].locations.used != main->parameters[fss_embedded_list_write_parameter_content].values.used) { + fss_embedded_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_embedded_list_write_parameter_object].locations.used != data->parameters[fss_embedded_list_write_parameter_content].locations.used && data->parameters[fss_embedded_list_write_parameter_partial].result == f_console_result_none) { - fss_embedded_list_write_error_parameter_same_times_print(*data); + else if (main->parameters[fss_embedded_list_write_parameter_object].locations.used != main->parameters[fss_embedded_list_write_parameter_content].locations.used && main->parameters[fss_embedded_list_write_parameter_partial].result == f_console_result_none) { + fss_embedded_list_write_error_parameter_same_times_print(*main); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_embedded_list_write_parameter_content].locations.used && data->parameters[fss_embedded_list_write_parameter_partial].locations.used) { - if (data->parameters[fss_embedded_list_write_parameter_content].result == f_console_result_additional) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter only allows either the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter or the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter, but not both.%c", f_string_eol_s[0]); + else if (main->parameters[fss_embedded_list_write_parameter_content].locations.used && main->parameters[fss_embedded_list_write_parameter_partial].locations.used) { + if (main->parameters[fss_embedded_list_write_parameter_content].result == f_console_result_additional) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter only allows either the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter or the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter, but not both.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -233,26 +233,26 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_embedded_list_write_parameter_content].result == f_console_result_additional) { + if (main->parameters[fss_embedded_list_write_parameter_content].result == f_console_result_additional) { f_array_length_t location_object = 0; f_array_length_t location_content = 0; f_array_length_t location_sub_object = 0; f_array_length_t location_sub_content = 0; - for (f_array_length_t i = 0; i < data->parameters[fss_embedded_list_write_parameter_object].locations.used; i++) { - location_object = data->parameters[fss_embedded_list_write_parameter_object].locations.array[i]; - location_content = data->parameters[fss_embedded_list_write_parameter_content].locations.array[i]; - location_sub_object = data->parameters[fss_embedded_list_write_parameter_object].locations_sub.array[i]; - location_sub_content = data->parameters[fss_embedded_list_write_parameter_content].locations_sub.array[i]; + for (f_array_length_t i = 0; i < main->parameters[fss_embedded_list_write_parameter_object].locations.used; i++) { + location_object = main->parameters[fss_embedded_list_write_parameter_object].locations.array[i]; + location_content = main->parameters[fss_embedded_list_write_parameter_content].locations.array[i]; + location_sub_object = main->parameters[fss_embedded_list_write_parameter_object].locations_sub.array[i]; + location_sub_content = main->parameters[fss_embedded_list_write_parameter_content].locations_sub.array[i]; if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sEach ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter must be specified before a '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sEach ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter must be specified before a '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -262,37 +262,37 @@ extern "C" { } } } - else if (data->parameters[fss_embedded_list_write_parameter_content].locations.used) { - if (data->parameters[fss_embedded_list_write_parameter_content].locations.used != data->parameters[fss_embedded_list_write_parameter_content].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); + else if (main->parameters[fss_embedded_list_write_parameter_content].locations.used) { + if (main->parameters[fss_embedded_list_write_parameter_content].locations.used != main->parameters[fss_embedded_list_write_parameter_content].values.used) { + fss_embedded_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); status = F_status_set_error(F_parameter); } - else if (!data->parameters[fss_embedded_list_write_parameter_partial].locations.used) { - fss_embedded_list_write_error_parameter_same_times_print(*data); + else if (!main->parameters[fss_embedded_list_write_parameter_partial].locations.used) { + fss_embedded_list_write_error_parameter_same_times_print(*main); status = F_status_set_error(F_parameter); } } } - else if (!data->process_pipe) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThis requires either piped data or the use of the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + else if (!main->process_pipe) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThis requires either piped main or the use of the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->process_pipe) { - if (data->parameters[fss_embedded_list_write_parameter_partial].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter cannot be used when processing a pipe.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->process_pipe) { + if (main->parameters[fss_embedded_list_write_parameter_partial].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter cannot be used when processing a pipe.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -301,38 +301,38 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_embedded_list_write_parameter_prepend].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + if (main->parameters[fss_embedded_list_write_parameter_prepend].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_embedded_list_write_parameter_prepend].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_embedded_list_write_parameter_prepend].values.array[data->parameters[fss_embedded_list_write_parameter_prepend].values.used - 1]; + else if (main->parameters[fss_embedded_list_write_parameter_prepend].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_embedded_list_write_parameter_prepend].values.array[main->parameters[fss_embedded_list_write_parameter_prepend].values.used - 1]; const f_array_length_t length = strnlen(arguments.argv[index], f_console_parameter_size); if (length) { f_string_range_t range = f_macro_string_range_t_initialize(length); - data->prepend.string = arguments.argv[index]; - data->prepend.used = length; - data->prepend.size = length; + main->prepend.string = arguments.argv[index]; + main->prepend.used = length; + main->prepend.size = length; for (; range.start < length; range.start++) { - status = f_fss_is_space(data->prepend, range); + status = f_fss_is_space(main->prepend, range); if (F_status_is_error(status)) break; if (status == F_false) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' must only contain whitespace.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' must only contain whitespace.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -341,11 +341,11 @@ extern "C" { } // for } else { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -354,25 +354,25 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_embedded_list_write_parameter_ignore].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no values were given.%c", f_string_eol_s[0]); + if (main->parameters[fss_embedded_list_write_parameter_ignore].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no values were given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_embedded_list_write_parameter_ignore].result == f_console_result_additional) { - const f_array_length_t total_locations = data->parameters[fss_embedded_list_write_parameter_ignore].locations.used; - const f_array_length_t total_arguments = data->parameters[fss_embedded_list_write_parameter_ignore].values.used; + else if (main->parameters[fss_embedded_list_write_parameter_ignore].result == f_console_result_additional) { + const f_array_length_t total_locations = main->parameters[fss_embedded_list_write_parameter_ignore].locations.used; + const f_array_length_t total_arguments = main->parameters[fss_embedded_list_write_parameter_ignore].values.used; if (total_locations * 2 > total_arguments) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore); - f_color_print(data->error.to.stream, data->context.set.error, "' requires two values.%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore); + f_color_print(main->error.to.stream, main->context.set.error, "' requires two values.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } @@ -382,14 +382,14 @@ extern "C" { f_fss_quote_t quote = f_fss_delimit_quote_double; if (F_status_is_error_not(status)) { - if (data->parameters[fss_embedded_list_write_parameter_double].result == f_console_result_found) { - if (data->parameters[fss_embedded_list_write_parameter_single].result == f_console_result_found) { - if (data->parameters[fss_embedded_list_write_parameter_double].location < data->parameters[fss_embedded_list_write_parameter_single].location) { + if (main->parameters[fss_embedded_list_write_parameter_double].result == f_console_result_found) { + if (main->parameters[fss_embedded_list_write_parameter_single].result == f_console_result_found) { + if (main->parameters[fss_embedded_list_write_parameter_double].location < main->parameters[fss_embedded_list_write_parameter_single].location) { quote = f_fss_delimit_quote_single; } } } - else if (data->parameters[fss_embedded_list_write_parameter_single].result == f_console_result_found) { + else if (main->parameters[fss_embedded_list_write_parameter_single].result == f_console_result_found) { quote = f_fss_delimit_quote_single; } } @@ -402,15 +402,15 @@ extern "C" { f_string_dynamic_t escaped = f_string_dynamic_t_initialize; f_string_ranges_t ignore = f_string_ranges_t_initialize; - if (data->process_pipe) { - status = fss_embedded_list_write_process_pipe(*data, output, quote, &buffer, &ignore); + if (main->process_pipe) { + status = fss_embedded_list_write_process_pipe(*main, output, quote, &buffer, &ignore); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sWhile processing the ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "input pipe"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sWhile processing the ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "input pipe"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); } } @@ -418,65 +418,65 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_embedded_list_write_parameter_partial].result == f_console_result_found) { + if (main->parameters[fss_embedded_list_write_parameter_partial].result == f_console_result_found) { - if (data->parameters[fss_embedded_list_write_parameter_object].result == f_console_result_additional) { - for (f_array_length_t i = 0; i < data->parameters[fss_embedded_list_write_parameter_object].values.used; i++) { + if (main->parameters[fss_embedded_list_write_parameter_object].result == f_console_result_additional) { + for (f_array_length_t i = 0; i < main->parameters[fss_embedded_list_write_parameter_object].values.used; i++) { - object.string = arguments.argv[data->parameters[fss_embedded_list_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[fss_embedded_list_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; - status = fss_embedded_list_write_process(*data, output, quote, &object, 0, 0, &buffer); + status = fss_embedded_list_write_process(*main, output, quote, &object, 0, 0, &buffer); if (F_status_is_error(status)) break; } // for } else { - for (f_array_length_t i = 0; i < data->parameters[fss_embedded_list_write_parameter_content].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[fss_embedded_list_write_parameter_content].values.used; i++) { - status = fss_embedded_list_write_process_parameter_ignore(arguments, *data, data->parameters[fss_embedded_list_write_parameter_content].locations, i, &ignore); + status = fss_embedded_list_write_process_parameter_ignore(arguments, *main, main->parameters[fss_embedded_list_write_parameter_content].locations, i, &ignore); if (F_status_is_error(status)) break; - content.string = arguments.argv[data->parameters[fss_embedded_list_write_parameter_content].values.array[i]]; + content.string = arguments.argv[main->parameters[fss_embedded_list_write_parameter_content].values.array[i]]; content.used = strnlen(content.string, f_console_parameter_size); content.size = content.used; - status = fss_embedded_list_write_process(*data, output, quote, 0, &content, &ignore, &buffer); + status = fss_embedded_list_write_process(*main, output, quote, 0, &content, &ignore, &buffer); if (F_status_is_error(status)) break; } // for } } else { - for (f_array_length_t i = 0; i < data->parameters[fss_embedded_list_write_parameter_object].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[fss_embedded_list_write_parameter_object].values.used; i++) { - status = fss_embedded_list_write_process_parameter_ignore(arguments, *data, data->parameters[fss_embedded_list_write_parameter_content].locations, i, &ignore); + status = fss_embedded_list_write_process_parameter_ignore(arguments, *main, main->parameters[fss_embedded_list_write_parameter_content].locations, i, &ignore); if (F_status_is_error(status)) break; - object.string = arguments.argv[data->parameters[fss_embedded_list_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[fss_embedded_list_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; - content.string = arguments.argv[data->parameters[fss_embedded_list_write_parameter_content].values.array[i]]; + content.string = arguments.argv[main->parameters[fss_embedded_list_write_parameter_content].values.array[i]]; content.used = strnlen(content.string, f_console_parameter_size); content.size = content.used; - status = fss_embedded_list_write_process(*data, output, quote, &object, &content, &ignore, &buffer); + status = fss_embedded_list_write_process(*main, output, quote, &object, &content, &ignore, &buffer); if (F_status_is_error(status)) break; } // for } if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sWhile processing the ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "input arguments"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sWhile processing the ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "input arguments"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); } } - else if (data->error.verbosity != f_console_verbosity_quiet && data->parameters[fss_embedded_list_write_parameter_file].result == f_console_result_none) { + else if (main->error.verbosity != f_console_verbosity_quiet && main->parameters[fss_embedded_list_write_parameter_file].result == f_console_result_none) { // ensure there is always a newline at the end, unless in quiet mode. - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); } } @@ -493,43 +493,43 @@ extern "C" { content.size = 0; } - if (data->parameters[fss_embedded_list_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[fss_embedded_list_write_parameter_file].result == f_console_result_additional) { if (output.id != -1) { f_file_stream_close(F_true, &output); } } // ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (data->error.verbosity != f_console_verbosity_quiet) { + if (main->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status)) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } } f_macro_string_dynamic_t_delete_simple(buffer); f_macro_string_dynamic_t_delete_simple(object); f_macro_string_dynamic_t_delete_simple(content); - fss_embedded_list_write_data_delete(data); + fss_embedded_list_write_main_delete(main); return status; } #endif // _di_fss_embedded_list_write_main_ -#ifndef _di_fss_embedded_list_write_data_delete_ - f_status_t fss_embedded_list_write_data_delete(fss_embedded_list_write_data_t *data) { +#ifndef _di_fss_embedded_list_write_main_delete_ + f_status_t fss_embedded_list_write_main_delete(fss_embedded_list_write_main_t *main) { for (f_array_length_t i = 0; i < fss_embedded_list_write_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_embedded_list_write_data_delete_ +#endif // _di_fss_embedded_list_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h index 2f11fac..0ca32ea 100644 --- a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h +++ b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h @@ -127,7 +127,7 @@ extern "C" { #define fss_embedded_list_write_total_parameters 18 #endif // _di_fss_embedded_list_write_defines_ -#ifndef _di_fss_embedded_list_write_data_t_ +#ifndef _di_fss_embedded_list_write_main_t_ typedef struct { f_console_parameter_t parameters[fss_embedded_list_write_total_parameters]; @@ -139,9 +139,9 @@ extern "C" { f_string_static_t prepend; f_color_context_t context; - } fss_embedded_list_write_data_t; + } fss_embedded_list_write_main_t; - #define fss_embedded_list_write_data_t_initialize \ + #define fss_embedded_list_write_main_t_initialize \ { \ fss_embedded_list_write_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -151,7 +151,7 @@ extern "C" { f_string_static_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_fss_embedded_list_write_data_t_ +#endif // _di_fss_embedded_list_write_main_t_ /** * Print help. @@ -171,31 +171,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_embedded_list_write_data_delete() after executing this. + * Be sure to call fss_embedded_list_write_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see fss_embedded_list_write_data_delete() + * @see fss_embedded_list_write_main_delete() */ #ifndef _di_fss_embedded_list_write_main_ - extern f_status_t fss_embedded_list_write_main(const f_console_arguments_t arguments, fss_embedded_list_write_data_t *data); + extern f_status_t fss_embedded_list_write_main(const f_console_arguments_t arguments, fss_embedded_list_write_main_t *main); #endif // _di_fss_embedded_list_write_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_embedded_list_write_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -204,9 +204,9 @@ extern "C" { * * @see fss_embedded_list_write_main() */ -#ifndef _di_fss_embedded_list_write_data_delete_ - extern f_status_t fss_embedded_list_write_data_delete(fss_embedded_list_write_data_t *data); -#endif // _di_fss_embedded_list_write_data_delete_ +#ifndef _di_fss_embedded_list_write_main_delete_ + extern f_status_t fss_embedded_list_write_main_delete(fss_embedded_list_write_main_t *main); +#endif // _di_fss_embedded_list_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_embedded_list_write/c/main.c b/level_3/fss_embedded_list_write/c/main.c index 6e07dd8..c236863 100644 --- a/level_3/fss_embedded_list_write/c/main.c +++ b/level_3/fss_embedded_list_write/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_embedded_list_write_data_t data = fss_embedded_list_write_data_t_initialize; + fss_embedded_list_write_main_t main = fss_embedded_list_write_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_embedded_list_write_main(arguments, &data); + const f_status_t status = fss_embedded_list_write_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_embedded_list_write/c/private-fss_embedded_list_write.c b/level_3/fss_embedded_list_write/c/private-fss_embedded_list_write.c index 4816882..4ba7eb4 100644 --- a/level_3/fss_embedded_list_write/c/private-fss_embedded_list_write.c +++ b/level_3/fss_embedded_list_write/c/private-fss_embedded_list_write.c @@ -6,53 +6,53 @@ extern "C" { #endif #ifndef _di_fss_embedded_list_write_error_parameter_same_times_print_ - void fss_embedded_list_write_error_parameter_same_times_print(const fss_embedded_list_write_data_t data) { + void fss_embedded_list_write_error_parameter_same_times_print(const fss_embedded_list_write_main_t main) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sMust specify both the '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_object); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter and the '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter the same number of times when not specifying the "); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sMust specify both the '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_object); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter and the '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_content); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter the same number of times when not specifying the "); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter.%c", f_string_eol_s[0]); } #endif // _di_fss_embedded_list_write_error_parameter_same_times_print_ #ifndef _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ - void fss_embedded_list_write_error_parameter_unsupported_eol_print(const fss_embedded_list_write_data_t data) { + void fss_embedded_list_write_error_parameter_unsupported_eol_print(const fss_embedded_list_write_main_t main) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThis standard does not support end of line character '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "\\n"); - f_color_print(data.error.to.stream, data.context.set.error, "' in objects.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThis standard does not support end of line character '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "\\n"); + f_color_print(main.error.to.stream, main.context.set.error, "' in objects.%c", f_string_eol_s[0]); } #endif // _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_embedded_list_write_error_parameter_value_missing_print_ - void fss_embedded_list_write_error_parameter_value_missing_print(const fss_embedded_list_write_data_t data, const f_string_t symbol, const f_string_t parameter) { + void fss_embedded_list_write_error_parameter_value_missing_print(const fss_embedded_list_write_main_t main, const f_string_t symbol, const f_string_t parameter) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", symbol, parameter); - f_color_print(data.error.to.stream, data.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", symbol, parameter); + f_color_print(main.error.to.stream, main.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } #endif // _di_fss_embedded_list_write_error_parameter_value_missing_print_ #ifndef _di_fss_embedded_list_write_process_ - f_status_t fss_embedded_list_write_process(const fss_embedded_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) { + f_status_t fss_embedded_list_write_process(const fss_embedded_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_string_range_t range = f_string_range_t_initialize; @@ -70,7 +70,7 @@ extern "C" { } if (content) { - if (data.parameters[fss_embedded_list_write_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_embedded_list_write_parameter_trim].result == f_console_result_found) { complete = f_fss_complete_full_trim; } else { @@ -81,13 +81,13 @@ extern "C" { status = fl_fss_embedded_list_object_write_string(*object, complete, &range, buffer); if (F_status_set_fine(status) == F_none_eol) { - fss_embedded_list_write_error_parameter_unsupported_eol_print(data); + fss_embedded_list_write_error_parameter_unsupported_eol_print(main); return F_status_set_error(F_supported_not); } if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_embedded_list_object_write_string", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_embedded_list_object_write_string", F_true); return status; } } @@ -96,10 +96,10 @@ extern "C" { range.start = 0; range.stop = content->used - 1; - status = fl_fss_embedded_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &data.prepend, ignore, &range, buffer); + status = fl_fss_embedded_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &main.prepend, ignore, &range, buffer); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_embedded_list_content_write_string", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_embedded_list_content_write_string", F_true); return status; } } @@ -108,7 +108,7 @@ extern "C" { status = f_string_append(f_string_eol, 1, buffer); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true); return status; } } @@ -121,7 +121,7 @@ extern "C" { #endif // _di_fss_embedded_list_write_process_ #ifndef _di_fss_embedded_list_write_process_pipe_ - f_status_t fss_embedded_list_write_process_pipe(const fss_embedded_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) { + f_status_t fss_embedded_list_write_process_pipe(const fss_embedded_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) { f_status_t status = F_none; f_status_t status_pipe = F_none; @@ -153,7 +153,7 @@ extern "C" { status_pipe = f_file_read_block(input, &block); if (F_status_is_error(status_pipe)) { - fll_error_print(data.error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); + fll_error_print(main.error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); status_pipe = F_status_set_error(F_pipe); break; @@ -180,7 +180,7 @@ extern "C" { status = f_string_dynamic_increase_by(block.used, &object); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); break; } } @@ -229,7 +229,7 @@ extern "C" { status = f_string_dynamic_increase_by(total, &content); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); break; } } @@ -237,9 +237,9 @@ extern "C" { for (; range.start <= range.stop; range.start++) { if (block.string[range.start] == fss_embedded_list_write_pipe_content_start) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThis standard only supports one content per object.%c", fll_error_print_error, f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThis standard only supports one content per object.%c", fll_error_print_error, f_string_eol_s[0]); } status = F_status_set_error(F_supported_not); @@ -262,7 +262,7 @@ extern "C" { if (ignore->used + 1 > ignore->size) { if (ignore->size + f_fss_default_allocation_step > f_array_length_t_size) { if (ignore->size + 1 > f_array_length_t_size) { - fll_error_print(data.error, F_string_too_large, "fss_embedded_list_write_process_pipe", F_true); + fll_error_print(main.error, F_string_too_large, "fss_embedded_list_write_process_pipe", F_true); status = F_status_set_error(F_string_too_large); break; @@ -275,7 +275,7 @@ extern "C" { } if (F_status_is_error(status)) { - fll_error_print(data.error, F_string_too_large, "fss_embedded_list_write_process_pipe", F_true); + fll_error_print(main.error, F_string_too_large, "fss_embedded_list_write_process_pipe", F_true); break; } } @@ -302,7 +302,7 @@ extern "C" { } if (state == 0x3) { - status = fss_embedded_list_write_process(data, output, quote, &object, &content, ignore, buffer); + status = fss_embedded_list_write_process(main, output, quote, &object, &content, ignore, buffer); if (F_status_is_error(status)) break; state = 0; @@ -311,7 +311,7 @@ extern "C" { // if the pipe ended before finishing, then attempt to wrap up. if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) { - status = fss_embedded_list_write_process(data, output, quote, &object, &content, ignore, buffer); + status = fss_embedded_list_write_process(main, output, quote, &object, &content, ignore, buffer); } f_macro_string_dynamic_t_delete_simple(block); @@ -322,7 +322,7 @@ extern "C" { #endif // _di_fss_embedded_list_write_process_pipe_ #ifndef _di_fss_embedded_list_write_process_parameter_ignore_ - f_status_t fss_embedded_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_embedded_list_write_data_t data, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) { + f_status_t fss_embedded_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_embedded_list_write_main_t main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) { f_status_t status = F_none; f_array_length_t i = 0; @@ -335,9 +335,9 @@ extern "C" { range.start = 0; - for (; i < data.parameters[fss_embedded_list_write_parameter_ignore].locations.used; i++) { + for (; i < main.parameters[fss_embedded_list_write_parameter_ignore].locations.used; i++) { - l = data.parameters[fss_embedded_list_write_parameter_ignore].locations.array[i]; + l = main.parameters[fss_embedded_list_write_parameter_ignore].locations.array[i]; if (l < contents.array[location]) continue; if (location + 1 < contents.used && l > contents.array[location + 1]) continue; @@ -345,7 +345,7 @@ extern "C" { if (ignore->used + 1 > ignore->size) { if (ignore->size + f_fss_default_allocation_step > f_array_length_t_size) { if (ignore->size + 1 > f_array_length_t_size) { - fll_error_print(data.error, F_string_too_large, "fss_embedded_list_write_process_parameter_ignore", F_true); + fll_error_print(main.error, F_string_too_large, "fss_embedded_list_write_process_parameter_ignore", F_true); return F_status_set_error(F_string_too_large); } @@ -356,12 +356,12 @@ extern "C" { } if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fss_embedded_list_write_process_parameter_ignore", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fss_embedded_list_write_process_parameter_ignore", F_true); return status; } } - index = data.parameters[fss_embedded_list_write_parameter_ignore].values.array[i * 2]; + index = main.parameters[fss_embedded_list_write_parameter_ignore].values.array[i * 2]; range.start = 0; range.stop = strnlen(arguments.argv[index], f_console_parameter_size) - 1; @@ -374,13 +374,13 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore, arguments.argv[index]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore, arguments.argv[index]); return status; } ignore->array[ignore->used].start = number; - index = data.parameters[fss_embedded_list_write_parameter_ignore].values.array[(i * 2) + 1]; + index = main.parameters[fss_embedded_list_write_parameter_ignore].values.array[(i * 2) + 1]; range.start = 0; range.stop = strnlen(arguments.argv[index], f_console_parameter_size) - 1; @@ -393,7 +393,7 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore, arguments.argv[index]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore, arguments.argv[index]); return status; } diff --git a/level_3/fss_embedded_list_write/c/private-fss_embedded_list_write.h b/level_3/fss_embedded_list_write/c/private-fss_embedded_list_write.h index cd8afa3..46e2eb8 100644 --- a/level_3/fss_embedded_list_write/c/private-fss_embedded_list_write.h +++ b/level_3/fss_embedded_list_write/c/private-fss_embedded_list_write.h @@ -15,42 +15,42 @@ extern "C" { /** * Print an message about the object and content parameters not being specified the same number of times. * - * @param data - * The program data. + * @param main + * The main data. */ #ifndef _di_fss_embedded_list_write_error_parameter_same_times_print_ - void fss_embedded_list_write_error_parameter_same_times_print(const fss_embedded_list_write_data_t data) f_attribute_visibility_internal; + void fss_embedded_list_write_error_parameter_same_times_print(const fss_embedded_list_write_main_t main) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_write_error_parameter_same_times_print_ /** * Print an message about a parameter EOL being unsupported. * - * @param data - * The program data. + * @param main + * The main data. */ #ifndef _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ - void fss_embedded_list_write_error_parameter_unsupported_eol_print(const fss_embedded_list_write_data_t data) f_attribute_visibility_internal; + void fss_embedded_list_write_error_parameter_unsupported_eol_print(const fss_embedded_list_write_main_t main) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ /** * Print an message about a parameter missing a value. * - * @param data - * The program data. + * @param main + * The main data. * @param symbol * The console symbol, such as "--" in "--help". * @param parameter * The parameter name, such as "help" in "--help". */ #ifndef _di_fss_embedded_list_write_error_parameter_value_missing_print_ - void fss_embedded_list_write_error_parameter_value_missing_print(const fss_embedded_list_write_data_t data, const f_string_t symbol, const f_string_t parameter) f_attribute_visibility_internal; + void fss_embedded_list_write_error_parameter_value_missing_print(const fss_embedded_list_write_main_t main, const f_string_t symbol, const f_string_t parameter) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_write_error_parameter_value_missing_print_ /** * Process a given object and content, printing the FSS if valid or an error if invalid. * - * @param data - * The program data. + * @param main + * The main data. * @param output * The file to output to. * @param quote @@ -73,14 +73,14 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_embedded_list_write_process_ - extern f_status_t fss_embedded_list_write_process(const fss_embedded_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) f_attribute_visibility_internal; + extern f_status_t fss_embedded_list_write_process(const fss_embedded_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_write_process_ /** * Process the pipe, reading from the pipe and writing to the output. * - * @param data - * The program data. + * @param main + * The main data. * @param output * The file to output to. * @param quote @@ -97,7 +97,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_embedded_list_write_process_pipe_ - extern f_status_t fss_embedded_list_write_process_pipe(const fss_embedded_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) f_attribute_visibility_internal; + extern f_status_t fss_embedded_list_write_process_pipe(const fss_embedded_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_write_process_pipe_ /** @@ -105,8 +105,8 @@ extern "C" { * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * @param contents * The console parameter locations array for the content parameter. * @param location @@ -119,7 +119,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_embedded_list_write_process_parameter_ignore_ - extern f_status_t fss_embedded_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_embedded_list_write_data_t data, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) f_attribute_visibility_internal; + extern f_status_t fss_embedded_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_embedded_list_write_main_t main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) f_attribute_visibility_internal; #endif // _di_fss_embedded_list_write_process_parameter_ignore_ #ifdef __cplusplus diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index 8cf3136..3b11b56 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -41,7 +41,7 @@ extern "C" { fprintf(output.stream, "%c", f_string_eol_s[0]); - fprintf(output.stream, " This program will print the content associated with the given object and content data based on the FSS-0003 Extended List standard.%c", f_string_eol_s[0]); + fprintf(output.stream, " This program will print the content associated with the given object and content main based on the FSS-0003 Extended List standard.%c", f_string_eol_s[0]); fprintf(output.stream, "%c", f_string_eol_s[0]); @@ -159,30 +159,30 @@ extern "C" { #endif // _di_fss_extended_list_read_print_help_ #ifndef _di_fss_extended_list_read_main_ - f_status_t fss_extended_list_read_main(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data) { + f_status_t fss_extended_list_read_main(const f_console_arguments_t arguments, fss_extended_list_read_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_extended_list_read_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_extended_list_read_total_parameters); { f_console_parameter_id_t ids[3] = { fss_extended_list_read_parameter_no_color, fss_extended_list_read_parameter_light, fss_extended_list_read_parameter_dark }; const f_console_parameter_ids_t choices = { ids, 3 }; - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_extended_list_read_data_delete(data); + fss_extended_list_read_main_delete(main); return F_status_set_error(status); } } @@ -196,142 +196,142 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_extended_list_read_data_delete(data); + fss_extended_list_read_main_delete(main); return status; } if (choice == fss_extended_list_read_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_extended_list_read_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_extended_list_read_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_extended_list_read_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_extended_list_read_parameter_help].result == f_console_result_found) { - fss_extended_list_read_print_help(data->output, data->context); + if (main->parameters[fss_extended_list_read_parameter_help].result == f_console_result_found) { + fss_extended_list_read_print_help(main->output, main->context); - fss_extended_list_read_data_delete(data); + fss_extended_list_read_main_delete(main); return status; } - if (data->parameters[fss_extended_list_read_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_extended_list_read_version); + if (main->parameters[fss_extended_list_read_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_extended_list_read_version); - fss_extended_list_read_data_delete(data); + fss_extended_list_read_main_delete(main); return status; } - if (data->remaining.used > 0 || data->process_pipe) { - if (data->parameters[fss_extended_list_read_parameter_at].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_at); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (main->remaining.used > 0 || main->process_pipe) { + if (main->parameters[fss_extended_list_read_parameter_at].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_at); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_depth].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_list_read_parameter_depth].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_line); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_list_read_parameter_line].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_line); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_name].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_name); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_list_read_parameter_name].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_name); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a string.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_select); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_list_read_parameter_select].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_select); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { - if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_line); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { + if (main->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_line); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } } - if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { - if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { + if (main->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_list_read_parameter_delimit].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a value.%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_list_read_parameter_delimit].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a value.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_list_read_parameter_delimit].result == f_console_result_additional) { - const f_array_length_t location = data->parameters[fss_extended_list_read_parameter_delimit].values.array[0]; + else if (main->parameters[fss_extended_list_read_parameter_delimit].result == f_console_result_additional) { + const f_array_length_t location = main->parameters[fss_extended_list_read_parameter_delimit].values.array[0]; f_array_length_t length = strnlen(arguments.argv[location], f_console_parameter_size); if (length == 0) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be empty.%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } else if (fl_string_compare(arguments.argv[location], fss_extended_list_read_delimit_mode_name_none, length, fss_extended_list_read_delimit_mode_name_none_length) == F_equal_to) { - data->delimit_mode = fss_extended_list_read_delimit_mode_none; + main->delimit_mode = fss_extended_list_read_delimit_mode_none; } else if (fl_string_compare(arguments.argv[location], fss_extended_list_read_delimit_mode_name_all, length, fss_extended_list_read_delimit_mode_name_all_length) == F_equal_to) { - data->delimit_mode = fss_extended_list_read_delimit_mode_all; + main->delimit_mode = fss_extended_list_read_delimit_mode_all; } else { - data->delimit_mode = fss_extended_list_read_delimit_mode_depth; + main->delimit_mode = fss_extended_list_read_delimit_mode_depth; if (arguments.argv[location][length - 1] == fss_extended_list_read_delimit_mode_name_greater[0]) { - data->delimit_mode = fss_extended_list_read_delimit_mode_depth_greater; + main->delimit_mode = fss_extended_list_read_delimit_mode_depth_greater; // shorten the length to better convert the remainder to a number. length--; } else if (arguments.argv[location][length - 1] == fss_extended_list_read_delimit_mode_name_lesser[0]) { - data->delimit_mode = fss_extended_list_read_delimit_mode_depth_lesser; + main->delimit_mode = fss_extended_list_read_delimit_mode_depth_lesser; // shorten the length to better convert the remainder to a number. length--; @@ -344,10 +344,10 @@ extern "C" { range.start++; } - status = fl_conversion_string_to_number_unsigned(arguments.argv[location], range, &data->delimit_depth); + status = fl_conversion_string_to_number_unsigned(arguments.argv[location], range, &main->delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_delimit, arguments.argv[location]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_delimit, arguments.argv[location]); } } } @@ -358,13 +358,13 @@ extern "C" { f_fss_delimits_t delimits = f_fss_delimits_t_initialize; f_fss_comments_t comments = f_fss_comments_t_initialize; - f_array_length_t original_size = data->quantity.total; + f_array_length_t original_size = main->quantity.total; if (F_status_is_error_not(status)) { - status = fss_extended_list_read_main_preprocess_depth(arguments, *data, &depths); + status = fss_extended_list_read_main_preprocess_depth(arguments, *main, &depths); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fss_extended_list_read_main_preprocess_depth", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fss_extended_list_read_main_preprocess_depth", F_true); } } @@ -374,73 +374,73 @@ extern "C" { f_macro_fss_delimits_t_delete_simple(delimits); f_macro_fss_comments_t_delete_simple(comments); - if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } - fss_extended_list_read_data_delete(data); + fss_extended_list_read_main_delete(main); return F_none; } - if (F_status_is_error_not(status) && data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_select); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_list_read_parameter_select].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_select); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->process_pipe) { + if (F_status_is_error_not(status) && main->process_pipe) { f_file_t file = f_file_t_initialize; file.id = f_type_descriptor_input; - status = f_file_read(file, &data->buffer); + status = f_file_read(file, &main->buffer); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe); } else { - status = fss_extended_list_read_main_process_file(arguments, data, "-", depths, &delimits, &comments); + status = fss_extended_list_read_main_process_file(arguments, main, "-", depths, &delimits, &comments); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "fss_extended_list_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_extended_list_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe); } } // Clear buffers before continuing. - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); } - if (F_status_is_error_not(status) && data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { + if (F_status_is_error_not(status) && main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { f_file_t file = f_file_t_initialize; - status = f_file_open(arguments.argv[data->remaining.array[i]], 0, &file); + status = f_file_open(arguments.argv[main->remaining.array[i]], 0, &file); - data->quantity.total = original_size; + main->quantity.total = original_size; if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[data->remaining.array[i]], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[main->remaining.array[i]], "open", fll_error_file_type_file); break; } - if (!data->quantity.total) { - status = f_file_size_by_id(file.id, &data->quantity.total); + if (!main->quantity.total) { + status = f_file_size_by_id(file.id, &main->quantity.total); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); f_file_stream_close(F_true, &file); break; } // Skip past empty files. - if (!data->quantity.total) { - if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (!main->quantity.total) { + if (main->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } f_file_stream_close(F_true, &file); @@ -448,32 +448,32 @@ extern "C" { } } - status = f_file_read_until(file, data->quantity.total, &data->buffer); + status = f_file_read_until(file, main->quantity.total, &main->buffer); f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); break; } - status = fss_extended_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[i]], depths, &delimits, &comments); + status = fss_extended_list_read_main_process_file(arguments, main, arguments.argv[main->remaining.array[i]], depths, &delimits, &comments); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "fss_extended_list_read_main_process_file", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_extended_list_read_main_process_file", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); break; } // Clear buffers before repeating the loop. - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); } // for if (F_status_is_error(status)) { - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); } } @@ -482,34 +482,34 @@ extern "C" { f_macro_fss_comments_t_delete_simple(comments); } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - fss_extended_list_read_data_delete(data); + fss_extended_list_read_main_delete(main); return status; } #endif // _di_fss_extended_list_read_main_ -#ifndef _di_fss_extended_list_read_data_delete_ - f_status_t fss_extended_list_read_data_delete(fss_extended_list_read_data_t *data) { +#ifndef _di_fss_extended_list_read_main_delete_ + f_status_t fss_extended_list_read_main_delete(fss_extended_list_read_main_t *main) { for (f_array_length_t i = 0; i < fss_extended_list_read_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_extended_list_read_data_delete_ +#endif // _di_fss_extended_list_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.h b/level_3/fss_extended_list_read/c/fss_extended_list_read.h index 1504695..cfae9f5 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.h +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.h @@ -7,7 +7,7 @@ * * This is the FSS Extended List Read program * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_extended_list_read_data_t. + * This program processes files or other input in fss format and stores the results in the fss_extended_list_read_main_t. * * This processes in accordance to the FSS-0003 Extended List specification. */ @@ -165,7 +165,7 @@ extern "C" { }; #endif // _di_fss_extended_list_read_delimit_modes_ -#ifndef _di_fss_extended_list_read_data_t_ +#ifndef _di_fss_extended_list_read_main_t_ typedef struct { f_console_parameter_t parameters[fss_extended_list_read_total_parameters]; @@ -184,9 +184,9 @@ extern "C" { f_array_length_t delimit_depth; f_color_context_t context; - } fss_extended_list_read_data_t; + } fss_extended_list_read_main_t; - #define fss_extended_list_read_data_t_initialize \ + #define fss_extended_list_read_main_t_initialize \ { \ fss_extended_list_read_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -201,7 +201,7 @@ extern "C" { 0, \ f_color_context_t_initialize, \ } -#endif // _di_fss_extended_list_read_data_t_ +#endif // _di_fss_extended_list_read_main_t_ /** * Print help. @@ -221,31 +221,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_extended_list_read_data_delete() after executing this. + * Be sure to call fss_extended_list_read_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see fss_extended_list_read_data_delete() + * @see fss_extended_list_read_main_delete() */ #ifndef _di_fss_extended_list_read_main_ - extern f_status_t fss_extended_list_read_main(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data); + extern f_status_t fss_extended_list_read_main(const f_console_arguments_t arguments, fss_extended_list_read_main_t *main); #endif // _di_fss_extended_list_read_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_extended_list_read_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -254,9 +254,9 @@ extern "C" { * * @see fss_extended_list_read_main() */ -#ifndef _di_fss_extended_list_read_data_delete_ - extern f_status_t fss_extended_list_read_data_delete(fss_extended_list_read_data_t *data); -#endif // _di_fss_extended_list_read_data_delete_ +#ifndef _di_fss_extended_list_read_main_delete_ + extern f_status_t fss_extended_list_read_main_delete(fss_extended_list_read_main_t *main); +#endif // _di_fss_extended_list_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_list_read/c/main.c b/level_3/fss_extended_list_read/c/main.c index bc0e272..e9f1b60 100644 --- a/level_3/fss_extended_list_read/c/main.c +++ b/level_3/fss_extended_list_read/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_extended_list_read_data_t data = fss_extended_list_read_data_t_initialize; + fss_extended_list_read_main_t main = fss_extended_list_read_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_extended_list_read_main(arguments, &data); + const f_status_t status = fss_extended_list_read_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c index 0e1f1df..78da61a 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c @@ -6,20 +6,20 @@ extern "C" { #endif #ifndef _di_fss_extended_list_read_main_preprocess_depth_ - f_status_t fss_extended_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_list_read_data_t data, fss_extended_list_read_depths_t *depths) { + f_status_t fss_extended_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_list_read_main_t main, fss_extended_list_read_depths_t *depths) { f_status_t status = F_none; { f_array_length_t depth_size = 1; - if (data.parameters[fss_extended_list_read_parameter_depth].result == f_console_result_additional) { - depth_size = data.parameters[fss_extended_list_read_parameter_depth].values.used; + if (main.parameters[fss_extended_list_read_parameter_depth].result == f_console_result_additional) { + depth_size = main.parameters[fss_extended_list_read_parameter_depth].values.used; } fss_extended_list_read_macro_depths_t_resize(status, (*depths), depth_size); if (F_status_is_error(status)) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); return status; } @@ -38,60 +38,60 @@ extern "C" { f_macro_string_dynamic_t_clear(depths->array[i].value_name); - if (!data.parameters[fss_extended_list_read_parameter_depth].values.used) { + if (!main.parameters[fss_extended_list_read_parameter_depth].values.used) { position_depth = 0; } else { - position_depth = data.parameters[fss_extended_list_read_parameter_depth].values.array[i]; + position_depth = main.parameters[fss_extended_list_read_parameter_depth].values.array[i]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[position_depth])); status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], range, &depths->array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_depth, arguments.argv[position_depth]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_depth, arguments.argv[position_depth]); return status; } } - if (data.parameters[fss_extended_list_read_parameter_at].result == f_console_result_additional) { - for (; position_at < data.parameters[fss_extended_list_read_parameter_at].values.used; position_at++) { + if (main.parameters[fss_extended_list_read_parameter_at].result == f_console_result_additional) { + for (; position_at < main.parameters[fss_extended_list_read_parameter_at].values.used; position_at++) { - if (data.parameters[fss_extended_list_read_parameter_at].values.array[position_at] < position_depth) { + if (main.parameters[fss_extended_list_read_parameter_at].values.array[position_at] < position_depth) { continue; } - if (i + 1 < depths->used && data.parameters[fss_extended_list_read_parameter_at].values.array[position_at] > data.parameters[fss_extended_list_read_parameter_depth].values.array[i + 1]) { + if (i + 1 < depths->used && main.parameters[fss_extended_list_read_parameter_at].values.array[position_at] > main.parameters[fss_extended_list_read_parameter_depth].values.array[i + 1]) { break; } - depths->array[i].index_at = data.parameters[fss_extended_list_read_parameter_at].values.array[position_at]; + depths->array[i].index_at = main.parameters[fss_extended_list_read_parameter_at].values.array[position_at]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[depths->array[i].index_at])); status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], range, &depths->array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_at, arguments.argv[depths->array[i].index_at]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_at, arguments.argv[depths->array[i].index_at]); return status; } } // for } - if (data.parameters[fss_extended_list_read_parameter_name].result == f_console_result_additional) { - for (; position_name < data.parameters[fss_extended_list_read_parameter_name].values.used; position_name++) { + if (main.parameters[fss_extended_list_read_parameter_name].result == f_console_result_additional) { + for (; position_name < main.parameters[fss_extended_list_read_parameter_name].values.used; position_name++) { - if (data.parameters[fss_extended_list_read_parameter_name].values.array[position_name] < position_depth) { + if (main.parameters[fss_extended_list_read_parameter_name].values.array[position_name] < position_depth) { continue; } - if (i + 1 < depths->used && data.parameters[fss_extended_list_read_parameter_name].values.array[position_name] > data.parameters[fss_extended_list_read_parameter_depth].values.array[i + 1]) { + if (i + 1 < depths->used && main.parameters[fss_extended_list_read_parameter_name].values.array[position_name] > main.parameters[fss_extended_list_read_parameter_depth].values.array[i + 1]) { break; } - depths->array[i].index_name = data.parameters[fss_extended_list_read_parameter_name].values.array[position_name]; + depths->array[i].index_name = main.parameters[fss_extended_list_read_parameter_name].values.array[position_name]; - if (data.parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) { status = fl_string_rip(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } else { @@ -103,34 +103,34 @@ extern "C" { // @todo: move error printing into common function. if (status_code == F_memory_not) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); } else if (status_code == F_string_too_large) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to process '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_trim); - f_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to process '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_trim); + f_color_print(main.error.to.stream, main.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol_s[0]); } else { f_string_t function = "f_string_append"; - if (data.parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) { function = "fl_string_rip"; } - f_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code); - f_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling "); - f_color_print(data.error.to.stream, data.context.set.notable, "%s()", function); - f_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%u", status_code); + f_color_print(main.error.to.stream, main.context.set.error, ") has occurred while calling "); + f_color_print(main.error.to.stream, main.context.set.notable, "%s()", function); + f_color_print(main.error.to.stream, main.context.set.error, ".%c", f_string_eol_s[0]); } return status; } if (!depths->array[i].value_name.used) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_name); - f_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_name); + f_color_print(main.error.to.stream, main.context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } @@ -143,22 +143,22 @@ extern "C" { for (f_array_length_t j = i + 1; j < depths->used; j++) { if (depths->array[i].depth == depths->array[j].depth) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe value '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); - f_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe value '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth); + f_color_print(main.error.to.stream, main.context.set.error, "' may only be specified once for the parameter '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } else if (depths->array[i].depth > depths->array[j].depth) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth); - f_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); - f_color_print(data.error.to.stream, data.context.set.error, "' before the value '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[j].depth); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth); + f_color_print(main.error.to.stream, main.context.set.error, "' may not have the value '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth); + f_color_print(main.error.to.stream, main.context.set.error, "' before the value '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[j].depth); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } @@ -170,36 +170,36 @@ extern "C" { #endif // _di_fss_extended_list_read_main_preprocess_depth_ #ifndef _di_fss_extended_list_read_main_process_file_ - f_status_t fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data, const f_string_t filename, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { + f_status_t fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_main_t *main, const f_string_t filename, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { f_status_t status = F_none; const f_array_lengths_t except_none = f_array_lengths_t_initialize; bool delimited = F_true; // for this standard, delimits would always be applied, except for when delimit_depth is greater than 0. - if (data->delimit_mode == fss_extended_list_read_delimit_mode_none || (data->delimit_depth && (data->delimit_mode == fss_extended_list_read_delimit_mode_depth || data->delimit_mode == fss_extended_list_read_delimit_mode_depth_greater))) { + if (main->delimit_mode == fss_extended_list_read_delimit_mode_none || (main->delimit_depth && (main->delimit_mode == fss_extended_list_read_delimit_mode_depth || main->delimit_mode == fss_extended_list_read_delimit_mode_depth_greater))) { delimited = F_false; } { - f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used); + f_string_range_t input = f_macro_string_range_t_initialize(main->buffer.used); delimits->used = 0; comments->used = 0; - status = fll_fss_extended_list_read(data->buffer, &input, &data->objects, &data->contents, delimits, 0, comments); + status = fll_fss_extended_list_read(main->buffer, &input, &main->objects, &main->contents, delimits, 0, comments); if (F_status_is_error(status)) { // @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate. - fll_error_file_print(data->error, F_status_set_fine(status), "fll_fss_extended_list_read", F_true, filename, "process", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_extended_list_read", F_true, filename, "process", fll_error_file_type_file); } else if (status == F_data_not_stop || status == F_data_not_eos) { - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); - if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); return F_none; } @@ -207,9 +207,9 @@ extern "C" { } if (F_status_is_error(status)) { - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); return status; } @@ -220,21 +220,21 @@ extern "C" { // comments are not to be part of the file, so remove them. for (; i < comments->used; ++i) { for (j = comments->array[i].start; j <= comments->array[i].stop; ++j) { - data->buffer.string[j] = f_fss_delimit_placeholder; + main->buffer.string[j] = f_fss_delimit_placeholder; } // for } // for } f_number_unsigned_t select = 0; - if (data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_extended_list_read_parameter_select].values.array[data->parameters[fss_extended_list_read_parameter_select].values.used - 1]; + if (main->parameters[fss_extended_list_read_parameter_select].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_extended_list_read_parameter_select].values.array[main->parameters[fss_extended_list_read_parameter_select].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &select); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_select, arguments.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_select, arguments.argv[index]); return status; } @@ -246,75 +246,75 @@ extern "C" { f_array_length_t line = 0; - if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_extended_list_read_parameter_line].values.array[data->parameters[fss_extended_list_read_parameter_line].values.used - 1]; + if (main->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_extended_list_read_parameter_line].values.array[main->parameters[fss_extended_list_read_parameter_line].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &line); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_line, arguments.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_line, arguments.argv[index]); return status; } } - bool names[data->objects.used]; + bool names[main->objects.used]; f_array_length_t i = 0; f_array_length_t j = 0; if (depths.array[0].index_name > 0) { - memset(names, 0, sizeof(bool) * data->objects.used); + memset(names, 0, sizeof(bool) * main->objects.used); - if (data->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) { - for (i = 0; i < data->objects.used; i++) { + if (main->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) { + for (i = 0; i < main->objects.used; i++) { - if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, *delimits) == F_equal_to) { + if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[0].value_name, main->buffer, main->objects.array[i], except_none, *delimits) == F_equal_to) { names[i] = 1; } } // for } else { - for (i = 0; i < data->objects.used; i++) { - if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, *delimits) == F_equal_to) { + for (i = 0; i < main->objects.used; i++) { + if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[0].value_name, main->buffer, main->objects.array[i], except_none, *delimits) == F_equal_to) { names[i] = 1; } } // for } } else { - memset(names, 1, sizeof(bool) * data->objects.used); + memset(names, 1, sizeof(bool) * main->objects.used); } bool include_empty = 0; - if (data->parameters[fss_extended_list_read_parameter_empty].result == f_console_result_found) { + if (main->parameters[fss_extended_list_read_parameter_empty].result == f_console_result_found) { include_empty = 1; } - if (data->parameters[fss_extended_list_read_parameter_object].result == f_console_result_found) { - if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + if (main->parameters[fss_extended_list_read_parameter_object].result == f_console_result_found) { + if (main->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { if (depths.array[0].index_at > 0) { - if (depths.array[0].value_at < data->objects.used && names[depths.array[0].value_at]) { - fprintf(data->output.stream, "1%c", f_string_eol_s[0]); + if (depths.array[0].value_at < main->objects.used && names[depths.array[0].value_at]) { + fprintf(main->output.stream, "1%c", f_string_eol_s[0]); } else { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } } else if (depths.array[0].index_name > 0) { f_array_length_t total = 0; - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { if (!names[i]) continue; total++; } // for - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); } else { - fprintf(data->output.stream, "%llu%c", data->objects.used, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", main->objects.used, f_string_eol_s[0]); } return F_none; @@ -322,7 +322,7 @@ extern "C" { f_status_t (*print_object)(FILE *, const f_string_static_t, const f_string_range_t, const f_array_lengths_t) = &f_print_except_dynamic_partial; - if (data->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) { + if (main->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) { print_object = &fl_print_trim_except_dynamic_partial; } @@ -330,23 +330,23 @@ extern "C" { f_array_length_t at = 0; f_array_length_t i = 0; - for (; i < data->objects.used; i++) { + for (; i < main->objects.used; i++) { if (names[i]) { if (at == depths.array[0].value_at) { - print_object(data->output.stream, data->buffer, data->objects.array[i], delimited ? *delimits : except_none); + print_object(main->output.stream, main->buffer, main->objects.array[i], delimited ? *delimits : except_none); - fss_extended_list_read_print_object_end(*data); + fss_extended_list_read_print_object_end(*main); - if (data->parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { - if (data->contents.array[i].used) { - fss_extended_list_read_print_content_ignore(*data); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); - fss_extended_list_read_print_content_ignore(*data); + if (main->parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { + if (main->contents.array[i].used) { + fss_extended_list_read_print_content_ignore(*main); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_extended_list_read_print_content_ignore(*main); } } - fss_extended_list_read_print_set_end(*data); + fss_extended_list_read_print_set_end(*main); break; } @@ -357,32 +357,32 @@ extern "C" { return F_none; } - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { if (!names[i]) continue; - print_object(data->output.stream, data->buffer, data->objects.array[i], delimited ? *delimits : except_none); + print_object(main->output.stream, main->buffer, main->objects.array[i], delimited ? *delimits : except_none); - fss_extended_list_read_print_object_end(*data); + fss_extended_list_read_print_object_end(*main); - if (data->parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { - if (data->contents.array[i].used) { - fss_extended_list_read_print_content_ignore(*data); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); - fss_extended_list_read_print_content_ignore(*data); + if (main->parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { + if (main->contents.array[i].used) { + fss_extended_list_read_print_content_ignore(*main); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_extended_list_read_print_content_ignore(*main); } } - fss_extended_list_read_print_set_end(*data); + fss_extended_list_read_print_set_end(*main); } // for return F_none; } if (depths.array[0].index_at > 0) { - if (depths.array[0].value_at >= data->objects.used) { - if (names[depths.array[0].value_at] && data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (depths.array[0].value_at >= main->objects.used) { + if (names[depths.array[0].value_at] && main->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } return F_none; @@ -392,73 +392,73 @@ extern "C" { f_array_length_t total = 0; f_array_length_t line_current = 0; - for (; i < data->objects.used; i++) { + for (; i < main->objects.used; i++) { if (names[i]) { if (at == depths.array[0].value_at) { - if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { - if (!data->contents.array[i].used) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + if (!main->contents.array[i].used) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } else { total = 1; - for (j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) { - if (!data->buffer.string[j]) continue; + for (j = main->contents.array[i].array[0].start; j <= main->contents.array[i].array[0].stop; j++) { + if (!main->buffer.string[j]) continue; - if (data->buffer.string[j] == f_string_eol_s[0]) { + if (main->buffer.string[j] == f_string_eol_s[0]) { total++; } } // for - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); } return F_none; } - if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { - if (!data->contents.array[i].used) { + if (main->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { + if (!main->contents.array[i].used) { if (include_empty && !line) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fss_extended_list_read_print_set_end(*data); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fss_extended_list_read_print_set_end(*main); } } else { - i = data->contents.array[i].array[0].start; + i = main->contents.array[i].array[0].start; if (!line) { - for (; i <= data->contents.array[i].array[0].stop; i++) { - if (!data->buffer.string[i]) continue; - if (data->buffer.string[i] == f_string_eol_s[0]) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + for (; i <= main->contents.array[i].array[0].stop; i++) { + if (!main->buffer.string[i]) continue; + if (main->buffer.string[i] == f_string_eol_s[0]) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); break; } - fprintf(data->output.stream, "%c", data->buffer.string[i]); + fprintf(main->output.stream, "%c", main->buffer.string[i]); } // for } else { line_current = 0; - for (; i <= data->contents.array[i].array[0].stop; i++) { - if (!data->buffer.string[i]) continue; + for (; i <= main->contents.array[i].array[0].stop; i++) { + if (!main->buffer.string[i]) continue; - if (data->buffer.string[i] == f_string_eol_s[0]) { + if (main->buffer.string[i] == f_string_eol_s[0]) { line_current++; if (line_current == line) { i++; - for (; i <= data->contents.array[i].array[0].stop; i++) { - if (!data->buffer.string[i]) continue; + for (; i <= main->contents.array[i].array[0].stop; i++) { + if (!main->buffer.string[i]) continue; - if (data->buffer.string[i] == f_string_eol_s[0]) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + if (main->buffer.string[i] == f_string_eol_s[0]) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); break; } - fprintf(data->output.stream, "%c", data->buffer.string[i]); + fprintf(main->output.stream, "%c", main->buffer.string[i]); } // for break; @@ -471,16 +471,16 @@ extern "C" { return F_none; } - if (data->contents.array[i].used > 0) { - fss_extended_list_read_print_content_ignore(*data); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); - fss_extended_list_read_print_content_ignore(*data); + if (main->contents.array[i].used > 0) { + fss_extended_list_read_print_content_ignore(*main); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_extended_list_read_print_content_ignore(*main); - fss_extended_list_read_print_set_end(*data); + fss_extended_list_read_print_set_end(*main); } else if (include_empty) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fss_extended_list_read_print_set_end(*data); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fss_extended_list_read_print_set_end(*main); } break; @@ -493,13 +493,13 @@ extern "C" { return F_none; } - if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + if (main->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { f_array_length_t total = 0; - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { if (!names[i]) continue; - if (!data->contents.array[i].used) { + if (!main->contents.array[i].used) { if (include_empty) { total++; } @@ -507,28 +507,28 @@ extern "C" { continue; } - for (j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) { - if (!data->buffer.string[j]) continue; + for (j = main->contents.array[i].array[0].start; j <= main->contents.array[i].array[0].stop; j++) { + if (!main->buffer.string[j]) continue; - if (data->buffer.string[j] == f_string_eol_s[0]) { + if (main->buffer.string[j] == f_string_eol_s[0]) { total++; } } // for } // for - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); return F_none; } - if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { - for (f_array_length_t line_current = 0; i < data->contents.used; i++) { + if (main->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { + for (f_array_length_t line_current = 0; i < main->contents.used; i++) { if (!names[i]) continue; - if (!data->contents.array[i].used) { + if (!main->contents.array[i].used) { if (include_empty) { if (line_current == line) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fss_extended_list_read_print_set_end(*data); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fss_extended_list_read_print_set_end(*main); break; } @@ -538,12 +538,12 @@ extern "C" { continue; } - j = data->contents.array[i].array[0].start; + j = main->contents.array[i].array[0].start; if (line_current != line) { - for (; j <= data->contents.array[i].array[0].stop; j++) { + for (; j <= main->contents.array[i].array[0].stop; j++) { - if (data->buffer.string[j] == f_string_eol_s[0]) { + if (main->buffer.string[j] == f_string_eol_s[0]) { line_current++; if (line_current == line) { @@ -555,17 +555,17 @@ extern "C" { } if (line_current == line) { - if (j > data->contents.array[i].array[0].stop) continue; + if (j > main->contents.array[i].array[0].stop) continue; - for (; j <= data->contents.array[i].array[0].stop; j++) { - if (!data->buffer.string[j]) continue; + for (; j <= main->contents.array[i].array[0].stop; j++) { + if (!main->buffer.string[j]) continue; - if (data->buffer.string[j] == f_string_eol_s[0]) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + if (main->buffer.string[j] == f_string_eol_s[0]) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); break; } - fprintf(data->output.stream, "%c", data->buffer.string[j]); + fprintf(main->output.stream, "%c", main->buffer.string[j]); } // for break; @@ -575,23 +575,23 @@ extern "C" { return F_none; } - for (i = 0; i < data->contents.used; i++) { + for (i = 0; i < main->contents.used; i++) { if (!names[i]) continue; - if (!data->contents.array[i].used) { + if (!main->contents.array[i].used) { if (include_empty) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); - fss_extended_list_read_print_set_end(*data); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); + fss_extended_list_read_print_set_end(*main); } continue; } - fss_extended_list_read_print_content_ignore(*data); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); - fss_extended_list_read_print_content_ignore(*data); + fss_extended_list_read_print_content_ignore(*main); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_extended_list_read_print_content_ignore(*main); - fss_extended_list_read_print_set_end(*data); + fss_extended_list_read_print_set_end(*main); } // for return F_none; @@ -599,60 +599,60 @@ extern "C" { #endif // _di_fss_extended_list_read_main_process_file_ #ifndef _di_fss_extended_list_read_print_object_end_ - void fss_extended_list_read_print_object_end(const fss_extended_list_read_data_t data) { + void fss_extended_list_read_print_object_end(const fss_extended_list_read_main_t main) { - if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_start); + if (main.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_extended_list_read_pipe_content_start); } else { - if (data.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { - fprintf(data.output.stream, "%c%c", f_fss_extended_list_open, f_fss_extended_list_open_end); + if (main.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && main.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { + fprintf(main.output.stream, "%c%c", f_fss_extended_list_open, f_fss_extended_list_open_end); } else { - fprintf(data.output.stream, "%c", f_fss_eol); + fprintf(main.output.stream, "%c", f_fss_eol); } } } #endif // _di_fss_extended_list_read_print_object_end_ #ifndef _di_fss_extended_list_read_print_content_end_ - void fss_extended_list_read_print_content_end(const fss_extended_list_read_data_t data) { + void fss_extended_list_read_print_content_end(const fss_extended_list_read_main_t main) { - if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_start); + if (main.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_extended_list_read_pipe_content_start); } else { - if (data.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { - fprintf(data.output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end); + if (main.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && main.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { + fprintf(main.output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end); } - else if (data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { - fprintf(data.output.stream, "%c", f_fss_eol); + else if (main.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { + fprintf(main.output.stream, "%c", f_fss_eol); } } } #endif // _di_fss_extended_list_read_print_content_end_ #ifndef _di_fss_extended_list_read_print_content_ignore_ - void fss_extended_list_read_print_content_ignore(const fss_extended_list_read_data_t data) { + void fss_extended_list_read_print_content_ignore(const fss_extended_list_read_main_t main) { - if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_ignore); + if (main.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_extended_list_read_pipe_content_ignore); } } #endif // _di_fss_extended_list_read_print_content_ignore_ #ifndef _di_fss_extended_list_read_print_set_end_ - void fss_extended_list_read_print_set_end(const fss_extended_list_read_data_t data) { + void fss_extended_list_read_print_set_end(const fss_extended_list_read_main_t main) { - if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_end); + if (main.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_extended_list_read_pipe_content_end); } else { - if (data.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { - fprintf(data.output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end); + if (main.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && main.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { + fprintf(main.output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end); } - else if (data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { - fprintf(data.output.stream, "%c", f_fss_eol); + else if (main.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { + fprintf(main.output.stream, "%c", f_fss_eol); } } } diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h index 0fd0f90..3e41a1e 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h @@ -118,8 +118,8 @@ extern "C" { * * @param arguments * The console arguments to pre-process. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param depths * This stores the pre-processed depth parameters. * @@ -129,7 +129,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fss_extended_list_read_main_preprocess_depth_ - extern f_status_t fss_extended_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_list_read_data_t data, fss_extended_list_read_depths_t *depths) f_attribute_visibility_internal; + extern f_status_t fss_extended_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_list_read_main_t main, fss_extended_list_read_depths_t *depths) f_attribute_visibility_internal; #endif // _di_fss_extended_list_read_main_preprocess_depth_ /** @@ -137,8 +137,8 @@ extern "C" { * * @param arguments * The console arguments passed to the program. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param file_name * The name of the file being processed. * @param depths @@ -157,17 +157,17 @@ extern "C" { * @see fss_extended_list_read_main_preprocess_depth() */ #ifndef _di_fss_extended_list_read_main_process_file_ - extern f_status_t fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data, const f_string_t file_name, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) f_attribute_visibility_internal; + extern f_status_t fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_main_t *main, const f_string_t file_name, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) f_attribute_visibility_internal; #endif // _di_fss_extended_list_read_main_process_file_ /** * Print the end of an object (which is essentially the start of a content). * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_extended_list_read_print_object_end_ - extern void fss_extended_list_read_print_object_end(const fss_extended_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_extended_list_read_print_object_end(const fss_extended_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_extended_list_read_print_object_end_ /** @@ -175,31 +175,31 @@ extern "C" { * * This is only used in pipe output mode. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_extended_list_read_print_content_ignore_ - extern void fss_extended_list_read_print_content_ignore(const fss_extended_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_extended_list_read_print_content_ignore(const fss_extended_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_extended_list_read_print_content_ignore_ /** * Print the end of an content. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_extended_list_read_print_content_end_ - extern void fss_extended_list_read_print_content_end(const fss_extended_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_extended_list_read_print_content_end(const fss_extended_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_extended_list_read_print_content_end_ /** * Print the end of an object/content set. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_extended_list_read_print_set_end_ - extern void fss_extended_list_read_print_set_end(const fss_extended_list_read_data_t data) f_attribute_visibility_internal; + extern void fss_extended_list_read_print_set_end(const fss_extended_list_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_extended_list_read_print_set_end_ #ifdef __cplusplus diff --git a/level_3/fss_extended_list_write/c/fss_extended_list_write.c b/level_3/fss_extended_list_write/c/fss_extended_list_write.c index e5bdd09..e95156e 100644 --- a/level_3/fss_extended_list_write/c/fss_extended_list_write.c +++ b/level_3/fss_extended_list_write/c/fss_extended_list_write.c @@ -92,30 +92,30 @@ extern "C" { #endif // _di_fss_extended_list_write_print_help_ #ifndef _di_fss_extended_list_write_main_ - f_status_t fss_extended_list_write_main(const f_console_arguments_t arguments, fss_extended_list_write_data_t *data) { + f_status_t fss_extended_list_write_main(const f_console_arguments_t arguments, fss_extended_list_write_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_extended_list_write_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_extended_list_write_total_parameters); { f_console_parameter_id_t ids[3] = { fss_extended_list_write_parameter_no_color, fss_extended_list_write_parameter_light, fss_extended_list_write_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_extended_list_write_data_delete(data); + fss_extended_list_write_main_delete(main); return F_status_set_error(status); } } @@ -129,38 +129,38 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_extended_list_write_data_delete(data); + fss_extended_list_write_main_delete(main); return status; } if (choice == fss_extended_list_write_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_extended_list_write_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_extended_list_write_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_extended_list_write_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_extended_list_write_parameter_help].result == f_console_result_found) { - fss_extended_list_write_print_help(data->output, data->context); + if (main->parameters[fss_extended_list_write_parameter_help].result == f_console_result_found) { + fss_extended_list_write_print_help(main->output, main->context); - fss_extended_list_write_data_delete(data); + fss_extended_list_write_main_delete(main); return status; } - if (data->parameters[fss_extended_list_write_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_extended_list_write_version); + if (main->parameters[fss_extended_list_write_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_extended_list_write_version); - fss_extended_list_write_data_delete(data); + fss_extended_list_write_main_delete(main); return status; } @@ -171,61 +171,61 @@ extern "C" { output.flag = f_file_flag_create | f_file_flag_write_only | f_file_flag_append; if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_list_write_parameter_file].result == f_console_result_additional) { - if (data->parameters[fss_extended_list_write_parameter_file].values.used > 1) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_file); - f_color_print(data->error.to.stream, data->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_list_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[fss_extended_list_write_parameter_file].values.used > 1) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_file); + f_color_print(main->error.to.stream, main->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } else { - const f_array_length_t location = data->parameters[fss_extended_list_write_parameter_file].values.array[0]; + const f_array_length_t location = main->parameters[fss_extended_list_write_parameter_file].values.array[0]; output.id = -1; output.stream = 0; status = f_file_stream_open(arguments.argv[location], 0, &output); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); } } } - else if (data->parameters[fss_extended_list_write_parameter_file].result == f_console_result_found) { - fss_extended_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_extended_list_write_long_file); + else if (main->parameters[fss_extended_list_write_parameter_file].result == f_console_result_found) { + fss_extended_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_extended_list_write_long_file); status = F_status_set_error(F_parameter); } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_list_write_parameter_object].locations.used || data->parameters[fss_extended_list_write_parameter_content].locations.used) { - if (data->parameters[fss_extended_list_write_parameter_object].locations.used) { - if (data->parameters[fss_extended_list_write_parameter_object].locations.used != data->parameters[fss_extended_list_write_parameter_object].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_extended_list_write_long_object); + if (main->parameters[fss_extended_list_write_parameter_object].locations.used || main->parameters[fss_extended_list_write_parameter_content].locations.used) { + if (main->parameters[fss_extended_list_write_parameter_object].locations.used) { + if (main->parameters[fss_extended_list_write_parameter_object].locations.used != main->parameters[fss_extended_list_write_parameter_object].values.used) { + fss_extended_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_extended_list_write_long_object); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_list_write_parameter_content].locations.used != data->parameters[fss_extended_list_write_parameter_content].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_extended_list_write_long_content); + else if (main->parameters[fss_extended_list_write_parameter_content].locations.used != main->parameters[fss_extended_list_write_parameter_content].values.used) { + fss_extended_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_extended_list_write_long_content); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_list_write_parameter_object].locations.used != data->parameters[fss_extended_list_write_parameter_content].locations.used && data->parameters[fss_extended_list_write_parameter_partial].result == f_console_result_none) { - fss_extended_list_write_error_parameter_same_times_print(*data); + else if (main->parameters[fss_extended_list_write_parameter_object].locations.used != main->parameters[fss_extended_list_write_parameter_content].locations.used && main->parameters[fss_extended_list_write_parameter_partial].result == f_console_result_none) { + fss_extended_list_write_error_parameter_same_times_print(*main); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_list_write_parameter_content].locations.used && data->parameters[fss_extended_list_write_parameter_partial].locations.used) { - if (data->parameters[fss_extended_list_write_parameter_content].result == f_console_result_additional) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_partial); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter only allows either the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter or the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter, but not both.%c", f_string_eol_s[0]); + else if (main->parameters[fss_extended_list_write_parameter_content].locations.used && main->parameters[fss_extended_list_write_parameter_partial].locations.used) { + if (main->parameters[fss_extended_list_write_parameter_content].result == f_console_result_additional) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_partial); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter only allows either the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter or the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter, but not both.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -233,26 +233,26 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_list_write_parameter_content].result == f_console_result_additional) { + if (main->parameters[fss_extended_list_write_parameter_content].result == f_console_result_additional) { f_array_length_t location_object = 0; f_array_length_t location_content = 0; f_array_length_t location_sub_object = 0; f_array_length_t location_sub_content = 0; - for (f_array_length_t i = 0; i < data->parameters[fss_extended_list_write_parameter_object].locations.used; i++) { - location_object = data->parameters[fss_extended_list_write_parameter_object].locations.array[i]; - location_content = data->parameters[fss_extended_list_write_parameter_content].locations.array[i]; - location_sub_object = data->parameters[fss_extended_list_write_parameter_object].locations_sub.array[i]; - location_sub_content = data->parameters[fss_extended_list_write_parameter_content].locations_sub.array[i]; + for (f_array_length_t i = 0; i < main->parameters[fss_extended_list_write_parameter_object].locations.used; i++) { + location_object = main->parameters[fss_extended_list_write_parameter_object].locations.array[i]; + location_content = main->parameters[fss_extended_list_write_parameter_content].locations.array[i]; + location_sub_object = main->parameters[fss_extended_list_write_parameter_object].locations_sub.array[i]; + location_sub_content = main->parameters[fss_extended_list_write_parameter_content].locations_sub.array[i]; if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sEach ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter must be specified before a '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sEach ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter must be specified before a '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -262,37 +262,37 @@ extern "C" { } } } - else if (data->parameters[fss_extended_list_write_parameter_content].locations.used) { - if (data->parameters[fss_extended_list_write_parameter_content].locations.used != data->parameters[fss_extended_list_write_parameter_content].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_extended_list_write_long_content); + else if (main->parameters[fss_extended_list_write_parameter_content].locations.used) { + if (main->parameters[fss_extended_list_write_parameter_content].locations.used != main->parameters[fss_extended_list_write_parameter_content].values.used) { + fss_extended_list_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_extended_list_write_long_content); status = F_status_set_error(F_parameter); } - else if (!data->parameters[fss_extended_list_write_parameter_partial].locations.used) { - fss_extended_list_write_error_parameter_same_times_print(*data); + else if (!main->parameters[fss_extended_list_write_parameter_partial].locations.used) { + fss_extended_list_write_error_parameter_same_times_print(*main); status = F_status_set_error(F_parameter); } } } - else if (!data->process_pipe) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThis requires either piped data or the use of the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + else if (!main->process_pipe) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThis requires either piped main or the use of the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->process_pipe) { - if (data->parameters[fss_extended_list_write_parameter_partial].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_partial); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter cannot be used when processing a pipe.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->process_pipe) { + if (main->parameters[fss_extended_list_write_parameter_partial].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_partial); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter cannot be used when processing a pipe.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -301,38 +301,38 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_list_write_parameter_prepend].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_list_write_parameter_prepend].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_list_write_parameter_prepend].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_extended_list_write_parameter_prepend].values.array[data->parameters[fss_extended_list_write_parameter_prepend].values.used - 1]; + else if (main->parameters[fss_extended_list_write_parameter_prepend].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_extended_list_write_parameter_prepend].values.array[main->parameters[fss_extended_list_write_parameter_prepend].values.used - 1]; const f_array_length_t length = strnlen(arguments.argv[index], f_console_parameter_size); if (length) { f_string_range_t range = f_macro_string_range_t_initialize(length); - data->prepend.string = arguments.argv[index]; - data->prepend.used = length; - data->prepend.size = length; + main->prepend.string = arguments.argv[index]; + main->prepend.used = length; + main->prepend.size = length; for (; range.start < length; range.start++) { - status = f_fss_is_space(data->prepend, range); + status = f_fss_is_space(main->prepend, range); if (F_status_is_error(status)) break; if (status == F_false) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' must only contain whitespace.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' must only contain whitespace.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -341,11 +341,11 @@ extern "C" { } // for } else { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -354,25 +354,25 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_list_write_parameter_ignore].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no values were given.%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_list_write_parameter_ignore].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no values were given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_list_write_parameter_ignore].result == f_console_result_additional) { - const f_array_length_t total_locations = data->parameters[fss_extended_list_write_parameter_ignore].locations.used; - const f_array_length_t total_arguments = data->parameters[fss_extended_list_write_parameter_ignore].values.used; + else if (main->parameters[fss_extended_list_write_parameter_ignore].result == f_console_result_additional) { + const f_array_length_t total_locations = main->parameters[fss_extended_list_write_parameter_ignore].locations.used; + const f_array_length_t total_arguments = main->parameters[fss_extended_list_write_parameter_ignore].values.used; if (total_locations * 2 > total_arguments) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore); - f_color_print(data->error.to.stream, data->context.set.error, "' requires two values.%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore); + f_color_print(main->error.to.stream, main->context.set.error, "' requires two values.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } @@ -382,14 +382,14 @@ extern "C" { f_fss_quote_t quote = f_fss_delimit_quote_double; if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_list_write_parameter_double].result == f_console_result_found) { - if (data->parameters[fss_extended_list_write_parameter_single].result == f_console_result_found) { - if (data->parameters[fss_extended_list_write_parameter_double].location < data->parameters[fss_extended_list_write_parameter_single].location) { + if (main->parameters[fss_extended_list_write_parameter_double].result == f_console_result_found) { + if (main->parameters[fss_extended_list_write_parameter_single].result == f_console_result_found) { + if (main->parameters[fss_extended_list_write_parameter_double].location < main->parameters[fss_extended_list_write_parameter_single].location) { quote = f_fss_delimit_quote_single; } } } - else if (data->parameters[fss_extended_list_write_parameter_single].result == f_console_result_found) { + else if (main->parameters[fss_extended_list_write_parameter_single].result == f_console_result_found) { quote = f_fss_delimit_quote_single; } } @@ -402,15 +402,15 @@ extern "C" { f_string_dynamic_t escaped = f_string_dynamic_t_initialize; f_string_ranges_t ignore = f_string_ranges_t_initialize; - if (data->process_pipe) { - status = fss_extended_list_write_process_pipe(*data, output, quote, &buffer, &ignore); + if (main->process_pipe) { + status = fss_extended_list_write_process_pipe(*main, output, quote, &buffer, &ignore); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sWhile processing the ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "input pipe"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sWhile processing the ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "input pipe"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); } } @@ -418,65 +418,65 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_list_write_parameter_partial].result == f_console_result_found) { + if (main->parameters[fss_extended_list_write_parameter_partial].result == f_console_result_found) { - if (data->parameters[fss_extended_list_write_parameter_object].result == f_console_result_additional) { - for (f_array_length_t i = 0; i < data->parameters[fss_extended_list_write_parameter_object].values.used; i++) { + if (main->parameters[fss_extended_list_write_parameter_object].result == f_console_result_additional) { + for (f_array_length_t i = 0; i < main->parameters[fss_extended_list_write_parameter_object].values.used; i++) { - object.string = arguments.argv[data->parameters[fss_extended_list_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[fss_extended_list_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; - status = fss_extended_list_write_process(*data, output, quote, &object, 0, 0, &buffer); + status = fss_extended_list_write_process(*main, output, quote, &object, 0, 0, &buffer); if (F_status_is_error(status)) break; } // for } else { - for (f_array_length_t i = 0; i < data->parameters[fss_extended_list_write_parameter_content].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[fss_extended_list_write_parameter_content].values.used; i++) { - status = fss_extended_list_write_process_parameter_ignore(arguments, *data, data->parameters[fss_extended_list_write_parameter_content].locations, i, &ignore); + status = fss_extended_list_write_process_parameter_ignore(arguments, *main, main->parameters[fss_extended_list_write_parameter_content].locations, i, &ignore); if (F_status_is_error(status)) break; - content.string = arguments.argv[data->parameters[fss_extended_list_write_parameter_content].values.array[i]]; + content.string = arguments.argv[main->parameters[fss_extended_list_write_parameter_content].values.array[i]]; content.used = strnlen(content.string, f_console_parameter_size); content.size = content.used; - status = fss_extended_list_write_process(*data, output, quote, 0, &content, &ignore, &buffer); + status = fss_extended_list_write_process(*main, output, quote, 0, &content, &ignore, &buffer); if (F_status_is_error(status)) break; } // for } } else { - for (f_array_length_t i = 0; i < data->parameters[fss_extended_list_write_parameter_object].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[fss_extended_list_write_parameter_object].values.used; i++) { - status = fss_extended_list_write_process_parameter_ignore(arguments, *data, data->parameters[fss_extended_list_write_parameter_content].locations, i, &ignore); + status = fss_extended_list_write_process_parameter_ignore(arguments, *main, main->parameters[fss_extended_list_write_parameter_content].locations, i, &ignore); if (F_status_is_error(status)) break; - object.string = arguments.argv[data->parameters[fss_extended_list_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[fss_extended_list_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; - content.string = arguments.argv[data->parameters[fss_extended_list_write_parameter_content].values.array[i]]; + content.string = arguments.argv[main->parameters[fss_extended_list_write_parameter_content].values.array[i]]; content.used = strnlen(content.string, f_console_parameter_size); content.size = content.used; - status = fss_extended_list_write_process(*data, output, quote, &object, &content, &ignore, &buffer); + status = fss_extended_list_write_process(*main, output, quote, &object, &content, &ignore, &buffer); if (F_status_is_error(status)) break; } // for } if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sWhile processing the ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "input arguments"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sWhile processing the ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "input arguments"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); } } - else if (data->error.verbosity != f_console_verbosity_quiet && data->parameters[fss_extended_list_write_parameter_file].result == f_console_result_none) { + else if (main->error.verbosity != f_console_verbosity_quiet && main->parameters[fss_extended_list_write_parameter_file].result == f_console_result_none) { // ensure there is always a newline at the end, unless in quiet mode. - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); } } @@ -493,43 +493,43 @@ extern "C" { content.size = 0; } - if (data->parameters[fss_extended_list_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[fss_extended_list_write_parameter_file].result == f_console_result_additional) { if (output.id != -1) { f_file_stream_close(F_true, &output); } } // ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (data->error.verbosity != f_console_verbosity_quiet) { + if (main->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status)) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } } f_macro_string_dynamic_t_delete_simple(buffer); f_macro_string_dynamic_t_delete_simple(object); f_macro_string_dynamic_t_delete_simple(content); - fss_extended_list_write_data_delete(data); + fss_extended_list_write_main_delete(main); return status; } #endif // _di_fss_extended_list_write_main_ -#ifndef _di_fss_extended_list_write_data_delete_ - f_status_t fss_extended_list_write_data_delete(fss_extended_list_write_data_t *data) { +#ifndef _di_fss_extended_list_write_main_delete_ + f_status_t fss_extended_list_write_main_delete(fss_extended_list_write_main_t *main) { for (f_array_length_t i = 0; i < fss_extended_list_write_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_extended_list_write_data_delete_ +#endif // _di_fss_extended_list_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_list_write/c/fss_extended_list_write.h b/level_3/fss_extended_list_write/c/fss_extended_list_write.h index 345739a..baa19ad 100644 --- a/level_3/fss_extended_list_write/c/fss_extended_list_write.h +++ b/level_3/fss_extended_list_write/c/fss_extended_list_write.h @@ -127,7 +127,7 @@ extern "C" { #define fss_extended_list_write_total_parameters 18 #endif // _di_fss_extended_list_write_defines_ -#ifndef _di_fss_extended_list_write_data_t_ +#ifndef _di_fss_extended_list_write_main_t_ typedef struct { f_console_parameter_t parameters[fss_extended_list_write_total_parameters]; @@ -139,9 +139,9 @@ extern "C" { f_string_static_t prepend; f_color_context_t context; - } fss_extended_list_write_data_t; + } fss_extended_list_write_main_t; - #define fss_extended_list_write_data_t_initialize \ + #define fss_extended_list_write_main_t_initialize \ { \ fss_extended_list_write_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -151,7 +151,7 @@ extern "C" { f_string_static_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_fss_extended_list_write_data_t_ +#endif // _di_fss_extended_list_write_main_t_ /** * Print help. @@ -171,31 +171,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_extended_list_write_data_delete() after executing this. + * Be sure to call fss_extended_list_write_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see fss_extended_list_write_data_delete() + * @see fss_extended_list_write_main_delete() */ #ifndef _di_fss_extended_list_write_main_ - extern f_status_t fss_extended_list_write_main(const f_console_arguments_t arguments, fss_extended_list_write_data_t *data); + extern f_status_t fss_extended_list_write_main(const f_console_arguments_t arguments, fss_extended_list_write_main_t *main); #endif // _di_fss_extended_list_write_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_extended_list_write_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -204,9 +204,9 @@ extern "C" { * * @see fss_extended_list_write_main() */ -#ifndef _di_fss_extended_list_write_data_delete_ - extern f_status_t fss_extended_list_write_data_delete(fss_extended_list_write_data_t *data); -#endif // _di_fss_extended_list_write_data_delete_ +#ifndef _di_fss_extended_list_write_main_delete_ + extern f_status_t fss_extended_list_write_main_delete(fss_extended_list_write_main_t *main); +#endif // _di_fss_extended_list_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_list_write/c/main.c b/level_3/fss_extended_list_write/c/main.c index cc4fcb7..435f88a 100644 --- a/level_3/fss_extended_list_write/c/main.c +++ b/level_3/fss_extended_list_write/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_extended_list_write_data_t data = fss_extended_list_write_data_t_initialize; + fss_extended_list_write_main_t main = fss_extended_list_write_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_extended_list_write_main(arguments, &data); + const f_status_t status = fss_extended_list_write_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_extended_list_write/c/private-fss_extended_list_write.c b/level_3/fss_extended_list_write/c/private-fss_extended_list_write.c index 6a05564..30675f5 100644 --- a/level_3/fss_extended_list_write/c/private-fss_extended_list_write.c +++ b/level_3/fss_extended_list_write/c/private-fss_extended_list_write.c @@ -6,53 +6,53 @@ extern "C" { #endif #ifndef _di_fss_extended_list_write_error_parameter_same_times_print_ - void fss_extended_list_write_error_parameter_same_times_print(const fss_extended_list_write_data_t data) { + void fss_extended_list_write_error_parameter_same_times_print(const fss_extended_list_write_main_t main) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sMust specify both the '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_object); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter and the '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_content); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter the same number of times when not specifying the "); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_partial); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sMust specify both the '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_object); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter and the '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_content); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter the same number of times when not specifying the "); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_write_long_partial); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter.%c", f_string_eol_s[0]); } #endif // _di_fss_extended_list_write_error_parameter_same_times_print_ #ifndef _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ - void fss_extended_list_write_error_parameter_unsupported_eol_print(const fss_extended_list_write_data_t data) { + void fss_extended_list_write_error_parameter_unsupported_eol_print(const fss_extended_list_write_main_t main) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThis standard does not support end of line character '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "\\n"); - f_color_print(data.error.to.stream, data.context.set.error, "' in objects.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThis standard does not support end of line character '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "\\n"); + f_color_print(main.error.to.stream, main.context.set.error, "' in objects.%c", f_string_eol_s[0]); } #endif // _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_extended_list_write_error_parameter_value_missing_print_ - void fss_extended_list_write_error_parameter_value_missing_print(const fss_extended_list_write_data_t data, const f_string_t symbol, const f_string_t parameter) { + void fss_extended_list_write_error_parameter_value_missing_print(const fss_extended_list_write_main_t main, const f_string_t symbol, const f_string_t parameter) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", symbol, parameter); - f_color_print(data.error.to.stream, data.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", symbol, parameter); + f_color_print(main.error.to.stream, main.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } #endif // _di_fss_extended_list_write_error_parameter_value_missing_print_ #ifndef _di_fss_extended_list_write_process_ - f_status_t fss_extended_list_write_process(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) { + f_status_t fss_extended_list_write_process(const fss_extended_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_string_range_t range = f_string_range_t_initialize; @@ -70,7 +70,7 @@ extern "C" { } if (content) { - if (data.parameters[fss_extended_list_write_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_extended_list_write_parameter_trim].result == f_console_result_found) { complete = f_fss_complete_full_trim; } else { @@ -81,13 +81,13 @@ extern "C" { status = fl_fss_extended_list_object_write_string(*object, complete, &range, buffer); if (F_status_set_fine(status) == F_none_eol) { - fss_extended_list_write_error_parameter_unsupported_eol_print(data); + fss_extended_list_write_error_parameter_unsupported_eol_print(main); return F_status_set_error(F_supported_not); } if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_extended_list_object_write_string", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_extended_list_object_write_string", F_true); return status; } } @@ -96,10 +96,10 @@ extern "C" { range.start = 0; range.stop = content->used - 1; - status = fl_fss_extended_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &data.prepend, ignore, &range, buffer); + status = fl_fss_extended_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &main.prepend, ignore, &range, buffer); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_extended_list_content_write_string", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_extended_list_content_write_string", F_true); return status; } } @@ -108,7 +108,7 @@ extern "C" { status = f_string_append(f_string_eol, 1, buffer); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true); return status; } } @@ -121,7 +121,7 @@ extern "C" { #endif // _di_fss_extended_list_write_process_ #ifndef _di_fss_extended_list_write_process_pipe_ - f_status_t fss_extended_list_write_process_pipe(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) { + f_status_t fss_extended_list_write_process_pipe(const fss_extended_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) { f_status_t status = F_none; f_status_t status_pipe = F_none; @@ -153,7 +153,7 @@ extern "C" { status_pipe = f_file_read_block(input, &block); if (F_status_is_error(status_pipe)) { - fll_error_print(data.error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); + fll_error_print(main.error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); status_pipe = F_status_set_error(F_pipe); break; @@ -180,7 +180,7 @@ extern "C" { status = f_string_dynamic_increase_by(block.used, &object); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); break; } } @@ -229,7 +229,7 @@ extern "C" { status = f_string_dynamic_increase_by(total, &content); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); break; } } @@ -237,9 +237,9 @@ extern "C" { for (; range.start <= range.stop; range.start++) { if (block.string[range.start] == fss_extended_list_write_pipe_content_start) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThis standard only supports one content per object.%c", fll_error_print_error, f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThis standard only supports one content per object.%c", fll_error_print_error, f_string_eol_s[0]); } status = F_status_set_error(F_supported_not); @@ -262,7 +262,7 @@ extern "C" { if (ignore->used + 1 > ignore->size) { if (ignore->size + f_fss_default_allocation_step > f_array_length_t_size) { if (ignore->size + 1 > f_array_length_t_size) { - fll_error_print(data.error, F_string_too_large, "fss_extended_list_write_process_pipe", F_true); + fll_error_print(main.error, F_string_too_large, "fss_extended_list_write_process_pipe", F_true); status = F_status_set_error(F_string_too_large); break; @@ -275,7 +275,7 @@ extern "C" { } if (F_status_is_error(status)) { - fll_error_print(data.error, F_string_too_large, "fss_extended_list_write_process_pipe", F_true); + fll_error_print(main.error, F_string_too_large, "fss_extended_list_write_process_pipe", F_true); break; } } @@ -302,7 +302,7 @@ extern "C" { } if (state == 0x3) { - status = fss_extended_list_write_process(data, output, quote, &object, &content, ignore, buffer); + status = fss_extended_list_write_process(main, output, quote, &object, &content, ignore, buffer); if (F_status_is_error(status)) break; state = 0; @@ -311,7 +311,7 @@ extern "C" { // if the pipe ended before finishing, then attempt to wrap up. if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) { - status = fss_extended_list_write_process(data, output, quote, &object, &content, ignore, buffer); + status = fss_extended_list_write_process(main, output, quote, &object, &content, ignore, buffer); } f_macro_string_dynamic_t_delete_simple(block); @@ -322,7 +322,7 @@ extern "C" { #endif // _di_fss_extended_list_write_process_pipe_ #ifndef _di_fss_extended_list_write_process_parameter_ignore_ - f_status_t fss_extended_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_extended_list_write_data_t data, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) { + f_status_t fss_extended_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_extended_list_write_main_t main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) { f_status_t status = F_none; f_array_length_t i = 0; @@ -335,9 +335,9 @@ extern "C" { range.start = 0; - for (; i < data.parameters[fss_extended_list_write_parameter_ignore].locations.used; i++) { + for (; i < main.parameters[fss_extended_list_write_parameter_ignore].locations.used; i++) { - l = data.parameters[fss_extended_list_write_parameter_ignore].locations.array[i]; + l = main.parameters[fss_extended_list_write_parameter_ignore].locations.array[i]; if (l < contents.array[location]) continue; if (location + 1 < contents.used && l > contents.array[location + 1]) continue; @@ -345,7 +345,7 @@ extern "C" { if (ignore->used + 1 > ignore->size) { if (ignore->size + f_fss_default_allocation_step > f_array_length_t_size) { if (ignore->size + 1 > f_array_length_t_size) { - fll_error_print(data.error, F_string_too_large, "fss_extended_list_write_process_parameter_ignore", F_true); + fll_error_print(main.error, F_string_too_large, "fss_extended_list_write_process_parameter_ignore", F_true); return F_status_set_error(F_string_too_large); } @@ -356,12 +356,12 @@ extern "C" { } if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fss_extended_list_write_process_parameter_ignore", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fss_extended_list_write_process_parameter_ignore", F_true); return status; } } - index = data.parameters[fss_extended_list_write_parameter_ignore].values.array[i * 2]; + index = main.parameters[fss_extended_list_write_parameter_ignore].values.array[i * 2]; range.start = 0; range.stop = strnlen(arguments.argv[index], f_console_parameter_size) - 1; @@ -374,13 +374,13 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore, arguments.argv[index]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore, arguments.argv[index]); return status; } ignore->array[ignore->used].start = number; - index = data.parameters[fss_extended_list_write_parameter_ignore].values.array[(i * 2) + 1]; + index = main.parameters[fss_extended_list_write_parameter_ignore].values.array[(i * 2) + 1]; range.start = 0; range.stop = strnlen(arguments.argv[index], f_console_parameter_size) - 1; @@ -393,7 +393,7 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore, arguments.argv[index]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore, arguments.argv[index]); return status; } diff --git a/level_3/fss_extended_list_write/c/private-fss_extended_list_write.h b/level_3/fss_extended_list_write/c/private-fss_extended_list_write.h index 77eec3f..372fdbb 100644 --- a/level_3/fss_extended_list_write/c/private-fss_extended_list_write.h +++ b/level_3/fss_extended_list_write/c/private-fss_extended_list_write.h @@ -15,42 +15,42 @@ extern "C" { /** * Print an message about the object and content parameters not being specified the same number of times. * - * @param data - * The program data. + * @param main + * The main data. */ #ifndef _di_fss_extended_list_write_error_parameter_same_times_print_ - void fss_extended_list_write_error_parameter_same_times_print(const fss_extended_list_write_data_t data) f_attribute_visibility_internal; + void fss_extended_list_write_error_parameter_same_times_print(const fss_extended_list_write_main_t main) f_attribute_visibility_internal; #endif // _di_fss_extended_list_write_error_parameter_same_times_print_ /** * Print an message about a parameter EOL being unsupported. * - * @param data - * The program data. + * @param main + * The main data. */ #ifndef _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ - void fss_extended_list_write_error_parameter_unsupported_eol_print(const fss_extended_list_write_data_t data) f_attribute_visibility_internal; + void fss_extended_list_write_error_parameter_unsupported_eol_print(const fss_extended_list_write_main_t main) f_attribute_visibility_internal; #endif // _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ /** * Print an message about a parameter missing a value. * - * @param data - * The program data. + * @param main + * The main data. * @param symbol * The console symbol, such as "--" in "--help". * @param parameter * The parameter name, such as "help" in "--help". */ #ifndef _di_fss_extended_list_write_error_parameter_value_missing_print_ - void fss_extended_list_write_error_parameter_value_missing_print(const fss_extended_list_write_data_t data, const f_string_t symbol, const f_string_t parameter) f_attribute_visibility_internal; + void fss_extended_list_write_error_parameter_value_missing_print(const fss_extended_list_write_main_t main, const f_string_t symbol, const f_string_t parameter) f_attribute_visibility_internal; #endif // _di_fss_extended_list_write_error_parameter_value_missing_print_ /** * Process a given object and content, printing the FSS if valid or an error if invalid. * - * @param data - * The program data. + * @param main + * The main data. * @param output * The file to output to. * @param quote @@ -73,14 +73,14 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_list_write_process_ - extern f_status_t fss_extended_list_write_process(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) f_attribute_visibility_internal; + extern f_status_t fss_extended_list_write_process(const fss_extended_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) f_attribute_visibility_internal; #endif // _di_fss_extended_list_write_process_ /** * Process the pipe, reading from the pipe and writing to the output. * - * @param data - * The program data. + * @param main + * The main data. * @param output * The file to output to. * @param quote @@ -97,7 +97,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_list_write_process_pipe_ - extern f_status_t fss_extended_list_write_process_pipe(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) f_attribute_visibility_internal; + extern f_status_t fss_extended_list_write_process_pipe(const fss_extended_list_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) f_attribute_visibility_internal; #endif // _di_fss_extended_list_write_process_pipe_ /** @@ -105,8 +105,8 @@ extern "C" { * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * @param contents * The console parameter locations array for the content parameter. * @param location @@ -119,7 +119,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_list_write_process_parameter_ignore_ - extern f_status_t fss_extended_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_extended_list_write_data_t data, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) f_attribute_visibility_internal; + extern f_status_t fss_extended_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_extended_list_write_main_t main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) f_attribute_visibility_internal; #endif // _di_fss_extended_list_write_process_parameter_ignore_ #ifdef __cplusplus diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 761ae1b..a4d4b83 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -41,7 +41,7 @@ extern "C" { fprintf(output.stream, "%c", f_string_eol_s[0]); - fprintf(output.stream, " This program will print the content associated with the given object and content data based on the FSS-0001 Extended standard.%c", f_string_eol_s[0]); + fprintf(output.stream, " This program will print the content associated with the given object and content main based on the FSS-0001 Extended standard.%c", f_string_eol_s[0]); fprintf(output.stream, "%c", f_string_eol_s[0]); @@ -159,30 +159,30 @@ extern "C" { #endif // _di_fss_extended_read_print_help_ #ifndef _di_fss_extended_read_main_ - f_status_t fss_extended_read_main(const f_console_arguments_t arguments, fss_extended_read_data_t *data) { + f_status_t fss_extended_read_main(const f_console_arguments_t arguments, fss_extended_read_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_extended_read_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_extended_read_total_parameters); { f_console_parameter_id_t ids[3] = { fss_extended_read_parameter_no_color, fss_extended_read_parameter_light, fss_extended_read_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_extended_read_data_delete(data); + fss_extended_read_main_delete(main); return F_status_set_error(status); } } @@ -196,142 +196,142 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_extended_read_data_delete(data); + fss_extended_read_main_delete(main); return status; } if (choice == fss_extended_read_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_extended_read_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_extended_read_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_extended_read_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_extended_read_parameter_help].result == f_console_result_found) { - fss_extended_read_print_help(data->output, data->context); + if (main->parameters[fss_extended_read_parameter_help].result == f_console_result_found) { + fss_extended_read_print_help(main->output, main->context); - fss_extended_read_data_delete(data); + fss_extended_read_main_delete(main); return F_none; } - if (data->parameters[fss_extended_read_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_extended_read_version); + if (main->parameters[fss_extended_read_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_extended_read_version); - fss_extended_read_data_delete(data); + fss_extended_read_main_delete(main); return F_none; } - if (data->remaining.used > 0 || data->process_pipe) { - if (data->parameters[fss_extended_read_parameter_at].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_at); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (main->remaining.used > 0 || main->process_pipe) { + if (main->parameters[fss_extended_read_parameter_at].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_at); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_extended_read_parameter_depth].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_depth].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_extended_read_parameter_line].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_line); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_line].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_line); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_extended_read_parameter_name].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_name); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_name].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_name); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a string.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[fss_extended_read_parameter_select].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_select); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_select].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_select); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { - if (F_status_is_error_not(status) && data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_line); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { + if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_line); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } } - if (data->parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) { - if (F_status_is_error_not(status) && data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_pipe); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) { + if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_pipe); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_read_parameter_delimit].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_delimit); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a value.%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_read_parameter_delimit].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_delimit); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a value.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_read_parameter_delimit].result == f_console_result_additional) { - const f_array_length_t location = data->parameters[fss_extended_read_parameter_delimit].values.array[0]; + else if (main->parameters[fss_extended_read_parameter_delimit].result == f_console_result_additional) { + const f_array_length_t location = main->parameters[fss_extended_read_parameter_delimit].values.array[0]; f_array_length_t length = strnlen(arguments.argv[location], f_console_parameter_size); if (length == 0) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_delimit); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be empty.%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_delimit); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } else if (fl_string_compare(arguments.argv[location], fss_extended_read_delimit_mode_name_none, length, fss_extended_read_delimit_mode_name_none_length) == F_equal_to) { - data->delimit_mode = fss_extended_read_delimit_mode_none; + main->delimit_mode = fss_extended_read_delimit_mode_none; } else if (fl_string_compare(arguments.argv[location], fss_extended_read_delimit_mode_name_all, length, fss_extended_read_delimit_mode_name_all_length) == F_equal_to) { - data->delimit_mode = fss_extended_read_delimit_mode_all; + main->delimit_mode = fss_extended_read_delimit_mode_all; } else { - data->delimit_mode = fss_extended_read_delimit_mode_depth; + main->delimit_mode = fss_extended_read_delimit_mode_depth; if (arguments.argv[location][length - 1] == fss_extended_read_delimit_mode_name_greater[0]) { - data->delimit_mode = fss_extended_read_delimit_mode_depth_greater; + main->delimit_mode = fss_extended_read_delimit_mode_depth_greater; // shorten the length to better convert the remainder to a number. length--; } else if (arguments.argv[location][length - 1] == fss_extended_read_delimit_mode_name_lesser[0]) { - data->delimit_mode = fss_extended_read_delimit_mode_depth_lesser; + main->delimit_mode = fss_extended_read_delimit_mode_depth_lesser; // shorten the length to better convert the remainder to a number. length--; @@ -344,10 +344,10 @@ extern "C" { range.start++; } - status = fl_conversion_string_to_number_unsigned(arguments.argv[location], range, &data->delimit_depth); + status = fl_conversion_string_to_number_unsigned(arguments.argv[location], range, &main->delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_delimit, arguments.argv[location]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_delimit, arguments.argv[location]); } } } @@ -358,13 +358,13 @@ extern "C" { f_fss_delimits_t objects_delimits = f_fss_delimits_t_initialize; f_fss_delimits_t contents_delimits = f_fss_delimits_t_initialize; - f_array_length_t original_size = data->quantity.total; + f_array_length_t original_size = main->quantity.total; if (F_status_is_error_not(status)) { - status = fss_extended_read_main_preprocess_depth(arguments, *data, &depths); + status = fss_extended_read_main_preprocess_depth(arguments, *main, &depths); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fss_extended_read_main_preprocess_depth", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fss_extended_read_main_preprocess_depth", F_true); } } @@ -374,73 +374,73 @@ extern "C" { f_macro_fss_delimits_t_delete_simple(objects_delimits); f_macro_fss_delimits_t_delete_simple(contents_delimits); - if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } - fss_extended_read_data_delete(data); + fss_extended_read_main_delete(main); return F_none; } - if (F_status_is_error_not(status) && data->parameters[fss_extended_read_parameter_select].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_select); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_select].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_select); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->process_pipe) { + if (F_status_is_error_not(status) && main->process_pipe) { f_file_t file = f_file_t_initialize; file.id = f_type_descriptor_input; - status = f_file_read(file, &data->buffer); + status = f_file_read(file, &main->buffer); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe); } else { - status = fss_extended_read_main_process_file(arguments, data, "-", depths, &objects_delimits, &contents_delimits); + status = fss_extended_read_main_process_file(arguments, main, "-", depths, &objects_delimits, &contents_delimits); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "fss_extended_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_extended_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe); } } // Clear buffers before continuing. - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); } - if (F_status_is_error_not(status) && data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { + if (F_status_is_error_not(status) && main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { f_file_t file = f_file_t_initialize; - status = f_file_open(arguments.argv[data->remaining.array[i]], 0, &file); + status = f_file_open(arguments.argv[main->remaining.array[i]], 0, &file); - data->quantity.total = original_size; + main->quantity.total = original_size; if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[data->remaining.array[i]], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[main->remaining.array[i]], "open", fll_error_file_type_file); break; } - if (!data->quantity.total) { - status = f_file_size_by_id(file.id, &data->quantity.total); + if (!main->quantity.total) { + status = f_file_size_by_id(file.id, &main->quantity.total); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); f_file_stream_close(F_true, &file); break; } // Skip past empty files. - if (!data->quantity.total) { - if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (!main->quantity.total) { + if (main->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } f_file_stream_close(F_true, &file); @@ -448,32 +448,32 @@ extern "C" { } } - status = f_file_read_until(file, data->quantity.total, &data->buffer); + status = f_file_read_until(file, main->quantity.total, &main->buffer); f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); break; } - status = fss_extended_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[i]], depths, &objects_delimits, &contents_delimits); + status = fss_extended_read_main_process_file(arguments, main, arguments.argv[main->remaining.array[i]], depths, &objects_delimits, &contents_delimits); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "fss_extended_read_main_process_file", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "fss_extended_read_main_process_file", F_true, arguments.argv[main->remaining.array[i]], "read", fll_error_file_type_file); break; } // Clear buffers before repeating the loop. - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); } // for if (F_status_is_error(status)) { - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); } } @@ -482,34 +482,34 @@ extern "C" { f_macro_fss_delimits_t_delete_simple(contents_delimits); } else { - f_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); status = F_status_set_error(F_parameter); } - fss_extended_read_data_delete(data); + fss_extended_read_main_delete(main); return status; } #endif // _di_fss_extended_read_main_ -#ifndef _di_fss_extended_read_data_delete_ - f_status_t fss_extended_read_data_delete(fss_extended_read_data_t *data) { +#ifndef _di_fss_extended_read_main_delete_ + f_status_t fss_extended_read_main_delete(fss_extended_read_main_t *main) { for (f_array_length_t i = 0; i < fss_extended_read_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_extended_read_data_delete_ +#endif // _di_fss_extended_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_read/c/fss_extended_read.h b/level_3/fss_extended_read/c/fss_extended_read.h index 9c1a6b3..14df824 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.h +++ b/level_3/fss_extended_read/c/fss_extended_read.h @@ -7,7 +7,7 @@ * * This is the FSS Basic Read program * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_extended_read_data_t. + * This program processes files or other input in fss format and stores the results in the fss_extended_read_main_t. * * This processes in accordance to the FSS-0001 Extended specification. */ @@ -165,7 +165,7 @@ extern "C" { }; #endif // _di_fss_extended_read_delimit_modes_ -#ifndef _di_fss_extended_read_data_t_ +#ifndef _di_fss_extended_read_main_t_ typedef struct { f_console_parameter_t parameters[fss_extended_read_total_parameters]; @@ -184,9 +184,9 @@ extern "C" { f_array_length_t delimit_depth; f_color_context_t context; - } fss_extended_read_data_t; + } fss_extended_read_main_t; - #define fss_extended_read_data_t_initialize \ + #define fss_extended_read_main_t_initialize \ { \ fss_extended_read_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -201,7 +201,7 @@ extern "C" { 0, \ f_color_context_t_initialize, \ } -#endif // _di_fss_extended_read_data_t_ +#endif // _di_fss_extended_read_main_t_ /** * Print help. @@ -221,31 +221,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_extended_read_data_delete() after executing this. + * Be sure to call fss_extended_read_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see fss_extended_read_data_delete() + * @see fss_extended_read_main_delete() */ #ifndef _di_fss_extended_read_main_ - extern f_status_t fss_extended_read_main(const f_console_arguments_t arguments, fss_extended_read_data_t *data); + extern f_status_t fss_extended_read_main(const f_console_arguments_t arguments, fss_extended_read_main_t *main); #endif // _di_fss_extended_read_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_extended_read_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -254,9 +254,9 @@ extern "C" { * * @see fss_extended_read_main() */ -#ifndef _di_fss_extended_read_data_delete_ - extern f_status_t fss_extended_read_data_delete(fss_extended_read_data_t *data); -#endif // _di_fss_extended_read_data_delete_ +#ifndef _di_fss_extended_read_main_delete_ + extern f_status_t fss_extended_read_main_delete(fss_extended_read_main_t *main); +#endif // _di_fss_extended_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_read/c/main.c b/level_3/fss_extended_read/c/main.c index aca350b..dbef786 100644 --- a/level_3/fss_extended_read/c/main.c +++ b/level_3/fss_extended_read/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_extended_read_data_t data = fss_extended_read_data_t_initialize; + fss_extended_read_main_t main = fss_extended_read_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_extended_read_main(arguments, &data); + const f_status_t status = fss_extended_read_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.c b/level_3/fss_extended_read/c/private-fss_extended_read.c index 7d79bf7..08f2a18 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.c +++ b/level_3/fss_extended_read/c/private-fss_extended_read.c @@ -6,26 +6,26 @@ extern "C" { #endif #ifndef _di_fss_extended_read_is_delimited_at_depth_ - f_status_t fss_extended_read_is_delimited_at_depth(const fss_extended_read_data_t data, const f_array_length_t depth) { + f_status_t fss_extended_read_is_delimited_at_depth(const fss_extended_read_main_t main, const f_array_length_t depth) { - if (data.delimit_mode == fss_extended_read_delimit_mode_none) { + if (main.delimit_mode == fss_extended_read_delimit_mode_none) { return F_false; } - if (data.delimit_mode == fss_extended_read_delimit_mode_all) { + if (main.delimit_mode == fss_extended_read_delimit_mode_all) { return F_true; } - if (data.delimit_mode == fss_extended_read_delimit_mode_depth) { - return depth == data.delimit_depth; + if (main.delimit_mode == fss_extended_read_delimit_mode_depth) { + return depth == main.delimit_depth; } - if (data.delimit_mode == fss_extended_read_delimit_mode_depth_lesser) { - return depth <= data.delimit_depth; + if (main.delimit_mode == fss_extended_read_delimit_mode_depth_lesser) { + return depth <= main.delimit_depth; } - if (data.delimit_mode == fss_extended_read_delimit_mode_depth_greater) { - return depth >= data.delimit_depth; + if (main.delimit_mode == fss_extended_read_delimit_mode_depth_greater) { + return depth >= main.delimit_depth; } return F_true; @@ -33,20 +33,20 @@ extern "C" { #endif // _di_fss_extended_read_is_delimited_at_depth_ #ifndef _di_fss_extended_read_main_preprocess_depth_ - f_status_t fss_extended_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_read_data_t data, fss_extended_read_depths_t *depths) { + f_status_t fss_extended_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_read_main_t main, fss_extended_read_depths_t *depths) { f_status_t status = F_none; { f_array_length_t depth_size = 1; - if (data.parameters[fss_extended_read_parameter_depth].result == f_console_result_additional) { - depth_size = data.parameters[fss_extended_read_parameter_depth].values.used; + if (main.parameters[fss_extended_read_parameter_depth].result == f_console_result_additional) { + depth_size = main.parameters[fss_extended_read_parameter_depth].values.used; } fss_extended_read_macro_depths_t_resize(status, (*depths), depth_size); if (F_status_is_error(status)) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); return status; } @@ -65,60 +65,60 @@ extern "C" { f_macro_string_dynamic_t_clear(depths->array[i].value_name); - if (!data.parameters[fss_extended_read_parameter_depth].values.used) { + if (!main.parameters[fss_extended_read_parameter_depth].values.used) { position_depth = 0; } else { - position_depth = data.parameters[fss_extended_read_parameter_depth].values.array[i]; + position_depth = main.parameters[fss_extended_read_parameter_depth].values.array[i]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[position_depth])); status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], range, &depths->array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_depth, arguments.argv[position_depth]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_depth, arguments.argv[position_depth]); return status; } } - if (data.parameters[fss_extended_read_parameter_at].result == f_console_result_additional) { - for (; position_at < data.parameters[fss_extended_read_parameter_at].values.used; position_at++) { + if (main.parameters[fss_extended_read_parameter_at].result == f_console_result_additional) { + for (; position_at < main.parameters[fss_extended_read_parameter_at].values.used; position_at++) { - if (data.parameters[fss_extended_read_parameter_at].values.array[position_at] < position_depth) { + if (main.parameters[fss_extended_read_parameter_at].values.array[position_at] < position_depth) { continue; } - if (i + 1 < depths->used && data.parameters[fss_extended_read_parameter_at].values.array[position_at] > data.parameters[fss_extended_read_parameter_depth].values.array[i + 1]) { + if (i + 1 < depths->used && main.parameters[fss_extended_read_parameter_at].values.array[position_at] > main.parameters[fss_extended_read_parameter_depth].values.array[i + 1]) { break; } - depths->array[i].index_at = data.parameters[fss_extended_read_parameter_at].values.array[position_at]; + depths->array[i].index_at = main.parameters[fss_extended_read_parameter_at].values.array[position_at]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[depths->array[i].index_at])); status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], range, &depths->array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_at, arguments.argv[depths->array[i].index_at]); + fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_at, arguments.argv[depths->array[i].index_at]); return status; } } // for } - if (data.parameters[fss_extended_read_parameter_name].result == f_console_result_additional) { - for (; position_name < data.parameters[fss_extended_read_parameter_name].values.used; position_name++) { + if (main.parameters[fss_extended_read_parameter_name].result == f_console_result_additional) { + for (; position_name < main.parameters[fss_extended_read_parameter_name].values.used; position_name++) { - if (data.parameters[fss_extended_read_parameter_name].values.array[position_name] < position_depth) { + if (main.parameters[fss_extended_read_parameter_name].values.array[position_name] < position_depth) { continue; } - if (i + 1 < depths->used && data.parameters[fss_extended_read_parameter_name].values.array[position_name] > data.parameters[fss_extended_read_parameter_depth].values.array[i + 1]) { + if (i + 1 < depths->used && main.parameters[fss_extended_read_parameter_name].values.array[position_name] > main.parameters[fss_extended_read_parameter_depth].values.array[i + 1]) { break; } - depths->array[i].index_name = data.parameters[fss_extended_read_parameter_name].values.array[position_name]; + depths->array[i].index_name = main.parameters[fss_extended_read_parameter_name].values.array[position_name]; - if (data.parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { status = fl_string_rip(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } else { @@ -130,34 +130,34 @@ extern "C" { // @todo: move error printing into common function. if (status_code == F_memory_not) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]); } else if (status_code == F_string_too_large) { - f_color_print(data.error.to.stream, data.context.set.error, "%sUnable to process '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_trim); - f_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to process '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_trim); + f_color_print(main.error.to.stream, main.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol_s[0]); } else { f_string_t function = "f_string_append"; - if (data.parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { function = "fl_string_rip"; } - f_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code); - f_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling "); - f_color_print(data.error.to.stream, data.context.set.notable, "%s()", function); - f_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%u", status_code); + f_color_print(main.error.to.stream, main.context.set.error, ") has occurred while calling "); + f_color_print(main.error.to.stream, main.context.set.notable, "%s()", function); + f_color_print(main.error.to.stream, main.context.set.error, ".%c", f_string_eol_s[0]); } return status; } if (!depths->array[i].value_name.used) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_name); - f_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_name); + f_color_print(main.error.to.stream, main.context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } @@ -170,22 +170,22 @@ extern "C" { for (f_array_length_t j = i + 1; j < depths->used; j++) { if (depths->array[i].depth == depths->array[j].depth) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe value '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); - f_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe value '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth); + f_color_print(main.error.to.stream, main.context.set.error, "' may only be specified once for the parameter '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } else if (depths->array[i].depth > depths->array[j].depth) { - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth); - f_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); - f_color_print(data.error.to.stream, data.context.set.error, "' before the value '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[j].depth); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth); + f_color_print(main.error.to.stream, main.context.set.error, "' may not have the value '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth); + f_color_print(main.error.to.stream, main.context.set.error, "' before the value '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[j].depth); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } @@ -197,36 +197,36 @@ extern "C" { #endif // _di_fss_extended_read_main_preprocess_depth_ #ifndef _di_fss_extended_read_main_process_file_ - f_status_t fss_extended_read_main_process_file(const f_console_arguments_t arguments, fss_extended_read_data_t *data, const f_string_t filename, const fss_extended_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { + f_status_t fss_extended_read_main_process_file(const f_console_arguments_t arguments, fss_extended_read_main_t *main, const f_string_t filename, const fss_extended_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { f_status_t status = F_none; const f_array_lengths_t except_none = f_array_lengths_t_initialize; bool object_delimited = F_true; bool content_delimited = F_true; - if (data->delimit_mode == fss_extended_read_delimit_mode_none || (data->delimit_depth && (data->delimit_mode == fss_extended_read_delimit_mode_depth || data->delimit_mode == fss_extended_read_delimit_mode_depth_greater))) { + if (main->delimit_mode == fss_extended_read_delimit_mode_none || (main->delimit_depth && (main->delimit_mode == fss_extended_read_delimit_mode_depth || main->delimit_mode == fss_extended_read_delimit_mode_depth_greater))) { object_delimited = F_false; } { - f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used); + f_string_range_t input = f_macro_string_range_t_initialize(main->buffer.used); objects_delimits->used = 0; contents_delimits->used = 0; - status = fll_fss_extended_read(data->buffer, &input, &data->objects, &data->contents, 0, 0, objects_delimits, contents_delimits); + status = fll_fss_extended_read(main->buffer, &input, &main->objects, &main->contents, 0, 0, objects_delimits, contents_delimits); if (F_status_is_error(status)) { // @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate. - fll_error_file_print(data->error, F_status_set_fine(status), "fll_fss_extended_read", F_true, filename, "process", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_extended_read", F_true, filename, "process", fll_error_file_type_file); } else if (status == F_data_not_stop || status == F_data_not_eos) { - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); - if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); return F_none; } @@ -234,9 +234,9 @@ extern "C" { } if (F_status_is_error(status)) { - f_macro_fss_contents_t_delete_simple(data->contents); - f_macro_fss_objects_t_delete_simple(data->objects); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_fss_contents_t_delete_simple(main->contents); + f_macro_fss_objects_t_delete_simple(main->objects); + f_macro_string_dynamic_t_delete_simple(main->buffer); return status; } @@ -244,90 +244,90 @@ extern "C" { f_number_unsigned_t select = 0; - if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_extended_read_parameter_select].values.array[data->parameters[fss_extended_read_parameter_select].values.used - 1]; + if (main->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_extended_read_parameter_select].values.array[main->parameters[fss_extended_read_parameter_select].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &select); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_select, arguments.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_select, arguments.argv[index]); return status; } } f_array_length_t line = 0; - if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_extended_read_parameter_line].values.array[data->parameters[fss_extended_read_parameter_line].values.used - 1]; + if (main->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_extended_read_parameter_line].values.array[main->parameters[fss_extended_read_parameter_line].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &line); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_line, arguments.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_line, arguments.argv[index]); return status; } } - bool names[data->objects.used]; + bool names[main->objects.used]; f_array_length_t i = 0; f_array_length_t j = 0; if (depths.array[0].index_name > 0) { - memset(names, 0, sizeof(bool) * data->objects.used); + memset(names, 0, sizeof(bool) * main->objects.used); - if (data->parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { - for (i = 0; i < data->objects.used; i++) { + if (main->parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { + for (i = 0; i < main->objects.used; i++) { - if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, *objects_delimits) == F_equal_to) { + if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[0].value_name, main->buffer, main->objects.array[i], except_none, *objects_delimits) == F_equal_to) { names[i] = 1; } } // for } else { - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { - if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, *objects_delimits) == F_equal_to) { + if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[0].value_name, main->buffer, main->objects.array[i], except_none, *objects_delimits) == F_equal_to) { names[i] = 1; } } // for } } else { - memset(names, 1, sizeof(bool) * data->objects.used); + memset(names, 1, sizeof(bool) * main->objects.used); } bool include_empty = 0; - if (data->parameters[fss_extended_read_parameter_empty].result == f_console_result_found) { + if (main->parameters[fss_extended_read_parameter_empty].result == f_console_result_found) { include_empty = 1; } - if (data->parameters[fss_extended_read_parameter_object].result == f_console_result_found) { - if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + if (main->parameters[fss_extended_read_parameter_object].result == f_console_result_found) { + if (main->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { if (depths.array[0].index_at > 0) { - if (depths.array[0].value_at < data->objects.used && names[depths.array[0].value_at]) { - fprintf(data->output.stream, "1%c", f_string_eol_s[0]); + if (depths.array[0].value_at < main->objects.used && names[depths.array[0].value_at]) { + fprintf(main->output.stream, "1%c", f_string_eol_s[0]); } else { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } } else if (depths.array[0].index_name > 0) { f_array_length_t total = 0; - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { if (!names[i]) continue; total++; } // for - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); } else { - fprintf(data->output.stream, "%llu%c", data->objects.used, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", main->objects.used, f_string_eol_s[0]); } return F_none; @@ -335,37 +335,37 @@ extern "C" { f_status_t (*print_object)(FILE *, const f_string_static_t, const f_string_range_t, const f_array_lengths_t) = &f_print_except_dynamic_partial; - if (data->parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { + if (main->parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { print_object = &fl_print_trim_except_dynamic_partial; } if (depths.array[0].index_at > 0) { f_array_length_t at = 0; - for (j = 0; i < data->objects.used; i++) { + for (j = 0; i < main->objects.used; i++) { if (names[i]) { if (at == depths.array[0].value_at) { - print_object(data->output.stream, data->buffer, data->objects.array[i], object_delimited ? *objects_delimits : except_none); + print_object(main->output.stream, main->buffer, main->objects.array[i], object_delimited ? *objects_delimits : except_none); - if (data->parameters[fss_extended_read_parameter_content].result == f_console_result_found) { - if (data->contents.array[i].used) { - fss_extended_read_print_object_end(*data); + if (main->parameters[fss_extended_read_parameter_content].result == f_console_result_found) { + if (main->contents.array[i].used) { + fss_extended_read_print_object_end(*main); - for (j = 0; j < data->contents.array[i].used; j++) { + for (j = 0; j < main->contents.array[i].used; j++) { - content_delimited = fss_extended_read_is_delimited_at_depth(*data, j); + content_delimited = fss_extended_read_is_delimited_at_depth(*main, j); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); - if (j + 1 < data->contents.array[i].used) { - fss_extended_read_print_content_end(*data); + if (j + 1 < main->contents.array[i].used) { + fss_extended_read_print_content_end(*main); } } // for } } - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); break; } @@ -376,38 +376,38 @@ extern "C" { return F_none; } - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { if (!names[i]) continue; - print_object(data->output.stream, data->buffer, data->objects.array[i], object_delimited ? *objects_delimits : except_none); + print_object(main->output.stream, main->buffer, main->objects.array[i], object_delimited ? *objects_delimits : except_none); - if (data->parameters[fss_extended_read_parameter_content].result == f_console_result_found) { - if (data->contents.array[i].used) { - fss_extended_read_print_object_end(*data); + if (main->parameters[fss_extended_read_parameter_content].result == f_console_result_found) { + if (main->contents.array[i].used) { + fss_extended_read_print_object_end(*main); - for (j = 0; j < data->contents.array[i].used; j++) { + for (j = 0; j < main->contents.array[i].used; j++) { - content_delimited = fss_extended_read_is_delimited_at_depth(*data, j); + content_delimited = fss_extended_read_is_delimited_at_depth(*main, j); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); - if (j + 1 < data->contents.array[i].used) { - fss_extended_read_print_content_end(*data); + if (j + 1 < main->contents.array[i].used) { + fss_extended_read_print_content_end(*main); } } // for } } - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); } // for return F_none; } if (depths.array[0].index_at > 0) { - if (depths.array[0].value_at >= data->objects.used) { - if (names[depths.array[0].value_at] && data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (depths.array[0].value_at >= main->objects.used) { + if (names[depths.array[0].value_at] && main->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } return F_none; @@ -415,57 +415,57 @@ extern "C" { f_array_length_t at = 0; - for (; i < data->objects.used; i++) { + for (; i < main->objects.used; i++) { if (names[i]) { if (at == depths.array[0].value_at) { - if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { - if (!data->contents.array[i].used) { - fprintf(data->output.stream, "0%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + if (!main->contents.array[i].used) { + fprintf(main->output.stream, "0%c", f_string_eol_s[0]); } else { - fprintf(data->output.stream, "1%c", f_string_eol_s[0]); + fprintf(main->output.stream, "1%c", f_string_eol_s[0]); } return F_none; } - if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { + if (main->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { if (!line) { - if (data->contents.array[i].used > 0) { + if (main->contents.array[i].used > 0) { j = 0; - if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { - if (select < data->contents.array[i].used) { - content_delimited = fss_extended_read_is_delimited_at_depth(*data, select); + if (main->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { + if (select < main->contents.array[i].used) { + content_delimited = fss_extended_read_is_delimited_at_depth(*main, select); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[select], content_delimited ? *contents_delimits : except_none); - fss_extended_read_print_set_end(*data); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[select], content_delimited ? *contents_delimits : except_none); + fss_extended_read_print_set_end(*main); } } else { - for (j = 0; j < data->contents.array[i].used; j++) { + for (j = 0; j < main->contents.array[i].used; j++) { - content_delimited = fss_extended_read_is_delimited_at_depth(*data, j); + content_delimited = fss_extended_read_is_delimited_at_depth(*main, j); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); - if (j + 1 < data->contents.array[i].used) { - fss_extended_read_print_content_end(*data); + if (j + 1 < main->contents.array[i].used) { + fss_extended_read_print_content_end(*main); } } // for - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); } } else if (include_empty) { - if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { + if (main->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { if (!select) { - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); } } else { - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); } } } @@ -473,40 +473,40 @@ extern "C" { return F_none; } - if (data->contents.array[i].used > 0) { + if (main->contents.array[i].used > 0) { j = 0; - if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { - if (select < data->contents.array[i].used) { - content_delimited = fss_extended_read_is_delimited_at_depth(*data, select); + if (main->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { + if (select < main->contents.array[i].used) { + content_delimited = fss_extended_read_is_delimited_at_depth(*main, select); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[select], content_delimited ? *contents_delimits : except_none); - fss_extended_read_print_set_end(*data); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[select], content_delimited ? *contents_delimits : except_none); + fss_extended_read_print_set_end(*main); } } else { - for (j = 0; j < data->contents.array[i].used; j++) { + for (j = 0; j < main->contents.array[i].used; j++) { - content_delimited = fss_extended_read_is_delimited_at_depth(*data, j); + content_delimited = fss_extended_read_is_delimited_at_depth(*main, j); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); - if (j + 1 < data->contents.array[i].used) { - fss_extended_read_print_content_end(*data); + if (j + 1 < main->contents.array[i].used) { + fss_extended_read_print_content_end(*main); } } // for - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); } } else if (include_empty) { - if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { + if (main->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { if (!select) { - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); } } else { - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); } } @@ -520,35 +520,35 @@ extern "C" { return F_none; } - if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + if (main->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { f_array_length_t total = 0; - for (i = 0; i < data->objects.used; i++) { + for (i = 0; i < main->objects.used; i++) { if (!names[i]) { continue; } - if (!data->contents.array[i].used && !include_empty) { + if (!main->contents.array[i].used && !include_empty) { continue; } total++; } // for - fprintf(data->output.stream, "%llu%c", total, f_string_eol_s[0]); + fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]); return F_none; } - if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { + if (main->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { f_array_length_t line_current = 0; - for (i = 0, j = 0; i < data->contents.used; i++) { + for (i = 0, j = 0; i < main->contents.used; i++) { if (!names[i]) continue; - if (!data->contents.array[i].used) { + if (!main->contents.array[i].used) { if (include_empty) { if (line_current == line) { - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); break; } @@ -559,27 +559,27 @@ extern "C" { } if (line_current == line) { - if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { - if (select < data->contents.array[i].used) { - content_delimited = fss_extended_read_is_delimited_at_depth(*data, select); + if (main->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { + if (select < main->contents.array[i].used) { + content_delimited = fss_extended_read_is_delimited_at_depth(*main, select); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[select], content_delimited ? *contents_delimits : except_none); - fss_extended_read_print_set_end(*data); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[select], content_delimited ? *contents_delimits : except_none); + fss_extended_read_print_set_end(*main); } } else { - for (j = 0; j < data->contents.array[i].used; j++) { + for (j = 0; j < main->contents.array[i].used; j++) { - content_delimited = fss_extended_read_is_delimited_at_depth(*data, j); + content_delimited = fss_extended_read_is_delimited_at_depth(*main, j); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); - if (j + 1 < data->contents.array[i].used) { - fss_extended_read_print_content_end(*data); + if (j + 1 < main->contents.array[i].used) { + fss_extended_read_print_content_end(*main); } } // for - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); } break; @@ -591,38 +591,38 @@ extern "C" { return F_none; } - for (i = 0, j = 0; i < data->contents.used; i++) { + for (i = 0, j = 0; i < main->contents.used; i++) { if (!names[i]) continue; - if (!data->contents.array[i].used) { + if (!main->contents.array[i].used) { if (include_empty && !select) { - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); } continue; } - if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { - if (select < data->contents.array[i].used) { - content_delimited = fss_extended_read_is_delimited_at_depth(*data, select); + if (main->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { + if (select < main->contents.array[i].used) { + content_delimited = fss_extended_read_is_delimited_at_depth(*main, select); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[select], content_delimited ? *contents_delimits : except_none); - fss_extended_read_print_set_end(*data); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[select], content_delimited ? *contents_delimits : except_none); + fss_extended_read_print_set_end(*main); } } else { - for (j = 0; j < data->contents.array[i].used; j++) { + for (j = 0; j < main->contents.array[i].used; j++) { - content_delimited = fss_extended_read_is_delimited_at_depth(*data, j); + content_delimited = fss_extended_read_is_delimited_at_depth(*main, j); - f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); + f_print_except_dynamic_partial(main->output.stream, main->buffer, main->contents.array[i].array[j], content_delimited ? *contents_delimits : except_none); - if (j + 1 < data->contents.array[i].used) { - fss_extended_read_print_content_end(*data); + if (j + 1 < main->contents.array[i].used) { + fss_extended_read_print_content_end(*main); } } // for - fss_extended_read_print_set_end(*data); + fss_extended_read_print_set_end(*main); } } // for @@ -631,37 +631,37 @@ extern "C" { #endif // _di_fss_extended_read_main_process_file_ #ifndef _di_fss_extended_read_print_object_end_ - void fss_extended_read_print_object_end(const fss_extended_read_data_t data) { + void fss_extended_read_print_object_end(const fss_extended_read_main_t main) { - if (data.parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_read_pipe_content_start); + if (main.parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_extended_read_pipe_content_start); } else { - fprintf(data.output.stream, "%c", f_fss_space); + fprintf(main.output.stream, "%c", f_fss_space); } } #endif // _di_fss_extended_read_print_object_end_ #ifndef _di_fss_extended_read_print_content_end_ - void fss_extended_read_print_content_end(const fss_extended_read_data_t data) { + void fss_extended_read_print_content_end(const fss_extended_read_main_t main) { - if (data.parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_read_pipe_content_start); + if (main.parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_extended_read_pipe_content_start); } else { - fprintf(data.output.stream, "%c", f_fss_space); + fprintf(main.output.stream, "%c", f_fss_space); } } #endif // _di_fss_extended_read_print_content_end_ #ifndef _di_fss_extended_read_print_set_end_ - void fss_extended_read_print_set_end(const fss_extended_read_data_t data) { + void fss_extended_read_print_set_end(const fss_extended_read_main_t main) { - if (data.parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_read_pipe_content_end); + if (main.parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) { + fprintf(main.output.stream, "%c", fss_extended_read_pipe_content_end); } else { - fprintf(data.output.stream, "%c", f_fss_eol); + fprintf(main.output.stream, "%c", f_fss_eol); } } #endif // _di_fss_extended_read_print_set_end_ diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.h b/level_3/fss_extended_read/c/private-fss_extended_read.h index b2c2b4a..09d35f5 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.h +++ b/level_3/fss_extended_read/c/private-fss_extended_read.h @@ -112,8 +112,8 @@ extern "C" { /** * Determine if the given depth is to be delimited or not. * - * @param data - * The program specific data. + * @param main + * The program specific main. * @param depth * The depth to check. * @@ -122,7 +122,7 @@ extern "C" { * F_false if not delimited. */ #ifndef _di_fss_extended_read_is_delimited_at_depth_ - extern f_status_t fss_extended_read_is_delimited_at_depth(const fss_extended_read_data_t data, const f_array_length_t depth) f_attribute_visibility_internal; + extern f_status_t fss_extended_read_is_delimited_at_depth(const fss_extended_read_main_t main, const f_array_length_t depth) f_attribute_visibility_internal; #endif // _di_fss_extended_read_is_delimited_at_depth_ /** @@ -132,8 +132,8 @@ extern "C" { * * @param arguments * The console arguments to pre-process. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param depths * This stores the pre-processed depth parameters. * @@ -143,7 +143,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fss_extended_read_main_preprocess_depth_ - extern f_status_t fss_extended_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_read_data_t data, fss_extended_read_depths_t *depths) f_attribute_visibility_internal; + extern f_status_t fss_extended_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_read_main_t main, fss_extended_read_depths_t *depths) f_attribute_visibility_internal; #endif // _di_fss_extended_read_main_preprocess_depth_ /** @@ -151,8 +151,8 @@ extern "C" { * * @param arguments * The console arguments passed to the program. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param file_name * The name of the file being processed. * @param depths @@ -170,37 +170,37 @@ extern "C" { * @see fss_extended_read_main_preprocess_depth() */ #ifndef _di_fss_extended_read_main_process_file_ - extern f_status_t fss_extended_read_main_process_file(const f_console_arguments_t arguments, fss_extended_read_data_t *data, const f_string_t file_name, const fss_extended_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) f_attribute_visibility_internal; + extern f_status_t fss_extended_read_main_process_file(const f_console_arguments_t arguments, fss_extended_read_main_t *main, const f_string_t file_name, const fss_extended_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) f_attribute_visibility_internal; #endif // _di_fss_extended_read_main_process_file_ /** * Print the end of an object (which is essentially the start of a content). * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_extended_read_print_object_end_ - extern void fss_extended_read_print_object_end(const fss_extended_read_data_t data) f_attribute_visibility_internal; + extern void fss_extended_read_print_object_end(const fss_extended_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_extended_read_print_object_end_ /** * Print the end of an content. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_extended_read_print_content_end_ - extern void fss_extended_read_print_content_end(const fss_extended_read_data_t data) f_attribute_visibility_internal; + extern void fss_extended_read_print_content_end(const fss_extended_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_extended_read_print_content_end_ /** * Print the end of an object/content set. * - * @param data - * The program specific data. + * @param main + * The program specific main. */ #ifndef _di_fss_extended_read_print_set_end_ - extern void fss_extended_read_print_set_end(const fss_extended_read_data_t data) f_attribute_visibility_internal; + extern void fss_extended_read_print_set_end(const fss_extended_read_main_t main) f_attribute_visibility_internal; #endif // _di_fss_extended_read_print_set_end_ #ifdef __cplusplus diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index 9fa7856..454c733 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -84,30 +84,30 @@ extern "C" { #endif // _di_fss_extended_write_print_help_ #ifndef _di_fss_extended_write_main_ - f_status_t fss_extended_write_main(const f_console_arguments_t arguments, fss_extended_write_data_t *data) { + f_status_t fss_extended_write_main(const f_console_arguments_t arguments, fss_extended_write_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_extended_write_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_extended_write_total_parameters); { f_console_parameter_id_t ids[3] = { fss_extended_write_parameter_no_color, fss_extended_write_parameter_light, fss_extended_write_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_extended_write_data_delete(data); + fss_extended_write_main_delete(main); return F_status_set_error(status); } } @@ -121,38 +121,38 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_extended_write_data_delete(data); + fss_extended_write_main_delete(main); return status; } if (choice == fss_extended_write_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_extended_write_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_extended_write_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_extended_write_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_extended_write_parameter_help].result == f_console_result_found) { - fss_extended_write_print_help(data->output, data->context); + if (main->parameters[fss_extended_write_parameter_help].result == f_console_result_found) { + fss_extended_write_print_help(main->output, main->context); - fss_extended_write_data_delete(data); + fss_extended_write_main_delete(main); return status; } - if (data->parameters[fss_extended_write_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_extended_write_version); + if (main->parameters[fss_extended_write_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_extended_write_version); - fss_extended_write_data_delete(data); + fss_extended_write_main_delete(main); return status; } @@ -163,61 +163,61 @@ extern "C" { output.flag = f_file_flag_create | f_file_flag_write_only | f_file_flag_append; if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_write_parameter_file].result == f_console_result_additional) { - if (data->parameters[fss_extended_write_parameter_file].values.used > 1) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_file); - f_color_print(data->error.to.stream, data->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[fss_extended_write_parameter_file].values.used > 1) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_file); + f_color_print(main->error.to.stream, main->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } else { - const f_array_length_t location = data->parameters[fss_extended_write_parameter_file].values.array[0]; + const f_array_length_t location = main->parameters[fss_extended_write_parameter_file].values.array[0]; output.id = -1; output.stream = 0; status = f_file_stream_open(arguments.argv[location], 0, &output); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); } } } - else if (data->parameters[fss_extended_write_parameter_file].result == f_console_result_found) { - fss_extended_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_extended_write_long_file); + else if (main->parameters[fss_extended_write_parameter_file].result == f_console_result_found) { + fss_extended_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_extended_write_long_file); status = F_status_set_error(F_parameter); } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_write_parameter_object].locations.used || data->parameters[fss_extended_write_parameter_content].locations.used) { - if (data->parameters[fss_extended_write_parameter_object].locations.used) { - if (data->parameters[fss_extended_write_parameter_object].locations.used != data->parameters[fss_extended_write_parameter_object].values.used) { - fss_extended_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_extended_write_long_object); + if (main->parameters[fss_extended_write_parameter_object].locations.used || main->parameters[fss_extended_write_parameter_content].locations.used) { + if (main->parameters[fss_extended_write_parameter_object].locations.used) { + if (main->parameters[fss_extended_write_parameter_object].locations.used != main->parameters[fss_extended_write_parameter_object].values.used) { + fss_extended_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_extended_write_long_object); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_write_parameter_content].locations.used != data->parameters[fss_extended_write_parameter_content].values.used) { - fss_extended_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_extended_write_long_content); + else if (main->parameters[fss_extended_write_parameter_content].locations.used != main->parameters[fss_extended_write_parameter_content].values.used) { + fss_extended_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_extended_write_long_content); status = F_status_set_error(F_parameter); } - else if (!data->parameters[fss_extended_write_parameter_content].locations.used && data->parameters[fss_extended_write_parameter_partial].result == f_console_result_none) { - fss_extended_write_error_parameter_at_least_once(*data); + else if (!main->parameters[fss_extended_write_parameter_content].locations.used && main->parameters[fss_extended_write_parameter_partial].result == f_console_result_none) { + fss_extended_write_error_parameter_at_least_once(*main); status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_write_parameter_content].locations.used && data->parameters[fss_extended_write_parameter_partial].locations.used) { - if (data->parameters[fss_extended_write_parameter_content].result == f_console_result_additional) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_partial); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter only allows either the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter or the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter, but not both.%c", f_string_eol_s[0]); + else if (main->parameters[fss_extended_write_parameter_content].locations.used && main->parameters[fss_extended_write_parameter_partial].locations.used) { + if (main->parameters[fss_extended_write_parameter_content].result == f_console_result_additional) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_partial); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter only allows either the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter or the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter, but not both.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -225,38 +225,38 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_write_parameter_content].result == f_console_result_additional) { - f_array_length_t location_object = data->parameters[fss_extended_write_parameter_object].locations.array[0]; - f_array_length_t location_content = data->parameters[fss_extended_write_parameter_content].locations.array[0]; - f_array_length_t location_sub_object = data->parameters[fss_extended_write_parameter_object].locations_sub.array[0]; - f_array_length_t location_sub_content = data->parameters[fss_extended_write_parameter_content].locations_sub.array[0]; + if (main->parameters[fss_extended_write_parameter_content].result == f_console_result_additional) { + f_array_length_t location_object = main->parameters[fss_extended_write_parameter_object].locations.array[0]; + f_array_length_t location_content = main->parameters[fss_extended_write_parameter_content].locations.array[0]; + f_array_length_t location_sub_object = main->parameters[fss_extended_write_parameter_object].locations_sub.array[0]; + f_array_length_t location_sub_content = main->parameters[fss_extended_write_parameter_content].locations_sub.array[0]; if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sEach ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter must be specified before a '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sEach ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter must be specified before a '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } else { - location_object = data->parameters[fss_extended_write_parameter_object].locations.array[data->parameters[fss_extended_write_parameter_object].locations.used - 1]; - location_content = data->parameters[fss_extended_write_parameter_content].locations.array[data->parameters[fss_extended_write_parameter_content].locations.used - 1]; - location_sub_object = data->parameters[fss_extended_write_parameter_object].locations_sub.array[data->parameters[fss_extended_write_parameter_object].locations_sub.used - 1]; - location_sub_content = data->parameters[fss_extended_write_parameter_content].locations_sub.array[data->parameters[fss_extended_write_parameter_content].locations_sub.used - 1]; + location_object = main->parameters[fss_extended_write_parameter_object].locations.array[main->parameters[fss_extended_write_parameter_object].locations.used - 1]; + location_content = main->parameters[fss_extended_write_parameter_content].locations.array[main->parameters[fss_extended_write_parameter_content].locations.used - 1]; + location_sub_object = main->parameters[fss_extended_write_parameter_object].locations_sub.array[main->parameters[fss_extended_write_parameter_object].locations_sub.used - 1]; + location_sub_content = main->parameters[fss_extended_write_parameter_content].locations_sub.array[main->parameters[fss_extended_write_parameter_content].locations_sub.used - 1]; if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sEach ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter must have at least one '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sEach ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter must have at least one '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -265,37 +265,37 @@ extern "C" { } } } - else if (data->parameters[fss_extended_write_parameter_content].locations.used) { - if (data->parameters[fss_extended_write_parameter_content].locations.used != data->parameters[fss_extended_write_parameter_content].values.used) { - fss_extended_write_error_parameter_value_missing_print(*data, f_console_symbol_long_enable_s, fss_extended_write_long_content); + else if (main->parameters[fss_extended_write_parameter_content].locations.used) { + if (main->parameters[fss_extended_write_parameter_content].locations.used != main->parameters[fss_extended_write_parameter_content].values.used) { + fss_extended_write_error_parameter_value_missing_print(*main, f_console_symbol_long_enable_s, fss_extended_write_long_content); status = F_status_set_error(F_parameter); } - else if (!data->parameters[fss_extended_write_parameter_partial].locations.used) { - fss_extended_write_error_parameter_at_least_once(*data); + else if (!main->parameters[fss_extended_write_parameter_partial].locations.used) { + fss_extended_write_error_parameter_at_least_once(*main); status = F_status_set_error(F_parameter); } } } - else if (!data->process_pipe) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThis requires either piped data or the use of the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + else if (!main->process_pipe) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThis requires either piped main or the use of the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->process_pipe) { - if (data->parameters[fss_extended_write_parameter_partial].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_partial); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter cannot be used when processing a pipe.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->process_pipe) { + if (main->parameters[fss_extended_write_parameter_partial].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_partial); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter cannot be used when processing a pipe.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -304,18 +304,18 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_write_parameter_prepend].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_write_parameter_prepend].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_write_parameter_prepend].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[fss_extended_write_parameter_prepend].values.array[data->parameters[fss_extended_write_parameter_prepend].values.used - 1]; + else if (main->parameters[fss_extended_write_parameter_prepend].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[fss_extended_write_parameter_prepend].values.array[main->parameters[fss_extended_write_parameter_prepend].values.used - 1]; const f_array_length_t length = strnlen(arguments.argv[index], f_console_parameter_size); // Even though this standard does not utilize this parameter, provide the validation for consistency. @@ -329,11 +329,11 @@ extern "C" { if (F_status_is_error(status)) break; if (status == F_false) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' must only contain whitespace.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' must only contain whitespace.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -342,11 +342,11 @@ extern "C" { } // for } else { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe value for the parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_prepend); - f_color_print(data->error.to.stream, data->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_prepend); + f_color_print(main->error.to.stream, main->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -355,25 +355,25 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_write_parameter_ignore].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_ignore); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no values were given.%c", f_string_eol_s[0]); + if (main->parameters[fss_extended_write_parameter_ignore].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_ignore); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no values were given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[fss_extended_write_parameter_ignore].result == f_console_result_additional) { - const f_array_length_t total_locations = data->parameters[fss_extended_write_parameter_ignore].locations.used; - const f_array_length_t total_arguments = data->parameters[fss_extended_write_parameter_ignore].values.used; + else if (main->parameters[fss_extended_write_parameter_ignore].result == f_console_result_additional) { + const f_array_length_t total_locations = main->parameters[fss_extended_write_parameter_ignore].locations.used; + const f_array_length_t total_arguments = main->parameters[fss_extended_write_parameter_ignore].values.used; if (total_locations * 2 > total_arguments) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_ignore); - f_color_print(data->error.to.stream, data->context.set.error, "' requires two values.%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_ignore); + f_color_print(main->error.to.stream, main->context.set.error, "' requires two values.%c", f_string_eol_s[0]); status = F_status_set_error(F_parameter); } @@ -383,14 +383,14 @@ extern "C" { f_fss_quote_t quote = f_fss_delimit_quote_double; if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_write_parameter_double].result == f_console_result_found) { - if (data->parameters[fss_extended_write_parameter_single].result == f_console_result_found) { - if (data->parameters[fss_extended_write_parameter_double].location < data->parameters[fss_extended_write_parameter_single].location) { + if (main->parameters[fss_extended_write_parameter_double].result == f_console_result_found) { + if (main->parameters[fss_extended_write_parameter_single].result == f_console_result_found) { + if (main->parameters[fss_extended_write_parameter_double].location < main->parameters[fss_extended_write_parameter_single].location) { quote = f_fss_delimit_quote_single; } } } - else if (data->parameters[fss_extended_write_parameter_single].result == f_console_result_found) { + else if (main->parameters[fss_extended_write_parameter_single].result == f_console_result_found) { quote = f_fss_delimit_quote_single; } } @@ -402,61 +402,61 @@ extern "C" { if (F_status_is_error_not(status)) { f_string_dynamic_t escaped = f_string_dynamic_t_initialize; - if (data->process_pipe) { - status = fss_extended_write_process_pipe(*data, output, quote, &buffer); + if (main->process_pipe) { + status = fss_extended_write_process_pipe(*main, output, quote, &buffer); if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sWhile processing the ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "input pipe"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sWhile processing the ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "input pipe"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); } } } if (F_status_is_error_not(status)) { - if (data->parameters[fss_extended_write_parameter_partial].result == f_console_result_found) { - if (data->parameters[fss_extended_write_parameter_object].result == f_console_result_additional) { + if (main->parameters[fss_extended_write_parameter_partial].result == f_console_result_found) { + if (main->parameters[fss_extended_write_parameter_object].result == f_console_result_additional) { contents.used = 0; - for (f_array_length_t i = 0; i < data->parameters[fss_extended_write_parameter_object].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[fss_extended_write_parameter_object].values.used; i++) { - object.string = arguments.argv[data->parameters[fss_extended_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[fss_extended_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; - status = fss_extended_write_process(*data, output, quote, &object, 0, &buffer); + status = fss_extended_write_process(*main, output, quote, &object, 0, &buffer); if (F_status_is_error(status)) break; } // for } else { object.used = 0; - status = f_string_dynamics_increase_by(data->parameters[fss_extended_write_parameter_content].values.used, &contents); + status = f_string_dynamics_increase_by(main->parameters[fss_extended_write_parameter_content].values.used, &contents); if (status == F_array_too_large) { status = F_status_set_error(status); } if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); } else { f_array_length_t i = 0; - for (; i < data->parameters[fss_extended_write_parameter_content].values.used; i++) { + for (; i < main->parameters[fss_extended_write_parameter_content].values.used; i++) { - contents.array[contents.used].string = arguments.argv[data->parameters[fss_extended_write_parameter_content].values.array[i]]; + contents.array[contents.used].string = arguments.argv[main->parameters[fss_extended_write_parameter_content].values.array[i]]; contents.array[contents.used].used = strnlen(contents.array[contents.used].string, f_console_parameter_size); contents.array[contents.used].size = contents.array[contents.used].used; contents.used++; } // for - status = fss_extended_write_process(*data, output, quote, 0, &contents, &buffer); + status = fss_extended_write_process(*main, output, quote, 0, &contents, &buffer); // clear the contents array of the static strings to avoid deallocation attempts on static variables. - for (; i < data->parameters[fss_extended_write_parameter_content].values.used; i++) { + for (; i < main->parameters[fss_extended_write_parameter_content].values.used; i++) { contents.array[contents.used].string = 0; contents.array[contents.used].used = 0; contents.array[contents.used].size = 0; @@ -474,32 +474,32 @@ extern "C" { f_array_length_t object_next = 0; f_array_length_t content_current = 0; - for (; i < data->parameters[fss_extended_write_parameter_object].values.used; i++) { + for (; i < main->parameters[fss_extended_write_parameter_object].values.used; i++) { - object_current = data->parameters[fss_extended_write_parameter_object].locations.array[i]; + object_current = main->parameters[fss_extended_write_parameter_object].locations.array[i]; - if (i + 1 < data->parameters[fss_extended_write_parameter_object].values.used) { - object_next = data->parameters[fss_extended_write_parameter_object].locations.array[i + 1]; + if (i + 1 < main->parameters[fss_extended_write_parameter_object].values.used) { + object_next = main->parameters[fss_extended_write_parameter_object].locations.array[i + 1]; } - object.string = arguments.argv[data->parameters[fss_extended_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[fss_extended_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; contents.used = 0; - for (; j < data->parameters[fss_extended_write_parameter_content].values.used; j++) { + for (; j < main->parameters[fss_extended_write_parameter_content].values.used; j++) { - content_current = data->parameters[fss_extended_write_parameter_content].locations.array[j]; + content_current = main->parameters[fss_extended_write_parameter_content].locations.array[j]; - if (i + 1 < data->parameters[fss_extended_write_parameter_object].values.used) { + if (i + 1 < main->parameters[fss_extended_write_parameter_object].values.used) { if (content_current < object_current || content_current > object_next) break; } status = f_string_dynamics_increase_by(f_fss_default_allocation_step, &contents); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); break; } @@ -507,10 +507,10 @@ extern "C" { contents.array[contents.used].used = 0; } - status = f_string_append(arguments.argv[data->parameters[fss_extended_write_parameter_content].values.array[j]], strnlen(arguments.argv[data->parameters[fss_extended_write_parameter_content].values.array[j]], f_console_parameter_size), &contents.array[contents.used]); + status = f_string_append(arguments.argv[main->parameters[fss_extended_write_parameter_content].values.array[j]], strnlen(arguments.argv[main->parameters[fss_extended_write_parameter_content].values.array[j]], f_console_parameter_size), &contents.array[contents.used]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true); break; } @@ -519,22 +519,22 @@ extern "C" { if (F_status_is_error(status)) break; - status = fss_extended_write_process(*data, output, quote, &object, &contents, &buffer); + status = fss_extended_write_process(*main, output, quote, &object, &contents, &buffer); if (F_status_is_error(status)) break; } // for } if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sWhile processing the ", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "input arguments"); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sWhile processing the ", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "input arguments"); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); } } - else if (data->error.verbosity != f_console_verbosity_quiet && data->parameters[fss_extended_write_parameter_file].result == f_console_result_none) { + else if (main->error.verbosity != f_console_verbosity_quiet && main->parameters[fss_extended_write_parameter_file].result == f_console_result_none) { // ensure there is always a newline at the end, unless in quiet mode. - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + fprintf(main->output.stream, "%c", f_string_eol_s[0]); } } @@ -549,43 +549,43 @@ extern "C" { contents.used = 0; } - if (data->parameters[fss_extended_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[fss_extended_write_parameter_file].result == f_console_result_additional) { if (output.id != -1) { f_file_stream_close(F_true, &output); } } // ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (data->error.verbosity != f_console_verbosity_quiet) { + if (main->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status)) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } } f_macro_string_dynamic_t_delete_simple(buffer); f_macro_string_dynamic_t_delete_simple(object); f_macro_string_dynamics_t_delete_simple(contents); - fss_extended_write_data_delete(data); + fss_extended_write_main_delete(main); return status; } #endif // _di_fss_extended_write_main_ -#ifndef _di_fss_extended_write_data_delete_ - f_status_t fss_extended_write_data_delete(fss_extended_write_data_t *data) { +#ifndef _di_fss_extended_write_main_delete_ + f_status_t fss_extended_write_main_delete(fss_extended_write_main_t *main) { for (f_array_length_t i = 0; i < fss_extended_write_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_extended_write_data_delete_ +#endif // _di_fss_extended_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_write/c/fss_extended_write.h b/level_3/fss_extended_write/c/fss_extended_write.h index f7f9805..657ae39 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.h +++ b/level_3/fss_extended_write/c/fss_extended_write.h @@ -126,7 +126,7 @@ extern "C" { #define fss_extended_write_total_parameters 18 #endif // _di_fss_extended_write_defines_ -#ifndef _di_fss_extended_write_data_t_ +#ifndef _di_fss_extended_write_main_t_ typedef struct { f_console_parameter_t parameters[fss_extended_write_total_parameters]; @@ -138,9 +138,9 @@ extern "C" { f_string_static_t prepend; f_color_context_t context; - } fss_extended_write_data_t; + } fss_extended_write_main_t; - #define fss_extended_write_data_t_initialize \ + #define fss_extended_write_main_t_initialize \ { \ fss_extended_write_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -150,7 +150,7 @@ extern "C" { f_string_static_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_fss_extended_write_data_t_ +#endif // _di_fss_extended_write_main_t_ /** * Print help. @@ -170,31 +170,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_extended_write_data_delete() after executing this. + * Be sure to call fss_extended_write_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see fss_extended_write_data_delete() + * @see fss_extended_write_main_delete() */ #ifndef _di_fss_extended_write_main_ - extern f_status_t fss_extended_write_main(const f_console_arguments_t arguments, fss_extended_write_data_t *data); + extern f_status_t fss_extended_write_main(const f_console_arguments_t arguments, fss_extended_write_main_t *main); #endif // _di_fss_extended_write_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_extended_write_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -203,9 +203,9 @@ extern "C" { * * @see fss_extended_write_main() */ -#ifndef _di_fss_extended_write_data_delete_ - extern f_status_t fss_extended_write_data_delete(fss_extended_write_data_t *data); -#endif // _di_fss_extended_write_data_delete_ +#ifndef _di_fss_extended_write_main_delete_ + extern f_status_t fss_extended_write_main_delete(fss_extended_write_main_t *main); +#endif // _di_fss_extended_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_write/c/main.c b/level_3/fss_extended_write/c/main.c index d6633c0..bfbeb9a 100644 --- a/level_3/fss_extended_write/c/main.c +++ b/level_3/fss_extended_write/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_extended_write_data_t data = fss_extended_write_data_t_initialize; + fss_extended_write_main_t main = fss_extended_write_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_extended_write_main(arguments, &data); + const f_status_t status = fss_extended_write_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_extended_write/c/private-fss_extended_write.c b/level_3/fss_extended_write/c/private-fss_extended_write.c index 35f2b0f..2ffb476 100644 --- a/level_3/fss_extended_write/c/private-fss_extended_write.c +++ b/level_3/fss_extended_write/c/private-fss_extended_write.c @@ -6,53 +6,53 @@ extern "C" { #endif #ifndef _di_fss_extended_write_error_parameter_at_least_once_print_ - void fss_extended_write_error_parameter_at_least_once(const fss_extended_write_data_t data) { + void fss_extended_write_error_parameter_at_least_once(const fss_extended_write_main_t main) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sMust specify the '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_object); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter at least once and the '"); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_content); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter one or more times when not specifying the "); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_partial); - f_color_print(data.error.to.stream, data.context.set.error, "' parameter.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sMust specify the '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_object); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter at least once and the '"); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_content); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter one or more times when not specifying the "); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_write_long_partial); + f_color_print(main.error.to.stream, main.context.set.error, "' parameter.%c", f_string_eol_s[0]); } #endif // _di_fss_extended_write_error_parameter_at_least_once_print_ #ifndef _di_fss_extended_write_error_parameter_value_missing_print_ - void fss_extended_write_error_parameter_value_missing_print(const fss_extended_write_data_t data, const f_string_t symbol, const f_string_t parameter) { + void fss_extended_write_error_parameter_value_missing_print(const fss_extended_write_main_t main, const f_string_t symbol, const f_string_t parameter) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "%s%s", symbol, parameter); - f_color_print(data.error.to.stream, data.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", symbol, parameter); + f_color_print(main.error.to.stream, main.context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } #endif // _di_fss_extended_write_error_parameter_value_missing_print_ #ifndef _di_fss_extended_write_error_parameter_unsupported_eol_print_ - void fss_extended_write_error_parameter_unsupported_eol_print(const fss_extended_write_data_t data) { + void fss_extended_write_error_parameter_unsupported_eol_print(const fss_extended_write_main_t main) { - if (data.error.verbosity == f_console_verbosity_quiet) { + if (main.error.verbosity == f_console_verbosity_quiet) { return; } - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThis standard does not support end of line character '", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "\\n"); - f_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol_s[0]); + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThis standard does not support end of line character '", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "\\n"); + f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]); } #endif // _di_fss_extended_write_error_parameter_unsupported_eol_print_ #ifndef _di_fss_extended_write_process_ - f_status_t fss_extended_write_process(const fss_extended_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) { + f_status_t fss_extended_write_process(const fss_extended_write_main_t main, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_string_range_t range = f_string_range_t_initialize; @@ -70,7 +70,7 @@ extern "C" { } if (contents && contents->used) { - if (data.parameters[fss_extended_write_parameter_trim].result == f_console_result_found) { + if (main.parameters[fss_extended_write_parameter_trim].result == f_console_result_found) { complete = f_fss_complete_full_trim; } else { @@ -81,13 +81,13 @@ extern "C" { status = fl_fss_extended_object_write_string(*object, quote, complete, &range, buffer); if (F_status_set_fine(status) == F_none_eol) { - fss_extended_write_error_parameter_unsupported_eol_print(data); + fss_extended_write_error_parameter_unsupported_eol_print(main); return F_status_set_error(F_supported_not); } if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_extended_object_write_string", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_extended_object_write_string", F_true); return F_status_set_error(status); } } @@ -108,13 +108,13 @@ extern "C" { status = fl_fss_extended_content_write_string(contents->array[i], quote, i + 1 < contents->used ? f_fss_complete_next : f_fss_complete_end, &range, buffer); if (F_status_set_fine(status) == F_none_eol) { - fss_extended_write_error_parameter_unsupported_eol_print(data); + fss_extended_write_error_parameter_unsupported_eol_print(main); return F_status_set_error(F_supported_not); } if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_fss_extended_content_write_string", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fl_fss_extended_content_write_string", F_true); return F_status_set_error(status); } } // for @@ -124,7 +124,7 @@ extern "C" { status = f_string_append(f_string_eol, 1, buffer); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_append", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true); return status; } } @@ -137,7 +137,7 @@ extern "C" { #endif // _di_fss_extended_write_process_ #ifndef _di_fss_extended_write_process_pipe_ - f_status_t fss_extended_write_process_pipe(const fss_extended_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { + f_status_t fss_extended_write_process_pipe(const fss_extended_write_main_t main, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) { f_status_t status = F_none; f_status_t status_pipe = F_none; @@ -169,7 +169,7 @@ extern "C" { status_pipe = f_file_read_block(input, &block); if (F_status_is_error(status_pipe)) { - fll_error_print(data.error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); + fll_error_print(main.error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); status_pipe = F_status_set_error(F_pipe); break; @@ -199,7 +199,7 @@ extern "C" { status = f_string_dynamic_increase_by(block.used, &object); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); break; } } @@ -240,7 +240,7 @@ extern "C" { status = f_string_dynamics_increase_by(f_fss_default_allocation_step, &contents); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); break; } } @@ -265,7 +265,7 @@ extern "C" { status = f_string_dynamics_increase_by(f_fss_default_allocation_step, &contents); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); break; } } @@ -286,7 +286,7 @@ extern "C" { } if (F_status_set_fine(status) == F_none_eol) { - fss_extended_write_error_parameter_unsupported_eol_print(data); + fss_extended_write_error_parameter_unsupported_eol_print(main); status = F_status_set_error(F_supported_not); break; @@ -296,7 +296,7 @@ extern "C" { status = f_string_dynamic_increase_by(f_fss_default_allocation_step, &contents.array[contents.used - 1]); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); break; } } @@ -312,7 +312,7 @@ extern "C" { } if (state == 0x4) { - status = fss_extended_write_process(data, output, quote, &object, &contents, buffer); + status = fss_extended_write_process(main, output, quote, &object, &contents, buffer); if (F_status_is_error(status)) break; state = 0; @@ -321,7 +321,7 @@ extern "C" { // if the pipe ended before finishing, then attempt to wrap up. if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) { - status = fss_extended_write_process(data, output, quote, &object, &contents, buffer); + status = fss_extended_write_process(main, output, quote, &object, &contents, buffer); } f_macro_string_dynamic_t_delete_simple(block); diff --git a/level_3/fss_extended_write/c/private-fss_extended_write.h b/level_3/fss_extended_write/c/private-fss_extended_write.h index c8f2be3..585f7d4 100644 --- a/level_3/fss_extended_write/c/private-fss_extended_write.h +++ b/level_3/fss_extended_write/c/private-fss_extended_write.h @@ -16,21 +16,21 @@ extern "C" { * Print an message about the object and content parameters not being specified the correct number of times. * * @param data - * The program data. + * The main data. * * @return * F_none on success. * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_write_error_parameter_at_least_once_print_ - void fss_extended_write_error_parameter_at_least_once(const fss_extended_write_data_t data) f_attribute_visibility_internal; + void fss_extended_write_error_parameter_at_least_once(const fss_extended_write_main_t data) f_attribute_visibility_internal; #endif // _di_fss_extended_write_error_parameter_at_least_once_print_ /** * Print an message about a parameter missing a value. * * @param data - * The program data. + * The main data. * @param symbol * The console symbol, such as "--" in "--help". * @param parameter @@ -41,28 +41,28 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_write_error_parameter_value_missing_print_ - void fss_extended_write_error_parameter_value_missing_print(const fss_extended_write_data_t data, const f_string_t symbol, const f_string_t parameter) f_attribute_visibility_internal; + void fss_extended_write_error_parameter_value_missing_print(const fss_extended_write_main_t data, const f_string_t symbol, const f_string_t parameter) f_attribute_visibility_internal; #endif // _di_fss_extended_write_error_parameter_value_missing_print_ /** * Print an message about a parameter EOL being unsupported. * * @param data - * The program data. + * The main data. * * @return * F_none on success. * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_write_error_parameter_unsupported_eol_print_ - void fss_extended_write_error_parameter_unsupported_eol_print(const fss_extended_write_data_t data) f_attribute_visibility_internal; + void fss_extended_write_error_parameter_unsupported_eol_print(const fss_extended_write_main_t data) f_attribute_visibility_internal; #endif // _di_fss_extended_write_error_parameter_unsupported_eol_print_ /** * Process a given object and content, printing the FSS if valid or an error if invalid. * * @param data - * The program data. + * The main data. * @param output * The file to output to. * @param quote @@ -82,14 +82,14 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_write_process_ - extern f_status_t fss_extended_write_process(const fss_extended_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) f_attribute_visibility_internal; + extern f_status_t fss_extended_write_process(const fss_extended_write_main_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) f_attribute_visibility_internal; #endif // _di_fss_extended_write_process_ /** * Process the pipe, reading from the pipe and writing to the output. * * @param data - * The program data. + * The main data. * @param output * The file to output to. * @param quote @@ -103,7 +103,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_fss_extended_write_process_pipe_ - extern f_status_t fss_extended_write_process_pipe(const fss_extended_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) f_attribute_visibility_internal; + extern f_status_t fss_extended_write_process_pipe(const fss_extended_write_main_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) f_attribute_visibility_internal; #endif // _di_fss_extended_write_process_pipe_ #ifdef __cplusplus diff --git a/level_3/fss_status_code/c/fss_status_code.c b/level_3/fss_status_code/c/fss_status_code.c index 62e956f..763fce6 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -34,30 +34,30 @@ extern "C" { #endif // _di_fss_status_code_print_help_ #ifndef _di_fss_status_code_main_ - f_status_t fss_status_code_main(const f_console_arguments_t arguments, fss_status_code_data_t *data) { + f_status_t fss_status_code_main(const f_console_arguments_t arguments, fss_status_code_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_status_code_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, fss_status_code_total_parameters); { f_console_parameter_id_t ids[3] = { fss_status_code_parameter_no_color, fss_status_code_parameter_light, fss_status_code_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fss_status_code_data_delete(data); + fss_status_code_main_delete(main); return F_status_set_error(status); } } @@ -71,92 +71,92 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fss_status_code_data_delete(data); + fss_status_code_main_delete(main); return status; } if (choice == fss_status_code_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == fss_status_code_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == fss_status_code_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == fss_status_code_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[fss_status_code_parameter_help].result == f_console_result_found) { - fss_status_code_print_help(data->output, data->context); + if (main->parameters[fss_status_code_parameter_help].result == f_console_result_found) { + fss_status_code_print_help(main->output, main->context); - fss_status_code_data_delete(data); + fss_status_code_main_delete(main); return F_none; } - if (data->parameters[fss_status_code_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, fss_status_code_version); + if (main->parameters[fss_status_code_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, fss_status_code_version); - fss_status_code_data_delete(data); + fss_status_code_main_delete(main); return F_none; } - if (data->parameters[fss_status_code_parameter_is_error].result == f_console_result_found) { - if (data->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_error); - f_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_warning); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->parameters[fss_status_code_parameter_is_error].result == f_console_result_found) { + if (main->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_error); + f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter "); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_warning); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); - fss_status_code_data_delete(data); + fss_status_code_main_delete(main); return F_status_set_error(status); } - else if (data->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_error); - f_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_fine); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); - - fss_status_code_data_delete(data); + else if (main->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_error); + f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter "); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_fine); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); + + fss_status_code_main_delete(main); return F_status_set_error(status); } } - else if (data->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found && data->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_warning); - f_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_fine); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); - - fss_status_code_data_delete(data); + else if (main->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found && main->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_warning); + f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter "); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_fine); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); + + fss_status_code_main_delete(main); return F_status_set_error(status); } - if (data->remaining.used == 0 && !data->process_pipe) { - f_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify an error code.%c", fll_error_print_error, f_string_eol_s[0]); + if (main->remaining.used == 0 && !main->process_pipe) { + f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify an error code.%c", fll_error_print_error, f_string_eol_s[0]); - fss_status_code_data_delete(data); + fss_status_code_main_delete(main); return F_status_set_error(F_parameter); } f_status_t status2 = F_none; - if (data->parameters[fss_status_code_parameter_is_error].result == f_console_result_found || data->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found || data->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) { - if (data->process_pipe) { - // @todo: call fss_status_code_process_check() here for all data from pipe that is space separated. + if (main->parameters[fss_status_code_parameter_is_error].result == f_console_result_found || main->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found || main->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) { + if (main->process_pipe) { + // @todo: call fss_status_code_process_check() here for all main from pipe that is space separated. } - if (data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { + if (main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { - status2 = fss_status_code_process_check(*data, arguments.argv[data->remaining.array[i]]); + status2 = fss_status_code_process_check(*main, arguments.argv[main->remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; @@ -164,15 +164,15 @@ extern "C" { } // for } } - else if (data->parameters[fss_status_code_parameter_number].result == f_console_result_found) { - if (data->process_pipe) { - // @todo: call fss_status_code_process_number() here for all data from pipe that is space separated. + else if (main->parameters[fss_status_code_parameter_number].result == f_console_result_found) { + if (main->process_pipe) { + // @todo: call fss_status_code_process_number() here for all main from pipe that is space separated. } - if (data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { + if (main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { - status2 = fss_status_code_process_number(*data, arguments.argv[data->remaining.array[i]]); + status2 = fss_status_code_process_number(*main, arguments.argv[main->remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; @@ -181,13 +181,13 @@ extern "C" { } } else { - if (data->process_pipe) { - // @todo: call fss_status_code_process_normal() here for all data from pipe that is space separated. + if (main->process_pipe) { + // @todo: call fss_status_code_process_normal() here for all main from pipe that is space separated. } - if (data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { - status2 = fss_status_code_process_normal(*data, arguments.argv[data->remaining.array[i]]); + if (main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { + status2 = fss_status_code_process_normal(*main, arguments.argv[main->remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; @@ -196,27 +196,27 @@ extern "C" { } } - fss_status_code_data_delete(data); + fss_status_code_main_delete(main); return status; } #endif // _di_fss_status_code_main_ -#ifndef _di_fss_status_code_data_delete_ - f_status_t fss_status_code_data_delete(fss_status_code_data_t *data) { +#ifndef _di_fss_status_code_main_delete_ + f_status_t fss_status_code_main_delete(fss_status_code_main_t *main) { for (f_array_length_t i = 0; i < fss_status_code_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_fss_status_code_data_delete_ +#endif // _di_fss_status_code_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_status_code/c/fss_status_code.h b/level_3/fss_status_code/c/fss_status_code.h index d17f185..d7c5c3a 100644 --- a/level_3/fss_status_code/c/fss_status_code.h +++ b/level_3/fss_status_code/c/fss_status_code.h @@ -103,7 +103,7 @@ extern "C" { #define fss_status_code_total_parameters 13 #endif // _di_fss_status_code_defines_ -#ifndef _di_fss_status_code_data_t_ +#ifndef _di_fss_status_code_main_t_ typedef struct { f_console_parameter_t parameters[fss_status_code_total_parameters]; @@ -114,9 +114,9 @@ extern "C" { fll_error_print_t error; f_color_context_t context; - } fss_status_code_data_t; + } fss_status_code_main_t; - #define fss_status_code_data_t_initialize \ + #define fss_status_code_main_t_initialize \ { \ fss_status_code_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -125,7 +125,7 @@ extern "C" { fll_error_print_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_fss_status_code_data_t_ +#endif // _di_fss_status_code_main_t_ /** * Print help. @@ -145,31 +145,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call fss_status_code_data_delete() after executing this. + * Be sure to call fss_status_code_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see fss_status_code_data_delete() + * @see fss_status_code_main_delete() */ #ifndef _di_fss_status_code_main_ - extern f_status_t fss_status_code_main(const f_console_arguments_t arguments, fss_status_code_data_t *data); + extern f_status_t fss_status_code_main(const f_console_arguments_t arguments, fss_status_code_main_t *main); #endif // _di_fss_status_code_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing fss_status_code_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -178,9 +178,9 @@ extern "C" { * * @see fss_status_code_main() */ -#ifndef _di_fss_status_code_data_delete_ - extern f_status_t fss_status_code_data_delete(fss_status_code_data_t *data); -#endif // _di_fss_status_code_data_delete_ +#ifndef _di_fss_status_code_main_delete_ + extern f_status_t fss_status_code_main_delete(fss_status_code_main_t *main); +#endif // _di_fss_status_code_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_status_code/c/main.c b/level_3/fss_status_code/c/main.c index 85ed255..760d7e6 100644 --- a/level_3/fss_status_code/c/main.c +++ b/level_3/fss_status_code/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - fss_status_code_data_t data = fss_status_code_data_t_initialize; + fss_status_code_main_t main = fss_status_code_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = fss_status_code_main(arguments, &data); + const f_status_t status = fss_status_code_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/fss_status_code/c/private-fss_status_code.c b/level_3/fss_status_code/c/private-fss_status_code.c index c5fe1bb..e9fd186 100644 --- a/level_3/fss_status_code/c/private-fss_status_code.c +++ b/level_3/fss_status_code/c/private-fss_status_code.c @@ -6,13 +6,13 @@ extern "C" { #endif #ifndef _di_fss_status_code_process_check_ - f_status_t fss_status_code_process_check(const fss_status_code_data_t data, const f_string_t value) { + f_status_t fss_status_code_process_check(const fss_status_code_main_t main, const f_string_t value) { f_number_unsigned_t number = 0; - f_status_t status = fss_status_code_convert_number(data, value, &number); + f_status_t status = fss_status_code_convert_number(main, value, &number); if (F_status_is_error(status)) return status; - if (data.parameters[fss_status_code_parameter_is_error].result == f_console_result_found) { + if (main.parameters[fss_status_code_parameter_is_error].result == f_console_result_found) { if (F_status_is_error(number)) { printf("%s\n", FL_status_string_true); } @@ -20,7 +20,7 @@ extern "C" { printf("%s\n", FL_status_string_false); } } - else if (data.parameters[fss_status_code_parameter_is_warning].result == f_console_result_found) { + else if (main.parameters[fss_status_code_parameter_is_warning].result == f_console_result_found) { if (F_status_is_warning(number)) { printf("%s\n", FL_status_string_true); } @@ -28,7 +28,7 @@ extern "C" { printf("%s\n", FL_status_string_false); } } - else if (data.parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) { + else if (main.parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) { if (F_status_is_fine(number)) { printf("%s\n", FL_status_string_true); } @@ -42,7 +42,7 @@ extern "C" { #endif // _di_fss_status_code_process_check_ #ifndef _di_fss_status_code_process_number_ - f_status_t fss_status_code_process_number(const fss_status_code_data_t data, const f_string_t value) { + f_status_t fss_status_code_process_number(const fss_status_code_main_t main, const f_string_t value) { f_status_t status = F_none; { @@ -53,13 +53,13 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(value, range, &number); if (status == F_none) { - f_color_print(data.output.stream, data.context.set.error, "invalid name%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "invalid name%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } if (status == F_data_not || F_status_set_fine(status) == F_parameter) { - f_color_print(data.output.stream, data.context.set.error, "invalid data%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "invalid main%c", f_string_eol_s[0]); return status; } @@ -76,10 +76,10 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_data) { - f_color_print(data.output.stream, data.context.set.error, "unknown name%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "unknown name%c", f_string_eol_s[0]); } else { - f_color_print(data.output.stream, data.context.set.error, "failed to convert%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "failed to convert%c", f_string_eol_s[0]); } return status; @@ -87,7 +87,7 @@ extern "C" { } if (status == F_data) { - f_color_print(data.output.stream, data.context.set.warning, "unknown code%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.warning, "unknown code%c", f_string_eol_s[0]); return F_none; } @@ -99,10 +99,10 @@ extern "C" { #endif // _di_fss_status_code_process_number_ #ifndef _di_fss_status_code_process_normal_ - f_status_t fss_status_code_process_normal(const fss_status_code_data_t data, const f_string_t value) { + f_status_t fss_status_code_process_normal(const fss_status_code_main_t main, const f_string_t value) { f_number_unsigned_t number = 0; - f_status_t status = fss_status_code_convert_number(data, value, &number); + f_status_t status = fss_status_code_convert_number(main, value, &number); if (F_status_is_error(status)) return status; const f_status_t code = (f_status_t) number; @@ -112,10 +112,10 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_data) { - f_color_print(data.output.stream, data.context.set.error, "unknown code%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "unknown code%c", f_string_eol_s[0]); } else { - f_color_print(data.output.stream, data.context.set.error, "failed to convert%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "failed to convert%c", f_string_eol_s[0]); } return status; @@ -128,23 +128,23 @@ extern "C" { #endif // _di_fss_status_code_process_normal_ #ifndef _di_fss_status_code_convert_number_ - f_status_t fss_status_code_convert_number(const fss_status_code_data_t data, const f_string_t value, f_number_unsigned_t *number) { + f_status_t fss_status_code_convert_number(const fss_status_code_main_t main, const f_string_t value, f_number_unsigned_t *number) { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(value)); f_status_t status = fl_conversion_string_to_number_unsigned(value, range, number); if (*number > F_status_size_max_with_signal) { - f_color_print(data.output.stream, data.context.set.error, "out of range%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "out of range%c", f_string_eol_s[0]); return status; } if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_number_negative) { - f_color_print(data.output.stream, data.context.set.error, "out of range%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "out of range%c", f_string_eol_s[0]); } else { - f_color_print(data.output.stream, data.context.set.error, "invalid number%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "invalid number%c", f_string_eol_s[0]); } return status; diff --git a/level_3/fss_status_code/c/private-fss_status_code.h b/level_3/fss_status_code/c/private-fss_status_code.h index 65bbfdf..59f550d 100644 --- a/level_3/fss_status_code/c/private-fss_status_code.h +++ b/level_3/fss_status_code/c/private-fss_status_code.h @@ -15,8 +15,8 @@ extern "C" { /** * Perform the 'check' processes, such as --fine or --error. * - * @param data - * The program data. + * @param main + * The main data. * @param value * The parameter value to process. * @@ -34,14 +34,14 @@ extern "C" { * @see fss_status_code_convert_number() */ #ifndef _di_fss_status_code_process_check_ - extern f_status_t fss_status_code_process_check(const fss_status_code_data_t data, const f_string_t value) f_attribute_visibility_internal; + extern f_status_t fss_status_code_process_check(const fss_status_code_main_t main, const f_string_t value) f_attribute_visibility_internal; #endif // _di_fss_status_code_process_check_ /** * Perform the 'number' processes, such as --number. * - * @param data - * The program data. + * @param main + * The main data. * @param value * The parameter value to process. * @@ -56,14 +56,14 @@ extern "C" { * @see fll_fss_status_from_string() */ #ifndef _di_fss_status_code_process_number_ - extern f_status_t fss_status_code_process_number(const fss_status_code_data_t data, const f_string_t value) f_attribute_visibility_internal; + extern f_status_t fss_status_code_process_number(const fss_status_code_main_t main, const f_string_t value) f_attribute_visibility_internal; #endif // _di_fss_status_code_process_number_ /** * Perform the normal processes. * - * @param data - * The program data. + * @param main + * The main data. * @param value * The parameter value to process. * @@ -83,14 +83,14 @@ extern "C" { * @see fss_status_code_convert_number() */ #ifndef _di_fss_status_code_process_normal_ - extern f_status_t fss_status_code_process_normal(const fss_status_code_data_t data, const f_string_t value) f_attribute_visibility_internal; + extern f_status_t fss_status_code_process_normal(const fss_status_code_main_t main, const f_string_t value) f_attribute_visibility_internal; #endif // _di_fss_status_code_process_normal_ /** * Convert the value string to the number, reporting any errors. * - * @param data - * The program data. + * @param main + * The main data. * @param value * The parameter value to process. * @param number @@ -111,7 +111,7 @@ extern "C" { * @see fl_console_parameter_to_number_unsigned() */ #ifndef _di_fss_status_code_convert_number_ - extern f_status_t fss_status_code_convert_number(const fss_status_code_data_t data, const f_string_t value, f_number_unsigned_t *number) f_attribute_visibility_internal; + extern f_status_t fss_status_code_convert_number(const fss_status_code_main_t main, const f_string_t value, f_number_unsigned_t *number) f_attribute_visibility_internal; #endif // _di_fss_status_code_convert_number_ #ifdef __cplusplus diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index d2d92f4..37ac55b 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -25,7 +25,7 @@ extern "C" { fll_program_print_help_option(output, context, iki_read_short_at, iki_read_long_at, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select variable at this numeric index."); fll_program_print_help_option(output, context, iki_read_short_line, iki_read_long_line, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the variables at the given line."); fll_program_print_help_option(output, context, iki_read_short_name, iki_read_long_name, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select variables with this name."); - fll_program_print_help_option(output, context, iki_read_short_whole, iki_read_long_whole, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print all of the data instead of just the variable data."); + fll_program_print_help_option(output, context, iki_read_short_whole, iki_read_long_whole, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print all of the main instead of just the variable main."); fprintf(output.stream, "%c", f_string_eol_s[0]); @@ -89,36 +89,36 @@ extern "C" { #endif // _di_iki_read_print_help_ #ifndef _di_iki_read_main_ - f_status_t iki_read_main(const f_console_arguments_t arguments, iki_read_data_t *data) { + f_status_t iki_read_main(const f_console_arguments_t arguments, iki_read_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, iki_read_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, iki_read_total_parameters); { f_console_parameter_id_t ids[3] = { iki_read_parameter_no_color, iki_read_parameter_light, iki_read_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); - if (data->error.verbosity == f_console_verbosity_verbose) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + if (main->error.verbosity == f_console_verbosity_verbose) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } - iki_read_data_delete(data); + iki_read_main_delete(main); return F_status_set_error(status); } } @@ -132,56 +132,56 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); - iki_read_data_delete(data); + iki_read_main_delete(main); return status; } if (choice == iki_read_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == iki_read_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == iki_read_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == iki_read_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[iki_read_parameter_help].result == f_console_result_found) { - iki_read_print_help(data->output, data->context); + if (main->parameters[iki_read_parameter_help].result == f_console_result_found) { + iki_read_print_help(main->output, main->context); - iki_read_data_delete(data); + iki_read_main_delete(main); return F_none; } - if (data->parameters[iki_read_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, iki_read_version); + if (main->parameters[iki_read_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, iki_read_version); - iki_read_data_delete(data); + iki_read_main_delete(main); return F_none; } - if (data->remaining.used > 0 || data->process_pipe) { - if (data->parameters[iki_read_parameter_at].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_at); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (main->remaining.used > 0 || main->process_pipe) { + if (main->parameters[iki_read_parameter_at].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_at); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[iki_read_parameter_at].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[iki_read_parameter_at].values.array[data->parameters[iki_read_parameter_at].values.used - 1]; + else if (main->parameters[iki_read_parameter_at].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[iki_read_parameter_at].values.array[main->parameters[iki_read_parameter_at].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); f_number_unsigned_t number = 0; @@ -189,39 +189,39 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, iki_read_long_at, arguments.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, iki_read_long_at, arguments.argv[index]); status = F_status_set_error(F_parameter); } - data->at = number; + main->at = number; - if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_at); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter."); + if (main->parameters[iki_read_parameter_total].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_at); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter."); } status = F_status_set_error(F_parameter); } } - if (data->parameters[iki_read_parameter_line].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_line); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); + if (main->parameters[iki_read_parameter_line].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_line); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - else if (data->parameters[iki_read_parameter_line].result == f_console_result_additional) { - const f_array_length_t index = data->parameters[iki_read_parameter_line].values.array[data->parameters[iki_read_parameter_line].values.used - 1]; + else if (main->parameters[iki_read_parameter_line].result == f_console_result_additional) { + const f_array_length_t index = main->parameters[iki_read_parameter_line].values.array[main->parameters[iki_read_parameter_line].values.used - 1]; const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); f_number_unsigned_t number = 0; @@ -229,139 +229,139 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], range, &number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, iki_read_long_line, arguments.argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, iki_read_long_line, arguments.argv[index]); status = F_status_set_error(F_parameter); } - data->line = number; + main->line = number; } - if (data->parameters[iki_read_parameter_name].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_name); - f_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol_s[0]); + if (main->parameters[iki_read_parameter_name].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_name); + f_color_print(main->error.to.stream, main->context.set.error, "' requires a string.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (data->parameters[iki_read_parameter_substitute].result != f_console_result_none) { - if (data->parameters[iki_read_parameter_substitute].result == f_console_result_found || data->parameters[iki_read_parameter_substitute].values.used % 3 != 0) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_substitute); - f_color_print(data->error.to.stream, data->context.set.error, "' requires 3 strings.%c", f_string_eol_s[0]); + if (main->parameters[iki_read_parameter_substitute].result != f_console_result_none) { + if (main->parameters[iki_read_parameter_substitute].result == f_console_result_found || main->parameters[iki_read_parameter_substitute].values.used % 3 != 0) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_substitute); + f_color_print(main->error.to.stream, main->context.set.error, "' requires 3 strings.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_substitute); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[iki_read_parameter_total].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_substitute); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } } - if (data->parameters[iki_read_parameter_literal].result == f_console_result_found) { - if (data->parameters[iki_read_parameter_object].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_literal); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[iki_read_parameter_literal].result == f_console_result_found) { + if (main->parameters[iki_read_parameter_object].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_literal); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (data->parameters[iki_read_parameter_content].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_literal); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[iki_read_parameter_content].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_literal); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_literal); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[iki_read_parameter_total].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_literal); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - data->mode = iki_read_mode_literal; + main->mode = iki_read_mode_literal; } - else if (data->parameters[iki_read_parameter_object].result == f_console_result_found) { - if (data->parameters[iki_read_parameter_content].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + else if (main->parameters[iki_read_parameter_object].result == f_console_result_found) { + if (main->parameters[iki_read_parameter_content].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[iki_read_parameter_total].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - data->mode = iki_read_mode_object; + main->mode = iki_read_mode_object; } - else if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { - data->mode = iki_read_mode_total; + else if (main->parameters[iki_read_parameter_total].result == f_console_result_found) { + main->mode = iki_read_mode_total; } else { // this is the default behavior, so there is no reason to check for the -c/--content parameter. - data->mode = iki_read_mode_content; + main->mode = iki_read_mode_content; } - if (data->parameters[iki_read_parameter_whole].result == f_console_result_found) { - if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_whole); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_total); - f_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol_s[0]); + if (main->parameters[iki_read_parameter_whole].result == f_console_result_found) { + if (main->parameters[iki_read_parameter_total].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_whole); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_read_long_total); + f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -369,52 +369,52 @@ extern "C" { } if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } - iki_read_data_delete(data); + iki_read_main_delete(main); return F_status_set_error(F_parameter); } - if (data->process_pipe) { + if (main->process_pipe) { f_file_t file = f_file_t_initialize; file.id = f_type_descriptor_input; - status = f_file_read(file, &data->buffer); + status = f_file_read(file, &main->buffer); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "process", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, "-", "process", fll_error_file_type_file); } else { - status = iki_read_process_buffer(arguments, "-", data); + status = iki_read_process_buffer(arguments, "-", main); } // Clear buffers before continuing. - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_string_dynamic_t_delete_simple(main->buffer); } - if (F_status_is_fine(status) && data->remaining.used > 0) { + if (F_status_is_fine(status) && main->remaining.used > 0) { f_array_length_t i = 0; f_array_length_t total = 0; f_file_t file = f_file_t_initialize; - for (; i < data->remaining.used; i++) { + for (; i < main->remaining.used; i++) { f_macro_file_t_reset(file); total = 0; - status = f_file_open(arguments.argv[data->remaining.array[i]], 0, &file); + status = f_file_open(arguments.argv[main->remaining.array[i]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[data->remaining.array[i]], "process", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[main->remaining.array[i]], "process", fll_error_file_type_file); break; } status = f_file_size_by_id(file.id, &total); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[i]], "process", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[main->remaining.array[i]], "process", fll_error_file_type_file); f_file_stream_close(F_true, &file); break; @@ -426,61 +426,61 @@ extern "C" { continue; } - status = f_file_read_until(file, total, &data->buffer); + status = f_file_read_until(file, total, &main->buffer); f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[data->remaining.array[i]], "process", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[main->remaining.array[i]], "process", fll_error_file_type_file); break; } - status = iki_read_process_buffer(arguments, arguments.argv[data->remaining.array[i]], data); + status = iki_read_process_buffer(arguments, arguments.argv[main->remaining.array[i]], main); if (F_status_is_error(status)) break; // Clear buffers before repeating the loop. - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_string_dynamic_t_delete_simple(main->buffer); } // for } } else { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%syou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%syou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } // ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (data->error.verbosity != f_console_verbosity_quiet) { - if (F_status_is_error(status) || !data->mode) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + if (F_status_is_error(status) || !main->mode) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } } - iki_read_data_delete(data); + iki_read_main_delete(main); return status; } #endif // _di_iki_read_main_ -#ifndef _di_iki_read_data_delete_ - f_status_t iki_read_data_delete(iki_read_data_t *data) { +#ifndef _di_iki_read_main_delete_ + f_status_t iki_read_main_delete(iki_read_main_t *main) { for (f_array_length_t i = 0; i < iki_read_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_array_lengths_t_delete_simple(main->remaining); + f_macro_string_dynamic_t_delete_simple(main->buffer); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_iki_read_data_delete_ +#endif // _di_iki_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/iki_read/c/iki_read.h b/level_3/iki_read/c/iki_read.h index 384e1c5..799d151 100644 --- a/level_3/iki_read/c/iki_read.h +++ b/level_3/iki_read/c/iki_read.h @@ -8,7 +8,7 @@ * This is the IKI Read program. * * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the iki_read_data_t. + * This program processes files or other input in fss format and stores the results in the iki_read_main_t. * * This processes in accordance to the IKI specification. */ @@ -180,7 +180,7 @@ extern "C" { #define iki_read_macro_substitutions_t_adjust(status, replacements, length) f_macro_memory_structure_adjust(status, replacements, iki_read_substitution_t, length) #endif // _di_iki_read_substitutions_t_ -#ifndef _di_iki_read_data_t_ +#ifndef _di_iki_read_main_t_ typedef struct { f_console_parameter_t parameters[iki_read_total_parameters]; @@ -200,9 +200,9 @@ extern "C" { iki_read_substitutions_t replacements; f_color_context_t context; - } iki_read_data_t; + } iki_read_main_t; - #define iki_read_data_t_initialize \ + #define iki_read_main_t_initialize \ { \ iki_read_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -216,7 +216,7 @@ extern "C" { iki_read_substitutions_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_iki_read_data_t_ +#endif // _di_iki_read_main_t_ /** * Print help. @@ -236,31 +236,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call iki_read_data_delete() after executing this. + * Be sure to call iki_read_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see iki_read_data_delete() + * @see iki_read_main_delete() */ #ifndef _di_iki_read_main_ - extern f_status_t iki_read_main(const f_console_arguments_t arguments, iki_read_data_t *data); + extern f_status_t iki_read_main(const f_console_arguments_t arguments, iki_read_main_t *main); #endif // _di_iki_read_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing iki_read_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -269,9 +269,9 @@ extern "C" { * * @see iki_read_main() */ -#ifndef _di_iki_read_data_delete_ - extern f_status_t iki_read_data_delete(iki_read_data_t *data); -#endif // _di_iki_read_data_delete_ +#ifndef _di_iki_read_main_delete_ + extern f_status_t iki_read_main_delete(iki_read_main_t *main); +#endif // _di_iki_read_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/iki_read/c/main.c b/level_3/iki_read/c/main.c index 8c45e40..bd2fa82 100644 --- a/level_3/iki_read/c/main.c +++ b/level_3/iki_read/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - iki_read_data_t data = iki_read_data_t_initialize; + iki_read_main_t main = iki_read_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = iki_read_main(arguments, &data); + const f_status_t status = iki_read_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/iki_read/c/private-iki_read.c b/level_3/iki_read/c/private-iki_read.c index 3c82f60..b0c96d1 100644 --- a/level_3/iki_read/c/private-iki_read.c +++ b/level_3/iki_read/c/private-iki_read.c @@ -6,21 +6,21 @@ extern "C" { #endif #ifndef _di_iki_read_process_at_ - f_status_t iki_read_process_at(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data, f_string_range_t *range) { - if (data->parameters[iki_read_parameter_line].result != f_console_result_additional) return F_false; + f_status_t iki_read_process_at(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_string_range_t *range) { + if (main->parameters[iki_read_parameter_line].result != f_console_result_additional) return F_false; f_array_length_t line = 0; range->start = 0; - if (data->line > 0) { - for (; line < data->line && range->start < data->buffer.used; range->start++) { - if (data->buffer.string[range->start] == f_string_eol_s[0]) line++; + if (main->line > 0) { + for (; line < main->line && range->start < main->buffer.used; range->start++) { + if (main->buffer.string[range->start] == f_string_eol_s[0]) line++; } // for } - if (line == data->line) { - for (range->stop = range->start; range->stop < data->buffer.used; range->stop++) { - if (data->buffer.string[range->stop] == f_string_eol_s[0]) break; + if (line == main->line) { + for (range->stop = range->start; range->stop < main->buffer.used; range->stop++) { + if (main->buffer.string[range->stop] == f_string_eol_s[0]) break; } // for return F_true; @@ -31,20 +31,20 @@ extern "C" { #endif // _di_iki_read_process_at_ #ifndef _di_iki_read_process_buffer_ - f_status_t iki_read_process_buffer(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data) { + f_status_t iki_read_process_buffer(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main) { f_status_t status = F_none; f_iki_variable_t variable = f_iki_variable_t_initialize; f_iki_vocabulary_t vocabulary = f_iki_vocabulary_t_initialize; f_iki_content_t content = f_iki_content_t_initialize; - if (data->parameters[iki_read_parameter_whole].result == f_console_result_found) { - f_string_range_t buffer_range = f_macro_string_range_t_initialize(data->buffer.used); + if (main->parameters[iki_read_parameter_whole].result == f_console_result_found) { + f_string_range_t buffer_range = f_macro_string_range_t_initialize(main->buffer.used); - status = iki_read_process_at(arguments, file_name, data, &buffer_range); + status = iki_read_process_at(arguments, file_name, main, &buffer_range); if (status == F_true) { - if (buffer_range.start > data->buffer.used) { + if (buffer_range.start > main->buffer.used) { return F_data_not; } } @@ -52,26 +52,26 @@ extern "C" { return F_data_not; } - if (data->mode == iki_read_mode_content) { - status = iki_read_process_buffer_ranges_whole(arguments, file_name, buffer_range, data, &variable, &vocabulary, &content, &content); + if (main->mode == iki_read_mode_content) { + status = iki_read_process_buffer_ranges_whole(arguments, file_name, buffer_range, main, &variable, &vocabulary, &content, &content); } - else if (data->mode == iki_read_mode_literal) { - status = iki_read_process_buffer_ranges_whole(arguments, file_name, buffer_range, data, &variable, &vocabulary, &content, &variable); + else if (main->mode == iki_read_mode_literal) { + status = iki_read_process_buffer_ranges_whole(arguments, file_name, buffer_range, main, &variable, &vocabulary, &content, &variable); } - else if (data->mode == iki_read_mode_object) { - status = iki_read_process_buffer_ranges_whole(arguments, file_name, buffer_range, data, &variable, &vocabulary, &content, &vocabulary); + else if (main->mode == iki_read_mode_object) { + status = iki_read_process_buffer_ranges_whole(arguments, file_name, buffer_range, main, &variable, &vocabulary, &content, &vocabulary); } } - else if (data->mode == iki_read_mode_total) { - status = iki_read_process_buffer_total(arguments, file_name, data, &variable, &vocabulary, &content); + else if (main->mode == iki_read_mode_total) { + status = iki_read_process_buffer_total(arguments, file_name, main, &variable, &vocabulary, &content); } else { - f_string_range_t buffer_range = f_macro_string_range_t_initialize(data->buffer.used); + f_string_range_t buffer_range = f_macro_string_range_t_initialize(main->buffer.used); - status = iki_read_process_at(arguments, file_name, data, &buffer_range); + status = iki_read_process_at(arguments, file_name, main, &buffer_range); if (status == F_true) { - if (buffer_range.start > data->buffer.used) { + if (buffer_range.start > main->buffer.used) { return F_data_not; } } @@ -79,14 +79,14 @@ extern "C" { return F_data_not; } - if (data->mode == iki_read_mode_content) { - status = iki_read_process_buffer_ranges(arguments, file_name, data, &buffer_range, &variable, &vocabulary, &content, &content); + if (main->mode == iki_read_mode_content) { + status = iki_read_process_buffer_ranges(arguments, file_name, main, &buffer_range, &variable, &vocabulary, &content, &content); } - else if (data->mode == iki_read_mode_literal) { - status = iki_read_process_buffer_ranges(arguments, file_name, data, &buffer_range, &variable, &vocabulary, &content, &variable); + else if (main->mode == iki_read_mode_literal) { + status = iki_read_process_buffer_ranges(arguments, file_name, main, &buffer_range, &variable, &vocabulary, &content, &variable); } - else if (data->mode == iki_read_mode_object) { - status = iki_read_process_buffer_ranges(arguments, file_name, data, &buffer_range, &variable, &vocabulary, &content, &vocabulary); + else if (main->mode == iki_read_mode_object) { + status = iki_read_process_buffer_ranges(arguments, file_name, main, &buffer_range, &variable, &vocabulary, &content, &vocabulary); } } @@ -99,29 +99,29 @@ extern "C" { #endif // _di_iki_read_process_buffer_ #ifndef _di_iki_read_process_buffer_ranges_ - f_status_t iki_read_process_buffer_ranges(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data, f_string_range_t *buffer_range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content, f_string_ranges_t *ranges) { + f_status_t iki_read_process_buffer_ranges(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_string_range_t *buffer_range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content, f_string_ranges_t *ranges) { f_status_t status = F_none; bool unmatched = F_true; - status = fl_iki_read(&data->buffer, buffer_range, variable, vocabulary, content); + status = fl_iki_read(&main->buffer, buffer_range, variable, vocabulary, content); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fl_iki_read", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fl_iki_read", F_true); return status; } - const bool content_only = data->mode == iki_read_mode_content; + const bool content_only = main->mode == iki_read_mode_content; iki_read_substitutions_t substitutionss[variable->used]; memset(substitutionss, 0, sizeof(iki_read_substitutions_t) * variable->used); - if (data->mode == iki_read_mode_literal || data->mode == iki_read_mode_content) { - status = iki_read_substitutions_identify(arguments, file_name, data, vocabulary, substitutionss); + if (main->mode == iki_read_mode_literal || main->mode == iki_read_mode_content) { + status = iki_read_substitutions_identify(arguments, file_name, main, vocabulary, substitutionss); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "iki_read_substitutions_identify", F_true); + fll_error_print(main->error, F_status_set_fine(status), "iki_read_substitutions_identify", F_true); for (f_array_length_t i = 0; i < variable->used; i++) { iki_read_macro_substitutions_t_delete_simple(substitutionss[i]); @@ -131,7 +131,7 @@ extern "C" { } } - if (data->parameters[iki_read_parameter_name].result == f_console_result_additional) { + if (main->parameters[iki_read_parameter_name].result == f_console_result_additional) { f_string_dynamic_t name = f_string_dynamic_t_initialize; f_array_length_t index = 0; @@ -139,15 +139,15 @@ extern "C" { f_array_length_t j = 0; buffer_range->start = 0; - for (; i < data->parameters[iki_read_parameter_name].values.used; i++) { + for (; i < main->parameters[iki_read_parameter_name].values.used; i++) { - index = data->parameters[iki_read_parameter_name].values.array[i]; + index = main->parameters[iki_read_parameter_name].values.array[i]; name.used = 0; status = f_string_append_nulless(arguments.argv[index], strlen(arguments.argv[index]), &name); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); for (f_array_length_t i = 0; i < variable->used; i++) { iki_read_macro_substitutions_t_delete_simple(substitutionss[i]); @@ -161,16 +161,16 @@ extern "C" { for (j = 0; j < vocabulary->used; j++) { - status = fl_string_dynamic_partial_compare(name, data->buffer, *buffer_range, vocabulary->array[j]); + status = fl_string_dynamic_partial_compare(name, main->buffer, *buffer_range, vocabulary->array[j]); if (status == F_equal_to) { unmatched = F_false; if (substitutionss[j].used) { - iki_read_substitutions_print(*data, *variable, *content, *ranges, substitutionss[j], j, content_only); + iki_read_substitutions_print(*main, *variable, *content, *ranges, substitutionss[j], j, content_only); } else { - f_print_dynamic_partial(data->output.stream, data->buffer, ranges->array[j]); + f_print_dynamic_partial(main->output.stream, main->buffer, ranges->array[j]); } printf("%c", f_string_eol_s[0]); @@ -190,10 +190,10 @@ extern "C" { for (; i < ranges->used; i++) { if (substitutionss[i].used) { - iki_read_substitutions_print(*data, *variable, *content, *ranges, substitutionss[i], i, content_only); + iki_read_substitutions_print(*main, *variable, *content, *ranges, substitutionss[i], i, content_only); } else { - f_print_dynamic_partial(data->output.stream, data->buffer, ranges->array[i]); + f_print_dynamic_partial(main->output.stream, main->buffer, ranges->array[i]); } printf("%c", f_string_eol_s[0]); @@ -214,33 +214,33 @@ extern "C" { #endif // _di_iki_read_process_buffer_ranges_ #ifndef _di_iki_read_process_buffer_ranges_whole_ - f_status_t iki_read_process_buffer_ranges_whole(const f_console_arguments_t arguments, const f_string_t file_name, const f_string_range_t buffer_range, iki_read_data_t *data, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content, f_string_ranges_t *ranges) { + f_status_t iki_read_process_buffer_ranges_whole(const f_console_arguments_t arguments, const f_string_t file_name, const f_string_range_t buffer_range, iki_read_main_t *main, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content, f_string_ranges_t *ranges) { f_status_t status = F_none; f_string_range_t range = buffer_range; - status = fl_iki_read(&data->buffer, &range, variable, vocabulary, content); + status = fl_iki_read(&main->buffer, &range, variable, vocabulary, content); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fl_iki_read", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fl_iki_read", F_true); return status; } if (!variable->used) { - f_print_dynamic_partial(data->output.stream, data->buffer, buffer_range); + f_print_dynamic_partial(main->output.stream, main->buffer, buffer_range); return F_none; } - const bool content_only = data->mode == iki_read_mode_content; + const bool content_only = main->mode == iki_read_mode_content; iki_read_substitutions_t substitutionss[variable->used]; memset(substitutionss, 0, sizeof(iki_read_substitutions_t) * variable->used); - if (data->mode == iki_read_mode_literal || data->mode == iki_read_mode_content) { - status = iki_read_substitutions_identify(arguments, file_name, data, vocabulary, substitutionss); + if (main->mode == iki_read_mode_literal || main->mode == iki_read_mode_content) { + status = iki_read_substitutions_identify(arguments, file_name, main, vocabulary, substitutionss); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "iki_read_substitutions_identify", F_true); + fll_error_print(main->error, F_status_set_fine(status), "iki_read_substitutions_identify", F_true); for (f_array_length_t i = 0; i < variable->used; i++) { iki_read_macro_substitutions_t_delete_simple(substitutionss[i]); @@ -258,14 +258,14 @@ extern "C" { substitution_range.start = 0; - if (data->parameters[iki_read_parameter_name].result == f_console_result_additional) { + if (main->parameters[iki_read_parameter_name].result == f_console_result_additional) { f_array_length_t i = 0; f_array_length_t j = 0; f_array_length_t length_argument = 0; - for (f_array_length_t index = 0; i < data->parameters[iki_read_parameter_name].values.used; i++) { + for (f_array_length_t index = 0; i < main->parameters[iki_read_parameter_name].values.used; i++) { - index = data->parameters[iki_read_parameter_name].values.array[i]; + index = main->parameters[iki_read_parameter_name].values.array[i]; length_argument = strnlen(arguments.argv[index], f_console_parameter_size); for (j = 0, name_missed = F_true; j < names.used; j++) { @@ -282,14 +282,14 @@ extern "C" { f_macro_memory_structure_macro_increment(status, names, 1, f_iki_default_allocation_step, f_macro_string_dynamics_t_resize, F_array_too_large); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "iki_read_process_buffer_ranges_whole", F_true); + fll_error_print(main->error, F_status_set_fine(status), "iki_read_process_buffer_ranges_whole", F_true); break; } status = f_string_append_nulless(arguments.argv[index], length_argument, &names.array[names.used]); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); break; } @@ -321,7 +321,7 @@ extern "C" { range.start = i; range.stop = variable->array[j].start - 1; - f_print_dynamic_partial(data->output.stream, data->buffer, range); + f_print_dynamic_partial(main->output.stream, main->buffer, range); range.start = variable->array[j].stop + 1; range.stop = buffer_range.stop; @@ -335,7 +335,7 @@ extern "C" { for (k = 0; k < names.used; k++) { name_range.stop = names.array[k].used - 1; - status = fl_string_dynamic_partial_compare(data->buffer, names.array[k], vocabulary->array[j], name_range); + status = fl_string_dynamic_partial_compare(main->buffer, names.array[k], vocabulary->array[j], name_range); if (status == F_equal_to) { name_missed = F_false; @@ -345,27 +345,27 @@ extern "C" { if (name_missed) { if (substitutionss[j].used) { - iki_read_substitutions_print(*data, *variable, *content, *variable, substitutionss[j], j, F_false); + iki_read_substitutions_print(*main, *variable, *content, *variable, substitutionss[j], j, F_false); } else { - f_print_dynamic_partial(data->output.stream, data->buffer, variable->array[j]); + f_print_dynamic_partial(main->output.stream, main->buffer, variable->array[j]); } } else { if (substitutionss[j].used) { - iki_read_substitutions_print(*data, *variable, *content, *ranges, substitutionss[j], j, content_only); + iki_read_substitutions_print(*main, *variable, *content, *ranges, substitutionss[j], j, content_only); } else { - f_print_dynamic_partial(data->output.stream, data->buffer, ranges->array[j]); + f_print_dynamic_partial(main->output.stream, main->buffer, ranges->array[j]); } } } else { if (substitutionss[j].used) { - iki_read_substitutions_print(*data, *variable, *content, *ranges, substitutionss[j], j, content_only); + iki_read_substitutions_print(*main, *variable, *content, *ranges, substitutionss[j], j, content_only); } else { - f_print_dynamic_partial(data->output.stream, data->buffer, ranges->array[j]); + f_print_dynamic_partial(main->output.stream, main->buffer, ranges->array[j]); } } @@ -375,7 +375,7 @@ extern "C" { if (i <= buffer_range.stop) { range.start = i; - f_print_dynamic_partial(data->output.stream, data->buffer, range); + f_print_dynamic_partial(main->output.stream, main->buffer, range); } } @@ -389,14 +389,14 @@ extern "C" { #endif // _di_iki_read_process_buffer_ranges_whole_ #ifndef _di_iki_read_process_buffer_total_ - f_status_t iki_read_process_buffer_total(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) { + f_status_t iki_read_process_buffer_total(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) { f_status_t status = F_none; - f_string_range_t range = f_macro_string_range_t_initialize(data->buffer.used); + f_string_range_t range = f_macro_string_range_t_initialize(main->buffer.used); - status = iki_read_process_at(arguments, file_name, data, &range); + status = iki_read_process_at(arguments, file_name, main, &range); if (status == F_true) { - if (range.start > data->buffer.used) { + if (range.start > main->buffer.used) { printf("0\n"); return F_none; } @@ -406,16 +406,16 @@ extern "C" { return F_none; } - status = fl_iki_read(&data->buffer, &range, variable, vocabulary, content); + status = fl_iki_read(&main->buffer, &range, variable, vocabulary, content); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fl_iki_read", F_true); + fll_error_print(main->error, F_status_set_fine(status), "fl_iki_read", F_true); return status; } f_array_length_t total = 0; - if (data->parameters[iki_read_parameter_name].result == f_console_result_additional) { + if (main->parameters[iki_read_parameter_name].result == f_console_result_additional) { f_string_dynamic_t name = f_string_dynamic_t_initialize; f_array_length_t index = 0; @@ -424,15 +424,15 @@ extern "C" { range.start = 0; - for (; i < data->parameters[iki_read_parameter_name].values.used; i++) { + for (; i < main->parameters[iki_read_parameter_name].values.used; i++) { - index = data->parameters[iki_read_parameter_name].values.array[i]; + index = main->parameters[iki_read_parameter_name].values.array[i]; name.used = 0; status = f_string_append_nulless(arguments.argv[index], strlen(arguments.argv[index]), &name); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); f_macro_string_dynamic_t_delete_simple(name); return status; @@ -441,7 +441,7 @@ extern "C" { range.stop = name.used - 1; for (j = 0; j < vocabulary->used; j++) { - status = fl_string_dynamic_partial_compare(name, data->buffer, range, vocabulary->array[j]); + status = fl_string_dynamic_partial_compare(name, main->buffer, range, vocabulary->array[j]); if (status == F_equal_to) total++; } // for @@ -460,9 +460,9 @@ extern "C" { #endif // _di_iki_read_process_buffer_total_ #ifndef _di_iki_read_substitutions_identify_ - f_status_t iki_read_substitutions_identify(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) { + f_status_t iki_read_substitutions_identify(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) { - if (data->parameters[iki_read_parameter_substitute].result != f_console_result_additional) { + if (main->parameters[iki_read_parameter_substitute].result != f_console_result_additional) { return F_none; } @@ -476,7 +476,7 @@ extern "C" { f_array_length_t length = 0; - f_console_parameter_t *parameter = &data->parameters[iki_read_parameter_substitute]; + f_console_parameter_t *parameter = &main->parameters[iki_read_parameter_substitute]; for (; i < parameter->values.used; i += 3) { @@ -485,7 +485,7 @@ extern "C" { for (j = 0; j < vocabulary->used; j++) { - status = fl_string_compare(arguments.argv[index], data->buffer.string + vocabulary->array[j].start, length, (vocabulary->array[j].stop - vocabulary->array[j].start) + 1); + status = fl_string_compare(arguments.argv[index], main->buffer.string + vocabulary->array[j].start, length, (vocabulary->array[j].stop - vocabulary->array[j].start) + 1); if (status == F_equal_to) { f_macro_memory_structure_macro_increment(status, substitutionss[j], 1, f_iki_default_allocation_step, iki_read_macro_substitutions_t_resize, F_array_too_large); @@ -512,7 +512,7 @@ extern "C" { #endif // _di_iki_read_substitutions_identify_ #ifndef _di_iki_read_substitutions_print_ - void iki_read_substitutions_print(const iki_read_data_t data, const f_iki_variable_t variable, const f_iki_content_t content, const f_string_ranges_t ranges, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) { + void iki_read_substitutions_print(const iki_read_main_t main, const f_iki_variable_t variable, const f_iki_content_t content, const f_string_ranges_t ranges, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) { f_status_t status = F_none; f_array_length_t i = 0; @@ -523,30 +523,30 @@ extern "C" { for (; i < substitutions.used; i++) { range.stop = substitutions.array[i].replace.used - 1; - status = fl_string_dynamic_partial_compare(substitutions.array[i].replace, data.buffer, range, content.array[index]); + status = fl_string_dynamic_partial_compare(substitutions.array[i].replace, main.buffer, range, content.array[index]); if (status == F_equal_to) break; } // for if (status == F_equal_to) { if (content_only) { - f_print_dynamic(data.output.stream, substitutions.array[i].with); + f_print_dynamic(main.output.stream, substitutions.array[i].with); } else { range.start = variable.array[index].start; range.stop = content.array[index].start - 1; - f_print_dynamic_partial(data.output.stream, data.buffer, range); + f_print_dynamic_partial(main.output.stream, main.buffer, range); - f_print_dynamic(data.output.stream, substitutions.array[i].with); + f_print_dynamic(main.output.stream, substitutions.array[i].with); range.start = content.array[index].stop + 1; range.stop = variable.array[index].stop; - f_print_dynamic_partial(data.output.stream, data.buffer, range); + f_print_dynamic_partial(main.output.stream, main.buffer, range); } } else { - f_print_dynamic_partial(data.output.stream, data.buffer, ranges.array[index]); + f_print_dynamic_partial(main.output.stream, main.buffer, ranges.array[index]); } } #endif // _di_iki_read_substitutions_print_ diff --git a/level_3/iki_read/c/private-iki_read.h b/level_3/iki_read/c/private-iki_read.h index 658610c..57c0ad9 100644 --- a/level_3/iki_read/c/private-iki_read.h +++ b/level_3/iki_read/c/private-iki_read.h @@ -16,14 +16,14 @@ extern "C" { * Determine the range based on the --at parameter. * * If the --at parameter is not specified in the console arguments, then range is untouched. - * The range.start will be greater than data->buffer.used if the --at range is not found before buffer end is reached. + * The range.start will be greater than main->buffer.used if the --at range is not found before buffer end is reached. * * @param arguments * The console arguments passed to the program. * @param file_name * The name of the file being processed. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param range * The range value to represent the --at values. * @@ -35,7 +35,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_iki_read_process_at_ - extern f_status_t iki_read_process_at(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data, f_string_range_t *range) f_attribute_visibility_internal; + extern f_status_t iki_read_process_at(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_string_range_t *range) f_attribute_visibility_internal; #endif // _di_iki_read_process_at_ /** @@ -45,8 +45,8 @@ extern "C" { * The console arguments passed to the program. * @param file_name * The name of the file being processed. - * @param data - * The program specific data. + * @param main + * The program specific main. * * @return * F_none on success. @@ -55,7 +55,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_iki_read_process_buffer_ - extern f_status_t iki_read_process_buffer(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data) f_attribute_visibility_internal; + extern f_status_t iki_read_process_buffer(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main) f_attribute_visibility_internal; #endif // _di_iki_read_process_buffer_ /** @@ -65,8 +65,8 @@ extern "C" { * The console arguments passed to the program. * @param file_name * The name of the file being processed. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param buffer_range * The range within the buffer to process. * @param variable @@ -86,7 +86,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_iki_read_process_buffer_ranges_ - extern f_status_t iki_read_process_buffer_ranges(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data, f_string_range_t *buffer_range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content, f_string_ranges_t *ranges) f_attribute_visibility_internal; + extern f_status_t iki_read_process_buffer_ranges(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_string_range_t *buffer_range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content, f_string_ranges_t *ranges) f_attribute_visibility_internal; #endif // _di_iki_read_process_buffer_ranges_ /** @@ -100,8 +100,8 @@ extern "C" { * The name of the file being processed. * @param buffer_range * The range within the buffer to process. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param variable * The ranges representing a variable. * @param vocabulary @@ -119,7 +119,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_iki_read_process_buffer_ranges_whole_ - extern f_status_t iki_read_process_buffer_ranges_whole(const f_console_arguments_t arguments, const f_string_t file_name, const f_string_range_t buffer_range, iki_read_data_t *data, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content, f_string_ranges_t *ranges) f_attribute_visibility_internal; + extern f_status_t iki_read_process_buffer_ranges_whole(const f_console_arguments_t arguments, const f_string_t file_name, const f_string_range_t buffer_range, iki_read_main_t *main, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content, f_string_ranges_t *ranges) f_attribute_visibility_internal; #endif // _di_iki_read_process_buffer_ranges_whole_ /** @@ -129,8 +129,8 @@ extern "C" { * The console arguments passed to the program. * @param file_name * The name of the file being processed. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param variable * The ranges representing a variable. * @param vocabulary @@ -144,7 +144,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_iki_read_process_buffer_total_ - extern f_status_t iki_read_process_buffer_total(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) f_attribute_visibility_internal; + extern f_status_t iki_read_process_buffer_total(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) f_attribute_visibility_internal; #endif // _di_iki_read_process_buffer_total_ /** @@ -154,8 +154,8 @@ extern "C" { * The console arguments passed to the program. * @param file_name * The name of the file being processed. - * @param data - * The program specific data. + * @param main + * The program specific main. * @param vocabulary * The ranges representing a vocabulary. * @param substitutionss @@ -167,14 +167,14 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_iki_read_substitutions_identify_ - extern f_status_t iki_read_substitutions_identify(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) f_attribute_visibility_internal; + extern f_status_t iki_read_substitutions_identify(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_main_t *main, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) f_attribute_visibility_internal; #endif // _di_iki_read_substitutions_identify_ /** * Print any applicable substition and if there is non then print the given range at the given index. * - * @param data - * The program specific data. + * @param main + * The program specific main. * @param variable * The ranges representing a variable. * @param content @@ -190,7 +190,7 @@ extern "C" { * Set to FALSE to print the entire variable when printing substituted text. */ #ifndef _di_iki_read_substitutions_print_ - extern void iki_read_substitutions_print(const iki_read_data_t data, const f_iki_variable_t variable, const f_iki_content_t content, const f_string_ranges_t ranges, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) f_attribute_visibility_internal; + extern void iki_read_substitutions_print(const iki_read_main_t main, const f_iki_variable_t variable, const f_iki_content_t content, const f_string_ranges_t ranges, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) f_attribute_visibility_internal; #endif // _di_iki_read_substitutions_print_ #ifdef __cplusplus diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/iki_write.c index a353502..19d2256 100644 --- a/level_3/iki_write/c/iki_write.c +++ b/level_3/iki_write/c/iki_write.c @@ -42,7 +42,7 @@ extern "C" { fprintf(output.stream, "%c", f_string_eol_s[0]); - fprintf(output.stream, " When piping data to this program, a single end of line (\\n) must be used to separate each object from each content.%c", f_string_eol_s[0]); + fprintf(output.stream, " When piping main to this program, a single end of line (\\n) must be used to separate each object from each content.%c", f_string_eol_s[0]); fprintf(output.stream, " Furthermore, each object must be followed by a content.%c", f_string_eol_s[0]); fprintf(output.stream, "%c", f_string_eol_s[0]); @@ -52,35 +52,35 @@ extern "C" { #endif // _di_iki_write_print_help_ #ifndef _di_iki_write_main_ - f_status_t iki_write_main(const f_console_arguments_t arguments, iki_write_data_t *data) { + f_status_t iki_write_main(const f_console_arguments_t arguments, iki_write_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, iki_write_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, iki_write_total_parameters); { f_console_parameter_id_t ids[3] = { iki_write_parameter_no_color, iki_write_parameter_light, iki_write_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } - iki_write_data_delete(data); + iki_write_main_delete(main); return F_status_set_error(status); } } @@ -94,38 +94,38 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - iki_write_data_delete(data); + iki_write_main_delete(main); return status; } if (choice == iki_write_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == iki_write_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == iki_write_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == iki_write_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[iki_write_parameter_help].result == f_console_result_found) { - iki_write_print_help(data->output, data->context); + if (main->parameters[iki_write_parameter_help].result == f_console_result_found) { + iki_write_print_help(main->output, main->context); - iki_write_data_delete(data); + iki_write_main_delete(main); return F_none; } - if (data->parameters[iki_write_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, iki_write_version); + if (main->parameters[iki_write_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, iki_write_version); - iki_write_data_delete(data); + iki_write_main_delete(main); return F_none; } @@ -136,18 +136,18 @@ extern "C" { output.flag = f_file_flag_create | f_file_flag_write_only | f_file_flag_append; if (F_status_is_error_not(status)) { - if (data->parameters[iki_write_parameter_file].result == f_console_result_additional) { - if (data->parameters[iki_write_parameter_file].values.used > 1) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_file); - f_color_print(data->error.to.stream, data->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); + if (main->parameters[iki_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[iki_write_parameter_file].values.used > 1) { + if (main->error.verbosity != f_console_verbosity_quiet) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_file); + f_color_print(main->error.to.stream, main->context.set.error, "' may only be specified once.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } else { - const f_array_length_t location = data->parameters[iki_write_parameter_file].values.array[0]; + const f_array_length_t location = main->parameters[iki_write_parameter_file].values.array[0]; output.id = -1; output.stream = 0; @@ -155,50 +155,50 @@ extern "C" { status = f_file_stream_open(arguments.argv[location], 0, &output); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments.argv[location], "open", fll_error_file_type_file); } } } - else if (data->parameters[iki_write_parameter_file].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_file); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + else if (main->parameters[iki_write_parameter_file].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_file); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } } - if (F_status_is_error_not(status) && data->parameters[iki_write_parameter_object].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[iki_write_parameter_object].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && data->parameters[iki_write_parameter_content].result == f_console_result_found) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->parameters[iki_write_parameter_content].result == f_console_result_found) { + if (main->error.verbosity != f_console_verbosity_quiet) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' was specified, but no value was given.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status) && !data->process_pipe) { - if (data->parameters[iki_write_parameter_object].result != f_console_result_additional && data->parameters[iki_write_parameter_content].result != f_console_result_additional) { - if (data->error.verbosity != f_console_verbosity_quiet) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data->error.to.stream, data->context.set.error, "%sNo data provided, either pipe the data or use the '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' and the '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' parameters.%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && !main->process_pipe) { + if (main->parameters[iki_write_parameter_object].result != f_console_result_additional && main->parameters[iki_write_parameter_content].result != f_console_result_additional) { + if (main->error.verbosity != f_console_verbosity_quiet) { + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main->error.to.stream, main->context.set.error, "%sNo main provided, either pipe the main or use the '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' and the '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' parameters.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -206,13 +206,13 @@ extern "C" { } if (F_status_is_error_not(status)) { - if (data->parameters[iki_write_parameter_object].values.used != data->parameters[iki_write_parameter_content].values.used) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameters '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_content); - f_color_print(data->error.to.stream, data->context.set.error, "' and '"); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_object); - f_color_print(data->error.to.stream, data->context.set.error, "' must be specified the same number of times.%c", f_string_eol_s[0]); + if (main->parameters[iki_write_parameter_object].values.used != main->parameters[iki_write_parameter_content].values.used) { + if (main->error.verbosity != f_console_verbosity_quiet) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameters '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_content); + f_color_print(main->error.to.stream, main->context.set.error, "' and '"); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, iki_write_long_object); + f_color_print(main->error.to.stream, main->context.set.error, "' must be specified the same number of times.%c", f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -222,14 +222,14 @@ extern "C" { uint8_t quote = f_iki_syntax_quote_double; if (F_status_is_error_not(status)) { - if (data->parameters[iki_write_parameter_double].result == f_console_result_found) { - if (data->parameters[iki_write_parameter_single].result == f_console_result_found) { - if (data->parameters[iki_write_parameter_double].location < data->parameters[iki_write_parameter_single].location) { + if (main->parameters[iki_write_parameter_double].result == f_console_result_found) { + if (main->parameters[iki_write_parameter_single].result == f_console_result_found) { + if (main->parameters[iki_write_parameter_double].location < main->parameters[iki_write_parameter_single].location) { quote = f_iki_syntax_quote_single; } } } - else if (data->parameters[iki_write_parameter_single].result == f_console_result_found) { + else if (main->parameters[iki_write_parameter_single].result == f_console_result_found) { quote = f_iki_syntax_quote_single; } } @@ -237,7 +237,7 @@ extern "C" { if (F_status_is_error_not(status)) { f_string_dynamic_t escaped = f_string_dynamic_t_initialize; - if (data->process_pipe) { + if (main->process_pipe) { f_file_t pipe = f_file_t_initialize; pipe.id = f_type_descriptor_input; @@ -260,15 +260,15 @@ extern "C" { status_pipe = f_file_read(pipe, &buffer); if (F_status_is_error(status_pipe)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_to", F_true, "-", "read", fll_error_file_type_pipe); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_to", F_true, "-", "read", fll_error_file_type_pipe); status = F_status_set_error(F_pipe); break; } if (!buffer.used) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe pipe has no data.%c", fll_error_print_error, f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe pipe has no main.%c", fll_error_print_error, f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -282,20 +282,20 @@ extern "C" { status = f_string_dynamic_seek_line(buffer, &range); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamic_seek_line", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_seek_line", F_true); break; } if (status == F_data_not_stop) { status = F_status_set_error(F_parameter); - fll_error_print(data->error, F_parameter, "f_string_dynamic_seek_line", F_true); + fll_error_print(main->error, F_parameter, "f_string_dynamic_seek_line", F_true); break; } if (object_ended && previous == range.start) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe pipe has incorrectly placed newlines.%c", fll_error_print_error, f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe pipe has incorrectly placed newlines.%c", fll_error_print_error, f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -312,12 +312,12 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, range, &content); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true); break; } } - status = iki_write_process(*data, output, object, content, quote, &escaped); + status = iki_write_process(*main, output, object, content, quote, &escaped); if (F_status_is_error(status)) break; fprintf(output.stream, "%c", f_string_eol_s[0]); @@ -330,7 +330,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, range, &object); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true); + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true); break; } @@ -351,8 +351,8 @@ extern "C" { } // for if (F_status_is_error_not(status) && object_ended) { - if (data->error.verbosity != f_console_verbosity_quiet) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe pipe has an object without content.%c", fll_error_print_error, f_string_eol_s[0]); + if (main->error.verbosity != f_console_verbosity_quiet) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe pipe has an object without content.%c", fll_error_print_error, f_string_eol_s[0]); } status = F_status_set_error(F_parameter); @@ -367,66 +367,66 @@ extern "C" { f_string_static_t object = f_string_static_t_initialize; f_string_static_t content = f_string_static_t_initialize; - for (f_array_length_t i = 0; i < data->parameters[iki_write_parameter_object].values.used; i++) { + for (f_array_length_t i = 0; i < main->parameters[iki_write_parameter_object].values.used; i++) { - object.string = arguments.argv[data->parameters[iki_write_parameter_object].values.array[i]]; + object.string = arguments.argv[main->parameters[iki_write_parameter_object].values.array[i]]; object.used = strnlen(object.string, f_console_parameter_size); object.size = object.used; - content.string = arguments.argv[data->parameters[iki_write_parameter_content].values.array[i]]; + content.string = arguments.argv[main->parameters[iki_write_parameter_content].values.array[i]]; content.used = strnlen(content.string, f_console_parameter_size); content.size = content.used; - status = iki_write_process(*data, output, object, content, quote, &escaped); + status = iki_write_process(*main, output, object, content, quote, &escaped); if (F_status_is_error(status)) break; fprintf(output.stream, "%c", f_string_eol_s[0]); } // for // ensure there is always a newline at the end, unless in quiet mode. - if (F_status_is_error_not(status) && data->error.verbosity != f_console_verbosity_quiet && data->parameters[iki_write_parameter_file].result == f_console_result_none) { - fprintf(data->output.stream, "%c", f_string_eol_s[0]); + if (F_status_is_error_not(status) && main->error.verbosity != f_console_verbosity_quiet && main->parameters[iki_write_parameter_file].result == f_console_result_none) { + fprintf(main->output.stream, "%c", f_string_eol_s[0]); } } f_macro_string_dynamic_t_delete_simple(escaped); } - if (data->parameters[iki_write_parameter_file].result == f_console_result_additional) { + if (main->parameters[iki_write_parameter_file].result == f_console_result_additional) { if (output.id != -1) { f_file_stream_close(F_true, &output); } } // ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (data->error.verbosity != f_console_verbosity_quiet) { + if (main->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status)) { - fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); + fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); } } - iki_write_data_delete(data); + iki_write_main_delete(main); return status; } #endif // _di_iki_write_main_ -#ifndef _di_iki_write_data_delete_ - f_status_t iki_write_data_delete(iki_write_data_t *data) { +#ifndef _di_iki_write_main_delete_ + f_status_t iki_write_main_delete(iki_write_main_t *main) { for (f_array_length_t i = 0; i < iki_write_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); - f_macro_string_dynamic_t_delete_simple(data->buffer); + f_macro_array_lengths_t_delete_simple(main->remaining); + f_macro_string_dynamic_t_delete_simple(main->buffer); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_iki_write_data_delete_ +#endif // _di_iki_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/iki_write/c/iki_write.h b/level_3/iki_write/c/iki_write.h index dcd402a..c2104dc 100644 --- a/level_3/iki_write/c/iki_write.h +++ b/level_3/iki_write/c/iki_write.h @@ -8,7 +8,7 @@ * This is the IKI Write program. * * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the iki_write_data_t. + * This program processes files or other input in fss format and stores the results in the iki_write_main_t. * * This processes in accordance to the IKI specification. */ @@ -116,7 +116,7 @@ extern "C" { #define iki_write_total_parameters 14 #endif // _di_iki_write_defines_ -#ifndef _di_iki_write_data_t_ +#ifndef _di_iki_write_main_t_ typedef struct { f_console_parameter_t parameters[iki_write_total_parameters]; @@ -129,9 +129,9 @@ extern "C" { f_string_dynamic_t buffer; f_color_context_t context; - } iki_write_data_t; + } iki_write_main_t; - #define iki_write_data_t_initialize \ + #define iki_write_main_t_initialize \ { \ iki_write_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -141,7 +141,7 @@ extern "C" { f_string_dynamic_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_iki_write_data_t_ +#endif // _di_iki_write_main_t_ /** * Print help. @@ -161,31 +161,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call iki_write_data_delete() after executing this. + * Be sure to call iki_write_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see iki_write_data_delete() + * @see iki_write_main_delete() */ #ifndef _di_iki_write_main_ - extern f_status_t iki_write_main(const f_console_arguments_t arguments, iki_write_data_t *data); + extern f_status_t iki_write_main(const f_console_arguments_t arguments, iki_write_main_t *main); #endif // _di_iki_write_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing iki_write_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -194,9 +194,9 @@ extern "C" { * * @see iki_write_main() */ -#ifndef _di_iki_write_data_delete_ - extern f_status_t iki_write_data_delete(iki_write_data_t *data); -#endif // _di_iki_write_data_delete_ +#ifndef _di_iki_write_main_delete_ + extern f_status_t iki_write_main_delete(iki_write_main_t *main); +#endif // _di_iki_write_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/iki_write/c/main.c b/level_3/iki_write/c/main.c index 13255b7..7fa07c5 100644 --- a/level_3/iki_write/c/main.c +++ b/level_3/iki_write/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - iki_write_data_t data = iki_write_data_t_initialize; + iki_write_main_t main = iki_write_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = iki_write_main(arguments, &data); + const f_status_t status = iki_write_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/iki_write/c/private-iki_write.c b/level_3/iki_write/c/private-iki_write.c index 892824b..eb201e2 100644 --- a/level_3/iki_write/c/private-iki_write.c +++ b/level_3/iki_write/c/private-iki_write.c @@ -6,14 +6,14 @@ extern "C" { #endif #ifndef _di_iki_write_process_ - f_status_t iki_write_process(const iki_write_data_t data, const f_file_t output, const f_string_static_t object, const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *escaped) { + f_status_t iki_write_process(const iki_write_main_t main, const f_file_t output, const f_string_static_t object, const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *escaped) { if (!object.used) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe object is missing, it must not have a length of ", fll_error_print_error); - f_color_print(data.error.to.stream, data.context.set.notable, "0"); - f_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol_s[0]); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe object is missing, it must not have a length of ", fll_error_print_error); + f_color_print(main.error.to.stream, main.context.set.notable, "0"); + f_color_print(main.error.to.stream, main.context.set.error, ".%c", f_string_eol_s[0]); } return F_status_set_error(F_failure); @@ -22,21 +22,21 @@ extern "C" { f_status_t status = f_iki_object_is(object); if (status == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(data.error.to.stream, "%c", f_string_eol_s[0]); - f_color_print(data.error.to.stream, data.context.set.error, "%sThe object '", fll_error_print_error); + if (main.error.verbosity != f_console_verbosity_quiet) { + fprintf(main.error.to.stream, "%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "%sThe object '", fll_error_print_error); - f_color_print_code(data.error.to.stream, data.context.notable); - f_print_dynamic(data.error.to.stream, object); - f_color_print_code(data.error.to.stream, data.context.reset); + f_color_print_code(main.error.to.stream, main.context.notable); + f_print_dynamic(main.error.to.stream, object); + f_color_print_code(main.error.to.stream, main.context.reset); - f_color_print(data.error.to.stream, data.context.set.error, "' is not a valid IKI object.%c", f_string_eol_s[0]); + f_color_print(main.error.to.stream, main.context.set.error, "' is not a valid IKI object.%c", f_string_eol_s[0]); } return F_status_set_error(F_failure); } else if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "f_iki_object_is", F_true); + fll_error_print(main.error, F_status_set_fine(status), "f_iki_object_is", F_true); return F_status_set_error(F_failure); } @@ -45,7 +45,7 @@ extern "C" { status = fll_iki_content_escape(content, quote, escaped); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fll_iki_content_escape", F_true); + fll_error_print(main.error, F_status_set_fine(status), "fll_iki_content_escape", F_true); f_macro_string_dynamic_t_delete_simple((*escaped)); return F_status_set_error(F_failure); diff --git a/level_3/iki_write/c/private-iki_write.h b/level_3/iki_write/c/private-iki_write.h index 4a94079..1ad5c19 100644 --- a/level_3/iki_write/c/private-iki_write.h +++ b/level_3/iki_write/c/private-iki_write.h @@ -15,8 +15,8 @@ extern "C" { /** * Process a given object and content, printing the IKI if valid or an error if invalid. * - * @param data - * The program data. + * @param main + * The main data. * @param output * The file to output to. * @param object @@ -34,7 +34,7 @@ extern "C" { * F_failure (with error bit) for any othe failure. */ #ifndef _di_iki_write_process_ - extern f_status_t iki_write_process(const iki_write_data_t data, const f_file_t output, const f_string_static_t object, const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *escaped) f_attribute_visibility_internal; + extern f_status_t iki_write_process(const iki_write_main_t main, const f_file_t output, const f_string_static_t object, const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *escaped) f_attribute_visibility_internal; #endif // _di_iki_write_process_ #ifdef __cplusplus diff --git a/level_3/status_code/c/main.c b/level_3/status_code/c/main.c index d01da5e..7ece9e0 100644 --- a/level_3/status_code/c/main.c +++ b/level_3/status_code/c/main.c @@ -2,13 +2,13 @@ int main(const int argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; - status_code_data_t data = status_code_data_t_initialize; + status_code_main_t main = status_code_main_t_initialize; if (f_pipe_input_exists()) { - data.process_pipe = F_true; + main.process_pipe = F_true; } - const f_status_t status = status_code_main(arguments, &data); + const f_status_t status = status_code_main(arguments, &main); // flush output pipes before closing. fflush(f_type_output); diff --git a/level_3/status_code/c/private-status_code.c b/level_3/status_code/c/private-status_code.c index 3373ed1..3425d35 100644 --- a/level_3/status_code/c/private-status_code.c +++ b/level_3/status_code/c/private-status_code.c @@ -6,15 +6,15 @@ extern "C" { #endif #ifndef _di_status_code_process_check_ - f_status_t status_code_process_check(const status_code_data_t data, const f_string_t value) { + f_status_t status_code_process_check(const status_code_main_t main, const f_string_t value) { f_number_unsigned_t number = 0; - f_status_t status = status_code_convert_number(data, value, &number); + f_status_t status = status_code_convert_number(main, value, &number); if (F_status_is_error(status)) { return status; } - if (data.parameters[status_code_parameter_is_error].result == f_console_result_found) { + if (main.parameters[status_code_parameter_is_error].result == f_console_result_found) { if (F_status_is_error(number)) { printf("%s\n", FL_status_string_true); } @@ -22,7 +22,7 @@ extern "C" { printf("%s\n", FL_status_string_false); } } - else if (data.parameters[status_code_parameter_is_warning].result == f_console_result_found) { + else if (main.parameters[status_code_parameter_is_warning].result == f_console_result_found) { if (F_status_is_warning(number)) { printf("%s\n", FL_status_string_true); } @@ -30,7 +30,7 @@ extern "C" { printf("%s\n", FL_status_string_false); } } - else if (data.parameters[status_code_parameter_is_fine].result == f_console_result_found) { + else if (main.parameters[status_code_parameter_is_fine].result == f_console_result_found) { if (F_status_is_fine(number)) { printf("%s\n", FL_status_string_true); } @@ -44,7 +44,7 @@ extern "C" { #endif // _di_status_code_process_check_ #ifndef _di_status_code_process_number_ - f_status_t status_code_process_number(const status_code_data_t data, const f_string_t value) { + f_status_t status_code_process_number(const status_code_main_t main, const f_string_t value) { f_status_t status = F_none; { @@ -55,13 +55,13 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(value, range, &number); if (status == F_none) { - f_color_print(data.output.stream, data.context.set.error, "invalid name%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "invalid name%c", f_string_eol_s[0]); return F_status_set_error(F_parameter); } if (status == F_data_not || F_status_set_fine(status) == F_parameter) { - f_color_print(data.output.stream, data.context.set.error, "invalid data%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "invalid main%c", f_string_eol_s[0]); return status; } @@ -73,17 +73,17 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_data) { - f_color_print(data.output.stream, data.context.set.error, "unknown name%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "unknown name%c", f_string_eol_s[0]); } else { - f_color_print(data.output.stream, data.context.set.error, "failed to convert%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "failed to convert%c", f_string_eol_s[0]); } return status; } if (status == F_data) { - f_color_print(data.output.stream, data.context.set.warning, "unknown code%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.warning, "unknown code%c", f_string_eol_s[0]); return F_none; } @@ -95,9 +95,9 @@ extern "C" { #endif // _di_status_code_process_number_ #ifndef _di_status_code_process_normal_ - f_status_t status_code_process_normal(const status_code_data_t data, const f_string_t value) { + f_status_t status_code_process_normal(const status_code_main_t main, const f_string_t value) { f_number_unsigned_t number = 0; - f_status_t status = status_code_convert_number(data, value, &number); + f_status_t status = status_code_convert_number(main, value, &number); if (F_status_is_error(status)) { return status; @@ -110,10 +110,10 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_data) { - f_color_print(data.output.stream, data.context.set.error, "unknown code%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "unknown code%c", f_string_eol_s[0]); } else { - f_color_print(data.output.stream, data.context.set.error, "failed to convert%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "failed to convert%c", f_string_eol_s[0]); } return status; @@ -126,23 +126,23 @@ extern "C" { #endif // _di_status_code_process_normal_ #ifndef _di_status_code_convert_number_ - f_status_t status_code_convert_number(const status_code_data_t data, const f_string_t value, f_number_unsigned_t *number) { + f_status_t status_code_convert_number(const status_code_main_t main, const f_string_t value, f_number_unsigned_t *number) { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(value)); f_status_t status = fl_conversion_string_to_number_unsigned(value, range, number); if (*number > F_status_size_max_with_signal) { - f_color_print(data.output.stream, data.context.set.error, "out of range%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "out of range%c", f_string_eol_s[0]); return status; } if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_number_negative) { - f_color_print(data.output.stream, data.context.set.error, "out of range%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "out of range%c", f_string_eol_s[0]); } else { - f_color_print(data.output.stream, data.context.set.error, "invalid number%c", f_string_eol_s[0]); + f_color_print(main.output.stream, main.context.set.error, "invalid number%c", f_string_eol_s[0]); } return status; diff --git a/level_3/status_code/c/private-status_code.h b/level_3/status_code/c/private-status_code.h index 431f2a0..2a90c04 100644 --- a/level_3/status_code/c/private-status_code.h +++ b/level_3/status_code/c/private-status_code.h @@ -15,8 +15,8 @@ extern "C" { /** * Perform the 'check' processes, such as --fine or --error. * - * @param data - * The program data. + * @param main + * The main data. * @param value * The parameter value to process. * @@ -34,14 +34,14 @@ extern "C" { * @see fss_status_code_convert_number() */ #ifndef _di_status_code_process_check_ - extern f_status_t status_code_process_check(const status_code_data_t data, const f_string_t value) f_attribute_visibility_internal; + extern f_status_t status_code_process_check(const status_code_main_t main, const f_string_t value) f_attribute_visibility_internal; #endif // _di_status_code_process_check_ /** * Perform the 'number' processes, such as --number. * - * @param data - * The program data. + * @param main + * The main data. * @param value * The parameter value to process. * @@ -56,14 +56,14 @@ extern "C" { * @see fll_fss_status_from_string() */ #ifndef _di_status_code_process_number_ - extern f_status_t status_code_process_number(const status_code_data_t data, const f_string_t value) f_attribute_visibility_internal; + extern f_status_t status_code_process_number(const status_code_main_t main, const f_string_t value) f_attribute_visibility_internal; #endif // _di_status_code_process_number_ /** * Perform the normal processes. * - * @param data - * The program data. + * @param main + * The main data. * @param value * The parameter value to process. * @@ -83,14 +83,14 @@ extern "C" { * @see fss_status_code_convert_number() */ #ifndef _di_status_code_process_normal_ - extern f_status_t status_code_process_normal(const status_code_data_t data, const f_string_t value) f_attribute_visibility_internal; + extern f_status_t status_code_process_normal(const status_code_main_t main, const f_string_t value) f_attribute_visibility_internal; #endif // _di_status_code_process_normal_ /** * Convert the value string to the number, reporting any errors. * - * @param data - * The program data. + * @param main + * The main data. * @param value * The parameter value to process. * @param number @@ -111,7 +111,7 @@ extern "C" { * @see fl_console_parameter_to_number_unsigned() */ #ifndef _di_status_code_convert_number_ - extern f_status_t status_code_convert_number(const status_code_data_t data, const f_string_t value, f_number_unsigned_t *number) f_attribute_visibility_internal; + extern f_status_t status_code_convert_number(const status_code_main_t main, const f_string_t value, f_number_unsigned_t *number) f_attribute_visibility_internal; #endif // _di_status_code_convert_number_ #ifdef __cplusplus diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index 7f641ea..ce8bad0 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -34,30 +34,30 @@ extern "C" { #endif // _di_status_code_print_help_ #ifndef _di_status_code_main_ - f_status_t status_code_main(const f_console_arguments_t arguments, status_code_data_t *data) { + f_status_t status_code_main(const f_console_arguments_t arguments, status_code_main_t *main) { f_status_t status = F_none; { - const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, status_code_total_parameters); + const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(main->parameters, status_code_total_parameters); { f_console_parameter_id_t ids[3] = { status_code_parameter_no_color, status_code_parameter_light, status_code_parameter_dark }; const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3); - status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + status = fll_program_parameter_process(arguments, parameters, choices, F_true, &main->remaining, &main->context); - if (data->context.set.error.before) { - data->error.context = data->context.set.error; - data->error.notable = data->context.set.notable; + if (main->context.set.error.before) { + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; } else { - f_color_set_t *sets[] = { &data->error.context, &data->error.notable, 0 }; + f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 }; - fll_program_parameter_process_empty(&data->context, sets); + fll_program_parameter_process_empty(&main->context, sets); } if (F_status_is_error(status)) { - status_code_data_delete(data); + status_code_main_delete(main); return F_status_set_error(status); } } @@ -71,92 +71,92 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - status_code_data_delete(data); + status_code_main_delete(main); return status; } if (choice == status_code_parameter_verbosity_quiet) { - data->error.verbosity = f_console_verbosity_quiet; + main->error.verbosity = f_console_verbosity_quiet; } else if (choice == status_code_parameter_verbosity_normal) { - data->error.verbosity = f_console_verbosity_normal; + main->error.verbosity = f_console_verbosity_normal; } else if (choice == status_code_parameter_verbosity_verbose) { - data->error.verbosity = f_console_verbosity_verbose; + main->error.verbosity = f_console_verbosity_verbose; } else if (choice == status_code_parameter_verbosity_debug) { - data->error.verbosity = f_console_verbosity_debug; + main->error.verbosity = f_console_verbosity_debug; } } status = F_none; } - if (data->parameters[status_code_parameter_help].result == f_console_result_found) { - status_code_print_help(data->output, data->context); + if (main->parameters[status_code_parameter_help].result == f_console_result_found) { + status_code_print_help(main->output, main->context); - status_code_data_delete(data); + status_code_main_delete(main); return F_none; } - if (data->parameters[status_code_parameter_version].result == f_console_result_found) { - fll_program_print_version(data->output, status_code_version); + if (main->parameters[status_code_parameter_version].result == f_console_result_found) { + fll_program_print_version(main->output, status_code_version); - status_code_data_delete(data); + status_code_main_delete(main); return F_none; } - if (data->parameters[status_code_parameter_is_error].result == f_console_result_found) { - if (data->parameters[status_code_parameter_is_warning].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_error); - f_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_warning); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); + if (main->parameters[status_code_parameter_is_error].result == f_console_result_found) { + if (main->parameters[status_code_parameter_is_warning].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_error); + f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter "); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_warning); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); - status_code_data_delete(data); + status_code_main_delete(main); return F_status_set_error(status); } - else if (data->parameters[status_code_parameter_is_fine].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_error); - f_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_fine); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); - - status_code_data_delete(data); + else if (main->parameters[status_code_parameter_is_fine].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_error); + f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter "); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_fine); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); + + status_code_main_delete(main); return F_status_set_error(status); } } - else if (data->parameters[status_code_parameter_is_warning].result == f_console_result_found && data->parameters[status_code_parameter_is_fine].result == f_console_result_found) { - f_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_warning); - f_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); - f_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_fine); - f_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol_s[0]); - - status_code_data_delete(data); + else if (main->parameters[status_code_parameter_is_warning].result == f_console_result_found && main->parameters[status_code_parameter_is_fine].result == f_console_result_found) { + f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_warning); + f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter "); + f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_fine); + f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]); + + status_code_main_delete(main); return F_status_set_error(status); } - if (data->remaining.used == 0 && !data->process_pipe) { - f_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify a status code.%c", fll_error_print_error, f_string_eol_s[0]); + if (main->remaining.used == 0 && !main->process_pipe) { + f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify a status code.%c", fll_error_print_error, f_string_eol_s[0]); - status_code_data_delete(data); + status_code_main_delete(main); return F_status_set_error(F_parameter); } f_status_t status2 = F_none; - if (data->parameters[status_code_parameter_is_error].result == f_console_result_found || data->parameters[status_code_parameter_is_warning].result == f_console_result_found || data->parameters[status_code_parameter_is_fine].result == f_console_result_found) { - if (data->process_pipe) { - // @todo: call status_code_process_check() here for all data from pipe that is space separated. + if (main->parameters[status_code_parameter_is_error].result == f_console_result_found || main->parameters[status_code_parameter_is_warning].result == f_console_result_found || main->parameters[status_code_parameter_is_fine].result == f_console_result_found) { + if (main->process_pipe) { + // @todo: call status_code_process_check() here for all main from pipe that is space separated. } - if (data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { + if (main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { - status2 = status_code_process_check(*data, arguments.argv[data->remaining.array[i]]); + status2 = status_code_process_check(*main, arguments.argv[main->remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; @@ -164,15 +164,15 @@ extern "C" { } // for } } - else if (data->parameters[status_code_parameter_number].result == f_console_result_found) { - if (data->process_pipe) { - // @todo: call status_code_process_number() here for all data from pipe that is space separated. + else if (main->parameters[status_code_parameter_number].result == f_console_result_found) { + if (main->process_pipe) { + // @todo: call status_code_process_number() here for all main from pipe that is space separated. } - if (data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { + if (main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { - status2 = status_code_process_number(*data, arguments.argv[data->remaining.array[i]]); + status2 = status_code_process_number(*main, arguments.argv[main->remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; @@ -181,14 +181,14 @@ extern "C" { } } else { - if (data->process_pipe) { - // @todo: call status_code_process_normal() here for all data from pipe that is space separated. + if (main->process_pipe) { + // @todo: call status_code_process_normal() here for all main from pipe that is space separated. } - if (data->remaining.used > 0) { - for (f_array_length_t i = 0; i < data->remaining.used; i++) { + if (main->remaining.used > 0) { + for (f_array_length_t i = 0; i < main->remaining.used; i++) { - status2 = status_code_process_normal(*data, arguments.argv[data->remaining.array[i]]); + status2 = status_code_process_normal(*main, arguments.argv[main->remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { status = status2; @@ -197,27 +197,27 @@ extern "C" { } } - status_code_data_delete(data); + status_code_main_delete(main); return status; } #endif // _di_status_code_main_ -#ifndef _di_status_code_data_delete_ - f_status_t status_code_data_delete(status_code_data_t *data) { +#ifndef _di_status_code_main_delete_ + f_status_t status_code_main_delete(status_code_main_t *main) { for (f_array_length_t i = 0; i < status_code_total_parameters; i++) { - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations); - f_macro_array_lengths_t_delete_simple(data->parameters[i].locations_sub); - f_macro_array_lengths_t_delete_simple(data->parameters[i].values); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations); + f_macro_array_lengths_t_delete_simple(main->parameters[i].locations_sub); + f_macro_array_lengths_t_delete_simple(main->parameters[i].values); } // for - f_macro_array_lengths_t_delete_simple(data->remaining); + f_macro_array_lengths_t_delete_simple(main->remaining); - f_macro_color_context_t_delete_simple(data->context); + f_macro_color_context_t_delete_simple(main->context); return F_none; } -#endif // _di_status_code_data_delete_ +#endif // _di_status_code_main_delete_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/status_code/c/status_code.h b/level_3/status_code/c/status_code.h index 5cc8ecc..c9c1f50 100644 --- a/level_3/status_code/c/status_code.h +++ b/level_3/status_code/c/status_code.h @@ -102,7 +102,7 @@ extern "C" { #define status_code_total_parameters 13 #endif // _di_status_code_defines_ -#ifndef _di_status_code_data_t_ +#ifndef _di_status_code_main_t_ typedef struct { f_console_parameter_t parameters[status_code_total_parameters]; @@ -113,9 +113,9 @@ extern "C" { fll_error_print_t error; f_color_context_t context; - } status_code_data_t; + } status_code_main_t; - #define status_code_data_t_initialize \ + #define status_code_main_t_initialize \ { \ status_code_console_parameter_t_initialize, \ f_array_lengths_t_initialize, \ @@ -124,7 +124,7 @@ extern "C" { fll_error_print_t_initialize, \ f_color_context_t_initialize, \ } -#endif // _di_status_code_data_t_ +#endif // _di_status_code_main_t_ /** * Print help. @@ -144,31 +144,31 @@ extern "C" { /** * Execute main program. * - * Be sure to call status_code_data_delete() after executing this. + * Be sure to call status_code_main_delete() after executing this. * * @param arguments * The parameters passed to the process. - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. * * Status codes (with error bit) are returned on any problem. * - * @see status_code_data_delete() + * @see status_code_main_delete() */ #ifndef _di_status_code_main_ - extern f_status_t status_code_main(const f_console_arguments_t arguments, status_code_data_t *data); + extern f_status_t status_code_main(const f_console_arguments_t arguments, status_code_main_t *main); #endif // _di_status_code_main_ /** - * Deallocate data. + * Deallocate main. * * Be sure to call this after executing status_code_main(). * - * @param data - * The program data. + * @param main + * The main data. * * @return * F_none on success. @@ -177,9 +177,9 @@ extern "C" { * * @see status_code_main() */ -#ifndef _di_status_code_data_delete_ - extern f_status_t status_code_data_delete(status_code_data_t *data); -#endif // _di_status_code_data_delete_ +#ifndef _di_status_code_main_delete_ + extern f_status_t status_code_main_delete(status_code_main_t *main); +#endif // _di_status_code_main_delete_ #ifdef __cplusplus } // extern "C" -- 1.8.3.1