From: Kevin Day Date: Sun, 10 Jul 2022 02:52:07 +0000 (-0500) Subject: Refactor: "if defined" and "if not defined" to be easier to use in fake program. X-Git-Tag: 0.6.0~71 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=98d6c6ae3c44b707805498a0572cc846addb6c1e;p=fll Refactor: "if defined" and "if not defined" to be easier to use in fake program. Using "if not defined parameter work" can be confusing. Using "if not parameter work" is shorter and easier to understand. Using "if defined environment PATH" can be very confusing. Using "if define PATH" is shorter and a lot easier to understand. Break apart the "if defined" (and "if not defined") logic into two operations: 1) "if define" (and "if not define"). 2) "if parameter" (and "if not parameter"). This makes the behavior easier to understand as it directly maps to the "defined" and "parameter" settings. --- diff --git a/level_0/f_account/data/build/testfile b/level_0/f_account/data/build/testfile index f7637a6..4154996 100644 --- a/level_0/f_account/data/build/testfile +++ b/level_0/f_account/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_capability/data/build/testfile b/level_0/f_capability/data/build/testfile index 3279fc6..3d84ad4 100644 --- a/level_0/f_capability/data/build/testfile +++ b/level_0/f_capability/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_color/data/build/testfile b/level_0/f_color/data/build/testfile index cb3442f..db88650 100644 --- a/level_0/f_color/data/build/testfile +++ b/level_0/f_color/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_console/data/build/testfile b/level_0/f_console/data/build/testfile index 565b1f2..c1a5d6a 100644 --- a/level_0/f_console/data/build/testfile +++ b/level_0/f_console/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_control_group/data/build/testfile b/level_0/f_control_group/data/build/testfile index 2c81bfc..71ffb1f 100644 --- a/level_0/f_control_group/data/build/testfile +++ b/level_0/f_control_group/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_conversion/data/build/testfile b/level_0/f_conversion/data/build/testfile index d25247e..dad2f5c 100644 --- a/level_0/f_conversion/data/build/testfile +++ b/level_0/f_conversion/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_directory/data/build/testfile b/level_0/f_directory/data/build/testfile index 27a87ee..f7fae91 100644 --- a/level_0/f_directory/data/build/testfile +++ b/level_0/f_directory/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_environment/data/build/testfile b/level_0/f_environment/data/build/testfile index d0a87d4..41a761a 100644 --- a/level_0/f_environment/data/build/testfile +++ b/level_0/f_environment/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_execute/data/build/testfile b/level_0/f_execute/data/build/testfile index 2999b34..af6c94c 100644 --- a/level_0/f_execute/data/build/testfile +++ b/level_0/f_execute/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_file/data/build/testfile b/level_0/f_file/data/build/testfile index 43c9ef5..3d49e78 100644 --- a/level_0/f_file/data/build/testfile +++ b/level_0/f_file/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_fss/data/build/testfile b/level_0/f_fss/data/build/testfile index d835ae0..b3d5b0c 100644 --- a/level_0/f_fss/data/build/testfile +++ b/level_0/f_fss/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_iki/data/build/testfile b/level_0/f_iki/data/build/testfile index 98dc5b5..bd77b03 100644 --- a/level_0/f_iki/data/build/testfile +++ b/level_0/f_iki/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_limit/data/build/testfile b/level_0/f_limit/data/build/testfile index 9212a7d..c13283b 100644 --- a/level_0/f_limit/data/build/testfile +++ b/level_0/f_limit/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_memory/data/build/testfile b/level_0/f_memory/data/build/testfile index 8532ddb..11d0202 100644 --- a/level_0/f_memory/data/build/testfile +++ b/level_0/f_memory/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_path/data/build/testfile b/level_0/f_path/data/build/testfile index 62e280a..ca3728f 100644 --- a/level_0/f_path/data/build/testfile +++ b/level_0/f_path/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_pipe/data/build/testfile b/level_0/f_pipe/data/build/testfile index a17a9d8..15e7aef 100644 --- a/level_0/f_pipe/data/build/testfile +++ b/level_0/f_pipe/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_print/data/build/testfile b/level_0/f_print/data/build/testfile index 8e2e642..1918308 100644 --- a/level_0/f_print/data/build/testfile +++ b/level_0/f_print/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_serialize/data/build/testfile b/level_0/f_serialize/data/build/testfile index 9fe8fbe..af05552 100644 --- a/level_0/f_serialize/data/build/testfile +++ b/level_0/f_serialize/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_signal/data/build/testfile b/level_0/f_signal/data/build/testfile index 6e8fb3e..ae578b7 100644 --- a/level_0/f_signal/data/build/testfile +++ b/level_0/f_signal/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_socket/data/build/testfile b/level_0/f_socket/data/build/testfile index 3fa4b68..01a2485 100644 --- a/level_0/f_socket/data/build/testfile +++ b/level_0/f_socket/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_status/data/build/testfile b/level_0/f_status/data/build/testfile index 07ad85b..5002084 100644 --- a/level_0/f_status/data/build/testfile +++ b/level_0/f_status/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_status_string/data/build/testfile b/level_0/f_status_string/data/build/testfile index cba4a27..0f4645f 100644 --- a/level_0/f_status_string/data/build/testfile +++ b/level_0/f_status_string/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_string/data/build/testfile b/level_0/f_string/data/build/testfile index 0ccc599..3953fe8 100644 --- a/level_0/f_string/data/build/testfile +++ b/level_0/f_string/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_thread/data/build/testfile b/level_0/f_thread/data/build/testfile index 41ed15c..884276d 100644 --- a/level_0/f_thread/data/build/testfile +++ b/level_0/f_thread/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_type_array/data/build/testfile b/level_0/f_type_array/data/build/testfile index 5ed3fd7..fed675c 100644 --- a/level_0/f_type_array/data/build/testfile +++ b/level_0/f_type_array/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_0/f_utf/data/build/testfile b/level_0/f_utf/data/build/testfile index 8c6f081..cd99cd4 100644 --- a/level_0/f_utf/data/build/testfile +++ b/level_0/f_utf/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_2/fll_status_string/data/build/testfile b/level_2/fll_status_string/data/build/testfile index 5358665..4226880 100644 --- a/level_2/fll_status_string/data/build/testfile +++ b/level_2/fll_status_string/data/build/testfile @@ -39,16 +39,16 @@ not_created: exit failure ld_library_path: - if defined environment PATH LD_LIBRARY_PATH - and defined parameter work + if define LD_LIBRARY_PATH + and parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' else - if defined environment PATH LD_LIBRARY_PATH + if define LD_LIBRARY_PATH define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' else - if defined parameter work + if parameter work define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' else diff --git a/level_3/fake/c/private-common.c b/level_3/fake/c/private-common.c index 47fc0a4..ee30456 100644 --- a/level_3/fake/c/private-common.c +++ b/level_3/fake/c/private-common.c @@ -225,7 +225,7 @@ extern "C" { const f_string_static_t fake_make_operation_argument_target_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_target_s, 0, FAKE_make_operation_argument_target_s_length); const f_string_static_t fake_make_operation_argument_warn_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_warn_s, 0, FAKE_make_operation_argument_warn_s_length); - const f_string_static_t fake_make_operation_argument_if_defined_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_if_defined_s, 0, FAKE_make_operation_argument_if_defined_s_length); + const f_string_static_t fake_make_operation_argument_if_define_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_if_define_s, 0, FAKE_make_operation_argument_if_define_s_length); const f_string_static_t fake_make_operation_argument_if_equal_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_if_equal_s, 0, FAKE_make_operation_argument_if_equal_s_length); const f_string_static_t fake_make_operation_argument_if_equal_not_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_if_equal_not_s, 0, FAKE_make_operation_argument_if_equal_not_s_length); const f_string_static_t fake_make_operation_argument_if_exists_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_if_exists_s, 0, FAKE_make_operation_argument_if_exists_s_length); @@ -240,6 +240,7 @@ extern "C" { const f_string_static_t fake_make_operation_argument_if_mode_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_if_mode_s, 0, FAKE_make_operation_argument_if_mode_s_length); const f_string_static_t fake_make_operation_argument_if_not_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_if_not_s, 0, FAKE_make_operation_argument_if_not_s_length); const f_string_static_t fake_make_operation_argument_if_owner_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_if_owner_s, 0, FAKE_make_operation_argument_if_owner_s_length); + const f_string_static_t fake_make_operation_argument_if_parameter_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_if_parameter_s, 0, FAKE_make_operation_argument_if_parameter_s_length); const f_string_static_t fake_make_operation_argument_if_success_s = macro_f_string_static_t_initialize(FAKE_make_operation_argument_if_success_s, 0, FAKE_make_operation_argument_if_success_s_length); #endif // _di_fake_make_operation_ diff --git a/level_3/fake/c/private-common.h b/level_3/fake/c/private-common.h index 4610343..0b5191b 100644 --- a/level_3/fake/c/private-common.h +++ b/level_3/fake/c/private-common.h @@ -1370,7 +1370,7 @@ extern "C" { extern const f_string_static_t fake_make_operation_argument_target_s; extern const f_string_static_t fake_make_operation_argument_warn_s; - #define FAKE_make_operation_argument_if_defined_s "defined" + #define FAKE_make_operation_argument_if_define_s "define" #define FAKE_make_operation_argument_if_equal_s "==" #define FAKE_make_operation_argument_if_equal_not_s "<>" #define FAKE_make_operation_argument_if_exists_s "exists" @@ -1385,9 +1385,10 @@ extern "C" { #define FAKE_make_operation_argument_if_mode_s "mode" #define FAKE_make_operation_argument_if_not_s "not" #define FAKE_make_operation_argument_if_owner_s "owner" + #define FAKE_make_operation_argument_if_parameter_s "parameter" #define FAKE_make_operation_argument_if_success_s "success" - #define FAKE_make_operation_argument_if_defined_s_length 7 + #define FAKE_make_operation_argument_if_define_s_length 6 #define FAKE_make_operation_argument_if_equal_s_length 2 #define FAKE_make_operation_argument_if_equal_not_s_length 2 #define FAKE_make_operation_argument_if_exists_s_length 6 @@ -1402,9 +1403,10 @@ extern "C" { #define FAKE_make_operation_argument_if_mode_s_length 4 #define FAKE_make_operation_argument_if_not_s_length 3 #define FAKE_make_operation_argument_if_owner_s_length 5 + #define FAKE_make_operation_argument_if_parameter_s_length 9 #define FAKE_make_operation_argument_if_success_s_length 7 - extern const f_string_static_t fake_make_operation_argument_if_defined_s; + extern const f_string_static_t fake_make_operation_argument_if_define_s; extern const f_string_static_t fake_make_operation_argument_if_equal_s; extern const f_string_static_t fake_make_operation_argument_if_equal_not_s; extern const f_string_static_t fake_make_operation_argument_if_exists_s; @@ -1419,12 +1421,13 @@ extern "C" { extern const f_string_static_t fake_make_operation_argument_if_mode_s; extern const f_string_static_t fake_make_operation_argument_if_not_s; extern const f_string_static_t fake_make_operation_argument_if_owner_s; + extern const f_string_static_t fake_make_operation_argument_if_parameter_s; extern const f_string_static_t fake_make_operation_argument_if_success_s; enum { fake_make_operation_if_type_else_e = 1, fake_make_operation_if_type_if_e, - fake_make_operation_if_type_if_defined_e, + fake_make_operation_if_type_if_define_e, fake_make_operation_if_type_if_equal_e, fake_make_operation_if_type_if_equal_not_e, fake_make_operation_if_type_if_exists_e, @@ -1437,12 +1440,14 @@ extern "C" { fake_make_operation_if_type_if_less_equal_e, fake_make_operation_if_type_if_mode_e, fake_make_operation_if_type_if_not_e, - fake_make_operation_if_type_if_not_defined_e, + fake_make_operation_if_type_if_not_define_e, fake_make_operation_if_type_if_not_exists_e, fake_make_operation_if_type_if_not_group_e, fake_make_operation_if_type_if_not_is_e, fake_make_operation_if_type_if_not_mode_e, fake_make_operation_if_type_if_not_owner_e, + fake_make_operation_if_type_if_not_parameter_e, + fake_make_operation_if_type_if_parameter_e, fake_make_operation_if_type_if_owner_e, fake_make_operation_if_type_if_success_e, }; diff --git a/level_3/fake/c/private-make-load_fakefile.c b/level_3/fake/c/private-make-load_fakefile.c index 632f7c1..4ae12b3 100644 --- a/level_3/fake/c/private-make-load_fakefile.c +++ b/level_3/fake/c/private-make-load_fakefile.c @@ -384,7 +384,6 @@ extern "C" { fake_make_setting_parameter_s, }; - f_string_map_multis_t *settings_value[] = { &define, &data_make->setting_make.parameter, diff --git a/level_3/fake/c/private-make-operate_process.c b/level_3/fake/c/private-make-operate_process.c index 91da8ad..c00f8cc 100644 --- a/level_3/fake/c/private-make-operate_process.c +++ b/level_3/fake/c/private-make-operate_process.c @@ -193,39 +193,8 @@ extern "C" { } if (state_process->operation == fake_make_operation_type_if_e || state_process->operation == fake_make_operation_type_and_e || state_process->operation == fake_make_operation_type_or_e) { - if (state_process->condition == fake_make_operation_if_type_if_success_e) { - if (state_process->success) { - state_process->condition_result = fake_condition_result_true_e; - } - else { - state_process->condition_result = fake_condition_result_false_e; - } - } - else if (state_process->condition == fake_make_operation_if_type_if_defined_e) { - fake_make_operate_process_type_if_defined(data_make, arguments, F_false, state_process); - } - else if (state_process->condition == fake_make_operation_if_type_if_exists_e) { - *status = fake_make_operate_process_type_if_exists(data_make, arguments, F_false, state_process); - } - else if (state_process->condition == fake_make_operation_if_type_if_failure_e) { - if (state_process->success) { - state_process->condition_result = fake_condition_result_false_e; - } - else { - state_process->condition_result = fake_condition_result_true_e; - } - } - else if (state_process->condition == fake_make_operation_if_type_if_group_e) { - *status = fake_make_operate_process_type_if_group(data_make, arguments, F_false, state_process); - } - else if (state_process->condition == fake_make_operation_if_type_if_is_e) { - *status = fake_make_operate_process_type_if_is(data_make, arguments, F_false, state_process); - } - else if (state_process->condition == fake_make_operation_if_type_if_mode_e) { - *status = fake_make_operate_process_type_if_mode(data_make, arguments, F_false, state_process); - } - else if (state_process->condition == fake_make_operation_if_type_if_not_defined_e) { - fake_make_operate_process_type_if_defined(data_make, arguments, F_true, state_process); + if (state_process->condition == fake_make_operation_if_type_if_define_e) { + fake_make_operate_process_type_if_define(data_make, arguments, F_false, state_process); } else if (state_process->condition == fake_make_operation_if_type_if_equal_e) { state_process->condition_result = fake_condition_result_true_e; @@ -258,9 +227,35 @@ extern "C" { } // for } // for } + else if (state_process->condition == fake_make_operation_if_type_if_exists_e) { + *status = fake_make_operate_process_type_if_exists(data_make, arguments, F_false, state_process); + } + else if (state_process->condition == fake_make_operation_if_type_if_failure_e) { + if (state_process->success) { + state_process->condition_result = fake_condition_result_false_e; + } + else { + state_process->condition_result = fake_condition_result_true_e; + } + } else if (state_process->condition == fake_make_operation_if_type_if_greater_e || state_process->condition == fake_make_operation_if_type_if_greater_equal_e || state_process->condition == fake_make_operation_if_type_if_less_e || state_process->condition == fake_make_operation_if_type_if_less_equal_e) { *status = fake_make_operate_process_type_if_greater_if_lesser(data_make, arguments, state_process); } + else if (state_process->condition == fake_make_operation_if_type_if_group_e) { + *status = fake_make_operate_process_type_if_group(data_make, arguments, F_false, state_process); + } + else if (state_process->condition == fake_make_operation_if_type_if_is_e) { + *status = fake_make_operate_process_type_if_is(data_make, arguments, F_false, state_process); + } + else if (state_process->condition == fake_make_operation_if_type_if_mode_e) { + *status = fake_make_operate_process_type_if_mode(data_make, arguments, F_false, state_process); + } + else if (state_process->condition == fake_make_operation_if_type_if_not_define_e) { + fake_make_operate_process_type_if_define(data_make, arguments, F_true, state_process); + } + else if (state_process->condition == fake_make_operation_if_type_if_not_parameter_e) { + fake_make_operate_process_type_if_parameter(data_make, arguments, F_true, state_process); + } else if (state_process->condition == fake_make_operation_if_type_if_not_exists_e) { *status = fake_make_operate_process_type_if_exists(data_make, arguments, F_true, state_process); } @@ -279,6 +274,17 @@ extern "C" { else if (state_process->condition == fake_make_operation_if_type_if_owner_e) { *status = fake_make_operate_process_type_if_owner(data_make, arguments, F_false, state_process); } + else if (state_process->condition == fake_make_operation_if_type_if_parameter_e) { + fake_make_operate_process_type_if_parameter(data_make, arguments, F_false, state_process); + } + else if (state_process->condition == fake_make_operation_if_type_if_success_e) { + if (state_process->success) { + state_process->condition_result = fake_condition_result_true_e; + } + else { + state_process->condition_result = fake_condition_result_false_e; + } + } if (state_process->block) { if (state_process->operation == fake_make_operation_type_and_e) { diff --git a/level_3/fake/c/private-make-operate_process_type.c b/level_3/fake/c/private-make-operate_process_type.c index 09f3005..16a8589 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -325,165 +325,34 @@ 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_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]; - - const f_string_static_t reserved_name[] = { - fake_make_parameter_variable_build_s, - fake_make_parameter_variable_color_s, - fake_make_parameter_variable_data_s, - fake_make_parameter_variable_define_s, - fake_make_parameter_variable_fakefile_s, - fake_make_parameter_variable_mode_s, - fake_make_parameter_variable_process_s, - fake_make_parameter_variable_settings_s, - fake_make_parameter_variable_sources_s, - fake_make_parameter_variable_verbosity_s, - fake_make_parameter_variable_work_s, - fake_make_parameter_variable_option_build_s, - fake_make_parameter_variable_option_color_s, - fake_make_parameter_variable_option_data_s, - fake_make_parameter_variable_option_define_s, - fake_make_parameter_variable_option_fakefile_s, - fake_make_parameter_variable_option_mode_s, - fake_make_parameter_variable_option_process_s, - fake_make_parameter_variable_option_settings_s, - fake_make_parameter_variable_option_sources_s, - fake_make_parameter_variable_option_verbosity_s, - fake_make_parameter_variable_option_work_s, - fake_make_parameter_variable_value_build_s, - fake_make_parameter_variable_value_color_s, - fake_make_parameter_variable_value_data_s, - fake_make_parameter_variable_value_define_s, - fake_make_parameter_variable_value_fakefile_s, - fake_make_parameter_variable_value_mode_s, - fake_make_parameter_variable_value_process_s, - fake_make_parameter_variable_value_settings_s, - fake_make_parameter_variable_value_sources_s, - fake_make_parameter_variable_value_verbosity_s, - fake_make_parameter_variable_value_work_s, - }; - - const bool reserved_defined[] = { - data_make->data->path_build.used, - F_true, - data_make->data->path_data.used, - data_make->data->define.used, - data_make->data->fakefile.used, - data_make->data->mode.used, - data_make->data->process.used, - data_make->data->settings.used, - data_make->data->path_sources.used, - F_true, - data_make->data->path_work.used, - data_make->main->parameters.array[fake_parameter_path_build_e].result == f_console_result_additional_e, - data_make->main->parameters.array[fake_parameter_light_e].result == f_console_result_found_e || data_make->main->parameters.array[fake_parameter_dark_e].result == f_console_result_found_e || data_make->main->parameters.array[fake_parameter_no_color_e].result == f_console_result_found_e, - data_make->main->parameters.array[fake_parameter_path_data_e].result == f_console_result_additional_e, - data_make->main->parameters.array[fake_parameter_define_e].result == f_console_result_additional_e, - data_make->main->parameters.array[fake_parameter_fakefile_e].result == f_console_result_additional_e, - data_make->main->parameters.array[fake_parameter_mode_e].result == f_console_result_additional_e, - data_make->main->parameters.array[fake_parameter_process_e].result == f_console_result_additional_e, - data_make->main->parameters.array[fake_parameter_settings_e].result == f_console_result_additional_e, - data_make->main->parameters.array[fake_parameter_path_sources_e].result == f_console_result_additional_e, - data_make->main->parameters.array[fake_parameter_verbosity_quiet_e].result == f_console_result_found_e || data_make->main->parameters.array[fake_parameter_verbosity_normal_e].result == f_console_result_found_e || data_make->main->parameters.array[fake_parameter_verbosity_verbose_e].result == f_console_result_found_e || data_make->main->parameters.array[fake_parameter_verbosity_debug_e].result == f_console_result_found_e, - data_make->main->parameters.array[fake_parameter_path_work_e].result == f_console_result_additional_e, - data_make->parameter_value.build.used, - data_make->parameter_value.color.used, - data_make->parameter_value.data.used, - data_make->parameter_value.define.used, - data_make->parameter_value.fakefile.used, - data_make->parameter_value.mode.used, - data_make->parameter_value.process.used, - data_make->parameter_value.settings.used, - data_make->parameter_value.sources.used, - data_make->parameter_value.verbosity.used, - data_make->parameter_value.work.used, - }; - - if (fl_string_dynamic_compare(fake_make_operation_argument_environment_s, argument) == F_equal_to) { - state_process->condition_result = fake_condition_result_true_e; - - if (if_not) { - for (f_array_length_t i = 3; i < arguments.used; ++i) { - - if (f_environment_exists(arguments.array[i]) == F_true) { - state_process->condition_result = fake_condition_result_false_e; - - break; - } - } // for - } - else { - for (f_array_length_t i = 2; i < arguments.used; ++i) { - - if (f_environment_exists(arguments.array[i]) != F_true) { - state_process->condition_result = fake_condition_result_false_e; - - break; - } - } // for - } - - return; - } - - f_array_length_t i = if_not ? 3 : 2; - f_array_length_t j = 0; - - // 0 = unknown, 1 = fail, 2 = pass. - uint8_t result = 0; +#ifndef _di_fake_make_operate_process_type_if_define_ + void fake_make_operate_process_type_if_define(fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) { state_process->condition_result = fake_condition_result_true_e; // Multiple properties may pass and so if any of them fail, then they all fail. - for (; i < arguments.used; ++i) { - - for (j = 0; j < 33; ++j) { + if (if_not) { + for (f_array_length_t i = 2; i < arguments.used; ++i) { - if (fl_string_dynamic_compare(reserved_name[j], arguments.array[i]) == F_equal_to) { - result = reserved_defined[j] ? 2 : 1; + if (f_environment_exists(arguments.array[i]) == F_true) { + state_process->condition_result = fake_condition_result_false_e; break; } } // for + } + else { + for (f_array_length_t i = 1; i < arguments.used; ++i) { - if (!result) { - for (j = 0; j < data_make->setting_make.parameter.used; ++j) { - - if (fl_string_dynamic_compare(arguments.array[i], data_make->setting_make.parameter.array[j].name) == F_equal_to) { - result = 2; - - break; - } - } // for - } - - if (result < 2) { - result = 1; - - break; - } - - if (i + 1 < arguments.used) { - result = 0; - } - } // for + if (f_environment_exists(arguments.array[i]) != F_true) { + state_process->condition_result = fake_condition_result_false_e; - if (if_not) { - if (result < 2) { - state_process->condition_result = fake_condition_result_true_e; - } - else { - state_process->condition_result = fake_condition_result_false_e; - } - } - else if (result < 2) { - state_process->condition_result = fake_condition_result_false_e; + break; + } + } // for } } -#endif // _di_fake_make_operate_process_type_if_defined_ +#endif // _di_fake_make_operate_process_type_if_define_ #ifndef _di_fake_make_operate_process_type_if_exists_ f_status_t fake_make_operate_process_type_if_exists(fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool if_not, fake_state_process_t *state_process) { @@ -992,6 +861,138 @@ extern "C" { } #endif // _di_fake_make_operate_process_type_if_owner_ +#ifndef _di_fake_make_operate_process_type_if_parameter_ + void fake_make_operate_process_type_if_parameter(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 reserved_name[] = { + fake_make_parameter_variable_build_s, + fake_make_parameter_variable_color_s, + fake_make_parameter_variable_data_s, + fake_make_parameter_variable_define_s, + fake_make_parameter_variable_fakefile_s, + fake_make_parameter_variable_mode_s, + fake_make_parameter_variable_process_s, + fake_make_parameter_variable_settings_s, + fake_make_parameter_variable_sources_s, + fake_make_parameter_variable_verbosity_s, + fake_make_parameter_variable_work_s, + fake_make_parameter_variable_option_build_s, + fake_make_parameter_variable_option_color_s, + fake_make_parameter_variable_option_data_s, + fake_make_parameter_variable_option_define_s, + fake_make_parameter_variable_option_fakefile_s, + fake_make_parameter_variable_option_mode_s, + fake_make_parameter_variable_option_process_s, + fake_make_parameter_variable_option_settings_s, + fake_make_parameter_variable_option_sources_s, + fake_make_parameter_variable_option_verbosity_s, + fake_make_parameter_variable_option_work_s, + fake_make_parameter_variable_value_build_s, + fake_make_parameter_variable_value_color_s, + fake_make_parameter_variable_value_data_s, + fake_make_parameter_variable_value_define_s, + fake_make_parameter_variable_value_fakefile_s, + fake_make_parameter_variable_value_mode_s, + fake_make_parameter_variable_value_process_s, + fake_make_parameter_variable_value_settings_s, + fake_make_parameter_variable_value_sources_s, + fake_make_parameter_variable_value_verbosity_s, + fake_make_parameter_variable_value_work_s, + }; + + const bool reserved_parameter[] = { + data_make->data->path_build.used, + F_true, + data_make->data->path_data.used, + data_make->data->define.used, + data_make->data->fakefile.used, + data_make->data->mode.used, + data_make->data->process.used, + data_make->data->settings.used, + data_make->data->path_sources.used, + F_true, + data_make->data->path_work.used, + data_make->main->parameters.array[fake_parameter_path_build_e].result == f_console_result_additional_e, + data_make->main->parameters.array[fake_parameter_light_e].result == f_console_result_found_e || data_make->main->parameters.array[fake_parameter_dark_e].result == f_console_result_found_e || data_make->main->parameters.array[fake_parameter_no_color_e].result == f_console_result_found_e, + data_make->main->parameters.array[fake_parameter_path_data_e].result == f_console_result_additional_e, + data_make->main->parameters.array[fake_parameter_define_e].result == f_console_result_additional_e, + data_make->main->parameters.array[fake_parameter_fakefile_e].result == f_console_result_additional_e, + data_make->main->parameters.array[fake_parameter_mode_e].result == f_console_result_additional_e, + data_make->main->parameters.array[fake_parameter_process_e].result == f_console_result_additional_e, + data_make->main->parameters.array[fake_parameter_settings_e].result == f_console_result_additional_e, + data_make->main->parameters.array[fake_parameter_path_sources_e].result == f_console_result_additional_e, + data_make->main->parameters.array[fake_parameter_verbosity_quiet_e].result == f_console_result_found_e || data_make->main->parameters.array[fake_parameter_verbosity_normal_e].result == f_console_result_found_e || data_make->main->parameters.array[fake_parameter_verbosity_verbose_e].result == f_console_result_found_e || data_make->main->parameters.array[fake_parameter_verbosity_debug_e].result == f_console_result_found_e, + data_make->main->parameters.array[fake_parameter_path_work_e].result == f_console_result_additional_e, + data_make->parameter_value.build.used, + data_make->parameter_value.color.used, + data_make->parameter_value.data.used, + data_make->parameter_value.define.used, + data_make->parameter_value.fakefile.used, + data_make->parameter_value.mode.used, + data_make->parameter_value.process.used, + data_make->parameter_value.settings.used, + data_make->parameter_value.sources.used, + data_make->parameter_value.verbosity.used, + data_make->parameter_value.work.used, + }; + + f_array_length_t i = if_not ? 2 : 1; + f_array_length_t j = 0; + + // 0 = unknown, 1 = fail, 2 = pass. + uint8_t result = 0; + + state_process->condition_result = fake_condition_result_true_e; + + // Multiple properties may pass and so if any of them fail, then they all fail. + for (; i < arguments.used && !result; ++i) { + + for (j = 0; j < 33; ++j) { + + if (fl_string_dynamic_compare(reserved_name[j], arguments.array[i]) == F_equal_to) { + result = reserved_parameter[j] ? 2 : 1; + + break; + } + } // for + + if (!result) { + for (j = 0; j < data_make->setting_make.parameter.used; ++j) { + + if (fl_string_dynamic_compare(arguments.array[i], data_make->setting_make.parameter.array[j].name) == F_equal_to) { + result = 2; + + break; + } + } // for + + if (j == data_make->setting_make.parameter.used) { + result = 1; + } + } + + if (result == 2 && i + 1 < arguments.used) { + result = 0; + } + } // for + + if (if_not) { + if (result == 2) { + state_process->condition_result = fake_condition_result_false_e; + } + else { + state_process->condition_result = fake_condition_result_true_e; + } + } + else if (result == 2) { + state_process->condition_result = fake_condition_result_true_e; + } + else { + state_process->condition_result = fake_condition_result_false_e; + } + } +#endif // _di_fake_make_operate_process_type_if_parameter_ + #ifndef _di_fake_make_operate_process_type_modes_ f_status_t fake_make_operate_process_type_modes(fake_make_data_t * const data_make, const f_string_dynamics_t arguments, const bool all) { diff --git a/level_3/fake/c/private-make-operate_process_type.h b/level_3/fake/c/private-make-operate_process_type.h index f766dda..b1161fc 100644 --- a/level_3/fake/c/private-make-operate_process_type.h +++ b/level_3/fake/c/private-make-operate_process_type.h @@ -113,7 +113,7 @@ extern "C" { #endif // _di_fake_make_operate_process_type_groups_ /** - * Perform the if defined operation process. + * Perform the if define operation process. * * @param data_make * All make related setting data, including data from the fakefile and the build settings file. @@ -125,9 +125,9 @@ extern "C" { * @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_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_ +#ifndef _di_fake_make_operate_process_type_if_define_ + extern void fake_make_operate_process_type_if_define(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_define_ /** * Perform the if exists operation process. @@ -285,6 +285,23 @@ extern "C" { #endif // _di_fake_make_operate_process_type_if_owner_ /** + * Perform the if parameter operation process. + * + * @param data_make + * 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 state_process + * The operation process state. + */ +#ifndef _di_fake_make_operate_process_type_if_parameter_ + extern void fake_make_operate_process_type_if_parameter(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_parameter_ + +/** * Perform the mode and modes operation processes. * * @param data_make diff --git a/level_3/fake/c/private-make-operate_validate.c b/level_3/fake/c/private-make-operate_validate.c index f52ecba..55230ca 100644 --- a/level_3/fake/c/private-make-operate_validate.c +++ b/level_3/fake/c/private-make-operate_validate.c @@ -615,7 +615,7 @@ extern "C" { if (arguments.used) { const f_string_static_t if_type_strings[] = { - fake_make_operation_argument_if_defined_s, + fake_make_operation_argument_if_define_s, fake_make_operation_argument_if_equal_s, fake_make_operation_argument_if_equal_not_s, fake_make_operation_argument_if_exists_s, @@ -628,18 +628,20 @@ 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_define_s, // If not define, represented by just "define". + 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_parameter_s, // If not parameter, represented by just "parameter". fake_make_operation_argument_if_owner_s, + fake_make_operation_argument_if_parameter_s, fake_make_operation_argument_if_success_s, }; const uint8_t if_type_codes[] = { - fake_make_operation_if_type_if_defined_e, + fake_make_operation_if_type_if_define_e, fake_make_operation_if_type_if_equal_e, fake_make_operation_if_type_if_equal_not_e, fake_make_operation_if_type_if_exists_e, @@ -652,32 +654,36 @@ extern "C" { fake_make_operation_if_type_if_less_equal_e, fake_make_operation_if_type_if_mode_e, fake_make_operation_if_type_if_not_e, - fake_make_operation_if_type_if_not_defined_e, + fake_make_operation_if_type_if_not_define_e, fake_make_operation_if_type_if_not_exists_e, fake_make_operation_if_type_if_not_group_e, fake_make_operation_if_type_if_not_is_e, fake_make_operation_if_type_if_not_mode_e, fake_make_operation_if_type_if_not_owner_e, + fake_make_operation_if_type_if_not_parameter_e, fake_make_operation_if_type_if_owner_e, + fake_make_operation_if_type_if_parameter_e, fake_make_operation_if_type_if_success_e, }; const f_string_static_t if_not_type_strings[] = { - fake_make_operation_argument_if_defined_s, + fake_make_operation_argument_if_define_s, fake_make_operation_argument_if_exists_s, fake_make_operation_argument_if_group_s, fake_make_operation_argument_if_is_s, fake_make_operation_argument_if_mode_s, fake_make_operation_argument_if_owner_s, + fake_make_operation_argument_if_parameter_s, }; const uint8_t if_not_type_codes[] = { - fake_make_operation_if_type_if_not_defined_e, + fake_make_operation_if_type_if_not_define_e, fake_make_operation_if_type_if_not_exists_e, fake_make_operation_if_type_if_not_group_e, fake_make_operation_if_type_if_not_is_e, fake_make_operation_if_type_if_not_mode_e, fake_make_operation_if_type_if_not_owner_e, + fake_make_operation_if_type_if_not_parameter_e, }; f_array_length_t i = 0; @@ -702,7 +708,7 @@ extern "C" { } const uint8_t if_type_minimum[] = { - dereference ? 3 : 4, // If defined. + dereference ? 3 : 4, // If define. dereference ? 2 : 3, // If equal (==). dereference ? 2 : 3, // If equal not (<>). dereference ? 2 : 3, // If exists. @@ -715,29 +721,32 @@ extern "C" { dereference ? 2 : 3, // If less equal (<=). dereference ? 4 : 5, // If mode. dereference ? 3 : 4, // If not. - dereference ? 5 : 6, // If not defined. + dereference ? 5 : 6, // If not define. dereference ? 3 : 4, // If not exists. dereference ? 4 : 5, // If not group. dereference ? 4 : 5, // If not is. dereference ? 5 : 6, // If not mode. dereference ? 4 : 5, // If not owner. + dereference ? 5 : 6, // If not parameter. + dereference ? 3 : 4, // If parameter. dereference ? 3 : 4, // If owner. dereference ? 1 : 2, // If success. }; const uint8_t if_not_type_minimum[] = { - dereference ? 4 : 5, // If not defined. + dereference ? 4 : 5, // If not define. dereference ? 3 : 4, // If not exists. dereference ? 4 : 5, // If not group. dereference ? 4 : 5, // If not is. dereference ? 5 : 6, // If not mode. dereference ? 4 : 5, // If not owner. + dereference ? 4 : 5, // If not parameter. }; - for (; i < 21; ++i) { + for (; i < 23; ++i) { // Skip the "if not XXX" types as they are determined later on. - if (i > 12 && i < 19) continue; + if (i > 12 && i < 21) continue; if (fl_string_dynamic_compare(if_type_strings[i], arguments.array[k]) == F_equal_to) { state_process->condition = if_type_codes[i]; @@ -746,7 +755,7 @@ extern "C" { } } // for - if (i == 21) { + if (i == 23) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); @@ -778,7 +787,7 @@ extern "C" { return; } - for (; j < 6; ++j) { + for (; j < 7; ++j) { if (fl_string_dynamic_compare(if_not_type_strings[j], arguments.array[k]) == F_equal_to) { state_process->condition = if_not_type_codes[j]; @@ -787,7 +796,7 @@ extern "C" { } } // for - if (j == 6) { + if (j == 7) { if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); @@ -806,10 +815,10 @@ extern "C" { } } else { - j = 6; + j = 7; } - if (j == 6 && arguments.used >= if_type_minimum[i] || arguments.used >= if_not_type_minimum[j]) { + if (j == 7 && arguments.used >= if_type_minimum[i] || arguments.used >= if_not_type_minimum[j]) { if (state_process->condition == fake_make_operation_if_type_if_success_e || state_process->condition == fake_make_operation_if_type_if_failure_e) { // The success and failure operations minimum is also the maximum. @@ -822,26 +831,6 @@ extern "C" { return; } - if (state_process->condition == fake_make_operation_if_type_if_defined_e || state_process->condition == fake_make_operation_if_type_if_not_defined_e) { - if (fl_string_dynamic_compare(fake_make_operation_argument_environment_s, arguments.array[k]) == F_equal_to_not) { - if (fl_string_dynamic_compare(fake_make_operation_argument_parameter_s, arguments.array[k]) == F_equal_to_not) { - if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { - flockfile(data_make->error.to.stream); - - fl_print_format("%r%[%QUnsupported define type '%]", data_make->error.to.stream, f_string_eol_s, 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, arguments.array[k], data_make->error.notable); - fl_print_format("%['.%]%r", data_make->error.to.stream, data_make->error.context, data_make->error.context, f_string_eol_s); - - funlockfile(data_make->error.to.stream); - } - - *status = F_status_set_error(F_failure); - } - } - - return; - } - if (state_process->condition == fake_make_operation_if_type_if_equal_e || state_process->condition == fake_make_operation_if_type_if_equal_not_e) { if (arguments.used < 2 + k) { fake_print_error_requires_more_arguments(data_make); @@ -857,7 +846,6 @@ extern "C" { } if (state_process->condition == fake_make_operation_if_type_if_group_e || state_process->condition == fake_make_operation_if_type_if_is_e || state_process->condition == fake_make_operation_if_type_if_mode_e || state_process->condition > fake_make_operation_if_type_if_not_exists_e && state_process->condition < fake_make_operation_if_type_if_success_e) { - if (state_process->condition == fake_make_operation_if_type_if_mode_e || state_process->condition == fake_make_operation_if_type_if_not_mode_e) { if (fl_string_dynamic_compare(fake_make_operation_argument_is_s, arguments.array[k]) == F_equal_to_not) { if (fl_string_dynamic_compare(fake_make_operation_argument_has_s, arguments.array[k]) == F_equal_to_not) { diff --git a/level_3/fake/data/build/fakefile-example-linux_using_make b/level_3/fake/data/build/fakefile-example-linux_using_make index 76ca62a..f5cc9cb 100644 --- a/level_3/fake/data/build/fakefile-example-linux_using_make +++ b/level_3/fake/data/build/fakefile-example-linux_using_make @@ -14,10 +14,10 @@ settings: load_build no fail exit - # add any desired environment variables here to expose to the run/shell environment. + # Add any desired environment variables here to expose to the run/shell environment. environment PATH - # config can be set to any valid config option, such as: menuconfig, nconfig, xconfig, gconfig, oldconfig, olddefconfig, defconfig, etc... + # "config" can be set to any valid config option, such as: menuconfig, nconfig, xconfig, gconfig, oldconfig, olddefconfig, defconfig, etc... parameter config defconfig main: diff --git a/level_3/fake/documents/fakefile.txt b/level_3/fake/documents/fakefile.txt index 88ab1ff..7f92619 100644 --- a/level_3/fake/documents/fakefile.txt +++ b/level_3/fake/documents/fakefile.txt @@ -192,12 +192,12 @@ Fakefile Documentation: This is mostly relevant when "if" operation is followed by an "and" or an "or" operation. Consider the following\: - if defined parameter xxx - or defined parameter yyy - and defined parameter zzz + if parameter xxx + or parameter yyy + and parameter zzz print first else - if defined parameter www + if parameter www print second else print third @@ -249,35 +249,9 @@ Fakefile Documentation: For example, "if <> 'a' 'b' 'c'" would test: 'a' <> 'b' && 'b' <> 'c' && 'a' <> 'c'. This performs only string-based comparisons. - - defined parameter/environment "some define name"\: - Test if one or more names are defined as a "parameter" or an "environment" variable. - For example, "if defined parameter verbose silent" would test if both the "verbose" and the "silent" variables are defined via the "parameter" setting. - For example, "if defined environment PWD SHELL" would test if both the "PWD" and the "SHELL" variables are defined via the "environment" variables. - - Reserved parameters that represent program arguments, three forms are available. - For example, the program argument -w/--work has the reserved word "work" and has three forms: - 1) "work". - 2) "work:option". - 3) "work:value". - - In the case of form 1, the "if defined parameter work" would be true if the argument is passed to the program or a default is provided. - In the case of form 2, the "if defined parameter work:option" would be true if the argument is passed to the program. - In the case of form 3, the "if defined parameter work:value" would be true if the argument is passed to the program and has a non-zero value. - - Some reserved parameters, such as the "verbosity", has no "value" and in this case would always return false for "if defined parameter verbosity:value". - - The following are reserved parameters: - - build: Associated with -b/--build parameter. - - color: Associated with +d/++dark, +l/++light, and +n/++no_color parameters. - - data: Associated with -D/--data parameter. - - define: Associated with -d/--define parameter. - - fakefile: Associated with -f/--fakefile parameter. - - mode: Associated with -m/--mode parameter and possibly with the build settings default mode "modes_default". - - process: Associated with -p/--process parameter. - - settings: Associated with -s/--settings parameter. - - sources: Associated with -S/--sources parameter. - - verbosity: Associated with +q/++quiet, +N/++normal, +V/++verbose, and +D/++debug parameters. - - work: Associated with -w/--work parameter. + - define "some define name"\: + Test if one or more names are defined as an environment variable. + For example, "if define PWD SHELL" would test if both the "PWD" and the "SHELL" variables are defined via the environment variables. - exists "file path"\: Test if file exists. @@ -304,21 +278,51 @@ Fakefile Documentation: This is to be immediately followed by a valid if condition as well as all appropriate valid content associated with that if condition. Only the following if conditions are supported\: - - defined. + - define. - exists. - group. - is. - mode. - owner. + - parameter. Examples\: - - "if not defined parameter work" + - "if not parameter work" - "if not exists documentation.txt" - owner "some mode" "some file"\: Test if one or more files has the given owner. For example, "if owner me a.txt b.txt" would test if both file a.txt and b.txt have an owner named "me". + - parameter "some parameter name"\: + Test if one or more names are defined as a "parameter" variable. + For example, "if parameter verbose silent" would test if both the "verbose" and the "silent" variables are defined via the "parameter" setting. + + Reserved parameters that represent program arguments, three forms are available. + For example, the program argument -w/--work has the reserved word "work" and has three forms: + 1) "work". + 2) "work:option". + 3) "work:value". + + In the case of form 1, the "if parameter work" would be true if the argument is passed to the program or a default is provided. + In the case of form 2, the "if parameter work:option" would be true if the argument is passed to the program. + In the case of form 3, the "if parameter work:value" would be true if the argument is passed to the program and has a non-zero value. + + Some reserved parameters, such as the "verbosity", has no "value" and in this case would always return false for "if parameter verbosity:value". + + The following are reserved parameters: + - build: Associated with -b/--build parameter. + - color: Associated with +d/++dark, +l/++light, and +n/++no_color parameters. + - data: Associated with -D/--data parameter. + - define: Associated with -d/--define parameter. + - fakefile: Associated with -f/--fakefile parameter. + - mode: Associated with -m/--mode parameter and possibly with the build settings default mode "modes_default". + - process: Associated with -p/--process parameter. + - settings: Associated with -s/--settings parameter. + - sources: Associated with -S/--sources parameter. + - verbosity: Associated with +q/++quiet, +N/++normal, +V/++verbose, and +D/++debug parameters. + - work: Associated with -w/--work parameter. + - succeed\: Test if the previous section operation succeeded. diff --git a/level_3/fake/specifications/fakefile.txt b/level_3/fake/specifications/fakefile.txt index edd7347..71e7c44 100644 --- a/level_3/fake/specifications/fakefile.txt +++ b/level_3/fake/specifications/fakefile.txt @@ -84,15 +84,16 @@ Fakefile Specification: - >=: Two or more Content. - <=: Two or more Content. - <>: Two or more Content. - - defined: First Content is either "parameter" or "environment". Second or more Content are valid names, such that for "parameter" it is a valid IKI name and for "environment" it is a valid environment variable name. + - define: One or more Content are valid environment variable name. - exists: One or more Content representing the files to check the existence of. - failure: has no other Content. - group: First Content is the name of a group. Second or more Content are paths to files. - is: First Content is a list of "block", "character", "no_dereference", "directory", "fifo", "link", "regular" , or "socket" followed by "for" and then the Remaining Content that are paths to files. - mode: First Content is either "has", "is", or "no_dereference". Second Content is a valid file mode. Third or more Content are paths to files. - no_dereference: A non-condition inserted before any of "exists", "is", and "mode" (then the second Content is the actual condition followed by any Content associated with that condition). - - not: First Content is one of "defined", "exists", "group", "is", "mode", "no_dereference", or "owner" and all remaining Content are based on the First Content's "if" Section Operation Content rules. + - not: First Content is one of "define", "exists", "group", "is", "mode", "no_dereference", "owner", or "parameter" and all remaining Content are based on the First Content's "if" Section Operation Content rules. - owner: First Content is the name of an owner. Second or more Content are paths to files. + - parameter: One or more Content are valid IKI names. - success: has no other Content. The "if" Section Operation conditions and numbers\: @@ -113,6 +114,6 @@ Fakefile Specification: - >= - <= - The "if" Section Operation condition "defined"\: + The "if" Section Operation condition "parameter"\: The following reserved words are available for parameter names: build, color, data, define, fakefile, mode, process, settings, sources, verbosity, and work. Each of the reserved words supports having ":option" and ":value" appended, such as: "work:value".