From ebaca7255a5773942f4f6c2be517f77ec4280222 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 14 Dec 2021 20:39:03 -0600 Subject: [PATCH] Update: Switch to simple string and cleanup syntax and comments. The f_string_static_t operations_name array can be converted to just an array of f_string_t. Then the f_string_range_t operations_range can become f_array_length_t operations_length. Then the operation_name can be removed (it appears to be unused). Finally The fl_string_dynamic_partial_compare() can become fl_string_dynamic_partial_compare_string(). Update comments and add additional inline comments to help clarify situations. --- level_3/fake/c/private-build.c | 389 ++++++++++++++++++++-------------------- level_3/fake/c/private-common.h | 170 +++++++++--------- level_3/fake/c/private-make.c | 178 +++++++++--------- level_3/fake/c/private-make.h | 12 +- 4 files changed, 371 insertions(+), 378 deletions(-) diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 48cd201..095ce1f 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -602,7 +602,7 @@ extern "C" { *status = fll_execute_arguments_add(fake_other_operation_build_s, fake_other_operation_build_s_length, &arguments); - // ensure console color mode is passed to the scripts so that they can also react to color mode. + // 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) && main->context.mode != F_color_mode_none_d) { char argument[3] = { f_console_symbol_short_disable_s[0], 0, 0 }; @@ -619,7 +619,7 @@ extern "C" { *status = fll_execute_arguments_add(argument, 2, &arguments); } - // ensure verbosity level is passed to the scripts so that they can also react to requested verbosity. + // Ensure verbosity level is passed to the scripts so that they can also react to requested verbosity. 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 }; @@ -1613,7 +1613,7 @@ extern "C" { macro_f_fss_contents_t_delete_simple(contents); } - // error when required settings are not specified. + // Error when required settings are not specified. if (F_status_is_error_not(*status)) { bool failed = F_false; @@ -2194,215 +2194,215 @@ extern "C" { }; bool * const settings_single_bool[] = { - 0, - 0, - 0, - &setting->build_script, - &setting->build_shared, - &setting->build_static, - 0, - &setting->path_headers_preserve, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &setting->path_standard, - 0, - 0, - 0, - &setting->search_exclusive, - &setting->search_shared, - &setting->search_static, + 0, // build_compiler + 0, // build_indexer + 0, // build_language + &setting->build_script, // build_script + &setting->build_shared, // build_shared + &setting->build_static, // build_static + 0, // path_headers + &setting->path_headers_preserve, // path_headers_preserve + 0, // path_language + 0, // path_library_script + 0, // path_library_shared + 0, // path_library_static + 0, // path_program_script + 0, // path_program_shared + 0, // path_program_static + 0, // path_sources + &setting->path_standard, // path_standard + 0, // process_post + 0, // process_pre + 0, // project_name + &setting->search_exclusive, // search_exclusive + &setting->search_shared, // search_shared + &setting->search_static, // search_static }; f_string_dynamic_t * const settings_single_destination[] = { - &setting->build_compiler, - &setting->build_indexer, - 0, - 0, - 0, - 0, - &setting->path_headers, - 0, - &setting->path_language, - &setting->path_library_script, - &setting->path_library_shared, - &setting->path_library_static, - &setting->path_program_script, - &setting->path_program_shared, - &setting->path_program_static, - &setting->path_sources, - 0, - &setting->process_post, - &setting->process_pre, - &setting->project_name, - 0, - 0, - 0, - 0, - &setting->version_major, - &setting->version_major_prefix, - &setting->version_micro, - &setting->version_micro_prefix, - &setting->version_minor, - &setting->version_minor_prefix, - &setting->version_nano, - &setting->version_nano_prefix, + &setting->build_compiler, // build_compiler + &setting->build_indexer, // build_indexer + 0, // build_language + 0, // build_script + 0, // build_shared + 0, // build_static + &setting->path_headers, // path_headers + 0, // path_headers_preserve + &setting->path_language, // path_language + &setting->path_library_script, // path_library_script + &setting->path_library_shared, // path_library_shared + &setting->path_library_static, // path_library_static + &setting->path_program_script, // path_program_script + &setting->path_program_shared, // path_program_shared + &setting->path_program_static, // path_program_static + &setting->path_sources, // path_sources + 0, // path_standard + &setting->process_post, // process_post + &setting->process_pre, // process_pre + &setting->project_name, // project_name + 0, // search_exclusive + 0, // search_shared + 0, // search_static + 0, // version_file + &setting->version_major, // version_major + &setting->version_major_prefix, // version_major_prefix + &setting->version_micro, // version_micro + &setting->version_micro_prefix, // version_micro_prefix + &setting->version_minor, // version_minor + &setting->version_minor_prefix, // version_minor_prefix + &setting->version_nano, // version_nano + &setting->version_nano_prefix, // version_nano_prefix }; uint8_t * const settings_single_language[] = { - 0, - 0, - &setting->build_language, + 0, // build_compiler + 0, // build_indexer + &setting->build_language, // build_language }; uint8_t * const settings_single_version[] = { - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &setting->version_file, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &setting->version_target, + 0, // build_compiler + 0, // build_indexer + 0, // build_language + 0, // build_script + 0, // build_shared + 0, // build_static + 0, // path_headers + 0, // path_headers_preserve + 0, // path_language + 0, // path_library_script + 0, // path_library_shared + 0, // path_library_static + 0, // path_program_script + 0, // path_program_shared + 0, // path_program_static + 0, // path_sources + 0, // path_standard + 0, // process_post + 0, // process_pre + 0, // project_name + 0, // search_exclusive + 0, // search_shared + 0, // search_static + &setting->version_file, // version_file + 0, // version_major + 0, // version_major_prefix + 0, // version_micro + 0, // version_micro_prefix + 0, // version_minor + 0, // version_minor_prefix + 0, // version_nano + 0, // version_nano_prefix + &setting->version_target, // version_target }; const uint8_t settings_single_version_default[] = { - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - fake_build_version_type_micro, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - fake_build_version_type_major, + 0, // build_compiler + 0, // build_indexer + 0, // build_language + 0, // build_script + 0, // build_shared + 0, // build_static + 0, // path_headers + 0, // path_headers_preserve + 0, // path_language + 0, // path_library_script + 0, // path_library_shared + 0, // path_library_static + 0, // path_program_script + 0, // path_program_shared + 0, // path_program_static + 0, // path_sources + 0, // path_standard + 0, // process_post + 0, // process_pre + 0, // project_name + 0, // search_exclusive + 0, // search_shared + 0, // search_static + fake_build_version_type_micro, // version_file + 0, // version_major + 0, // version_major_prefix + 0, // version_micro + 0, // version_micro_prefix + 0, // version_minor + 0, // version_minor_prefix + 0, // version_nano + 0, // version_nano_prefix + fake_build_version_type_major, // version_target }; const char *settings_single_version_default_name[] = { - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - fake_build_version_micro_s, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - fake_build_version_major_s, + 0, // build_compiler + 0, // build_indexer + 0, // build_language + 0, // build_script + 0, // build_shared + 0, // build_static + 0, // path_headers + 0, // path_headers_preserve + 0, // path_language + 0, // path_library_script + 0, // path_library_shared + 0, // path_library_static + 0, // path_program_script + 0, // path_program_shared + 0, // path_program_static + 0, // path_sources + 0, // path_standard + 0, // process_post + 0, // process_pre + 0, // project_name + 0, // search_exclusive + 0, // search_shared + 0, // search_static + fake_build_version_micro_s, // version_file + 0, // version_major + 0, // version_major_prefix + 0, // version_micro + 0, // version_micro_prefix + 0, // version_minor + 0, // version_minor_prefix + 0, // version_nano + 0, // version_nano_prefix + fake_build_version_major_s, // version_target }; // 1 = "yes" or "no", 2 = path/, 3 = literal, 4 = "bash", "c", or "c++", 5 = "major", "minor", "micro", or "nano". const uint8_t settings_single_type[] = { - 3, - 3, - 4, - 1, - 1, - 1, - 2, - 1, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 1, - 3, - 3, - 3, - 1, - 1, - 1, - 5, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 5, + 3, // build_compiler + 3, // build_indexer + 4, // build_language + 1, // build_script + 1, // build_shared + 1, // build_static + 2, // path_headers + 1, // path_headers_preserve + 2, // path_language + 2, // path_library_script + 2, // path_library_shared + 2, // path_library_static + 2, // path_program_script + 2, // path_program_shared + 2, // path_program_static + 2, // path_sources + 1, // path_standard + 3, // process_post + 3, // process_pre + 3, // project_name + 1, // search_exclusive + 1, // search_shared + 1, // search_static + 5, // version_file + 3, // version_major + 3, // version_major_prefix + 3, // version_micro + 3, // version_micro_prefix + 3, // version_minor + 3, // version_minor_prefix + 3, // version_nano + 3, // version_nano_prefix + 5, // version_target }; for (f_array_length_t i = 0; i < 33; ++i) { @@ -2536,6 +2536,7 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + break; } @@ -2544,6 +2545,7 @@ extern "C" { if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_append_assure", F_true); + break; } } @@ -2551,6 +2553,7 @@ extern "C" { *status = f_string_dynamic_terminate_after(settings_single_destination[i]); if (F_status_is_error(*status)) { fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); + break; } } diff --git a/level_3/fake/c/private-common.h b/level_3/fake/c/private-common.h index 19a62a3..77a1a90 100644 --- a/level_3/fake/c/private-common.h +++ b/level_3/fake/c/private-common.h @@ -164,64 +164,64 @@ extern "C" { } #define macro_fake_build_setting_t_delete_simple(setting) \ - macro_f_string_dynamic_t_delete_simple(setting.build_compiler); \ - macro_f_string_dynamic_t_delete_simple(setting.build_indexer); \ - macro_f_string_dynamic_t_delete_simple(setting.path_headers); \ - macro_f_string_dynamic_t_delete_simple(setting.path_language); \ - macro_f_string_dynamic_t_delete_simple(setting.path_library_script); \ - macro_f_string_dynamic_t_delete_simple(setting.path_library_shared); \ - macro_f_string_dynamic_t_delete_simple(setting.path_library_static); \ - macro_f_string_dynamic_t_delete_simple(setting.path_program_script); \ - macro_f_string_dynamic_t_delete_simple(setting.path_program_shared); \ - macro_f_string_dynamic_t_delete_simple(setting.path_program_static); \ - macro_f_string_dynamic_t_delete_simple(setting.path_sources); \ - macro_f_string_dynamic_t_delete_simple(setting.process_post); \ - macro_f_string_dynamic_t_delete_simple(setting.process_pre); \ - macro_f_string_dynamic_t_delete_simple(setting.project_name); \ - macro_f_string_dynamic_t_delete_simple(setting.version_major); \ - macro_f_string_dynamic_t_delete_simple(setting.version_major_prefix); \ - macro_f_string_dynamic_t_delete_simple(setting.version_micro); \ - macro_f_string_dynamic_t_delete_simple(setting.version_micro_prefix); \ - macro_f_string_dynamic_t_delete_simple(setting.version_minor); \ - macro_f_string_dynamic_t_delete_simple(setting.version_minor_prefix); \ - macro_f_string_dynamic_t_delete_simple(setting.version_nano); \ - macro_f_string_dynamic_t_delete_simple(setting.version_nano_prefix); \ - macro_f_string_dynamics_t_delete_simple(setting.build_indexer_arguments); \ - macro_f_string_dynamics_t_delete_simple(setting.build_libraries); \ - macro_f_string_dynamics_t_delete_simple(setting.build_libraries_shared); \ - macro_f_string_dynamics_t_delete_simple(setting.build_libraries_static); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_headers); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_headers_shared); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_headers_static); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_library); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_library_shared); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_library_static); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_program); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_program_shared); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_program_static); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_script); \ - macro_f_string_dynamics_t_delete_simple(setting.build_sources_setting); \ - macro_f_string_dynamics_t_delete_simple(setting.defines); \ - macro_f_string_dynamics_t_delete_simple(setting.defines_library); \ - macro_f_string_dynamics_t_delete_simple(setting.defines_library_shared); \ - macro_f_string_dynamics_t_delete_simple(setting.defines_library_static); \ - macro_f_string_dynamics_t_delete_simple(setting.defines_program); \ - macro_f_string_dynamics_t_delete_simple(setting.defines_program_shared); \ - macro_f_string_dynamics_t_delete_simple(setting.defines_program_static); \ - macro_f_string_dynamics_t_delete_simple(setting.defines_shared); \ - macro_f_string_dynamics_t_delete_simple(setting.defines_static); \ - macro_f_string_dynamics_t_delete_simple(setting.environment); \ - macro_f_string_dynamics_t_delete_simple(setting.flags); \ - macro_f_string_dynamics_t_delete_simple(setting.flags_library); \ - macro_f_string_dynamics_t_delete_simple(setting.flags_library_shared); \ - macro_f_string_dynamics_t_delete_simple(setting.flags_library_static); \ - macro_f_string_dynamics_t_delete_simple(setting.flags_program); \ - macro_f_string_dynamics_t_delete_simple(setting.flags_program_shared); \ - macro_f_string_dynamics_t_delete_simple(setting.flags_program_static); \ - macro_f_string_dynamics_t_delete_simple(setting.flags_shared); \ - macro_f_string_dynamics_t_delete_simple(setting.flags_static); \ - macro_f_string_dynamics_t_delete_simple(setting.modes); \ - macro_f_string_dynamics_t_delete_simple(setting.modes_default); + macro_f_string_dynamic_t_delete_simple(setting.build_compiler) \ + macro_f_string_dynamic_t_delete_simple(setting.build_indexer) \ + macro_f_string_dynamic_t_delete_simple(setting.path_headers) \ + macro_f_string_dynamic_t_delete_simple(setting.path_language) \ + macro_f_string_dynamic_t_delete_simple(setting.path_library_script) \ + macro_f_string_dynamic_t_delete_simple(setting.path_library_shared) \ + macro_f_string_dynamic_t_delete_simple(setting.path_library_static) \ + macro_f_string_dynamic_t_delete_simple(setting.path_program_script) \ + macro_f_string_dynamic_t_delete_simple(setting.path_program_shared) \ + macro_f_string_dynamic_t_delete_simple(setting.path_program_static) \ + macro_f_string_dynamic_t_delete_simple(setting.path_sources) \ + macro_f_string_dynamic_t_delete_simple(setting.process_post) \ + macro_f_string_dynamic_t_delete_simple(setting.process_pre) \ + macro_f_string_dynamic_t_delete_simple(setting.project_name) \ + macro_f_string_dynamic_t_delete_simple(setting.version_major) \ + macro_f_string_dynamic_t_delete_simple(setting.version_major_prefix) \ + macro_f_string_dynamic_t_delete_simple(setting.version_micro) \ + macro_f_string_dynamic_t_delete_simple(setting.version_micro_prefix) \ + macro_f_string_dynamic_t_delete_simple(setting.version_minor) \ + macro_f_string_dynamic_t_delete_simple(setting.version_minor_prefix) \ + macro_f_string_dynamic_t_delete_simple(setting.version_nano) \ + macro_f_string_dynamic_t_delete_simple(setting.version_nano_prefix) \ + macro_f_string_dynamics_t_delete_simple(setting.build_indexer_arguments) \ + macro_f_string_dynamics_t_delete_simple(setting.build_libraries) \ + macro_f_string_dynamics_t_delete_simple(setting.build_libraries_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.build_libraries_static) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_headers) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_headers_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_headers_static) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_library) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_library_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_library_static) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_program) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_program_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_program_static) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_script) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_setting) \ + macro_f_string_dynamics_t_delete_simple(setting.defines) \ + macro_f_string_dynamics_t_delete_simple(setting.defines_library) \ + macro_f_string_dynamics_t_delete_simple(setting.defines_library_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.defines_library_static) \ + macro_f_string_dynamics_t_delete_simple(setting.defines_program) \ + macro_f_string_dynamics_t_delete_simple(setting.defines_program_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.defines_program_static) \ + macro_f_string_dynamics_t_delete_simple(setting.defines_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.defines_static) \ + macro_f_string_dynamics_t_delete_simple(setting.environment) \ + macro_f_string_dynamics_t_delete_simple(setting.flags) \ + macro_f_string_dynamics_t_delete_simple(setting.flags_library) \ + macro_f_string_dynamics_t_delete_simple(setting.flags_library_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.flags_library_static) \ + macro_f_string_dynamics_t_delete_simple(setting.flags_program) \ + macro_f_string_dynamics_t_delete_simple(setting.flags_program_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.flags_program_static) \ + macro_f_string_dynamics_t_delete_simple(setting.flags_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.flags_static) \ + macro_f_string_dynamics_t_delete_simple(setting.modes) \ + macro_f_string_dynamics_t_delete_simple(setting.modes_default) \ #define FAKE_build_setting_name_build_compiler_s "build_compiler" #define FAKE_build_setting_name_build_language_s "build_language" @@ -481,19 +481,19 @@ extern "C" { #define fake_build_stage_total_d 13 #define macro_fake_build_stage_t_delete_simple(stage) \ - macro_f_string_dynamic_t_delete_simple(stage.file_libraries_script); \ - macro_f_string_dynamic_t_delete_simple(stage.file_libraries_shared); \ - macro_f_string_dynamic_t_delete_simple(stage.file_libraries_static); \ - macro_f_string_dynamic_t_delete_simple(stage.file_objects_static); \ - macro_f_string_dynamic_t_delete_simple(stage.file_process_post); \ - macro_f_string_dynamic_t_delete_simple(stage.file_process_pre); \ - macro_f_string_dynamic_t_delete_simple(stage.file_programs_script); \ - macro_f_string_dynamic_t_delete_simple(stage.file_programs_shared); \ - macro_f_string_dynamic_t_delete_simple(stage.file_programs_static); \ - macro_f_string_dynamic_t_delete_simple(stage.file_skeleton); \ - macro_f_string_dynamic_t_delete_simple(stage.file_sources_headers); \ - macro_f_string_dynamic_t_delete_simple(stage.file_sources_script); \ - macro_f_string_dynamic_t_delete_simple(stage.file_sources_settings); + macro_f_string_dynamic_t_delete_simple(stage.file_libraries_script) \ + macro_f_string_dynamic_t_delete_simple(stage.file_libraries_shared) \ + macro_f_string_dynamic_t_delete_simple(stage.file_libraries_static) \ + macro_f_string_dynamic_t_delete_simple(stage.file_objects_static) \ + macro_f_string_dynamic_t_delete_simple(stage.file_process_post) \ + macro_f_string_dynamic_t_delete_simple(stage.file_process_pre) \ + macro_f_string_dynamic_t_delete_simple(stage.file_programs_script) \ + macro_f_string_dynamic_t_delete_simple(stage.file_programs_shared) \ + macro_f_string_dynamic_t_delete_simple(stage.file_programs_static) \ + macro_f_string_dynamic_t_delete_simple(stage.file_skeleton) \ + macro_f_string_dynamic_t_delete_simple(stage.file_sources_headers) \ + macro_f_string_dynamic_t_delete_simple(stage.file_sources_script) \ + macro_f_string_dynamic_t_delete_simple(stage.file_sources_settings) #define FAKE_build_stage_built_s ".built" #define FAKE_build_stage_libraries_script_s "libraries_script" @@ -1041,17 +1041,17 @@ extern "C" { } #define macro_fake_make_parameter_delete_simple(parameter) \ - macro_f_string_dynamics_t_delete_simple(parameter.build); \ - macro_f_string_dynamics_t_delete_simple(parameter.color); \ - macro_f_string_dynamics_t_delete_simple(parameter.data); \ - macro_f_string_dynamics_t_delete_simple(parameter.define); \ - macro_f_string_dynamics_t_delete_simple(parameter.fakefile); \ - macro_f_string_dynamics_t_delete_simple(parameter.mode); \ - macro_f_string_dynamics_t_delete_simple(parameter.process); \ - macro_f_string_dynamics_t_delete_simple(parameter.settings); \ - macro_f_string_dynamics_t_delete_simple(parameter.sources); \ - macro_f_string_dynamics_t_delete_simple(parameter.verbosity); \ - macro_f_string_dynamics_t_delete_simple(parameter.work); + macro_f_string_dynamics_t_delete_simple(parameter.build) \ + macro_f_string_dynamics_t_delete_simple(parameter.color) \ + macro_f_string_dynamics_t_delete_simple(parameter.data) \ + macro_f_string_dynamics_t_delete_simple(parameter.define) \ + macro_f_string_dynamics_t_delete_simple(parameter.fakefile) \ + macro_f_string_dynamics_t_delete_simple(parameter.mode) \ + macro_f_string_dynamics_t_delete_simple(parameter.process) \ + macro_f_string_dynamics_t_delete_simple(parameter.settings) \ + macro_f_string_dynamics_t_delete_simple(parameter.sources) \ + macro_f_string_dynamics_t_delete_simple(parameter.verbosity) \ + macro_f_string_dynamics_t_delete_simple(parameter.work) #endif // _di_fake_make_parameter_t_ #ifndef _di_fake_make_path_t_ @@ -1108,12 +1108,12 @@ extern "C" { #define macro_fake_make_data_t_delete_simple(structure) \ macro_fake_build_setting_t_delete_simple(structure.setting_build) \ macro_fake_make_setting_t_delete_simple(structure.setting_make) \ - macro_f_string_maps_t_delete_simple(structure.environment); \ + macro_f_string_maps_t_delete_simple(structure.environment) \ macro_fake_make_parameter_delete_simple(structure.parameter) \ macro_fake_make_path_delete_simple(structure.path) \ macro_f_fss_nameds_t_delete_simple(structure.fakefile) \ - macro_f_string_dynamic_t_delete_simple(structure.buffer); \ - macro_f_string_dynamic_t_delete_simple(structure.path_cache); + macro_f_string_dynamic_t_delete_simple(structure.buffer) \ + macro_f_string_dynamic_t_delete_simple(structure.path_cache) #endif // _di_fake_make_data_t_ #ifndef _di_fake_skeleton_content_ diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index cf86a9f..4c0d1f8 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -674,7 +674,7 @@ extern "C" { return; } - // if either compiler or indexer is specified, each will replace any existing build_compiler or build_indexer, respectively. + // If either compiler or indexer is specified, each will replace any existing build_compiler or build_indexer, respectively. if (range_compiler) { data_make->setting_build.build_compiler.used = 0; @@ -698,7 +698,7 @@ extern "C" { f_string_map_multis_t define = f_string_map_multis_t_initialize; - // load the fakefile "settings" as if they are build "settings". + // Load the fakefile "settings" as if they are build "settings". fake_build_load_setting_process(main, F_false, 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) { @@ -1209,20 +1209,20 @@ extern "C" { f_file_stream_close(F_true, &data_make.path.top); - macro_f_array_lengths_t_delete_simple(section_stack); - macro_fake_make_data_t_delete_simple(data_make); + macro_f_array_lengths_t_delete_simple(section_stack) + macro_fake_make_data_t_delete_simple(data_make) return status; } #endif // _di_fake_make_operate_ #ifndef _di_fake_make_operate_expand_ - void fake_make_operate_expand(fake_main_t * const 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) { + void fake_make_operate_expand(fake_main_t * const main, const f_string_range_t section_name, const f_array_length_t operation, 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; - // pre-allocate the known arguments size. + // Pre-allocate the known arguments size. if (arguments->used + content.used > arguments->size) { *status = f_string_dynamics_increase_by(content.used, arguments); @@ -1382,9 +1382,8 @@ extern "C" { if (parameter_is) { unmatched = F_true; - // check against reserved parameter names and if matches use them instead. + // Check against reserved parameter names and if matches use them instead. if (fl_string_dynamic_partial_compare_string(fake_make_parameter_variable_return_s, data_make->buffer, fake_make_parameter_variable_return_s_length, iki_content.array[j]) == F_equal_to) { - if (data_make->setting_make.parameter.array[0].value.array[0].used) { *status = f_string_dynamic_append(data_make->setting_make.parameter.array[0].value.array[0], &arguments->array[arguments->used]); @@ -1451,7 +1450,7 @@ extern "C" { if (unmatched && parameter->used) { for (k = 0; k < parameter->used; ++k) { - // check against iki variable list. + // Check against iki variable list. *status = fl_string_dynamic_partial_compare_dynamic(parameter->array[k].name, data_make->buffer, iki_content.array[j]); if (*status == F_equal_to) { @@ -1547,7 +1546,7 @@ extern "C" { range.start = iki_variable.array[iki_variable.used - 1].stop + 1; range.stop = content.array[i].stop; - // if arguments->used was not incremented, then use the value, otherwise arguments->used is past the value to append to, so subtract 1. + // If arguments->used was not incremented, then use the value, otherwise arguments->used is past the value to append to, so subtract 1. if (used_arguments == arguments->used) { *status = f_string_dynamic_partial_append_nulless(data_make->buffer, range, &arguments->array[arguments->used]); } @@ -1579,7 +1578,7 @@ extern "C" { } } - // if iki variable did not match (results in empty string) or iki variable is inside quotes, then increment. + // If iki variable did not match (results in empty string) or iki variable is inside quotes, then increment. if (used_arguments == arguments->used) { *status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); @@ -2014,7 +2013,7 @@ extern "C" { return 0; } - // add the operation id to the operation stack. + // Add the operation id to the operation stack. if (section_stack->used + 1 > section_stack->size) { macro_f_array_lengths_t_increase_by((*status), (*section_stack), F_memory_default_allocation_small_d); @@ -2044,72 +2043,72 @@ extern "C" { return 0; } - const f_string_static_t operations_name[] = { - macro_f_string_static_t_initialize(fake_make_operation_break_s, fake_make_operation_break_s_length), - macro_f_string_static_t_initialize(fake_make_operation_build_s, fake_make_operation_build_s_length), - macro_f_string_static_t_initialize(fake_make_operation_clean_s, fake_make_operation_clean_s_length), - macro_f_string_static_t_initialize(fake_make_operation_clone_s, fake_make_operation_clone_s_length), - macro_f_string_static_t_initialize(fake_make_operation_compile_s, fake_make_operation_compile_s_length), - macro_f_string_static_t_initialize(fake_make_operation_copy_s, fake_make_operation_copy_s_length), - macro_f_string_static_t_initialize(fake_make_operation_define_s, fake_make_operation_define_s_length), - macro_f_string_static_t_initialize(fake_make_operation_delete_s, fake_make_operation_delete_s_length), - macro_f_string_static_t_initialize(fake_make_operation_deletes_s, fake_make_operation_deletes_s_length), - macro_f_string_static_t_initialize(fake_make_operation_else_s, fake_make_operation_else_s_length), - macro_f_string_static_t_initialize(fake_make_operation_exit_s, fake_make_operation_exit_s_length), - macro_f_string_static_t_initialize(fake_make_operation_fail_s, fake_make_operation_fail_s_length), - macro_f_string_static_t_initialize(fake_make_operation_group_s, fake_make_operation_group_s_length), - macro_f_string_static_t_initialize(fake_make_operation_groups_s, fake_make_operation_groups_s_length), - macro_f_string_static_t_initialize(fake_make_operation_if_s, fake_make_operation_if_s_length), - macro_f_string_static_t_initialize(fake_make_operation_index_s, fake_make_operation_index_s_length), - macro_f_string_static_t_initialize(fake_make_operation_link_s, fake_make_operation_link_s_length), - macro_f_string_static_t_initialize(fake_make_operation_mode_s, fake_make_operation_mode_s_length), - macro_f_string_static_t_initialize(fake_make_operation_modes_s, fake_make_operation_modes_s_length), - macro_f_string_static_t_initialize(fake_make_operation_move_s, fake_make_operation_move_s_length), - macro_f_string_static_t_initialize(fake_make_operation_operate_s, fake_make_operation_operate_s_length), - macro_f_string_static_t_initialize(fake_make_operation_owner_s, fake_make_operation_owner_s_length), - macro_f_string_static_t_initialize(fake_make_operation_owners_s, fake_make_operation_owners_s_length), - macro_f_string_static_t_initialize(fake_make_operation_pop_s, fake_make_operation_pop_s_length), - macro_f_string_static_t_initialize(fake_make_operation_print_s, fake_make_operation_print_s_length), - macro_f_string_static_t_initialize(fake_make_operation_run_s, fake_make_operation_run_s_length), - macro_f_string_static_t_initialize(fake_make_operation_shell_s, fake_make_operation_shell_s_length), - macro_f_string_static_t_initialize(fake_make_operation_skeleton_s, fake_make_operation_skeleton_s_length), - macro_f_string_static_t_initialize(fake_make_operation_to_s, fake_make_operation_to_s_length), - macro_f_string_static_t_initialize(fake_make_operation_top_s, fake_make_operation_top_s_length), - macro_f_string_static_t_initialize(fake_make_operation_touch_s, fake_make_operation_touch_s_length), + const f_string_t operations_name[] = { + fake_make_operation_break_s, + fake_make_operation_build_s, + fake_make_operation_clean_s, + fake_make_operation_clone_s, + fake_make_operation_compile_s, + fake_make_operation_copy_s, + fake_make_operation_define_s, + fake_make_operation_delete_s, + fake_make_operation_deletes_s, + fake_make_operation_else_s, + fake_make_operation_exit_s, + fake_make_operation_fail_s, + fake_make_operation_group_s, + fake_make_operation_groups_s, + fake_make_operation_if_s, + fake_make_operation_index_s, + fake_make_operation_link_s, + fake_make_operation_mode_s, + fake_make_operation_modes_s, + fake_make_operation_move_s, + fake_make_operation_operate_s, + fake_make_operation_owner_s, + fake_make_operation_owners_s, + fake_make_operation_pop_s, + fake_make_operation_print_s, + fake_make_operation_run_s, + fake_make_operation_shell_s, + fake_make_operation_skeleton_s, + fake_make_operation_to_s, + fake_make_operation_top_s, + fake_make_operation_touch_s, }; - const f_string_range_t operations_range[] = { - macro_f_string_range_t_initialize(fake_make_operation_break_s_length), - macro_f_string_range_t_initialize(fake_make_operation_build_s_length), - macro_f_string_range_t_initialize(fake_make_operation_clean_s_length), - macro_f_string_range_t_initialize(fake_make_operation_clone_s_length), - macro_f_string_range_t_initialize(fake_make_operation_compile_s_length), - macro_f_string_range_t_initialize(fake_make_operation_copy_s_length), - macro_f_string_range_t_initialize(fake_make_operation_define_s_length), - macro_f_string_range_t_initialize(fake_make_operation_delete_s_length), - macro_f_string_range_t_initialize(fake_make_operation_deletes_s_length), - macro_f_string_range_t_initialize(fake_make_operation_else_s_length), - macro_f_string_range_t_initialize(fake_make_operation_exit_s_length), - macro_f_string_range_t_initialize(fake_make_operation_fail_s_length), - macro_f_string_range_t_initialize(fake_make_operation_group_s_length), - macro_f_string_range_t_initialize(fake_make_operation_groups_s_length), - macro_f_string_range_t_initialize(fake_make_operation_if_s_length), - macro_f_string_range_t_initialize(fake_make_operation_index_s_length), - macro_f_string_range_t_initialize(fake_make_operation_link_s_length), - macro_f_string_range_t_initialize(fake_make_operation_mode_s_length), - macro_f_string_range_t_initialize(fake_make_operation_modes_s_length), - macro_f_string_range_t_initialize(fake_make_operation_move_s_length), - macro_f_string_range_t_initialize(fake_make_operation_operate_s_length), - macro_f_string_range_t_initialize(fake_make_operation_owner_s_length), - macro_f_string_range_t_initialize(fake_make_operation_owners_s_length), - macro_f_string_range_t_initialize(fake_make_operation_pop_s_length), - macro_f_string_range_t_initialize(fake_make_operation_print_s_length), - macro_f_string_range_t_initialize(fake_make_operation_run_s_length), - macro_f_string_range_t_initialize(fake_make_operation_shell_s_length), - macro_f_string_range_t_initialize(fake_make_operation_skeleton_s_length), - macro_f_string_range_t_initialize(fake_make_operation_to_s_length), - macro_f_string_range_t_initialize(fake_make_operation_top_s_length), - macro_f_string_range_t_initialize(fake_make_operation_touch_s_length), + const f_array_length_t operations_length[] = { + fake_make_operation_break_s_length, + fake_make_operation_build_s_length, + fake_make_operation_clean_s_length, + fake_make_operation_clone_s_length, + fake_make_operation_compile_s_length, + fake_make_operation_copy_s_length, + fake_make_operation_define_s_length, + fake_make_operation_delete_s_length, + fake_make_operation_deletes_s_length, + fake_make_operation_else_s_length, + fake_make_operation_exit_s_length, + fake_make_operation_fail_s_length, + fake_make_operation_group_s_length, + fake_make_operation_groups_s_length, + fake_make_operation_if_s_length, + fake_make_operation_index_s_length, + fake_make_operation_link_s_length, + fake_make_operation_mode_s_length, + fake_make_operation_modes_s_length, + fake_make_operation_move_s_length, + fake_make_operation_operate_s_length, + fake_make_operation_owner_s_length, + fake_make_operation_owners_s_length, + fake_make_operation_pop_s_length, + fake_make_operation_print_s_length, + fake_make_operation_run_s_length, + fake_make_operation_shell_s_length, + fake_make_operation_skeleton_s_length, + fake_make_operation_to_s_length, + fake_make_operation_top_s_length, + fake_make_operation_touch_s_length, }; const uint8_t operations_type[] = { @@ -2152,31 +2151,29 @@ extern "C" { bool success = F_true; - const f_string_static_t *operation_name = 0; - f_string_dynamics_t arguments[section->objects.used]; f_array_length_t i = 0; f_array_length_t j = 0; - memset(operations, 0, sizeof(uint8_t) * section->objects.used); + memset(operations, 0, section->objects.used); memset(arguments, 0, sizeof(f_string_dynamics_t) * section->objects.used); for (i = 0; i < section->objects.used; ++i, *status = F_none) { operation = 0; - operation_name = 0; if (!(i % fake_signal_check_short_d) && fake_signal_received(main)) { *status = F_status_set_error(F_interrupt); + break; } for (j = 0; j < fake_make_operation_total_d; ++j) { - if (fl_string_dynamic_partial_compare(operations_name[j], data_make->buffer, operations_range[j], section->objects.array[i]) == F_equal_to) { + if (fl_string_dynamic_partial_compare_string(operations_name[j], data_make->buffer, operations_length[j], section->objects.array[i]) == F_equal_to) { operation = operations_type[j]; - operation_name = &operations_name[j]; + break; } } // for @@ -2197,7 +2194,7 @@ extern "C" { if (F_status_is_error_not(*status)) { operations[i] = operation; - fake_make_operate_expand(main, 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, section->contents.array[i], section->quotess.array[i], data_make, &arguments[i], status); } if (operation_if == fake_make_operation_if_type_true_next) { @@ -2210,10 +2207,9 @@ extern "C" { operation_if = fake_make_operation_if_type_false_always; } - fake_make_operate_validate(main, section->name, operation, *operation_name, arguments[i], &operation_if, data_make, section_stack, status); + fake_make_operate_validate(main, section->name, operation, arguments[i], &operation_if, data_make, section_stack, status); if (F_status_is_error_not(*status)) { - if (operation_if == fake_make_operation_if_type_false) { operation_if = fake_make_operation_if_type_else_true_next; continue; @@ -2227,14 +2223,13 @@ extern "C" { continue; } - const int result = fake_make_operate_process(main, section->name, operation, *operation_name, arguments[i], success, &operation_if, data_make, section_stack, status); + const int result = fake_make_operate_process(main, section->name, operation, arguments[i], success, &operation_if, data_make, section_stack, status); if (*status == F_child) { return result; } } else { - if (operation == fake_make_operation_type_if) { switch (operation_if) { case fake_make_operation_if_type_if_defined: @@ -2272,6 +2267,7 @@ extern "C" { } if (operation_if == fake_make_operation_if_type_else_true || operation_if == fake_make_operation_if_type_else_false) { + // No else condition provided, so clear the operation_if state. if (operation != fake_make_operation_type_else) { operation_if = 0; @@ -2287,7 +2283,7 @@ extern "C" { if (F_status_is_error(*status)) { success = F_false; - // break acts identical to fail when at the top of the stack. + // Break acts identical to fail when at the top of the stack. 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 = fl_print_error_s; @@ -2366,7 +2362,7 @@ extern "C" { *status = F_status_set_error(F_failure); } - // ensure an error is returned during recursion if the last known section operation failed, except for the main operation. + // Ensure an error is returned during recursion if the last known section operation failed, except for the main operation. if (success == F_false && F_status_is_error_not(*status) && section_stack->used > 1) { *status = F_status_set_error(F_failure); } @@ -2382,7 +2378,7 @@ extern "C" { #endif // _di_fake_make_operate_section_ #ifndef _di_fake_make_operate_process_ - int fake_make_operate_process(fake_main_t * const main, 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_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) { + int fake_make_operate_process(fake_main_t * const main, const f_string_range_t section_name, const uint8_t operation, const f_string_dynamics_t arguments, const bool success, uint8_t *operation_if, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) { if (*status == F_child) return main->child; @@ -4089,7 +4085,7 @@ extern "C" { #endif // _di_fake_make_operate_process_run_ #ifndef _di_fake_make_operate_validate_ - void fake_make_operate_validate(fake_main_t * const 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) { + void fake_make_operate_validate(fake_main_t * const main, const f_string_range_t section_name, const f_array_length_t operation, 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; diff --git a/level_3/fake/c/private-make.h b/level_3/fake/c/private-make.h index e65fa9f..60ed437 100644 --- a/level_3/fake/c/private-make.h +++ b/level_3/fake/c/private-make.h @@ -178,8 +178,6 @@ extern "C" { * The section name. * @param operation * The operation being performed. - * @param operation_name - * The operation name. * @param content * The content array. * @param quoteds @@ -194,7 +192,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_operate_expand_ - extern void fake_make_operate_expand(fake_main_t * const 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_d; + extern void fake_make_operate_expand(fake_main_t * const main, const f_string_range_t section_name, const f_array_length_t operation, 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_d; #endif // _di_fake_make_operate_expand_ /** @@ -282,8 +280,6 @@ extern "C" { * The section name. * @param operation * The operation type. - * @param operation_name - * The operation name. * @param arguments * The expanded arguments. * @param success @@ -306,7 +302,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_process_ - extern int fake_make_operate_process(fake_main_t * const main, 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_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) F_attribute_visibility_internal_d; + extern int fake_make_operate_process(fake_main_t * const main, const f_string_range_t section_name, const uint8_t operation, const f_string_dynamics_t arguments, const bool success, uint8_t *operation_if, fake_make_data_t *data_make, f_array_lengths_t *section_stack, f_status_t *status) F_attribute_visibility_internal_d; #endif // _di_fake_make_operate_process_ /** @@ -387,8 +383,6 @@ extern "C" { * The section name. * @param operation * The operation being performed. - * @param operation_name - * The operation name. * @param arguments * The expanded arguments. * @param operation_if @@ -403,7 +397,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(fake_main_t * const 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_d; + extern void fake_make_operate_validate(fake_main_t * const main, const f_string_range_t section_name, const f_array_length_t operation, 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_d; #endif // _di_fake_make_operate_validate_ /** -- 1.8.3.1