From: Kevin Day Date: Thu, 23 Dec 2021 03:59:47 +0000 (-0600) Subject: Update: Add "and" and "or" operations, operation if-then-else logic, and some cleanups. X-Git-Tag: 0.5.7~8 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=2d6dc239e7348d8b6ebd35f3bade54b9a1ad3556;p=fll Update: Add "and" and "or" operations, operation if-then-else logic, and some cleanups. Add the "and" and "or" operations to make the "if" and "else" operations more complete. The current design still does not support directly nested multiple operations underneath an "if" or an "else". Using an "operate" operation is still the only way to do this. The reason for this is to keep the logic and design simple. This has a cost of causing complicated design to be even more complicated than they otherwise could be if I allowed "if" and "else" to contain blocks of commands or even be nested. While I am at it, this cleans up the if-then-else logic. This needed to be done for some time. My original design was patched at some point to add unexpected functionality that I had not originally planned but later realized I needed. The patch was just a good enough for now. This resulted in the logic being a bit ugly and confusing. The new logic is a lot better, but there are still some things that might be confusing. To that end, I decided to only perform simple tests. I instead intend to write unit tests that will perform all of the possible combinations that I can reasonably come up with. This should help me find logic flaws in my current design. This now uses a structure to pass the process state data. This further simplifies the design to allow for fewer parameters in the relevant functions. Several of the duplicated print calls are consolidated into a single print function. I fixed some missing or incomplete documentation. --- diff --git a/level_3/fake/c/private-common.c b/level_3/fake/c/private-common.c index 4ed9784..6c4c2ad 100644 --- a/level_3/fake/c/private-common.c +++ b/level_3/fake/c/private-common.c @@ -140,6 +140,7 @@ extern "C" { #endif // _di_fake_make_setting_t_ #ifndef _di_fake_make_operation_ + const f_string_t fake_make_operation_and_s = FAKE_make_operation_and_s; const f_string_t fake_make_operation_break_s = FAKE_make_operation_break_s; const f_string_t fake_make_operation_build_s = FAKE_make_operation_build_s; const f_string_t fake_make_operation_clean_s = FAKE_make_operation_clean_s; @@ -161,6 +162,7 @@ extern "C" { const f_string_t fake_make_operation_modes_s = FAKE_make_operation_modes_s; const f_string_t fake_make_operation_move_s = FAKE_make_operation_move_s; const f_string_t fake_make_operation_operate_s = FAKE_make_operation_operate_s; + const f_string_t fake_make_operation_or_s = FAKE_make_operation_or_s; const f_string_t fake_make_operation_owner_s = FAKE_make_operation_owner_s; const f_string_t fake_make_operation_owners_s = FAKE_make_operation_owners_s; const f_string_t fake_make_operation_parameter_s = FAKE_make_operation_parameter_s; diff --git a/level_3/fake/c/private-common.h b/level_3/fake/c/private-common.h index 7a72380..991880f 100644 --- a/level_3/fake/c/private-common.h +++ b/level_3/fake/c/private-common.h @@ -707,6 +707,7 @@ extern "C" { #endif // _di_fake_make_setting_t_ #ifndef _di_fake_make_operation_ + #define FAKE_make_operation_and_s "and" #define FAKE_make_operation_break_s "break" #define FAKE_make_operation_build_s "build" #define FAKE_make_operation_clean_s "clean" @@ -728,6 +729,7 @@ extern "C" { #define FAKE_make_operation_modes_s "modes" #define FAKE_make_operation_move_s "move" #define FAKE_make_operation_operate_s "operate" + #define FAKE_make_operation_or_s "or" #define FAKE_make_operation_owner_s "owner" #define FAKE_make_operation_owners_s "owners" #define FAKE_make_operation_parameter_s "parameter" @@ -740,6 +742,7 @@ extern "C" { #define FAKE_make_operation_top_s "top" #define FAKE_make_operation_touch_s "touch" + #define fake_make_operation_and_s_length 3 #define fake_make_operation_break_s_length 5 #define fake_make_operation_build_s_length 5 #define fake_make_operation_clean_s_length 5 @@ -761,6 +764,7 @@ extern "C" { #define fake_make_operation_modes_s_length 5 #define fake_make_operation_move_s_length 4 #define fake_make_operation_operate_s_length 7 + #define fake_make_operation_or_s_length 2 #define fake_make_operation_owner_s_length 5 #define fake_make_operation_owners_s_length 6 #define fake_make_operation_parameter_s_length 9 @@ -773,6 +777,7 @@ extern "C" { #define fake_make_operation_top_s_length 3 #define fake_make_operation_touch_s_length 5 + extern const f_string_t fake_make_operation_and_s; extern const f_string_t fake_make_operation_break_s; extern const f_string_t fake_make_operation_build_s; extern const f_string_t fake_make_operation_clean_s; @@ -794,6 +799,7 @@ extern "C" { extern const f_string_t fake_make_operation_modes_s; extern const f_string_t fake_make_operation_move_s; extern const f_string_t fake_make_operation_operate_s; + extern const f_string_t fake_make_operation_or_s; extern const f_string_t fake_make_operation_owner_s; extern const f_string_t fake_make_operation_owners_s; extern const f_string_t fake_make_operation_parameter_s; @@ -807,7 +813,8 @@ extern "C" { extern const f_string_t fake_make_operation_touch_s; enum { - fake_make_operation_type_break = 1, + fake_make_operation_type_and = 1, + fake_make_operation_type_break, fake_make_operation_type_build, fake_make_operation_type_clean, fake_make_operation_type_clone, @@ -828,6 +835,7 @@ extern "C" { fake_make_operation_type_modes, fake_make_operation_type_move, fake_make_operation_type_operate, + fake_make_operation_type_or, fake_make_operation_type_owner, fake_make_operation_type_owners, fake_make_operation_type_parameter, @@ -841,7 +849,7 @@ extern "C" { fake_make_operation_type_touch, }; - #define fake_make_operation_total_d 32 + #define fake_make_operation_total_d 34 #define FAKE_make_operation_argument_environment_s "environment" #define FAKE_make_operation_argument_failure_s "failure" @@ -943,15 +951,9 @@ extern "C" { extern const f_string_t fake_make_operation_argument_if_success_s; enum { - fake_make_operation_if_type_else_false = 1, - fake_make_operation_if_type_else_false_next, - fake_make_operation_if_type_else_false_next_always, - fake_make_operation_if_type_else_true, - fake_make_operation_if_type_else_true_next, - fake_make_operation_if_type_false, - fake_make_operation_if_type_false_always, - fake_make_operation_if_type_false_always_next, - fake_make_operation_if_type_false_next, + fake_make_operation_if_type_done = 1, + fake_make_operation_if_type_else, + fake_make_operation_if_type_if, fake_make_operation_if_type_if_defined, fake_make_operation_if_type_if_equal, fake_make_operation_if_type_if_equal_not, @@ -973,8 +975,6 @@ extern "C" { fake_make_operation_if_type_if_not_owner, fake_make_operation_if_type_if_owner, fake_make_operation_if_type_if_success, - fake_make_operation_if_type_true, - fake_make_operation_if_type_true_next, }; enum { @@ -1166,6 +1166,54 @@ extern "C" { macro_f_string_dynamic_t_delete_simple(structure.path_cache) #endif // _di_fake_make_data_t_ +/** + * A structure for managing the operation and if-condition states. + * + * block: The operation type representing the block (either "if" or "else"). + * block_result: The result of the block. + * condition: The current if-condition type. + * condition_result: The result of the currently processed condition. + * operation: The current operation type. + * operation_previous: The previous operation type. + */ +#ifndef _di_fake_state_process_t_ + typedef struct { + uint8_t block; + uint8_t block_result; + uint8_t condition; + uint8_t condition_result; + uint8_t operation; + uint8_t operation_previous; + } fake_state_process_t; + + #define fake_state_process_t_initialize { \ + 0, \ + 0, \ + 0, \ + 0, \ + 0, \ + 0, \ + } +#endif // _di_fake_state_process_t_ + +/** + * Designate that the if state is true, false, or undefined (none). + * + * fake_condition_result_*: + * - none: The result of the if-condition is not set. + * - false: The result of the if-condition is false. + * - true: The result of the if-condition is true. + * - done: The if-condition is done and should no longer be processed. + */ +#ifndef _di_fake_condition_result_ + enum { + fake_condition_result_none = 0, + fake_condition_result_false, + fake_condition_result_true, + fake_condition_result_done, + }; +#endif // _di_fake_condition_result_ + #ifndef _di_fake_skeleton_content_ #define FAKE_make_skeleton_content_defines_s "# fss-0000\n\n" #define FAKE_make_skeleton_content_dependencies_s "# fss-0000\n\n" diff --git a/level_3/fake/c/private-make-load_fakefile.h b/level_3/fake/c/private-make-load_fakefile.h index fd1da2f..7c0623c 100644 --- a/level_3/fake/c/private-make-load_fakefile.h +++ b/level_3/fake/c/private-make-load_fakefile.h @@ -20,7 +20,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param status * The return status. * @@ -42,7 +42,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param object * The setting object. * @param content @@ -60,7 +60,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param object * The setting object. * @param content @@ -78,7 +78,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param settings * The settings data. * @@ -105,7 +105,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param content * The setting content. * @@ -132,7 +132,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param object * The setting object. * @param content @@ -150,7 +150,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param object * The setting object. * @param content @@ -171,7 +171,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param object * The setting object. * @param content diff --git a/level_3/fake/c/private-make-load_parameters.h b/level_3/fake/c/private-make-load_parameters.h index 06c2456..1ddfb71 100644 --- a/level_3/fake/c/private-make-load_parameters.h +++ b/level_3/fake/c/private-make-load_parameters.h @@ -18,7 +18,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param status * The return status. * diff --git a/level_3/fake/c/private-make-operate-type.c b/level_3/fake/c/private-make-operate-type.c index a0cebf0..0345b1d 100644 --- a/level_3/fake/c/private-make-operate-type.c +++ b/level_3/fake/c/private-make-operate-type.c @@ -316,7 +316,7 @@ extern "C" { #endif // _di_fake_make_operate_process_type_groups_ #ifndef _di_fake_make_operate_process_type_if_defined_ - void fake_make_operate_process_type_if_defined(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) { + void fake_make_operate_process_type_if_defined(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) { const f_string_static_t argument = if_not ? arguments.array[2] : arguments.array[1]; @@ -429,13 +429,13 @@ extern "C" { }; if (fl_string_dynamic_compare_string(fake_make_operation_argument_environment_s, argument, fake_make_operation_argument_environment_s_length) == F_equal_to) { - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; if (if_not) { for (f_array_length_t i = 3; i < arguments.used; ++i) { if (f_environment_exists(arguments.array[i].string) == F_true) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } @@ -445,7 +445,7 @@ extern "C" { for (f_array_length_t i = 2; i < arguments.used; ++i) { if (f_environment_exists(arguments.array[i].string) != F_true) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } @@ -461,7 +461,7 @@ extern "C" { // 0 = unknown, 1 = fail, 2 = pass. uint8_t result = 0; - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; // Multiple properties may pass and so if any of them fail, then they all fail. for (; i < arguments.used; ++i) { @@ -499,31 +499,31 @@ extern "C" { if (if_not) { if (result < 2) { - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; } else { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; } } else if (result < 2) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; } } #endif // _di_fake_make_operate_process_type_if_defined_ #ifndef _di_fake_make_operate_process_type_if_exists_ - f_status_t fake_make_operate_process_type_if_exists(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) { + f_status_t fake_make_operate_process_type_if_exists(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) { f_status_t status = F_none; - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; for (f_array_length_t i = if_not ? 2 : 1; i < arguments.used; ++i) { status = f_file_exists(arguments.array[i].string); if (F_status_is_error(status)) { - *operation_if = fake_make_operation_if_type_false_always_next; + state_process->condition_result = fake_condition_result_done; fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_exists", F_true, arguments.array[i].string, "find", fll_error_file_type_file); @@ -532,14 +532,14 @@ extern "C" { if (if_not) { if (status == F_true) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } else { if (status == F_false) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } @@ -553,7 +553,7 @@ extern "C" { #endif // _di_fake_make_operate_process_type_if_exists_ #ifndef _di_fake_make_operate_process_type_if_is_ - f_status_t fake_make_operate_process_type_if_is(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) { + f_status_t fake_make_operate_process_type_if_is(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) { f_status_t status = F_none; @@ -601,14 +601,14 @@ extern "C" { uint8_t type_file = 0; mode_t mode_file = 0; - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; for (; i < arguments.used; ++i, mode_file = 0) { status = f_file_mode_read(arguments.array[i].string, &mode_file); if (F_status_is_error(status)) { - *operation_if = fake_make_operation_if_type_false_always_next; + state_process->condition_result = fake_condition_result_done; fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_read", F_true, arguments.array[i].string, "get mode of", fll_error_file_type_file); @@ -639,14 +639,14 @@ extern "C" { if (if_not) { if (type & type_file) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } else { if (!(type & type_file)) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } @@ -660,7 +660,7 @@ extern "C" { #endif // _di_fake_make_operate_process_type_if_is_ #ifndef _di_fake_make_operate_process_type_if_greater_if_lesser_ - f_status_t fake_make_operate_process_type_if_greater_if_lesser(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, uint8_t *operation_if) { + f_status_t fake_make_operate_process_type_if_greater_if_lesser(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, fake_state_process_t *state_process) { f_status_t status = F_none; @@ -673,9 +673,7 @@ extern "C" { f_array_length_t i = 1; - const uint8_t type_if = *operation_if; - - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; // @fixme This needs to handle converting numbers with decimals (like 1.01), perhaps operate on them as strings or provide a special processor. range.start = 0; @@ -726,62 +724,62 @@ extern "C" { if (F_status_is_error(status)) break; - if (type_if == fake_make_operation_if_type_if_greater) { + if (state_process->condition == fake_make_operation_if_type_if_greater) { if (is_negative_left == is_negative_right) { if (!(number_left > number_right)) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } else if (!is_negative_left && is_negative_right) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } - else if (type_if == fake_make_operation_if_type_if_greater_equal) { + else if (state_process->condition == fake_make_operation_if_type_if_greater_equal) { if (is_negative_left == is_negative_right) { if (!(number_left >= number_right)) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } else if (!is_negative_left && is_negative_right) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } - else if (type_if == fake_make_operation_if_type_if_less) { + else if (state_process->condition == fake_make_operation_if_type_if_less) { if (is_negative_left == is_negative_right) { if (!(number_left < number_right)) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } else if (is_negative_left && !is_negative_right) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } - else if (type_if == fake_make_operation_if_type_if_less_equal) { + else if (state_process->condition == fake_make_operation_if_type_if_less_equal) { if (is_negative_left == is_negative_right) { if (!(number_left <= number_right)) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } else if (is_negative_left && !is_negative_right) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } @@ -790,7 +788,7 @@ extern "C" { } if (F_status_is_error(status)) { - *operation_if = fake_make_operation_if_type_false_always_next; + state_process->condition_result = fake_condition_result_done; if (main->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { flockfile(data_make->error.to.stream); @@ -817,7 +815,7 @@ extern "C" { #endif // _di_fake_make_operate_process_type_if_greater_if_lesser_ #ifndef _di_fake_make_operate_process_type_if_group_ - f_status_t fake_make_operate_process_type_if_group(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) { + f_status_t fake_make_operate_process_type_if_group(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) { f_status_t status = F_none; uid_t id = 0; @@ -827,14 +825,14 @@ extern "C" { uid_t id_file = 0; - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; for (f_array_length_t i = if_not ? 3 : 2; i < arguments.used; ++i, id_file = 0) { status = f_file_group_read(arguments.array[i].string, &id_file); if (F_status_is_error(status)) { - *operation_if = fake_make_operation_if_type_false_always_next; + state_process->condition_result = fake_condition_result_done; fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_group_read", F_true, arguments.array[i].string, "get group of", fll_error_file_type_file); @@ -843,14 +841,14 @@ extern "C" { if (if_not) { if (id == id_file) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } else { if (id != id_file) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } @@ -864,7 +862,7 @@ extern "C" { #endif // _di_fake_make_operate_process_type_if_group_ #ifndef _di_fake_make_operate_process_type_if_mode_ - f_status_t fake_make_operate_process_type_if_mode(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) { + f_status_t fake_make_operate_process_type_if_mode(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) { f_status_t status = F_none; f_file_mode_t mode_rule = 0; @@ -881,7 +879,7 @@ extern "C" { status = fake_make_get_id_mode(main, data_make->error, arguments.array[if_not ? 3 : 2], &mode_rule, &mode_replace); if (F_status_is_error(status)) { - *operation_if = fake_make_operation_if_type_false_always_next; + state_process->condition_result = fake_condition_result_done; return status; } @@ -889,7 +887,7 @@ extern "C" { status = f_file_mode_to_mode(mode_rule, &mode_match); if (F_status_is_error(status)) { - *operation_if = fake_make_operation_if_type_false_always_next; + state_process->condition_result = fake_condition_result_done; fll_error_print(data_make->error, F_status_set_fine(status), "f_file_mode_to_mode", F_true); @@ -899,14 +897,14 @@ extern "C" { mode_t mode_file = 0; - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; for (f_array_length_t i = if_not ? 4 : 3; i < arguments.used; ++i, mode_file = 0) { status = f_file_mode_read(arguments.array[i].string, &mode_file); if (F_status_is_error(status)) { - *operation_if = fake_make_operation_if_type_false_always_next; + state_process->condition_result = fake_condition_result_done; fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_read", F_true, arguments.array[i].string, "get mode of", fll_error_file_type_file); @@ -916,14 +914,14 @@ extern "C" { if (if_not) { if (is) { if (mode_match == (mode_file & F_file_mode_all_d)) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } else { if (mode_match & mode_file) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } @@ -932,14 +930,14 @@ extern "C" { else { if (is) { if (mode_match != (mode_file & F_file_mode_all_d)) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } else { if (!(mode_match & mode_file)) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } @@ -952,7 +950,7 @@ extern "C" { #endif // _di_fake_make_operate_process_type_if_mode_ #ifndef _di_fake_make_operate_process_type_if_owner_ - f_status_t fake_make_operate_process_type_if_owner(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) { + f_status_t fake_make_operate_process_type_if_owner(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) { f_status_t status = F_none; uid_t id = 0; @@ -962,14 +960,14 @@ extern "C" { uid_t id_file = 0; - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; for (f_array_length_t i = if_not ? 3 : 2; i < arguments.used; ++i, id_file = 0) { status = f_file_owner_read(arguments.array[i].string, &id_file); if (F_status_is_error(status)) { - *operation_if = fake_make_operation_if_type_false_always_next; + state_process->condition_result = fake_condition_result_done; fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_owner_read", F_true, arguments.array[i].string, "get owner of", fll_error_file_type_file); @@ -978,14 +976,14 @@ extern "C" { if (if_not) { if (id == id_file) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } else { if (id != id_file) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } diff --git a/level_3/fake/c/private-make-operate-type.h b/level_3/fake/c/private-make-operate-type.h index 257b4e7..d586604 100644 --- a/level_3/fake/c/private-make-operate-type.h +++ b/level_3/fake/c/private-make-operate-type.h @@ -18,7 +18,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param clone @@ -50,7 +50,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param all @@ -80,7 +80,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. */ @@ -94,7 +94,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param all @@ -104,15 +104,14 @@ extern "C" { * @return * F_none on success. * - * Errors (with error bit) from: (). - * Errors (with error bit) from: (). - * Errors (with error bit) from: (). + * Errors (with error bit) from: f_file_role_change(). + * Errors (with error bit) from: fll_file_role_change_all(). * + * Errors (with error bit) from: fake_make_assure_inside_project(). * Errors (with error bit) from: fake_make_get_id_group(). * - * @see () - * @see () - * @see () + * @see f_file_role_change() + * @see fll_file_role_change_all() * * @see fake_make_assure_inside_project() * @see fake_make_get_id_group() @@ -127,17 +126,17 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param if_not * When TRUE, perform the if not is. * When FALSE, perform the if is. - * @param operation_if - * The if-condition status for the current operation. + * @param state_process + * The operation process state. */ #ifndef _di_fake_make_operate_process_type_if_defined_ - extern void fake_make_operate_process_type_if_defined(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) F_attribute_visibility_internal_d; + extern void fake_make_operate_process_type_if_defined(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) F_attribute_visibility_internal_d; #endif // _di_fake_make_operate_process_type_if_defined_ /** @@ -146,12 +145,14 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param if_not * When TRUE, perform the if not is. * When FALSE, perform the if is. * @param arguments * The arguments for the run or shell operation. + * @param state_process + * The operation process state. * * @return * F_none on success. @@ -161,7 +162,7 @@ extern "C" { * @see f_file_exists() */ #ifndef _di_fake_make_operate_process_type_if_exists_ - extern f_status_t fake_make_operate_process_type_if_exists(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) F_attribute_visibility_internal_d; + extern f_status_t fake_make_operate_process_type_if_exists(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) F_attribute_visibility_internal_d; #endif // _di_fake_make_operate_process_type_if_exists_ /** @@ -170,11 +171,11 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. - * @param operation_if - * The if-condition status for the current operation. + * @param state_process + * The operation process state. * * @return * F_none on success. @@ -184,7 +185,7 @@ extern "C" { * @see fl_conversion_string_to_number_unsigned() */ #ifndef _di_fake_make_operate_process_type_if_greater_if_lesser_ - extern f_status_t fake_make_operate_process_type_if_greater_if_lesser(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, uint8_t *operation_if) F_attribute_visibility_internal_d; + extern f_status_t fake_make_operate_process_type_if_greater_if_lesser(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, fake_state_process_t *state_process) F_attribute_visibility_internal_d; #endif // _di_fake_make_operate_process_type_if_greater_if_lesser_ /** @@ -193,14 +194,14 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param if_not * When TRUE, perform the if not is. * When FALSE, perform the if is. - * @param operation_if - * The if-condition status for the current operation. + * @param state_process + * The operation process state. * * @return * F_none on success. @@ -214,7 +215,7 @@ extern "C" { * @see fake_make_get_id_group() */ #ifndef _di_fake_make_operate_process_type_if_group_ - extern f_status_t fake_make_operate_process_type_if_group(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) F_attribute_visibility_internal_d; + extern f_status_t fake_make_operate_process_type_if_group(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) F_attribute_visibility_internal_d; #endif // _di_fake_make_operate_process_type_if_group_ /** @@ -223,14 +224,14 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param if_not * When TRUE, perform the if not is. * When FALSE, perform the if is. - * @param operation_if - * The if-condition status for the current operation. + * @param state_process + * The operation process state. * * @return * F_none on success. @@ -240,7 +241,7 @@ extern "C" { * @see f_file_mode_read() */ #ifndef _di_fake_make_operate_process_type_if_is_ - extern f_status_t fake_make_operate_process_type_if_is(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) F_attribute_visibility_internal_d; + extern f_status_t fake_make_operate_process_type_if_is(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) F_attribute_visibility_internal_d; #endif // _di_fake_make_operate_process_type_if_is_ /** @@ -249,14 +250,14 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param if_not * When TRUE, perform the if not is. * When FALSE, perform the if is. - * @param operation_if - * The if-condition status for the current operation. + * @param state_process + * The operation process state. * * @return * F_none on success. @@ -272,7 +273,7 @@ extern "C" { * @see fake_make_get_id_mode() */ #ifndef _di_fake_make_operate_process_type_if_mode_ - extern f_status_t fake_make_operate_process_type_if_mode(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) F_attribute_visibility_internal_d; + extern f_status_t fake_make_operate_process_type_if_mode(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) F_attribute_visibility_internal_d; #endif // _di_fake_make_operate_process_type_if_mode_ /** @@ -281,14 +282,14 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param if_not * When TRUE, perform the if not is. * When FALSE, perform the if is. - * @param operation_if - * The if-condition status for the current operation. + * @param state_process + * The operation process state. * * @return * F_none on success. @@ -302,7 +303,7 @@ extern "C" { * @see fake_make_get_id_owner() */ #ifndef _di_fake_make_operate_process_type_if_owner_ - extern f_status_t fake_make_operate_process_type_if_owner(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, uint8_t *operation_if) F_attribute_visibility_internal_d; + extern f_status_t fake_make_operate_process_type_if_owner(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) F_attribute_visibility_internal_d; #endif // _di_fake_make_operate_process_type_if_owner_ /** @@ -311,7 +312,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @@ -336,7 +337,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param all @@ -368,7 +369,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @@ -391,7 +392,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param all @@ -423,7 +424,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @@ -453,7 +454,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @@ -478,7 +479,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @@ -508,7 +509,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @@ -531,7 +532,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * diff --git a/level_3/fake/c/private-make-operate.c b/level_3/fake/c/private-make-operate.c index e02456d..23979b4 100644 --- a/level_3/fake/c/private-make-operate.c +++ b/level_3/fake/c/private-make-operate.c @@ -1066,6 +1066,7 @@ extern "C" { } const f_string_t operations_name[] = { + fake_make_operation_and_s, fake_make_operation_break_s, fake_make_operation_build_s, fake_make_operation_clean_s, @@ -1087,6 +1088,7 @@ extern "C" { fake_make_operation_modes_s, fake_make_operation_move_s, fake_make_operation_operate_s, + fake_make_operation_or_s, fake_make_operation_owner_s, fake_make_operation_owners_s, fake_make_operation_parameter_s, @@ -1101,6 +1103,7 @@ extern "C" { }; const f_array_length_t operations_length[] = { + fake_make_operation_and_s_length, fake_make_operation_break_s_length, fake_make_operation_build_s_length, fake_make_operation_clean_s_length, @@ -1122,6 +1125,7 @@ extern "C" { fake_make_operation_modes_s_length, fake_make_operation_move_s_length, fake_make_operation_operate_s_length, + fake_make_operation_or_s_length, fake_make_operation_owner_s_length, fake_make_operation_owners_s_length, fake_make_operation_parameter_s_length, @@ -1136,6 +1140,7 @@ extern "C" { }; const uint8_t operations_type[] = { + fake_make_operation_type_and, fake_make_operation_type_break, fake_make_operation_type_build, fake_make_operation_type_clean, @@ -1157,6 +1162,7 @@ extern "C" { fake_make_operation_type_modes, fake_make_operation_type_move, fake_make_operation_type_operate, + fake_make_operation_type_or, fake_make_operation_type_owner, fake_make_operation_type_owners, fake_make_operation_type_parameter, @@ -1170,19 +1176,15 @@ extern "C" { fake_make_operation_type_touch, }; - uint8_t operation = 0; - uint8_t operations[section->objects.used]; - uint8_t operation_if = 0; - + fake_state_process_t state_process = fake_state_process_t_initialize; bool success = F_true; + int result; f_string_dynamics_t arguments = f_string_dynamics_t_initialize; f_array_length_t i = 0; f_array_length_t j = 0; - memset(operations, 0, section->objects.used); - for (i = 0; i < section->objects.used; ++i, *status = F_none) { for (j = 0; j < arguments.size; ++j) { @@ -1190,7 +1192,10 @@ extern "C" { } // for arguments.used = 0; - operation = 0; + state_process.condition = 0; + state_process.condition_result = 0; + state_process.operation_previous = state_process.operation; + state_process.operation = 0; if (!(i % fake_signal_check_short_d) && fake_signal_received(main)) { *status = F_status_set_error(F_interrupt); @@ -1201,18 +1206,18 @@ extern "C" { for (j = 0; j < fake_make_operation_total_d; ++j) { 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]; + state_process.operation = operations_type[j]; break; } } // for - if (!operation) { + if (!state_process.operation) { fake_print_message_section_operation_unknown(main, data_make->error, data_make->buffer, section->name, section->objects.array[i]); *status = F_status_set_error(F_valid_not); } - else if (operation == fake_make_operation_type_operate) { + else if (state_process.operation == fake_make_operation_type_operate) { if (section_stack->used == fake_make_section_stack_max_d) { fake_print_message_section_operation_stack_max(main, data_make->error, data_make->buffer, section->name, section->objects.array[i], fake_make_section_stack_max_d); @@ -1221,104 +1226,87 @@ extern "C" { } if (F_status_is_error_not(*status)) { - operations[i] = operation; - - fake_make_operate_expand(main, data_make, section->name, operation, section->contents.array[i], section->quotess.array[i], &arguments, status); + fake_make_operate_expand(main, data_make, section->name, state_process.operation, section->contents.array[i], section->quotess.array[i], &arguments, status); } - if (operation_if == fake_make_operation_if_type_true_next) { - operation_if = fake_make_operation_if_type_true; - } - else if (operation_if == fake_make_operation_if_type_false_next) { - operation_if = fake_make_operation_if_type_false; + if (F_status_is_error_not(*status)) { + fake_make_operate_validate(main, data_make, section->name, arguments, &state_process, section_stack, status); } - else if (operation_if == fake_make_operation_if_type_false_always_next) { - operation_if = fake_make_operation_if_type_false_always; + + // Block is set to the synthetic done type when an if-condition completes in order to inform any subsequent else condition. + // If there is no follow-up else condition, then reset the block (there is no condition block at this point). + if (state_process.block == fake_make_operation_if_type_done) { + if (state_process.operation != fake_make_operation_type_else) { + state_process.block = 0; + state_process.block_result = 0; + } } - fake_make_operate_validate(main, data_make, section->name, operation, arguments, &operation_if, section_stack, status); + if (F_status_is_error(*status)) { + if (state_process.block) { - 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; + // Reset the block information for a completely processed block. + if (state_process.block == fake_make_operation_if_type_done && state_process.operation != fake_make_operation_type_else) { + state_process.block = 0; + state_process.block_result = 0; + } - continue; + // Always set the condition result to done on error for unfinished blocks as there is no way to determine truth at this point. + else { + state_process.block_result = fake_condition_result_done; + } } - else if (operation_if == fake_make_operation_if_type_false_always) { - operation_if = fake_make_operation_if_type_else_false_next_always; + } + else { + if (!(state_process.operation == fake_make_operation_type_if || state_process.operation == fake_make_operation_type_else || state_process.operation == fake_make_operation_type_and || state_process.operation == fake_make_operation_type_or)) { - continue; - } - else if (operation_if == fake_make_operation_if_type_else_false) { - operation_if = 0; + // Only process a non-if-condition operation following an if condition, if the block result is true. + if (state_process.block == fake_make_operation_if_type_if) { + if (state_process.block_result != fake_condition_result_true) { + state_process.block = fake_make_operation_if_type_done; + + success = F_true; + + continue; + } + } + + // Only process a non-if-condition operation following an else condition, if the block result is false. + else if (state_process.block == fake_make_operation_if_type_else) { + if (state_process.block_result != fake_condition_result_false) { + state_process.block = 0; + state_process.block_result = 0; + + success = F_true; - continue; + continue; + } + } } - const int result = fake_make_operate_process(main, data_make, section->name, operation, arguments, success, &operation_if, section_stack, status); + result = fake_make_operate_process(main, data_make, section->name, arguments, success, &state_process, section_stack, status); if (*status == F_child) { f_string_dynamics_resize(0, &arguments); return result; } - } - else { - if (operation == fake_make_operation_type_if) { - switch (operation_if) { - case fake_make_operation_if_type_if_defined: - case fake_make_operation_if_type_if_equal: - case fake_make_operation_if_type_if_equal_not: - case fake_make_operation_if_type_if_exists: - case fake_make_operation_if_type_if_failure: - case fake_make_operation_if_type_if_greater: - case fake_make_operation_if_type_if_greater_equal: - case fake_make_operation_if_type_if_group: - case fake_make_operation_if_type_if_is: - case fake_make_operation_if_type_if_less: - case fake_make_operation_if_type_if_less_equal: - case fake_make_operation_if_type_if_mode: - case fake_make_operation_if_type_if_not: - case fake_make_operation_if_type_if_not_defined: - case fake_make_operation_if_type_if_not_exists: - case fake_make_operation_if_type_if_not_group: - case fake_make_operation_if_type_if_not_is: - case fake_make_operation_if_type_if_not_mode: - case fake_make_operation_if_type_if_not_owner: - case fake_make_operation_if_type_if_owner: - case fake_make_operation_if_type_if_success: - operation_if = 0; - break; - } - } - if (operation_if == fake_make_operation_if_type_false) { - operation_if = fake_make_operation_if_type_else_true_next; - } - else if (operation_if == fake_make_operation_if_type_false_always) { - operation_if = fake_make_operation_if_type_else_false_next_always; - } - else if (operation_if == fake_make_operation_if_type_else_false) { - operation_if = 0; + // When done processing an operation within a block, continue onto next block stage or exit the block. + if (!(state_process.operation == fake_make_operation_type_if || state_process.operation == fake_make_operation_type_else || state_process.operation == fake_make_operation_type_and || state_process.operation == fake_make_operation_type_or)) { + + if (state_process.block == fake_make_operation_if_type_if) { + state_process.block = fake_make_operation_if_type_done; + } + else if (state_process.block == fake_make_operation_if_type_else) { + state_process.block = 0; + state_process.block_result = 0; + } } } if (F_status_set_fine(*status) == F_interrupt) break; - 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; - } - } - else if (operation_if == fake_make_operation_if_type_true) { - operation_if = fake_make_operation_if_type_else_false_next; - } - else if (operation_if == fake_make_operation_if_type_false_always) { - operation_if = fake_make_operation_if_type_else_false_next_always; - } - if (F_status_is_error(*status)) { success = F_false; @@ -1349,8 +1337,6 @@ extern "C" { } if (data_make->setting_make.fail == fake_make_operation_fail_type_exit) { - operation_if = 0; - break; } } @@ -1363,7 +1349,7 @@ extern "C" { else if (*status == F_signal_quit) { success = F_true; - // F_signal_abort is used by the exit section operation. + // F_signal_quit is used by the exit section operation. if (!section_stack->used) { *status = F_none; } @@ -1381,16 +1367,21 @@ extern "C" { return 0; } - if (i == section->objects.used && (operation_if == fake_make_operation_if_type_true_next || operation_if == fake_make_operation_if_type_false_next || operation_if == fake_make_operation_if_type_else_true || operation_if == fake_make_operation_if_type_else_false)) { - + if (i == section->objects.used && F_status_is_error_not(*status) && state_process.condition) { if (main->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { flockfile(data_make->error.to.stream); fl_print_format("%c%[%SIncomplete '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); - if (operation_if == fake_make_operation_if_type_true_next || operation_if == fake_make_operation_if_type_false_next) { + if (state_process.condition == fake_make_operation_type_if) { fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); } + else if (state_process.condition == fake_make_operation_type_and) { + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); + } + else if (state_process.condition == fake_make_operation_type_or) { + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); + } else { fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_else_s, data_make->error.notable); } @@ -1419,11 +1410,11 @@ extern "C" { #endif // _di_fake_make_operate_section_ #ifndef _di_fake_make_operate_process_ - int fake_make_operate_process(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_range_t section_name, const uint8_t operation, const f_string_dynamics_t arguments, const bool success, uint8_t *operation_if, f_array_lengths_t *section_stack, f_status_t *status) { + int fake_make_operate_process(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_range_t section_name, const f_string_dynamics_t arguments, const bool success, fake_state_process_t *state_process, f_array_lengths_t *section_stack, f_status_t *status) { if (*status == F_child) return main->child; - if (operation == fake_make_operation_type_index) { + if (state_process->operation == fake_make_operation_type_index) { const f_status_t result = fake_execute(main, data_make->environment, data_make->setting_build.build_indexer, arguments, status); if (F_status_is_error(*status)) { @@ -1439,7 +1430,7 @@ extern "C" { return 0; } - if (operation == fake_make_operation_type_break) { + if (state_process->operation == fake_make_operation_type_break) { if (!arguments.used || fl_string_dynamic_compare_string(fake_make_operation_argument_success_s, arguments.array[0], fake_make_operation_argument_success_s_length) == F_equal_to) { *status = F_signal_abort; @@ -1464,7 +1455,7 @@ extern "C" { return 0; } - if (operation == fake_make_operation_type_build) { + if (state_process->operation == fake_make_operation_type_build) { f_string_static_t stub = f_string_static_t_initialize; *status = fake_build_operate(arguments.used ? arguments.array[0] : stub, main); @@ -1478,7 +1469,7 @@ extern "C" { return 0; } - if (operation == fake_make_operation_type_clean) { + if (state_process->operation == fake_make_operation_type_clean) { *status = fake_clean_operate(main); if (F_status_set_fine(*status) == F_interrupt) { @@ -1490,13 +1481,13 @@ extern "C" { return 0; } - if (operation == fake_make_operation_type_clone) { + if (state_process->operation == fake_make_operation_type_clone) { *status = fake_make_operate_process_type_copy(main, data_make, arguments, F_true); return 0; } - if (operation == fake_make_operation_type_compile) { + if (state_process->operation == fake_make_operation_type_compile) { const int result = fake_execute(main, data_make->environment, data_make->setting_build.build_compiler, arguments, status); if (F_status_is_error(*status)) { @@ -1512,13 +1503,13 @@ extern "C" { return 0; } - if (operation == fake_make_operation_type_copy) { + if (state_process->operation == fake_make_operation_type_copy) { *status = fake_make_operate_process_type_copy(main, data_make, arguments, F_false); return 0; } - if (operation == fake_make_operation_type_define) { + if (state_process->operation == fake_make_operation_type_define) { if (arguments.used > 1) { *status = f_environment_set(arguments.array[0].string, arguments.array[1].string, F_true); @@ -1537,32 +1528,27 @@ extern "C" { return 0; } - if (operation == fake_make_operation_type_delete) { + if (state_process->operation == fake_make_operation_type_delete) { *status = fake_make_operate_process_type_deletes(main, data_make, arguments, F_false); return 0; } - if (operation == fake_make_operation_type_deletes) { + if (state_process->operation == fake_make_operation_type_deletes) { *status = fake_make_operate_process_type_deletes(main, data_make, arguments, F_true); return 0; } - if (operation == fake_make_operation_type_else) { + if (state_process->operation == fake_make_operation_type_else) { - if (*operation_if == fake_make_operation_if_type_else_false_next || *operation_if == fake_make_operation_if_type_else_false_next_always) { - *operation_if = fake_make_operation_if_type_else_false; - } - else if (*operation_if != fake_make_operation_if_type_else_true_next) { - *operation_if = fake_make_operation_if_type_else_true; - } + // Setup the block so that subsequent operations can know the current block and the result (which is preserved across to the else condition). + state_process->block = fake_make_operation_if_type_else; return 0; } - if (operation == fake_make_operation_type_exit) { - + if (state_process->operation == fake_make_operation_type_exit) { if (!arguments.used || fl_string_dynamic_compare_string(fake_make_operation_argument_success_s, arguments.array[0], fake_make_operation_argument_success_s_length) == F_equal_to) { *status = F_signal_quit; } @@ -1590,100 +1576,73 @@ extern "C" { return 0; } - if (operation == fake_make_operation_type_fail) { + if (state_process->operation == fake_make_operation_type_fail) { fake_make_operate_process_type_fail(main, data_make, arguments); return 0; } - if (operation == fake_make_operation_type_group) { + if (state_process->operation == fake_make_operation_type_group) { *status = fake_make_operate_process_type_groups(main, data_make, arguments, F_false); return 0; } - if (operation == fake_make_operation_type_groups) { + if (state_process->operation == fake_make_operation_type_groups) { *status = fake_make_operate_process_type_groups(main, data_make, arguments, F_true); return 0; } - if (operation == fake_make_operation_type_if) { - if (*operation_if == fake_make_operation_if_type_if_success) { + if (state_process->operation == fake_make_operation_type_if || state_process->operation == fake_make_operation_type_and || state_process->operation == fake_make_operation_type_or) { + if (state_process->condition == fake_make_operation_if_type_if_success) { if (success) { - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; } else { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; } - - return 0; } - - if (*operation_if == fake_make_operation_if_type_if_defined) { - fake_make_operate_process_type_if_defined(main, data_make, arguments, F_false, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_defined) { + fake_make_operate_process_type_if_defined(main, data_make, arguments, F_false, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_exists) { - *status = fake_make_operate_process_type_if_exists(main, data_make, arguments, F_false, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_exists) { + *status = fake_make_operate_process_type_if_exists(main, data_make, arguments, F_false, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_failure) { + else if (state_process->condition == fake_make_operation_if_type_if_failure) { if (success) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; } else { - *operation_if = fake_make_operation_if_type_true_next; + state_process->condition_result = fake_condition_result_true; } - - return 0; } - - if (*operation_if == fake_make_operation_if_type_if_group) { - *status = fake_make_operate_process_type_if_group(main, data_make, arguments, F_false, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_group) { + *status = fake_make_operate_process_type_if_group(main, data_make, arguments, F_false, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_is) { - *status = fake_make_operate_process_type_if_is(main, data_make, arguments, F_false, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_is) { + *status = fake_make_operate_process_type_if_is(main, data_make, arguments, F_false, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_mode) { - *status = fake_make_operate_process_type_if_mode(main, data_make, arguments, F_false, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_mode) { + *status = fake_make_operate_process_type_if_mode(main, data_make, arguments, F_false, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_not_defined) { - fake_make_operate_process_type_if_defined(main, data_make, arguments, F_true, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_not_defined) { + fake_make_operate_process_type_if_defined(main, data_make, arguments, F_true, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_equal) { - *operation_if = fake_make_operation_if_type_true_next; + else if (state_process->condition == fake_make_operation_if_type_if_equal) { + state_process->condition_result = fake_condition_result_true; for (f_array_length_t i = 2; i < arguments.used; ++i) { if (fl_string_dynamic_compare(arguments.array[1], arguments.array[i]) == F_equal_to_not) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; break; } } // for - - return 0; } - - if (*operation_if == fake_make_operation_if_type_if_equal_not) { - *operation_if = fake_make_operation_if_type_true_next; + else if (state_process->condition == fake_make_operation_if_type_if_equal_not) { + state_process->condition_result = fake_condition_result_true; f_array_length_t i = 1; f_array_length_t j = 0; @@ -1693,63 +1652,63 @@ extern "C" { for (j = i + 1; j < arguments.used; ++j) { if (fl_string_dynamic_compare(arguments.array[i], arguments.array[j]) == F_equal_to) { - *operation_if = fake_make_operation_if_type_false_next; + state_process->condition_result = fake_condition_result_false; i = arguments.used; break; } } // for } // for - - return 0; } - - if (*operation_if == fake_make_operation_if_type_if_greater || *operation_if == fake_make_operation_if_type_if_greater_equal || *operation_if == fake_make_operation_if_type_if_less || *operation_if == fake_make_operation_if_type_if_less_equal) { - *status = fake_make_operate_process_type_if_greater_if_lesser(main, data_make, arguments, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_greater || state_process->condition == fake_make_operation_if_type_if_greater_equal || state_process->condition == fake_make_operation_if_type_if_less || state_process->condition == fake_make_operation_if_type_if_less_equal) { + *status = fake_make_operate_process_type_if_greater_if_lesser(main, data_make, arguments, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_not_exists) { - *status = fake_make_operate_process_type_if_exists(main, data_make, arguments, F_true, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_not_exists) { + *status = fake_make_operate_process_type_if_exists(main, data_make, arguments, F_true, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_not_group) { - *status = fake_make_operate_process_type_if_group(main, data_make, arguments, F_true, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_not_group) { + *status = fake_make_operate_process_type_if_group(main, data_make, arguments, F_true, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_not_is) { - *status = fake_make_operate_process_type_if_is(main, data_make, arguments, F_true, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_not_is) { + *status = fake_make_operate_process_type_if_is(main, data_make, arguments, F_true, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_not_mode) { - *status = fake_make_operate_process_type_if_mode(main, data_make, arguments, F_true, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_not_mode) { + *status = fake_make_operate_process_type_if_mode(main, data_make, arguments, F_true, state_process); } - - if (*operation_if == fake_make_operation_if_type_if_not_owner) { - *status = fake_make_operate_process_type_if_owner(main, data_make, arguments, F_true, operation_if); - - return 0; + else if (state_process->condition == fake_make_operation_if_type_if_not_owner) { + *status = fake_make_operate_process_type_if_owner(main, data_make, arguments, F_true, state_process); + } + else if (state_process->condition == fake_make_operation_if_type_if_owner) { + *status = fake_make_operate_process_type_if_owner(main, data_make, arguments, F_false, state_process); } - if (*operation_if == fake_make_operation_if_type_if_owner) { - *status = fake_make_operate_process_type_if_owner(main, data_make, arguments, F_false, operation_if); + // Setup the block for subsequent operations. + state_process->block = fake_make_operation_if_type_if; - return 0; + if (state_process->condition_result == fake_condition_result_done || state_process->operation == fake_make_operation_type_if) { + state_process->block_result = state_process->condition_result; + } + else if (state_process->operation == fake_make_operation_type_or) { + if (state_process->block_result == fake_condition_result_true || state_process->condition_result == fake_condition_result_true) { + state_process->block_result = fake_condition_result_true; + } + else { + state_process->block_result = fake_condition_result_false; + } + } + else { + if (state_process->block_result == fake_condition_result_true && state_process->condition_result == fake_condition_result_true) { + state_process->block_result = fake_condition_result_true; + } + else { + state_process->block_result = fake_condition_result_false; + } } return 0; } - if (operation == fake_make_operation_type_link) { + if (state_process->operation == fake_make_operation_type_link) { *status = f_file_link(arguments.array[0].string, arguments.array[1].string); if (F_status_is_error(*status)) { @@ -1767,25 +1726,25 @@ extern "C" { return 0; } - if (operation == fake_make_operation_type_mode) { + if (state_process->operation == fake_make_operation_type_mode) { *status = fake_make_operate_process_type_modes(main, data_make, arguments, F_false); return 0; } - if (operation == fake_make_operation_type_modes) { + if (state_process->operation == fake_make_operation_type_modes) { *status = fake_make_operate_process_type_modes(main, data_make, arguments, F_true); return 0; } - if (operation == fake_make_operation_type_move) { + if (state_process->operation == fake_make_operation_type_move) { *status = fake_make_operate_process_type_move(main, data_make, arguments); return 0; } - if (operation == fake_make_operation_type_operate) { + if (state_process->operation == fake_make_operation_type_operate) { f_array_length_t id_section = 0; for (; id_section < data_make->fakefile.used; ++id_section) { @@ -1801,7 +1760,7 @@ extern "C" { const int result = fake_make_operate_section(main, data_make, id_section, section_stack, status); - // Ensure that a break only happens within its active operation stack. + // Ensure that a break only happens within its active state_process->operation stack. if (*status == F_signal_abort) { *status = F_none; } @@ -1812,31 +1771,31 @@ extern "C" { return result; } - if (operation == fake_make_operation_type_owner) { + if (state_process->operation == fake_make_operation_type_owner) { *status = fake_make_operate_process_type_owners(main, data_make, arguments, F_false); return 0; } - if (operation == fake_make_operation_type_owners) { + if (state_process->operation == fake_make_operation_type_owners) { *status = fake_make_operate_process_type_owners(main, data_make, arguments, F_true); return 0; } - if (operation == fake_make_operation_type_parameter) { + if (state_process->operation == fake_make_operation_type_parameter) { *status = fake_make_operate_process_type_parameter(main, data_make, arguments); return 0; } - if (operation == fake_make_operation_type_pop) { + if (state_process->operation == fake_make_operation_type_pop) { *status = fake_make_operate_process_type_pop(main, data_make, arguments); return 0; } - if (operation == fake_make_operation_type_print) { + if (state_process->operation == fake_make_operation_type_print) { flockfile(main->output.to.stream); for (f_array_length_t i = 0; i < arguments.used; ++i) { @@ -1856,19 +1815,19 @@ extern "C" { return 0; } - if (operation == fake_make_operation_type_run) { + if (state_process->operation == fake_make_operation_type_run) { *status = fake_make_operate_process_run(main, data_make, arguments, F_false); return 0; } - if (operation == fake_make_operation_type_shell) { + if (state_process->operation == fake_make_operation_type_shell) { *status = fake_make_operate_process_run(main, data_make, arguments, F_true); return 0; } - if (operation == fake_make_operation_type_skeleton) { + if (state_process->operation == fake_make_operation_type_skeleton) { *status = fake_skeleton_operate(main); if (F_status_set_fine(*status) == F_interrupt) { @@ -1880,19 +1839,19 @@ extern "C" { return 0; } - if (operation == fake_make_operation_type_to) { + if (state_process->operation == fake_make_operation_type_to) { *status = fake_make_operate_process_type_to(main, data_make, arguments); return 0; } - if (operation == fake_make_operation_type_top) { + if (state_process->operation == fake_make_operation_type_top) { *status = fake_make_operate_process_type_top(main, data_make, arguments); return 0; } - if (operation == fake_make_operation_type_touch) { + if (state_process->operation == fake_make_operation_type_touch) { *status = fake_make_operate_process_type_touch(main, data_make, arguments); } @@ -2112,19 +2071,17 @@ 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, fake_make_data_t * const data_make, const f_string_range_t section_name, const f_array_length_t operation, const f_string_dynamics_t arguments, uint8_t *operation_if, f_array_lengths_t *section_stack, f_status_t *status) { + void fake_make_operate_validate(fake_main_t * const main, fake_make_data_t * const data_make, const f_string_range_t section_name, const f_string_dynamics_t arguments, fake_state_process_t *state_process, f_array_lengths_t *section_stack, f_status_t *status) { if (F_status_is_error(*status)) return; - if (operation == fake_make_operation_type_index || operation == fake_make_operation_type_run || operation == fake_make_operation_type_shell) { + if (state_process->operation == fake_make_operation_type_index || state_process->operation == fake_make_operation_type_run || state_process->operation == fake_make_operation_type_shell) { if (!arguments.used) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } - else if (operation == fake_make_operation_type_index) { + else if (state_process->operation == fake_make_operation_type_index) { if (!data_make->setting_build.build_indexer.used) { if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { flockfile(data_make->error.to.stream); @@ -2143,11 +2100,9 @@ extern "C" { return; } - if (operation == fake_make_operation_type_break) { + if (state_process->operation == fake_make_operation_type_break) { if (arguments.used > 1) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SHas too many arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_too_many_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -2173,11 +2128,9 @@ extern "C" { return; } - if (operation == fake_make_operation_type_build) { + if (state_process->operation == fake_make_operation_type_build) { if (arguments.used > 1) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SHas too many arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_too_many_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -2235,15 +2188,13 @@ extern "C" { return; } - if (operation == fake_make_operation_type_clean || operation == fake_make_operation_type_pop || operation == fake_make_operation_type_top || operation == fake_make_operation_type_skeleton) { + if (state_process->operation == fake_make_operation_type_clean || state_process->operation == fake_make_operation_type_pop || state_process->operation == fake_make_operation_type_top || state_process->operation == fake_make_operation_type_skeleton) { if (arguments.used) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SHas too many arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_too_many_arguments(data_make); *status = F_status_set_error(F_failure); } - else if (operation == fake_make_operation_type_pop) { + else if (state_process->operation == fake_make_operation_type_pop) { if (data_make->path.stack.used == 1) { if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { @@ -2257,7 +2208,7 @@ extern "C" { return; } - if (operation == fake_make_operation_type_clone) { + if (state_process->operation == fake_make_operation_type_clone) { if (arguments.used > 1) { for (f_array_length_t i = 0; i < arguments.used; ++i) { @@ -2291,7 +2242,7 @@ extern "C" { if (arguments.used > 2) { - // the last file must be a directory. + // The last file must be a directory. f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); if (status_file == F_false || status_file == F_file_found_not) { @@ -2314,7 +2265,7 @@ extern "C" { } else { - // when the first file is a directory, then the second, if it exists, must also be a directory. + // When the first file is a directory, then the second, if it exists, must also be a directory. f_status_t status_file = f_directory_is(arguments.array[0].string); if (status_file == F_true) { @@ -2337,9 +2288,7 @@ extern "C" { } } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -2347,11 +2296,9 @@ extern "C" { return; } - if (operation == fake_make_operation_type_compile) { + if (state_process->operation == fake_make_operation_type_compile) { if (!arguments.used) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -2372,7 +2319,7 @@ extern "C" { return; } - if (operation == fake_make_operation_type_copy) { + if (state_process->operation == fake_make_operation_type_copy) { if (arguments.used > 1) { for (f_array_length_t i = 0; i < arguments.used; ++i) { @@ -2406,7 +2353,7 @@ extern "C" { if (arguments.used > 2) { - // the last file must be a directory. + // The last file must be a directory. f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); if (status_file == F_false || status_file == F_file_found_not) { @@ -2429,7 +2376,7 @@ extern "C" { } else { - // when the first file is a directory, then the second, if it exists, must also be a directory. + // When the first file is a directory, then the second, if it exists, must also be a directory. f_status_t status_file = f_directory_is(arguments.array[0].string); if (status_file == F_true) { @@ -2452,9 +2399,7 @@ extern "C" { } } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -2462,7 +2407,7 @@ extern "C" { return; } - if (operation == fake_make_operation_type_define) { + if (state_process->operation == fake_make_operation_type_define) { if (arguments.used) { *status = fake_make_operate_validate_define_name(arguments.array[0]); @@ -2488,9 +2433,7 @@ extern "C" { } } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -2498,7 +2441,7 @@ extern "C" { return; } - if (operation == fake_make_operation_type_delete || operation == fake_make_operation_type_deletes) { + if (state_process->operation == fake_make_operation_type_delete || state_process->operation == fake_make_operation_type_deletes) { if (arguments.used) { for (f_array_length_t i = 0; i < arguments.used; ++i) { @@ -2514,9 +2457,7 @@ extern "C" { } // for } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -2524,69 +2465,71 @@ extern "C" { return; } - if (operation == fake_make_operation_type_else) { - if (*operation_if == fake_make_operation_if_type_else_true || *operation_if == fake_make_operation_if_type_else_false) { + if (state_process->operation == fake_make_operation_type_else) { + if (state_process->block == fake_make_operation_if_type_else) { if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%c%[%SMust not be used after another '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[else%]", data_make->error.to.stream, data_make->error.notable, data_make->error.notable); + fl_print_format("%c%[%SMust not be used immediately after another '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_else_s, data_make->error.notable); fl_print_format("%[' section operation.%]%c", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s[0]); funlockfile(data_make->error.to.stream); } *status = F_status_set_error(F_failure); - *operation_if = 0; return; } - if (*operation_if == fake_make_operation_if_type_true || *operation_if == fake_make_operation_if_type_false || *operation_if == fake_make_operation_if_type_false_always) { + if (state_process->operation_previous == fake_make_operation_type_if || state_process->operation_previous == fake_make_operation_type_and || state_process->operation_previous == fake_make_operation_type_or) { if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%c%[%SMust not be used inside an '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[if%]", data_make->error.to.stream, data_make->error.notable, data_make->error.notable); + fl_print_format("%c%[%SMust not be used immediately after an '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); + fl_print_format("%[', '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); + fl_print_format("%[', or '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); fl_print_format("%[' section operation.%]%c", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s[0]); funlockfile(data_make->error.to.stream); } *status = F_status_set_error(F_failure); - *operation_if = 0; return; } - if (*operation_if != fake_make_operation_if_type_else_true_next && *operation_if != fake_make_operation_if_type_else_false_next && *operation_if != fake_make_operation_if_type_else_false_next_always) { + if (state_process->block != fake_make_operation_if_type_done) { if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SHas no preceding if condition.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); + fl_print_format("%c%[%SHas no preceding '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); + fl_print_format("%[', '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); + fl_print_format("%[', or '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); + fl_print_format("%[' section operation.%]%c", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s[0]); } *status = F_status_set_error(F_failure); - *operation_if = 0; return; } if (arguments.used) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SHas too many arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_too_many_arguments(data_make); *status = F_status_set_error(F_failure); - *operation_if = 0; } return; } - if (operation == fake_make_operation_type_exit) { + if (state_process->operation == fake_make_operation_type_exit) { if (arguments.used > 1) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SHas too many arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_too_many_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -2611,7 +2554,7 @@ extern "C" { return; } - if (operation == fake_make_operation_type_fail) { + if (state_process->operation == fake_make_operation_type_fail) { if (arguments.used) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_exit_s, arguments.array[0], fake_make_operation_argument_exit_s_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_warn_s, arguments.array[0], fake_make_operation_argument_warn_s_length) == F_equal_to_not) { @@ -2632,9 +2575,7 @@ extern "C" { } } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -2642,7 +2583,7 @@ extern "C" { return; } - if (operation == fake_make_operation_type_group || operation == fake_make_operation_type_groups || operation == fake_make_operation_type_mode || operation == fake_make_operation_type_modes || operation == fake_make_operation_type_owner || operation == fake_make_operation_type_owners) { + if (state_process->operation == fake_make_operation_type_group || state_process->operation == fake_make_operation_type_groups || state_process->operation == fake_make_operation_type_mode || state_process->operation == fake_make_operation_type_modes || state_process->operation == fake_make_operation_type_owner || state_process->operation == fake_make_operation_type_owners) { if (arguments.used > 1) { f_status_t status_file = F_none; @@ -2675,31 +2616,55 @@ extern "C" { return; } - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); return; } - if (operation == fake_make_operation_type_if) { - if (*operation_if == fake_make_operation_if_type_true || *operation_if == fake_make_operation_if_type_false || *operation_if == fake_make_operation_if_type_false_always) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - flockfile(data_make->error.to.stream); + if (state_process->operation == fake_make_operation_type_if || state_process->operation == fake_make_operation_type_and || state_process->operation == fake_make_operation_type_or) { + if (state_process->operation == fake_make_operation_type_if) { + if (state_process->block == fake_make_operation_type_if) { + if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + flockfile(data_make->error.to.stream); - fl_print_format("%c%[%SMust not be used after another '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[if%]", data_make->error.to.stream, data_make->error.notable, data_make->error.notable); - fl_print_format("%[' section operation.%]%c", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s[0]); + fl_print_format("%c%[%SMust not be used immediately after another '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); + fl_print_format("%[', '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); + fl_print_format("%[', or '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); + fl_print_format("%[' section operation.%]%c", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s[0]); - funlockfile(data_make->error.to.stream); + funlockfile(data_make->error.to.stream); + } + + *status = F_status_set_error(F_failure); + + return; } + } + else { + if (!(state_process->operation_previous == fake_make_operation_type_if || state_process->operation_previous == fake_make_operation_type_and || state_process->operation_previous == fake_make_operation_type_or)) { + if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + flockfile(data_make->error.to.stream); - *status = F_status_set_error(F_failure); - *operation_if = 0; + fl_print_format("%c%[%SMay only be used immediately after another '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_if_s, data_make->error.notable); + fl_print_format("%[', '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_and_s, data_make->error.notable); + fl_print_format("%[', or '%]", data_make->error.to.stream, data_make->error.context, data_make->error.context); + fl_print_format("%[%s%]", data_make->error.to.stream, data_make->error.notable, fake_make_operation_or_s, data_make->error.notable); + fl_print_format("%[' section operation.%]%c", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s[0]); - return; + funlockfile(data_make->error.to.stream); + } + + *status = F_status_set_error(F_failure); + + return; + } } if (arguments.used) { @@ -2717,12 +2682,12 @@ extern "C" { fake_make_operation_argument_if_less_equal_s, fake_make_operation_argument_if_mode_s, fake_make_operation_argument_if_not_s, - fake_make_operation_argument_if_defined_s, // if not defined, represented by just "defined". - fake_make_operation_argument_if_exists_s, // if not exists, represented by just "exists". - fake_make_operation_argument_if_group_s, // if not group, represented by just "group". - fake_make_operation_argument_if_is_s, // if not is, represented by just "is". - fake_make_operation_argument_if_mode_s, // if not mode, represented by just "mode". - fake_make_operation_argument_if_owner_s, // if not owner, represented by just "owner". + fake_make_operation_argument_if_defined_s, // If not defined, represented by just "defined". + fake_make_operation_argument_if_exists_s, // If not exists, represented by just "exists". + fake_make_operation_argument_if_group_s, // If not group, represented by just "group". + fake_make_operation_argument_if_is_s, // If not is, represented by just "is". + fake_make_operation_argument_if_mode_s, // If not mode, represented by just "mode". + fake_make_operation_argument_if_owner_s, // If not owner, represented by just "owner". fake_make_operation_argument_if_owner_s, fake_make_operation_argument_if_success_s, }; @@ -2837,6 +2802,17 @@ extern "C" { f_array_length_t i = 0; f_array_length_t j = 0; + f_string_t if_and_or; + + if (state_process->operation == fake_make_operation_type_and) { + if_and_or = fake_make_operation_and_s; + } + else if (state_process->operation == fake_make_operation_type_or) { + if_and_or = fake_make_operation_or_s; + } + else { + if_and_or = fake_make_operation_if_s; + } for (; i < 21; ++i) { @@ -2844,7 +2820,7 @@ extern "C" { if (i > 12 && i < 19) continue; if (fl_string_dynamic_compare_string(if_type_strings[i], arguments.array[0], if_type_lengths[i]) == F_equal_to) { - *operation_if = if_type_codes[i]; + state_process->condition = if_type_codes[i]; break; } @@ -2854,7 +2830,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%c%[%SUnsupported if type '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%c%[%SUnsupported '%s' type '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, if_and_or, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%['.%]%c", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s[0]); @@ -2862,20 +2838,16 @@ extern "C" { } *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; return; } // Identify and convert to the appropriate if not condition. - if (*operation_if == fake_make_operation_if_type_if_not) { + if (state_process->condition == fake_make_operation_if_type_if_not) { if (arguments.used < 2) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; return; } @@ -2883,7 +2855,7 @@ extern "C" { for (; j < 6; ++j) { if (fl_string_dynamic_compare_string(if_not_type_strings[j], arguments.array[1], if_not_type_lengths[j]) == F_equal_to) { - *operation_if = if_not_type_codes[j]; + state_process->condition = if_not_type_codes[j]; break; } @@ -2893,7 +2865,7 @@ extern "C" { if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { flockfile(data_make->error.to.stream); - fl_print_format("%c%[%SUnsupported if not type '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); + fl_print_format("%c%[%SUnsupported '%s' not type '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, if_and_or, data_make->error.context); fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[0], data_make->error.notable); fl_print_format("%['.%]%c", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s[0]); @@ -2901,7 +2873,6 @@ extern "C" { } *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; return; } @@ -2911,71 +2882,65 @@ extern "C" { } if (j == 6 && arguments.used >= if_type_minimum[i] || arguments.used >= if_not_type_minimum[j]) { - if (*operation_if == fake_make_operation_if_type_if_success || *operation_if == fake_make_operation_if_type_if_failure) { + if (state_process->condition == fake_make_operation_if_type_if_success || state_process->condition == fake_make_operation_if_type_if_failure) { + + // The success and failure operations minimum is also the maximum. if (arguments.used > if_type_minimum[i]) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SHas too many arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_too_many_arguments(data_make); *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; } return; } - if (*operation_if == fake_make_operation_if_type_if_defined || *operation_if == fake_make_operation_if_type_if_not_defined) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_environment_s, j == 6 ? arguments.array[1] : arguments.array[2], fake_make_operation_argument_environment_s_length) == F_equal_to_not) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_parameter_s, j == 6 ? arguments.array[1] : arguments.array[2], fake_make_operation_argument_parameter_s_length) == F_equal_to_not) { + if (state_process->condition == fake_make_operation_if_type_if_defined || state_process->condition == fake_make_operation_if_type_if_not_defined) { + if (fl_string_dynamic_compare_string(fake_make_operation_argument_environment_s, arguments.array[1], fake_make_operation_argument_environment_s_length) == F_equal_to_not) { + if (fl_string_dynamic_compare_string(fake_make_operation_argument_parameter_s, arguments.array[1], fake_make_operation_argument_parameter_s_length) == F_equal_to_not) { if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { flockfile(data_make->error.to.stream); fl_print_format("%c%[%SUnsupported define type '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context); - fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, j == 6 ? arguments.array[1] : arguments.array[2], data_make->error.notable); + fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[1], data_make->error.notable); fl_print_format("%['.%]%c", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s[0]); funlockfile(data_make->error.to.stream); } *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; } } return; } - else if (*operation_if == fake_make_operation_if_type_if_equal || *operation_if == fake_make_operation_if_type_if_equal_not) { + else if (state_process->condition == fake_make_operation_if_type_if_equal || state_process->condition == fake_make_operation_if_type_if_equal_not) { if (arguments.used < 3) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; } return; } - else if (*operation_if == fake_make_operation_if_type_if_exists || *operation_if == fake_make_operation_if_type_if_not_exists) { + else if (state_process->condition == fake_make_operation_if_type_if_exists || state_process->condition == fake_make_operation_if_type_if_not_exists) { return; } - else if (*operation_if == fake_make_operation_if_type_if_group || *operation_if == fake_make_operation_if_type_if_is || *operation_if == fake_make_operation_if_type_if_mode || *operation_if > fake_make_operation_if_type_if_not_exists && *operation_if < fake_make_operation_if_type_if_success) { + else if (state_process->condition == fake_make_operation_if_type_if_group || state_process->condition == fake_make_operation_if_type_if_is || state_process->condition == fake_make_operation_if_type_if_mode || state_process->condition > fake_make_operation_if_type_if_not_exists && state_process->condition < fake_make_operation_if_type_if_success) { - if (*operation_if == fake_make_operation_if_type_if_mode || *operation_if == fake_make_operation_if_type_if_not_mode) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_is_s, j == 6 ? arguments.array[1] : arguments.array[2], fake_make_operation_argument_is_s_length) == F_equal_to_not) { - if (fl_string_dynamic_compare_string(fake_make_operation_argument_has_s, j == 6 ? arguments.array[1] : arguments.array[2], fake_make_operation_argument_has_s_length) == F_equal_to_not) { + if (state_process->condition == fake_make_operation_if_type_if_mode || state_process->condition == fake_make_operation_if_type_if_not_mode) { + if (fl_string_dynamic_compare_string(fake_make_operation_argument_is_s, arguments.array[1], fake_make_operation_argument_is_s_length) == F_equal_to_not) { + if (fl_string_dynamic_compare_string(fake_make_operation_argument_has_s, arguments.array[1], fake_make_operation_argument_has_s_length) == F_equal_to_not) { if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { flockfile(data_make->error.to.stream); fl_print_format("%c%[%SUnsupported %smode type '%]", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, j == 6 ? "" : "not ", data_make->error.context); - fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, j == 6 ? arguments.array[1] : arguments.array[2], data_make->error.notable); + fl_print_format("%[%Q%]", data_make->error.to.stream, data_make->error.notable, arguments.array[1], data_make->error.notable); fl_print_format("%['.%]%c", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s[0]); funlockfile(data_make->error.to.stream); } *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; return; } @@ -2985,29 +2950,19 @@ extern "C" { uint8_t replace = 0; *status = fake_make_get_id_mode(main, data_make->error, j == 6 ? arguments.array[2] : arguments.array[3], &mode_rule, &replace); - - if (F_status_is_error(*status)) { - *operation_if = fake_make_operation_if_type_false_always_next; - - return; - } + if (F_status_is_error(*status)) return; i = j == 6 ? 3 : 4; } - else if (*operation_if == fake_make_operation_if_type_if_group || *operation_if == fake_make_operation_if_type_if_not_group) { + else if (state_process->condition == fake_make_operation_if_type_if_group || state_process->condition == fake_make_operation_if_type_if_not_group) { gid_t id = 0; *status = fake_make_get_id_group(main, data_make->error, j == 6 ? arguments.array[1] : arguments.array[2], &id); - - if (F_status_is_error(*status)) { - *operation_if = fake_make_operation_if_type_false_always_next; - - return; - } + if (F_status_is_error(*status)) return; i = j == 6 ? 2 : 3; } - else if (*operation_if == fake_make_operation_if_type_if_is || *operation_if == fake_make_operation_if_type_if_not_is) { + else if (state_process->condition == fake_make_operation_if_type_if_is || state_process->condition == fake_make_operation_if_type_if_not_is) { // block = 0x1 (0000 0001) link = 0x10 (0001 0000) // character = 0x2 (0000 0010) regular = 0x20 (0010 0000) @@ -3061,21 +3016,15 @@ extern "C" { if (type_file & 0x80) { *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; return; } } - else if (*operation_if == fake_make_operation_if_type_if_owner || *operation_if == fake_make_operation_if_type_if_not_owner) { + else if (state_process->condition == fake_make_operation_if_type_if_owner || state_process->condition == fake_make_operation_if_type_if_not_owner) { uid_t id = 0; - *status = fake_make_get_id_owner(main, data_make->error, j == 6 ? arguments.array[1] : arguments.array[2], &id); - - if (F_status_is_error(*status)) { - *operation_if = fake_make_operation_if_type_false_always_next; - - return; - } + *status = fake_make_get_id_owner(main, data_make->error, arguments.array[1], &id); + if (F_status_is_error(*status)) return; i = j == 6 ? 2 : 3; } @@ -3088,19 +3037,16 @@ extern "C" { if (F_status_is_error(status_file)) { fake_print_message_section_operation_path_outside(main, data_make->error, F_status_set_fine(status_file), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string); - *operation_if = fake_make_operation_if_type_false_always_next; - if (F_status_is_error_not(*status)) { if (F_status_set_fine(status_file) == F_false) { *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; } else { *status = status_file; } } } - else if (*operation_if != fake_make_operation_if_type_if_exists && *operation_if != fake_make_operation_if_type_if_is) { + else if (state_process->condition != fake_make_operation_if_type_if_exists && state_process->condition != fake_make_operation_if_type_if_is) { // The existence tests do not need to happen here for *_if_exists and *_if_is as those two types will handle performing them during the process stage. status_file = f_file_exists(arguments.array[i].string); @@ -3112,26 +3058,19 @@ extern "C" { if (F_status_is_error(status_file)) { fll_error_file_print(data_make->error, F_status_set_fine(status_file), "f_file_exists", F_true, arguments.array[i].string, "find", fll_error_file_type_file); - *operation_if = fake_make_operation_if_type_false_always_next; - if (F_status_is_error_not(*status)) { *status = F_status_set_error(status_file); } } } } // for - - return; } } - else if (*operation_if == fake_make_operation_if_type_if_greater || *operation_if == fake_make_operation_if_type_if_greater_equal || *operation_if == fake_make_operation_if_type_if_less || *operation_if == fake_make_operation_if_type_if_less_equal) { + else if (state_process->condition == fake_make_operation_if_type_if_greater || state_process->condition == fake_make_operation_if_type_if_greater_equal || state_process->condition == fake_make_operation_if_type_if_less || state_process->condition == fake_make_operation_if_type_if_less_equal) { if (arguments.used < 3) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; return; } @@ -3169,7 +3108,6 @@ extern "C" { if (F_status_is_error(status_number)) { *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { flockfile(data_make->error.to.stream); @@ -3189,27 +3127,22 @@ extern "C" { } } } // for - - return; } } - } - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); + return; } + fake_print_error_requires_more_arguments(data_make); + *status = F_status_set_error(F_failure); - *operation_if = fake_make_operation_if_type_false_always_next; return; } - if (operation == fake_make_operation_type_link) { + if (state_process->operation == fake_make_operation_type_link) { if (arguments.used > 2) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SHas too many arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_too_many_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -3235,9 +3168,7 @@ extern "C" { } } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -3245,7 +3176,7 @@ extern "C" { return; } - if (operation == fake_make_operation_type_move) { + if (state_process->operation == fake_make_operation_type_move) { if (arguments.used > 1) { for (f_array_length_t i = 0; i < arguments.used; ++i) { @@ -3279,7 +3210,7 @@ extern "C" { if (arguments.used > 2) { - // the last file must be a directory. + // The last file must be a directory. f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); if (status_file == F_false || status_file == F_file_found_not) { @@ -3302,7 +3233,7 @@ extern "C" { } else { - // when the first file is a directory, then the second, if it exists, must also be a directory. + // When the first file is a directory, then the second, if it exists, must also be a directory. f_status_t status_file = f_directory_is(arguments.array[0].string); if (status_file == F_true) { @@ -3325,9 +3256,7 @@ extern "C" { } } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -3335,11 +3264,9 @@ extern "C" { return; } - if (operation == fake_make_operation_type_operate) { + if (state_process->operation == fake_make_operation_type_operate) { if (arguments.used > 1) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SHas too many arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_too_many_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -3383,9 +3310,7 @@ extern "C" { } } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -3393,7 +3318,7 @@ extern "C" { return; } - if (operation == fake_make_operation_type_parameter) { + if (state_process->operation == fake_make_operation_type_parameter) { if (arguments.used) { const f_string_t reserved_name[] = { fake_make_parameter_variable_build_s, @@ -3479,9 +3404,7 @@ extern "C" { } // for } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -3489,11 +3412,9 @@ extern "C" { return; } - if (operation == fake_make_operation_type_to) { + if (state_process->operation == fake_make_operation_type_to) { if (arguments.used > 1) { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SHas too many arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_too_many_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -3542,9 +3463,7 @@ extern "C" { } } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -3552,7 +3471,7 @@ extern "C" { return; } - if (operation == fake_make_operation_type_touch) { + if (state_process->operation == fake_make_operation_type_touch) { if (arguments.used > 1) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_file_s, arguments.array[0], fake_make_operation_argument_file_s_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_directory_s, arguments.array[0], fake_make_operation_argument_directory_s_length) == F_equal_to_not) { @@ -3585,9 +3504,7 @@ extern "C" { } // for } else { - if (data_make->error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { - fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); - } + fake_print_error_requires_more_arguments(data_make); *status = F_status_set_error(F_failure); } @@ -3596,6 +3513,7 @@ extern "C" { } // Note: there is nothing to validate for fake_make_operation_type_print. + return; } #endif // _di_fake_make_operate_validate_ diff --git a/level_3/fake/c/private-make-operate.h b/level_3/fake/c/private-make-operate.h index 425cae7..bd76356 100644 --- a/level_3/fake/c/private-make-operate.h +++ b/level_3/fake/c/private-make-operate.h @@ -40,7 +40,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param section_name * The section name. * @param operation @@ -66,7 +66,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param quoted * The quoted associated with the content. * @param range_name @@ -90,7 +90,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param quoted * The quoted associated with the content. * @param range_name @@ -114,7 +114,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param id_section * The array location id within the fakefile of the section to operate on. * @param section_stack @@ -142,17 +142,15 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param section_name * The section name. - * @param operation - * The operation type. * @param arguments * The expanded arguments. * @param success * Whether or not a previous section operation succeeded or failed. - * @param operation_if - * The if-condition status for the current operation. + * @param state_process + * The operation and if-condition states. * @param section_stack * The current operation stack. * @param status @@ -167,7 +165,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, fake_make_data_t * const data_make, const f_string_range_t section_name, const uint8_t operation, const f_string_dynamics_t arguments, const bool success, uint8_t *operation_if, 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, fake_make_data_t * const data_make, const f_string_range_t section_name, const f_string_dynamics_t arguments, const bool success, fake_state_process_t *state_process, f_array_lengths_t *section_stack, f_status_t *status) F_attribute_visibility_internal_d; #endif // _di_fake_make_operate_process_ /** @@ -176,7 +174,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param program * The program to be executed. * @param arguments @@ -204,7 +202,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param return_code * The return code to process. * @@ -232,7 +230,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param arguments * The arguments for the run or shell operation. * @param as_shell @@ -255,15 +253,14 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * @param section_name * The section name. - * @param operation - * The operation being performed. * @param arguments * The expanded arguments. - * @param operation_if - * The if-condition status for the current operation. + * @param state_process + * The operation and if-condition operation states. + * This condition will be updated by this as appropriate. * @param section_stack * The current operation stack. * @param status @@ -272,7 +269,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, fake_make_data_t * const data_make, const f_string_range_t section_name, const f_array_length_t operation, const f_string_dynamics_t arguments, uint8_t *operation_if, 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, fake_make_data_t * const data_make, const f_string_range_t section_name, const f_string_dynamics_t arguments, fake_state_process_t *state_process, f_array_lengths_t *section_stack, f_status_t *status) F_attribute_visibility_internal_d; #endif // _di_fake_make_operate_validate_ /** diff --git a/level_3/fake/c/private-make.h b/level_3/fake/c/private-make.h index 52e825b..2beac07 100644 --- a/level_3/fake/c/private-make.h +++ b/level_3/fake/c/private-make.h @@ -18,7 +18,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * The data_make.path_cache will be updated to reflect the full path to this file. * @param path * file path to get the real path of. @@ -109,7 +109,7 @@ extern "C" { * @param main * The main program data. * @param data_make - * All make related setting data, including data from the fakefile and optionally build settings file. + * All make related setting data, including data from the fakefile and the build settings file. * The relative path is stored in data_make.path_cache. * @param path * The NULL terminated path to get the relative path of. diff --git a/level_3/fake/c/private-print.c b/level_3/fake/c/private-print.c index c1e1942..a35ca2d 100644 --- a/level_3/fake/c/private-print.c +++ b/level_3/fake/c/private-print.c @@ -356,6 +356,26 @@ extern "C" { } #endif // _di_fake_print_error_parameter_too_many_ +#ifndef _di_fake_print_error_requires_more_arguments_ + void fake_print_error_requires_more_arguments(fake_make_data_t * const data_make) { + + if (data_make->error.verbosity == f_console_verbosity_quiet) return; + if (!data_make->error.to.stream) return; + + fll_print_format("%c%[%SRequires more arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); + } +#endif // _di_fake_print_error_requires_more_arguments_ + +#ifndef _di_fake_print_error_too_many_arguments_ + void fake_print_error_too_many_arguments(fake_make_data_t * const data_make) { + + if (data_make->error.verbosity == f_console_verbosity_quiet) return; + if (!data_make->error.to.stream) return; + + fll_print_format("%c%[%SHas too many arguments.%]%c", data_make->error.to.stream, f_string_eol_s[0], data_make->error.context, data_make->error.prefix, data_make->error.context, f_string_eol_s[0]); + } +#endif // _di_fake_print_error_too_many_arguments_ + #ifndef _di_fake_print_message_section_operation_failed_ void fake_print_message_section_operation_failed(fake_main_t * const main, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { diff --git a/level_3/fake/c/private-print.h b/level_3/fake/c/private-print.h index 379553c..81c96b4 100644 --- a/level_3/fake/c/private-print.h +++ b/level_3/fake/c/private-print.h @@ -39,6 +39,11 @@ extern "C" { * @return * F_true is returned if the status code has no print message. * F_false is returned on successful print of known errors. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_error_operation_file_ extern bool fake_print_error_build_operation_file(fake_main_t * const main, const f_status_t status, const f_string_t function, const f_string_t operation, const f_string_t source, const f_string_t destination, const f_string_t how, const bool fallback) F_attribute_visibility_internal_d; @@ -63,6 +68,11 @@ extern "C" { * @return * F_true is returned if the status code has no print message. * F_false is returned on successful print of known errors. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_error_fss_ extern bool fake_print_error_fss(fake_main_t * const main, const f_status_t status, const f_string_t function, const f_string_t path_file, const f_string_range_t range, const bool fallback) F_attribute_visibility_internal_d; @@ -75,6 +85,11 @@ extern "C" { * The main program data. * @param parameter * The parameter name. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_error_parameter_missing_value_ extern void fake_print_error_parameter_missing_value(fake_main_t * const main, const f_string_t parameter) F_attribute_visibility_internal_d; @@ -87,12 +102,41 @@ extern "C" { * The main program data. * @param parameter * The parameter name. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_error_parameter_too_many_ extern void fake_print_error_parameter_too_many(fake_main_t * const main, const f_string_t parameter) F_attribute_visibility_internal_d; #endif // _di_fake_print_error_parameter_too_many_ /** + * Print an error message for when there are more arguments are required (such as to a fakefile operation). + * + * @param data_make + * All make related setting data, including data from the fakefile and the build settings file. + * + * @see fll_print_format() + */ +#ifndef _di_fake_print_error_requires_more_arguments_ + extern void fake_print_error_requires_more_arguments(fake_make_data_t * const data_make) F_attribute_visibility_internal_d; +#endif // _di_fake_print_error_requires_more_arguments_ + +/** + * Print an error message for when there are too many arguments passed (such as to a fakefile operation). + * + * @param data_make + * All make related setting data, including data from the fakefile and the build settings file. + * + * @see fll_print_format() + */ +#ifndef _di_fake_print_error_too_many_arguments_ + extern void fake_print_error_too_many_arguments(fake_make_data_t * const data_make) F_attribute_visibility_internal_d; +#endif // _di_fake_print_error_too_many_arguments_ + +/** * Print error messages when processing some fakefile section, for a specific line and operation, and that operation failed. * * @param main @@ -105,6 +149,11 @@ extern "C" { * The range within the buffer representing the section name. * @param operation_name * The range within the buffer representing the operation name within the section. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_message_section_operation_failed_ extern void fake_print_message_section_operation_failed(fake_main_t * const main, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) F_attribute_visibility_internal_d; @@ -123,6 +172,12 @@ extern "C" { * The name of the function where the error happened. * @param path * The path that is outside of the project path. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() + * @see fll_error_file_print() */ #ifndef _di_fake_print_message_section_operation_path_outside_ extern void fake_print_message_section_operation_path_outside(fake_main_t * const main, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_t path) F_attribute_visibility_internal_d; @@ -142,6 +197,12 @@ extern "C" { * Set to 0 to disable. * @param path * The path to the directory. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() + * @see fll_error_file_print() */ #ifndef _di_fake_print_message_section_operation_path_stack_max_ extern void fake_print_message_section_operation_path_stack_max(fake_main_t * const main, fl_print_t error, const f_status_t status, const f_string_t function, const f_string_t path) F_attribute_visibility_internal_d; @@ -162,6 +223,11 @@ extern "C" { * The range within the buffer representing the operation name within the section. * @param stack_max * The max stack depth. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_message_section_operation_stack_max_ extern void fake_print_message_section_operation_stack_max(fake_main_t * const main, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max) F_attribute_visibility_internal_d; @@ -180,6 +246,11 @@ extern "C" { * The range within the buffer representing the section name. * @param operation_name * The range within the buffer representing the operation name within the section. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_message_section_operation_unknown_ extern void fake_print_message_section_operation_unknown(fake_main_t * const main, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) F_attribute_visibility_internal_d; @@ -192,6 +263,11 @@ extern "C" { * The main program data. * @param signal * The signal received. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_signal_received_ extern void fake_print_signal_received(fake_main_t * const main, const f_status_t signal) F_attribute_visibility_internal_d; @@ -210,6 +286,11 @@ extern "C" { * The range within the buffer representing the object. * @param settings_name * The name of the setting that has an invalid value. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_warning_settings_content_empty_ extern void fake_print_warning_settings_content_empty(fake_main_t * const main, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_t settings_name) F_attribute_visibility_internal_d; @@ -230,6 +311,11 @@ extern "C" { * The range within the buffer representing the content. * @param settings_name * The name of the setting that has an invalid value. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_warning_settings_content_invalid_ extern void fake_print_warning_settings_content_invalid(fake_main_t * const main, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_t settings_name) F_attribute_visibility_internal_d; @@ -246,6 +332,11 @@ extern "C" { * The buffer containing the loaded file content. * @param name_object * The name of the object. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_warning_settings_content_multiple_ extern void fake_print_warning_settings_content_multiple(fake_main_t * const main, const f_string_t path_file, const f_string_t name_object) F_attribute_visibility_internal_d; @@ -264,6 +355,11 @@ extern "C" { * A label describing what this object belongs to. * @param name_object * The name of the object. + * + * @see flockfile() + * @see funlockfile() + * + * @see fl_print_format() */ #ifndef _di_fake_print_warning_settings_object_multiple_ extern void fake_print_warning_settings_object_multiple(fake_main_t * const main, const f_string_t path_file, const f_string_t label, const f_string_t name_object) F_attribute_visibility_internal_d; diff --git a/level_3/fake/documents/fakefile.txt b/level_3/fake/documents/fakefile.txt index 4a350a5..da10b2c 100644 --- a/level_3/fake/documents/fakefile.txt +++ b/level_3/fake/documents/fakefile.txt @@ -75,6 +75,14 @@ Fakefile Documentation: This is processed top-down until the end of the list is reached. The following operations are available\: + - and\: + A special type of an "if" operation. + May only be specified following a valid "if", "and", or "or" operation. + This is executed only if the previous "if" operation result is true. + + When executed, this performs the test and returns true or false as appropriate. + When not executed, this passes through the result of the previous "if", "and", or "or" operation. + - build\: Run the fake build operation as if "fake build" was run instead of "fake make". Command line arguments are automatically passed to the fake build operation. @@ -313,6 +321,14 @@ Fakefile Documentation: Recursion is prohibited, a Section that is already on the operation stack may not be called again. Once the operation is off the stack, it can then be called again. + - or\: + A special type of an "if" operation. + May only be specified following a valid "if", "and", or "or" operation. + This is executed only if the previous "if" operation result is false. + + When executed, this performs the test and returns true or false as appropriate. + When not executed, this passes through the result of the previous "if", "and", or "or" operation. + - owner\: Change the owner role for a given file. @@ -323,7 +339,7 @@ Fakefile Documentation: Identical to owner operation, except this will recursively apply the mode to all files within the given file, if that file is a directory file path. - parameter\: - This represents an variable defined within the scope of the fakefile. + This represents a variable defined within the scope of the fakefile. This is not exported as an environment variable and is therefore not visible to any executed programs or scripts. This replaces the value of any existing parameter variable with this name. The reserved parameter variable names (see IKI vocabulary context section below) may not be changed by this. @@ -356,7 +372,6 @@ Fakefile Documentation: - shell\: Manually execute a remote program or script using a specific path to the program or script. This does not require the program to exist in PATH, but the path to the program or script must be relative to the project path. - @todo consider relaxing this restriction on the relativeness of the path, possibly adding a configurable setting to allow enabling/disabling this restriction. The first Content represents the program or script name. All Content after the first are passed to the program or script when running. diff --git a/level_3/fake/specifications/fakefile.txt b/level_3/fake/specifications/fakefile.txt index 1942eef..e0ec3da 100644 --- a/level_3/fake/specifications/fakefile.txt +++ b/level_3/fake/specifications/fakefile.txt @@ -38,6 +38,7 @@ Fakefile Specification: The build settings may also be specified in the Settings Section. The Section Operation Objects are\: + - and: One or more Content. First Content is the condition, remaining Content are specific to the condition. - break: Zero or One Content. If specified, First content must be one of "success" or "failure". - build: Zero or One Content. First Content represents file name of the settings file to use. - clean: Zero Content. @@ -59,6 +60,7 @@ Fakefile Specification: - modes: Two or more Content. First Content is the mode, remaining Content are paths to files. - move: Two or more Content representing paths to files. - operate: One Content. First Content is the name of a valid Section Object, except for the reserved Section Objects. + - or: One or more Content. First Content is the condition, remaining Content are specific to the condition. - owner: Two or more Content. First Content is group name or number, remaining Content are paths to files. - owners: Two or more Content. First Content is group name or number, remaining Content are paths to files. - parameter: First Content represents variable name (case-sensitive), remaining Content represents the value.