From 68c2b0d933576bb02563d8f5a06d926d7e58fdc6 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 7 May 2020 23:38:59 -0500 Subject: [PATCH] Progress: continue fake development Utilize the recently added functions for appending console parameters for execution. --- level_3/fake/c/fake.h | 39 ++++++++++ level_3/fake/c/private-build.c | 127 +++++++++++++++++++++++++++++--- level_3/fake/c/private-fake.c | 3 + level_3/fake/data/build/process_post.sh | 4 +- level_3/fake/data/build/process_pre.sh | 4 +- 5 files changed, 163 insertions(+), 14 deletions(-) mode change 100644 => 100755 level_3/fake/data/build/process_post.sh mode change 100644 => 100755 level_3/fake/data/build/process_pre.sh diff --git a/level_3/fake/c/fake.h b/level_3/fake/c/fake.h index 909d280..2a3a251 100644 --- a/level_3/fake/c/fake.h +++ b/level_3/fake/c/fake.h @@ -472,9 +472,17 @@ extern "C" { #define fake_short_process "p" #define fake_short_settings "s" + #define fake_short_defines_length 1 + #define fake_short_mode_length 1 + #define fake_short_process_length 1 + #define fake_short_settings_length 1 + #define fake_short_path_build "b" #define fake_short_path_work "w" + #define fake_short_path_build_length 1 + #define fake_short_path_work_length 1 + #define fake_short_path_source_build "B" #define fake_short_path_source_common "O" #define fake_short_path_source_data "D" @@ -483,14 +491,30 @@ extern "C" { #define fake_short_path_source_licenses "L" #define fake_short_path_source_settings "S" + #define fake_short_path_source_build_length 1 + #define fake_short_path_source_common_length 1 + #define fake_short_path_source_data_length 1 + #define fake_short_path_source_documents_length 1 + #define fake_short_path_source_codes_length 1 + #define fake_short_path_source_licenses_length 1 + #define fake_short_path_source_settings_length 1 + #define fake_long_defines "defines" #define fake_long_mode "mode" #define fake_long_process "process" #define fake_long_settings "settings" + #define fake_long_defines_length 7 + #define fake_long_mode_length 4 + #define fake_long_process_length 7 + #define fake_long_settings_length 8 + #define fake_long_path_build "build" #define fake_long_path_work "work" + #define fake_long_path_build_length 5 + #define fake_long_path_work_length 4 + #define fake_long_path_source_build "source_build" #define fake_long_path_source_common "source_common" #define fake_long_path_source_data "source_data" @@ -499,6 +523,14 @@ extern "C" { #define fake_long_path_source_licenses "source_licenses" #define fake_long_path_source_settings "source_settings" + #define fake_long_path_source_build_length 12 + #define fake_long_path_source_common_length 13 + #define fake_long_path_source_data_length 11 + #define fake_long_path_source_documents_length 16 + #define fake_long_path_source_codes_length 12 + #define fake_long_path_source_licenses_length 15 + #define fake_long_path_source_settings_length 15 + // these special parameters are provided in such a way that they mimic the traditional ./configure script. #define fake_long_documents_disabled "disable-doc" #define fake_long_documents_enabled "enable-doc" @@ -507,6 +539,13 @@ extern "C" { #define fake_long_static_disabled "disable-static" #define fake_long_static_enabled "enable-static" + #define fake_long_documents_disabled_length 11 + #define fake_long_documents_enabled_length 10 + #define fake_long_shared_disabled_length 14 + #define fake_long_shared_enabled_length 13 + #define fake_long_static_disabled_length 14 + #define fake_long_static_enabled_length 13 + #define fake_other_operation_build "build" #define fake_other_operation_clean "clean" #define fake_other_operation_make "make" diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index b525148..f334345 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -11,6 +11,119 @@ extern "C" { if (process_script.used == 0) return f_none; f_status status = f_none; + + const f_string parameter_prefixs[] = { + f_console_symbol_short_enable, + f_console_symbol_short_enable, + f_console_symbol_short_enable, + f_console_symbol_short_enable, + f_console_symbol_short_enable, + f_console_symbol_short_enable, + f_console_symbol_short_enable, + f_console_symbol_short_enable, + f_console_symbol_short_enable, + f_console_symbol_short_enable, + f_console_symbol_short_enable, + f_console_symbol_short_enable, + }; + + const f_string_length parameter_prefixs_length[] = { + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + f_console_symbol_short_enable_length, + }; + + const f_string parameter_names[] = { + fake_short_defines, + fake_short_process, + fake_short_settings, + fake_short_path_build, + fake_short_path_work, + fake_short_path_source_build, + fake_short_path_source_common, + fake_short_path_source_data, + fake_short_path_source_documents, + fake_short_path_source_codes, + fake_short_path_source_licenses, + fake_short_path_source_settings, + }; + + const f_string_length parameter_names_length[] = { + fake_short_defines_length, + fake_short_process_length, + fake_short_settings_length, + fake_short_path_build_length, + fake_short_path_work_length, + fake_short_path_source_build_length, + fake_short_path_source_common_length, + fake_short_path_source_data_length, + fake_short_path_source_documents_length, + fake_short_path_source_codes_length, + fake_short_path_source_licenses_length, + fake_short_path_source_settings_length, + }; + + const f_string parameter_values[] = { + data.defines.string, + data.process.string, + data.settings.string, + data.path_build.string, + data.path_work.string, + data.path_source_build.string, + data.path_source_common.string, + data.path_source_data.string, + data.path_source_documents.string, + data.path_source_codes.string, + data.path_source_licenses.string, + data.path_source_settings.string, + }; + + const f_string_length parameter_values_length[] = { + data.defines.used, + data.process.used, + data.settings.used, + data.path_build.used, + data.path_work.used, + data.path_source_build.used, + data.path_source_common.used, + data.path_source_data.used, + data.path_source_documents.used, + data.path_source_codes.used, + data.path_source_licenses.used, + data.path_source_settings.used, + }; + + const uint8_t parameters_total = 12; + + f_string_dynamics arguments = f_string_dynamics_initialize; + + status = fll_execute_arguments_add(fake_other_operation_build, fake_other_operation_build_length, &arguments); + + if (f_status_is_error(status)) { + fake_print_error(data.context, f_status_set_fine(status), "fll_execute_arguments_add", f_true); + + f_macro_string_dynamics_delete_simple(arguments); + return status; + } + + status = fll_execute_arguments_add_parameter_set(parameter_prefixs, parameter_prefixs_length, parameter_names, parameter_names_length, parameter_values, parameter_values_length, parameters_total, &arguments); + + if (f_status_is_error(status)) { + fake_print_error(data.context, f_status_set_fine(status), "fll_execute_arguments_add_parameter_set", f_true); + + f_macro_string_dynamics_delete_simple(arguments); + return status; + } + f_string_dynamic path = f_string_dynamic_initialize; if (process_script.string[0] != '/') { @@ -28,19 +141,8 @@ extern "C" { return status; } - // @todo: add all arguments and possibly fss settings. - f_string_dynamics arguments = f_string_dynamics_initialize; - f_string_dynamic argument[1] = f_string_dynamic_initialize; int results = 0; - argument[0].string = (f_string) fake_other_operation_build; - argument[0].size = fake_other_operation_build_length; - argument[0].used = fake_other_operation_build_length; - - arguments.array = argument; - arguments.size = 1; - arguments.used = 1; - status = fll_execute_path(path.string, arguments, &results); if (f_status_is_error(status)) { @@ -50,11 +152,12 @@ extern "C" { fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "."); } else { - fake_print_error(data.context, status, "fll_execute_program", f_true); + fake_print_error(data.context, f_status_set_fine(status), "fll_execute_path", f_true); } } f_macro_string_dynamic_delete_simple(path); + f_macro_string_dynamics_delete_simple(arguments); return status; } diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 213c339..1c81d78 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -469,6 +469,9 @@ extern "C" { return status; } + else { + status = f_none; + } } if (length == 0 || status == f_no_data) { diff --git a/level_3/fake/data/build/process_post.sh b/level_3/fake/data/build/process_post.sh old mode 100644 new mode 100755 index c961671..52d860b --- a/level_3/fake/data/build/process_post.sh +++ b/level_3/fake/data/build/process_post.sh @@ -58,6 +58,8 @@ process_post_main(){ if [[ $grab_next == "mode" ]] ; then if [[ $mode == "" ]] ; then mode=$p + else + mode="$mode $p" fi elif [[ $grab_next == "defines" ]] ; then if [[ $defines == "" ]] ; then @@ -95,7 +97,7 @@ process_post_main(){ echo -e "${c_title}Done Processing Operation: $c_reset$c_notice$operation$c_reset" if [[ $mode != "" ]] ; then - echo -e " Mode: $c_reset$c_notice$mode$c_reset" + echo -e " Modes: $c_reset$c_notice$mode$c_reset" fi if [[ $defines != "" ]] ; then diff --git a/level_3/fake/data/build/process_pre.sh b/level_3/fake/data/build/process_pre.sh old mode 100644 new mode 100755 index 563e2a3..7b730d3 --- a/level_3/fake/data/build/process_pre.sh +++ b/level_3/fake/data/build/process_pre.sh @@ -58,6 +58,8 @@ process_pre_main(){ if [[ $grab_next == "mode" ]] ; then if [[ $mode == "" ]] ; then mode=$p + else + mode="$mode $p" fi elif [[ $grab_next == "defines" ]] ; then if [[ $defines == "" ]] ; then @@ -95,7 +97,7 @@ process_pre_main(){ echo -e "${c_title}Begin Processing Operation: $c_reset$c_notice$operation$c_reset" if [[ $mode != "" ]] ; then - echo -e " Mode: $c_reset$c_notice$mode$c_reset" + echo -e " Modes: $c_reset$c_notice$mode$c_reset" fi if [[ $defines != "" ]] ; then -- 1.8.3.1