From f53649098fabdcf7c37cd8a0e6679b9e51818adf Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 17 May 2020 12:05:59 -0500 Subject: [PATCH] Progress: featureless make Snatch apart the settings strings instead of mashing them together. Process the environment build setting to enable selecting additional environment variable to expose to the process scripts. --- level_0/f_path/c/path.h | 3 + level_3/fake/c/private-build.c | 410 ++++++++++++++++++++++++++++++++------- level_3/fake/c/private-build.h | 255 ++++++++---------------- level_3/fake/data/build/settings | 2 +- 4 files changed, 427 insertions(+), 243 deletions(-) diff --git a/level_0/f_path/c/path.h b/level_0/f_path/c/path.h index 481c8f5..d678ebd 100644 --- a/level_0/f_path/c/path.h +++ b/level_0/f_path/c/path.h @@ -39,6 +39,9 @@ extern "C" { #define f_path_separator "/" #define f_path_separator_variable ":" + #define f_path_separator_length 1 + #define f_path_separator_variable_length 1 + #define f_path_environment "PATH" #define f_path_home_wildcard "~" #define f_path_present_working "PWD" diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 8afe26b..eda9a65 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -128,9 +128,10 @@ extern "C" { } f_string_dynamic path = f_string_dynamic_initialize; + f_string function = 0; { - f_string function = "fl_string_dynamic_append_nulless"; + function = "fl_string_dynamic_append_nulless"; if (process_script.string[0] != '/') { status = fl_string_dynamic_append_nulless(data.path_data_build, &path); @@ -149,43 +150,119 @@ extern "C" { fake_print_error(data.context, data.verbosity, f_status_set_fine(status), function, f_true); f_macro_string_dynamic_delete_simple(path); + f_macro_string_dynamics_delete_simple(arguments); return status; } } { - f_string_dynamics environment_names = f_string_dynamics_initialize; - f_string_dynamics environment_values = f_string_dynamics_initialize; + // @todo: create an implode function that merges f_string [] (and an f_string_dynamic [] equivalent) into a f_string_dynamics. + f_string_dynamics names = f_string_dynamics_initialize; - // @todo add support for allowing specific environment variables - const f_string variables_name[] = { - f_path_environment, - f_path_present_working - }; + { + // add the guaranteed environment variables. + const f_string variables_name[] = { + f_path_environment, + f_path_present_working + }; - const f_string_length variables_length[] = { - f_path_environment_length, - f_path_present_working_length - }; + const f_string_length variables_length[] = { + f_path_environment_length, + f_path_present_working_length + }; + + f_macro_string_dynamics_new(status, names, 2); + if (f_status_is_error(status)) { + fake_print_error(data.context, data.verbosity, f_status_set_fine(status), "f_macro_string_dynamics_new", f_true); + + f_macro_string_dynamic_delete_simple(path); + f_macro_string_dynamics_delete_simple(arguments); + f_macro_string_dynamics_delete_simple(names); + return status; + } + + f_string_dynamic part = f_string_dynamic_initialize; + + for (uint8_t i = 0; i < 2; i++) { + status = fl_string_append(variables_name[i], variables_length[i], &part); + if (f_status_is_error(status)) break; + + names.array[names.used].string = part.string; + names.array[names.used].used = part.used; + names.array[names.used].size = part.size; + names.used++; + + f_macro_string_dynamic_clear(part); + } // for + + if (!f_status_is_error(status)) { + if (names.used + settings.environment.used > names.size) { + if (names.used + settings.environment.used > f_array_length_size) { + if (data.verbosity != fake_verbosity_quiet) { + fprintf(f_standard_error, "%c", f_string_eol); + fl_color_print(f_standard_error, data.context.error, data.context.reset, "ERROR: The values for the settings '"); + fl_color_print(f_standard_error, data.context.notable, data.context.reset, "%s", fake_build_settings_name_environment); + fl_color_print(f_standard_error, data.context.error, data.context.reset, "' of settings file '"); + fl_color_print(f_standard_error, data.context.notable, data.context.reset, "%s", data.file_data_build_settings.string); + fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "' is too large."); + } + + f_macro_string_dynamic_delete_simple(part); + f_macro_string_dynamics_delete_simple(arguments); + f_macro_string_dynamics_delete_simple(names); + return f_status_set_error(f_buffer_too_large); + } + + f_macro_string_dynamics_resize(status, names, names.used + settings.environment.used); + if (f_status_is_error(status)) { + fake_print_error(data.context, data.verbosity, f_status_set_fine(status), "f_macro_string_dynamics_resize", f_true); + + f_macro_string_dynamic_delete_simple(part); + f_macro_string_dynamics_delete_simple(arguments); + f_macro_string_dynamics_delete_simple(names); + return status; + } + } + + for (f_string_length i = 0; i < settings.environment.used; i++) { + status = fl_string_dynamic_append_nulless(settings.environment.array[i], &part); + if (f_status_is_error(status)) break; + + names.array[names.used].string = part.string; + names.array[names.used].used = part.used; + names.array[names.used].size = part.size; + names.used++; + + f_macro_string_dynamic_clear(part); + } // for + } + + f_macro_string_dynamic_delete_simple(part); + + if (f_status_is_error(status)) { + fake_print_error(data.context, data.verbosity, f_status_set_fine(status), "fl_string_append", f_true); + + f_macro_string_dynamic_delete_simple(path); + f_macro_string_dynamics_delete_simple(arguments); + f_macro_string_dynamics_delete_simple(names); + return status; + } + } + + f_string_dynamics environment_names = f_string_dynamics_initialize; + f_string_dynamics environment_values = f_string_dynamics_initialize; f_string_dynamic variable_name = f_string_dynamic_initialize; f_string_dynamic variable_value = f_string_dynamic_initialize; - for (uint8_t i = 0; i < 2; i++) { - status = f_environment_get(variables_name[i], &variable_value); + for (f_string_length i = 0; i < names.used; i++) { + status = f_environment_get_dynamic(names.array[i], &variable_value); if (f_status_is_error(status)) { status = f_status_set_fine(status); if (status == f_error_reallocation) { - fake_print_error(data.context, data.verbosity, status, "f_environment_get", f_true); - - f_macro_string_dynamic_delete_simple(variable_name); - f_macro_string_dynamic_delete_simple(variable_value); - f_macro_string_dynamic_delete_simple(path); - f_macro_string_dynamics_delete_simple(environment_names); - f_macro_string_dynamics_delete_simple(environment_values); - f_macro_string_dynamics_delete_simple(arguments); - return status; + function = "f_macro_string_dynamics_resize"; + break; } } @@ -197,30 +274,16 @@ extern "C" { } if (f_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, status, "f_macro_string_dynamics_resize", f_true); - - f_macro_string_dynamic_delete_simple(variable_name); - f_macro_string_dynamic_delete_simple(variable_value); - f_macro_string_dynamic_delete_simple(path); - f_macro_string_dynamics_delete_simple(environment_names); - f_macro_string_dynamics_delete_simple(environment_values); - f_macro_string_dynamics_delete_simple(arguments); - return status; + function = "f_macro_string_dynamics_resize"; + break; } } - status = fl_string_append(variables_name[i], variables_length[i], &variable_name); + status = fl_string_dynamic_append(names.array[i], &variable_name); if (f_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, status, "fl_string_append", f_true); - - f_macro_string_dynamic_delete_simple(variable_name); - f_macro_string_dynamic_delete_simple(variable_value); - f_macro_string_dynamic_delete_simple(path); - f_macro_string_dynamics_delete_simple(environment_names); - f_macro_string_dynamics_delete_simple(environment_values); - f_macro_string_dynamics_delete_simple(arguments); - return status; + function = "fl_string_append"; + break; } environment_names.array[environment_names.used].string = variable_name.string; @@ -235,6 +298,20 @@ extern "C" { f_macro_string_dynamic_clear(variable_name); f_macro_string_dynamic_clear(variable_value); + } // for + + f_macro_string_dynamics_delete_simple(names); + + if (f_status_is_error(status)) { + fake_print_error(data.context, data.verbosity, status, function, f_true); + + f_macro_string_dynamic_delete_simple(variable_name); + f_macro_string_dynamic_delete_simple(variable_value); + f_macro_string_dynamics_delete_simple(environment_names); + f_macro_string_dynamics_delete_simple(environment_values); + f_macro_string_dynamic_delete_simple(path); + f_macro_string_dynamics_delete_simple(arguments); + return status; } int result = 0; @@ -392,7 +469,7 @@ extern "C" { } { - const f_string setting_names[] = { + const f_string settings_name[] = { fake_build_settings_name_build_compiler, fake_build_settings_name_build_libraries, fake_build_settings_name_build_linker, @@ -406,13 +483,14 @@ extern "C" { fake_build_settings_name_defines_all, fake_build_settings_name_defines_shared, fake_build_settings_name_defines_static, + fake_build_settings_name_environment, fake_build_settings_name_flags_all, fake_build_settings_name_flags_library, fake_build_settings_name_flags_program, fake_build_settings_name_flags_shared, fake_build_settings_name_flags_static, - fake_build_settings_name_path_language, fake_build_settings_name_path_headers, + fake_build_settings_name_path_language, fake_build_settings_name_path_library_shared, fake_build_settings_name_path_library_static, fake_build_settings_name_path_program_shared, @@ -426,7 +504,7 @@ extern "C" { fake_build_settings_name_version_minor, }; - const f_string_length setting_lengths[] = { + const f_string_length settings_length[] = { fake_build_settings_name_build_compiler_length, fake_build_settings_name_build_libraries_length, fake_build_settings_name_build_linker_length, @@ -440,13 +518,14 @@ extern "C" { fake_build_settings_name_defines_all_length, fake_build_settings_name_defines_shared_length, fake_build_settings_name_defines_static_length, + fake_build_settings_name_environment_length, fake_build_settings_name_flags_all_length, fake_build_settings_name_flags_library_length, fake_build_settings_name_flags_program_length, fake_build_settings_name_flags_shared_length, fake_build_settings_name_flags_static_length, - fake_build_settings_name_path_language_length, fake_build_settings_name_path_headers_length, + fake_build_settings_name_path_language_length, fake_build_settings_name_path_library_shared_length, fake_build_settings_name_path_library_static_length, fake_build_settings_name_path_program_shared_length, @@ -460,42 +539,58 @@ extern "C" { fake_build_settings_name_version_minor_length, }; - f_string_dynamic *setting_values[] = { + f_string_dynamics build_shared = f_string_dynamics_initialize; + f_string_dynamics build_static = f_string_dynamics_initialize; + f_string_dynamics path_headers = f_string_dynamics_initialize; + f_string_dynamics path_language = f_string_dynamics_initialize; + f_string_dynamics path_library_shared = f_string_dynamics_initialize; + f_string_dynamics path_library_static = f_string_dynamics_initialize; + f_string_dynamics path_program_shared = f_string_dynamics_initialize; + f_string_dynamics path_program_static = f_string_dynamics_initialize; + f_string_dynamics process_post = f_string_dynamics_initialize; + f_string_dynamics process_pre = f_string_dynamics_initialize; + f_string_dynamics project_level = f_string_dynamics_initialize; + f_string_dynamics project_name = f_string_dynamics_initialize; + f_string_dynamics version_major = f_string_dynamics_initialize; + f_string_dynamics version_micro = f_string_dynamics_initialize; + f_string_dynamics version_minor = f_string_dynamics_initialize; + + f_string_dynamics *settings_value[] = { &settings->build_compiler, &settings->build_libraries, &settings->build_linker, - &settings->build_shared, + &build_shared, &settings->build_sources_headers, &settings->build_sources_library, &settings->build_sources_program, &settings->build_sources_setting, &settings->build_sources_shell, - &settings->build_static, + &build_static, &settings->defines_all, &settings->defines_shared, &settings->defines_static, + &settings->environment, &settings->flags_all, &settings->flags_library, &settings->flags_program, &settings->flags_shared, &settings->flags_static, - &settings->path_language, - &settings->path_headers, - &settings->path_library_shared, - &settings->path_library_static, - &settings->path_program_shared, - &settings->path_program_static, - &settings->process_post, - &settings->process_pre, - &settings->project_level, - &settings->project_name, - &settings->version_major, - &settings->version_micro, - &settings->version_minor, + &path_headers, + &path_language, + &path_library_shared, + &path_library_static, + &path_program_shared, + &path_program_static, + &process_post, + &process_pre, + &project_level, + &project_name, + &version_major, + &version_micro, + &version_minor, }; - // @todo change this to use fll_fss_snatch_apart() so that each string can be a distinct argument for fll_execute functions. - status = fll_fss_snatch_mash_together(buffer, objects, contents, setting_names, setting_lengths, setting_values, fake_build_settings_total, " ", 1); + status = fll_fss_snatch_apart(buffer, objects, contents, settings_name, settings_length, settings_value, fake_build_settings_total); if (status == f_none) { for (f_array_length i = 0; i < data.mode.used; i++) { @@ -507,20 +602,20 @@ extern "C" { memset(&settings_mode_names, 0, sizeof(f_string) * fake_build_settings_total); for (f_string_length j = 0; j < fake_build_settings_total; j++) { - setting_mode_lengths[j] = setting_lengths[j] + 1 + data.mode.array[i].used; + setting_mode_lengths[j] = settings_length[j] + 1 + data.mode.array[i].used; f_macro_string_dynamic_new(status, settings_mode_name_dynamic[j], setting_mode_lengths[j]); if (f_status_is_error(status)) break; - memcpy(settings_mode_name_dynamic[j].string, setting_names[j], setting_lengths[j]); - memcpy(settings_mode_name_dynamic[j].string + setting_lengths[j] + 1, data.mode.array[i].string, data.mode.array[i].used); - settings_mode_name_dynamic[j].string[setting_lengths[j]] = '-'; + memcpy(settings_mode_name_dynamic[j].string, settings_name[j], settings_length[j]); + memcpy(settings_mode_name_dynamic[j].string + settings_length[j] + 1, data.mode.array[i].string, data.mode.array[i].used); + settings_mode_name_dynamic[j].string[settings_length[j]] = '-'; settings_mode_names[j] = settings_mode_name_dynamic[j].string; } // for if (status == f_none) { - status = fll_fss_snatch_mash_together(buffer, objects, contents, settings_mode_names, setting_mode_lengths, setting_values, fake_build_settings_total, " ", 1); + status = fll_fss_snatch_apart(buffer, objects, contents, settings_mode_names, setting_mode_lengths, settings_value, fake_build_settings_total); } for (f_string_length j = 0; j < fake_build_settings_total; j++) { @@ -533,6 +628,22 @@ extern "C" { if (f_status_is_error(status)) { fake_print_error(data.context, data.verbosity, f_status_set_fine(status), "f_macro_string_dynamic_new", f_true); + f_macro_string_dynamics_delete_simple(build_shared); + f_macro_string_dynamics_delete_simple(build_static); + f_macro_string_dynamics_delete_simple(path_headers); + f_macro_string_dynamics_delete_simple(path_language); + f_macro_string_dynamics_delete_simple(path_library_shared); + f_macro_string_dynamics_delete_simple(path_library_static); + f_macro_string_dynamics_delete_simple(path_program_shared); + f_macro_string_dynamics_delete_simple(path_program_static); + f_macro_string_dynamics_delete_simple(process_post); + f_macro_string_dynamics_delete_simple(process_pre); + f_macro_string_dynamics_delete_simple(project_level); + f_macro_string_dynamics_delete_simple(project_name); + f_macro_string_dynamics_delete_simple(version_major); + f_macro_string_dynamics_delete_simple(version_micro); + f_macro_string_dynamics_delete_simple(version_minor); + f_macro_fss_objects_delete_simple(objects); f_macro_fss_contents_delete_simple(contents); f_macro_string_dynamic_delete_simple(buffer); @@ -543,9 +654,10 @@ extern "C" { if (f_status_is_error(status)) { if (status == f_status_set_error(f_string_too_large)) { if (data.verbosity != fake_verbosity_quiet) { + // @todo update FSS functions to return which setting index the problem happened on. fprintf(f_standard_error, "%c", f_string_eol); fl_color_print(f_standard_error, data.context.error, data.context.reset, "ERROR: a setting in the build settings file '"); - fl_color_print(f_standard_error, data.context.notable, data.context.reset, "%s", data.file_data_build_settings); + fl_color_print(f_standard_error, data.context.notable, data.context.reset, "%s", data.file_data_build_settings.string); fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "' is too long."); } } @@ -553,6 +665,164 @@ extern "C" { fake_print_error(data.context, data.verbosity, f_status_set_fine(status), "fl_string_dynamic_partial_mash", f_true); } } + + const f_string settings_single_name[] = { + fake_build_settings_name_build_shared, + fake_build_settings_name_build_static, + fake_build_settings_name_path_headers, + fake_build_settings_name_path_language, + fake_build_settings_name_path_library_shared, + fake_build_settings_name_path_library_static, + fake_build_settings_name_path_program_shared, + fake_build_settings_name_path_program_static, + fake_build_settings_name_process_post, + fake_build_settings_name_process_pre, + fake_build_settings_name_project_level, + fake_build_settings_name_project_name, + fake_build_settings_name_version_major, + fake_build_settings_name_version_micro, + fake_build_settings_name_version_minor, + }; + + const f_string_statics *settings_single_source[] = { + &build_shared, + &build_static, + &path_headers, + &path_language, + &path_library_shared, + &path_library_static, + &path_program_shared, + &path_program_static, + &process_post, + &process_pre, + &project_level, + &project_name, + &version_major, + &version_micro, + &version_minor, + }; + + bool *settings_single_bool[] = { + &settings->build_shared, + &settings->build_static, + }; + + f_string_dynamic *settings_single_destination[] = { + 0, + 0, + &settings->path_headers, + &settings->path_language, + &settings->path_library_shared, + &settings->path_library_static, + &settings->path_program_shared, + &settings->path_program_static, + &settings->process_post, + &settings->process_pre, + &settings->project_level, + &settings->project_name, + &settings->version_major, + &settings->version_micro, + &settings->version_minor, + }; + + uint8_t settings_single_type[] = { + 1, // yes/no + 1, + 2, // path + 2, + 2, + 2, + 2, + 2, + 3, // just a string + 3, + 3, + 3, + 3, + 3, + 3, + }; + + for (f_array_length i = 0; i < 15; i++) { + if (settings_single_source[i]->used == 0) continue; + + if (settings_single_source[i]->used > 1) { + if (data.verbosity != fake_verbosity_quiet) { + fprintf(f_standard_warning, "%c", f_string_eol); + fl_color_print(f_standard_warning, data.context.warning, data.context.reset, "WARNING: the setting '"); + fl_color_print(f_standard_warning, data.context.notable, data.context.reset, "%s", settings_single_name[i]); + fl_color_print(f_standard_warning, data.context.warning, data.context.reset, "' in the file '"); + fl_color_print(f_standard_warning, data.context.notable, data.context.reset, "%s", data.file_data_build_settings.string); + fl_color_print(f_standard_warning, data.context.warning, data.context.reset, "' may only have a single property, only using the first: '"); + fl_color_print(f_standard_warning, data.context.notable, data.context.reset, "%s", settings_single_source[i]->array[0].string); + fl_color_print_line(f_standard_warning, data.context.warning, data.context.reset, "'."); + } + } + + if (settings_single_type[i] == 1) { + if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_settings_bool_yes, settings_single_source[i]->array[0].used, fake_build_settings_bool_yes_length) == f_equal_to) { + *settings_single_bool[i] = f_true; + } + else if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_settings_bool_no, settings_single_source[i]->array[0].used, fake_build_settings_bool_no_length) == f_equal_to) { + *settings_single_bool[i] = f_false; + } + else { + *settings_single_bool[i] = f_true; + + if (data.verbosity != fake_verbosity_quiet) { + fprintf(f_standard_warning, "%c", f_string_eol); + fl_color_print(f_standard_warning, data.context.warning, data.context.reset, "WARNING: the setting '"); + fl_color_print(f_standard_warning, data.context.notable, data.context.reset, "%s", settings_single_name[i]); + fl_color_print(f_standard_warning, data.context.warning, data.context.reset, "' in the file '"); + fl_color_print(f_standard_warning, data.context.notable, data.context.reset, "%s", data.file_data_build_settings.string); + fl_color_print(f_standard_warning, data.context.warning, data.context.reset, "' may be either '"); + fl_color_print(f_standard_warning, data.context.notable, data.context.reset, "%s", fake_build_settings_bool_yes); + fl_color_print(f_standard_warning, data.context.warning, data.context.reset, "' or '"); + fl_color_print(f_standard_warning, data.context.notable, data.context.reset, "%s", fake_build_settings_bool_no); + fl_color_print(f_standard_warning, data.context.warning, data.context.reset, "', defaulting to '"); + fl_color_print(f_standard_warning, data.context.notable, data.context.reset, "%s", fake_build_settings_bool_yes); + fl_color_print_line(f_standard_warning, data.context.warning, data.context.reset, "'."); + } + } + } + else { + status = fl_string_dynamic_append_nulless(settings_single_source[i]->array[0], settings_single_destination[i]); + if (f_status_is_error(status)) { + fake_print_error(data.context, data.verbosity, f_status_set_fine(status), "fl_string_dynamic_append_nulless", f_true); + break; + } + + if (settings_single_type[i] == 2) { + status = fl_string_append_assure(f_path_separator, f_path_separator_length, settings_single_destination[i]); + if (f_status_is_error(status)) { + fake_print_error(data.context, data.verbosity, f_status_set_fine(status), "fl_string_dynamic_append_nulless", f_true); + break; + } + } + + status = fl_string_dynamic_terminate(settings_single_destination[i]); + if (f_status_is_error(status)) { + fake_print_error(data.context, data.verbosity, f_status_set_fine(status), "fl_string_dynamic_terminate", f_true); + break; + } + } + } // for + + f_macro_string_dynamics_delete_simple(build_shared); + f_macro_string_dynamics_delete_simple(build_static); + f_macro_string_dynamics_delete_simple(path_headers); + f_macro_string_dynamics_delete_simple(path_language); + f_macro_string_dynamics_delete_simple(path_library_shared); + f_macro_string_dynamics_delete_simple(path_library_static); + f_macro_string_dynamics_delete_simple(path_program_shared); + f_macro_string_dynamics_delete_simple(path_program_static); + f_macro_string_dynamics_delete_simple(process_post); + f_macro_string_dynamics_delete_simple(process_pre); + f_macro_string_dynamics_delete_simple(project_level); + f_macro_string_dynamics_delete_simple(project_name); + f_macro_string_dynamics_delete_simple(version_major); + f_macro_string_dynamics_delete_simple(version_micro); + f_macro_string_dynamics_delete_simple(version_minor); } f_macro_fss_objects_delete_simple(objects); diff --git a/level_3/fake/c/private-build.h b/level_3/fake/c/private-build.h index 8c22513..5fc854e 100644 --- a/level_3/fake/c/private-build.h +++ b/level_3/fake/c/private-build.h @@ -14,24 +14,9 @@ extern "C" { #ifndef _di_fake_build_settings_ typedef struct { - f_string_dynamic build_compiler; - f_string_dynamic build_libraries; - f_string_dynamic build_linker; - f_string_dynamic build_shared; - f_string_dynamic build_sources_headers; - f_string_dynamic build_sources_library; - f_string_dynamic build_sources_program; - f_string_dynamic build_sources_setting; - f_string_dynamic build_sources_shell; - f_string_dynamic build_static; - f_string_dynamic defines_all; - f_string_dynamic defines_shared; - f_string_dynamic defines_static; - f_string_dynamic flags_all; - f_string_dynamic flags_library; - f_string_dynamic flags_program; - f_string_dynamic flags_shared; - f_string_dynamic flags_static; + bool build_shared; + bool build_static; + f_string_dynamic path_language; f_string_dynamic path_headers; f_string_dynamic path_library_shared; @@ -45,130 +30,64 @@ extern "C" { f_string_dynamic version_major; f_string_dynamic version_micro; f_string_dynamic version_minor; - } fake_build_settings; - - #define fake_build_settings_initialize { f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize } - #define fake_macro_settings_build_clear(settings) \ - f_macro_string_dynamic_clear(settings.build_compiler) \ - f_macro_string_dynamic_clear(settings.build_libraries) \ - f_macro_string_dynamic_clear(settings.build_linker) \ - f_macro_string_dynamic_clear(settings.build_shared) \ - f_macro_string_dynamic_clear(settings.build_sources_headers) \ - f_macro_string_dynamic_clear(settings.build_sources_library) \ - f_macro_string_dynamic_clear(settings.build_sources_program) \ - f_macro_string_dynamic_clear(settings.build_sources_setting) \ - f_macro_string_dynamic_clear(settings.build_sources_shell) \ - f_macro_string_dynamic_clear(settings.build_static) \ - f_macro_string_dynamic_clear(settings.defines_all) \ - f_macro_string_dynamic_clear(settings.defines_shared) \ - f_macro_string_dynamic_clear(settings.defines_static) \ - f_macro_string_dynamic_clear(settings.flags_all) \ - f_macro_string_dynamic_clear(settings.flags_library) \ - f_macro_string_dynamic_clear(settings.flags_program) \ - f_macro_string_dynamic_clear(settings.flags_shared) \ - f_macro_string_dynamic_clear(settings.flags_static) \ - f_macro_string_dynamic_clear(settings.path_language) \ - f_macro_string_dynamic_clear(settings.path_headers) \ - f_macro_string_dynamic_clear(settings.path_libary_shared) \ - f_macro_string_dynamic_clear(settings.path_library_static) \ - f_macro_string_dynamic_clear(settings.path_program_shared) \ - f_macro_string_dynamic_clear(settings.path_program_static) \ - f_macro_string_dynamic_clear(settings.process_post) \ - f_macro_string_dynamic_clear(settings.process_pre) \ - f_macro_string_dynamic_clear(settings.project_level) \ - f_macro_string_dynamic_clear(settings.project_name) \ - f_macro_string_dynamic_clear(settings.version_major) \ - f_macro_string_dynamic_clear(settings.version_micro) \ - f_macro_string_dynamic_clear(settings.version_minor) - - #define fake_macro_build_settings_delete(status, settings) \ - f_macro_string_dynamic_delete(status, settings.build_compiler) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.build_libraries) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.build_linker) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.build_shared) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.build_sources_headers) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.build_sources_library) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.build_sources_program) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.build_sources_setting) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.build_sources_shell) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.build_static) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.defines_all) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.defines_shared) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.defines_static) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.flags_all) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.flags_library) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.flags_program) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.flags_shared) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.flags_static) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.path_language) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.path_headers) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.path_library_shared) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.path_library_static) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.path_library_shared) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.path_library_static) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.process_post) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.process_pre) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.project_level) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.project_name) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.version_major) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.version_micro) \ - if (status == f_none) f_macro_string_dynamic_delete(status, settings.version_minor) + f_string_dynamics build_compiler; + f_string_dynamics build_libraries; + f_string_dynamics build_linker; + f_string_dynamics build_sources_headers; + f_string_dynamics build_sources_library; + f_string_dynamics build_sources_program; + f_string_dynamics build_sources_setting; + f_string_dynamics build_sources_shell; + f_string_dynamics defines_all; + f_string_dynamics defines_shared; + f_string_dynamics defines_static; + f_string_dynamics environment; + f_string_dynamics flags_all; + f_string_dynamics flags_library; + f_string_dynamics flags_program; + f_string_dynamics flags_shared; + f_string_dynamics flags_static; + } fake_build_settings; - #define fake_macro_build_settings_destroy(status, settings, length) \ - f_macro_string_dynamic_delete(status, settings.build_compiler) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.build_libraries) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.build_linker) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.build_shared) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.build_sources_headers) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.build_sources_library) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.build_sources_program) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.build_sources_setting) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.build_sources_shell) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.build_static) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.defines_all) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.defines_shared) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.defines_static) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.flags_all) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.flags_library) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.flags_program) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.flags_shared) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.flags_static) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.path_language) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.path_headers) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.path_library_shared) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.path_library_static) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.path_program_shared) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.path_program_static) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.process_post) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.process_pre) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.project_level) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.project_name) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.version_major) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.version_micro) \ - if (status == f_none) f_macro_string_dynamic_destroy(status, settings.version_minor) + #define fake_build_settings_initialize { \ + f_true, \ + f_true, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + f_string_dynamics_initialize, \ + } #define fake_macro_build_settings_delete_simple(settings) \ - f_macro_string_dynamic_delete_simple(settings.build_compiler) \ - f_macro_string_dynamic_delete_simple(settings.build_libraries) \ - f_macro_string_dynamic_delete_simple(settings.build_linker) \ - f_macro_string_dynamic_delete_simple(settings.build_shared) \ - f_macro_string_dynamic_delete_simple(settings.build_sources_headers) \ - f_macro_string_dynamic_delete_simple(settings.build_sources_library) \ - f_macro_string_dynamic_delete_simple(settings.build_sources_program) \ - f_macro_string_dynamic_delete_simple(settings.build_sources_setting) \ - f_macro_string_dynamic_delete_simple(settings.build_sources_shell) \ - f_macro_string_dynamic_delete_simple(settings.build_static) \ - f_macro_string_dynamic_delete_simple(settings.defines_all) \ - f_macro_string_dynamic_delete_simple(settings.defines_shared) \ - f_macro_string_dynamic_delete_simple(settings.defines_static) \ - f_macro_string_dynamic_delete_simple(settings.flags_all) \ - f_macro_string_dynamic_delete_simple(settings.flags_library) \ - f_macro_string_dynamic_delete_simple(settings.flags_program) \ - f_macro_string_dynamic_delete_simple(settings.flags_shared) \ - f_macro_string_dynamic_delete_simple(settings.flags_static) \ - f_macro_string_dynamic_delete_simple(settings.path_language) \ f_macro_string_dynamic_delete_simple(settings.path_headers) \ + f_macro_string_dynamic_delete_simple(settings.path_language) \ f_macro_string_dynamic_delete_simple(settings.path_library_shared) \ f_macro_string_dynamic_delete_simple(settings.path_library_static) \ f_macro_string_dynamic_delete_simple(settings.path_program_shared) \ @@ -179,40 +98,24 @@ extern "C" { f_macro_string_dynamic_delete_simple(settings.project_name) \ f_macro_string_dynamic_delete_simple(settings.version_major) \ f_macro_string_dynamic_delete_simple(settings.version_micro) \ - f_macro_string_dynamic_delete_simple(settings.version_minor) - - #define fake_macro_build_settings_destroy_simple(settings, length) \ - f_macro_string_dynamic_destroy_simple(settings.build_compiler) \ - f_macro_string_dynamic_destroy_simple(settings.build_libraries) \ - f_macro_string_dynamic_destroy_simple(settings.build_linker) \ - f_macro_string_dynamic_destroy_simple(settings.build_shared) \ - f_macro_string_dynamic_destroy_simple(settings.build_sources_headers) \ - f_macro_string_dynamic_destroy_simple(settings.build_sources_library) \ - f_macro_string_dynamic_destroy_simple(settings.build_sources_program) \ - f_macro_string_dynamic_destroy_simple(settings.build_sources_setting) \ - f_macro_string_dynamic_destroy_simple(settings.build_sources_shell) \ - f_macro_string_dynamic_destroy_simple(settings.build_static) \ - f_macro_string_dynamic_destroy_simple(settings.defines_all) \ - f_macro_string_dynamic_destroy_simple(settings.defines_shared) \ - f_macro_string_dynamic_destroy_simple(settings.defines_static) \ - f_macro_string_dynamic_destroy_simple(settings.flags_all) \ - f_macro_string_dynamic_destroy_simple(settings.flags_library) \ - f_macro_string_dynamic_destroy_simple(settings.flags_program) \ - f_macro_string_dynamic_destroy_simple(settings.flags_shared) \ - f_macro_string_dynamic_destroy_simple(settings.flags_static) \ - f_macro_string_dynamic_destroy_simple(settings.path_language) \ - f_macro_string_dynamic_destroy_simple(settings.path_headers) \ - f_macro_string_dynamic_destroy_simple(settings.path_library_shared) \ - f_macro_string_dynamic_destroy_simple(settings.path_library_static) \ - f_macro_string_dynamic_destroy_simple(settings.path_program_shared) \ - f_macro_string_dynamic_destroy_simple(settings.path_program_static) \ - f_macro_string_dynamic_destroy_simple(settings.process_post) \ - f_macro_string_dynamic_destroy_simple(settings.process_pre) \ - f_macro_string_dynamic_destroy_simple(settings.project_level) \ - f_macro_string_dynamic_destroy_simple(settings.project_name) \ - f_macro_string_dynamic_destroy_simple(settings.version_major) \ - f_macro_string_dynamic_destroy_simple(settings.version_micro) \ - f_macro_string_dynamic_destroy_simple(settings.version_minor) + f_macro_string_dynamic_delete_simple(settings.version_minor) \ + f_macro_string_dynamics_delete_simple(settings.build_compiler) \ + f_macro_string_dynamics_delete_simple(settings.build_libraries) \ + f_macro_string_dynamics_delete_simple(settings.build_linker) \ + f_macro_string_dynamics_delete_simple(settings.build_sources_headers) \ + f_macro_string_dynamics_delete_simple(settings.build_sources_library) \ + f_macro_string_dynamics_delete_simple(settings.build_sources_program) \ + f_macro_string_dynamics_delete_simple(settings.build_sources_setting) \ + f_macro_string_dynamics_delete_simple(settings.build_sources_shell) \ + f_macro_string_dynamics_delete_simple(settings.defines_all) \ + f_macro_string_dynamics_delete_simple(settings.defines_shared) \ + f_macro_string_dynamics_delete_simple(settings.defines_static) \ + f_macro_string_dynamics_delete_simple(settings.environment) \ + f_macro_string_dynamics_delete_simple(settings.flags_all) \ + f_macro_string_dynamics_delete_simple(settings.flags_library) \ + f_macro_string_dynamics_delete_simple(settings.flags_program) \ + f_macro_string_dynamics_delete_simple(settings.flags_shared) \ + f_macro_string_dynamics_delete_simple(settings.flags_static) #define fake_build_settings_name_build_compiler "build_compiler" #define fake_build_settings_name_build_libraries "build_libraries" @@ -227,6 +130,7 @@ extern "C" { #define fake_build_settings_name_defines_all "defines_all" #define fake_build_settings_name_defines_shared "defines_shared" #define fake_build_settings_name_defines_static "defines_static" + #define fake_build_settings_name_environment "environment" #define fake_build_settings_name_flags_all "flags_all" #define fake_build_settings_name_flags_library "flags_library" #define fake_build_settings_name_flags_program "flags_program" @@ -256,6 +160,7 @@ extern "C" { #define fake_build_settings_name_build_sources_settings_length 22 #define fake_build_settings_name_build_sources_shell_length 19 #define fake_build_settings_name_build_static_length 12 + #define fake_build_settings_name_environment_length 11 #define fake_build_settings_name_defines_all_length 11 #define fake_build_settings_name_defines_shared_length 14 #define fake_build_settings_name_defines_static_length 14 @@ -278,7 +183,13 @@ extern "C" { #define fake_build_settings_name_version_micro_length 13 #define fake_build_settings_name_version_minor_length 13 - #define fake_build_settings_total 31 + #define fake_build_settings_total 32 + + #define fake_build_settings_bool_yes "yes" + #define fake_build_settings_bool_no "no" + + #define fake_build_settings_bool_yes_length 3 + #define fake_build_settings_bool_no_length 2 #endif // _di_fake_build_settings_ /** diff --git a/level_3/fake/data/build/settings b/level_3/fake/data/build/settings index b8a3ea4..530e99e 100644 --- a/level_3/fake/data/build/settings +++ b/level_3/fake/data/build/settings @@ -9,7 +9,7 @@ version_micro 0 process_pre process_pre.sh process_post process_post.sh -process_environment +environment modes individual level monolithic modes_default individual -- 1.8.3.1