From: Kevin Day Date: Thu, 1 Aug 2024 02:24:23 +0000 (-0500) Subject: Bugfix: Add stage setting to standards to prevent build state file conflicts. X-Git-Tag: 0.6.11~13 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=b6cfc2c85cc8b71256c5ec9b4be47fdb5e66855b;p=fll Bugfix: Add stage setting to standards to prevent build state file conflicts. The build state stage files are conflicting in some cases. The old solution to this problem has been observed as insufficient. The different build settings might have the same exact file name. I have tossed around the idea of a settings Object such as "stage" in the past but I had previously opted against it. I now believe that skipping over this was a mistake. Add a new feature to the standards to fix this bug. The "stage" value may now be specified. The fakefile files accept the "stage" setting and passes the result along to any build settings. The settings files accept the "stage" setting and uses the value by appending it to the stage files. Only a single value is supported. The forward and backward slashes are explicitly prohibited. Other special characters are recommended to be avoided given the possibility of local file system problems. Rather than erroring out, this slashes are stripped out. The bootstrap.sh script is updated to support this. The support for "stage" in the boostrap.sh script is very limited. --- diff --git a/build/scripts/bootstrap.sh b/build/scripts/bootstrap.sh index 13ba49c..970c4f4 100644 --- a/build/scripts/bootstrap.sh +++ b/build/scripts/bootstrap.sh @@ -44,6 +44,7 @@ bootstrap_main() { local key= local -A variables=() + local define_extra= local failure=0 local settings_name=settings local settings_file= @@ -61,6 +62,7 @@ bootstrap_main() { local path_sources=sources/ local path_language=c/ local path_work= + local process= local project_built= local project_built_shared= local project_built_static= @@ -69,8 +71,7 @@ bootstrap_main() { local override_path_data= local override_path_sources= local override_path_work= - local define_extra= - local process= + local stage= local verbosity=normal local verbose= local verbose_common= @@ -259,8 +260,16 @@ bootstrap_main() { project_built="${project_built}-${process}" fi - project_built_shared="${project_built}.shared" - project_built_static="${project_built}.static" + key= + stage= + bootstrap_id "stage" + if [[ ${variables[${key}]} != "" ]] ; then + stage="-${variables[${key}]}" + fi + + project_built="${project_built}${stage}" + project_built_shared="${project_built}${stage}.shared" + project_built_static="${project_built}${stage}.static" if [[ ${modes_available} == "" ]] ; then if [[ ${modes} != "" ]] ; then @@ -609,164 +618,168 @@ bootstrap_id() { "search_exclusive") let key=80;; "search_shared") let key=81;; "search_static") let key=82;; - "version_file") let key=83;; - "version_major") let key=84;; - "version_major_prefix") let key=85;; - "version_micro") let key=86;; - "version_micro_prefix") let key=87;; - "version_minor") let key=88;; - "version_minor_prefix") let key=89;; - "version_nano") let key=90;; - "version_nano_prefix") let key=91;; - "version_target") let key=92;; - - "build_compiler-mode") let key=93;; - "build_indexer-mode") let key=94;; - "build_indexer_arguments-mode") let key=95;; - "build_language-mode") let key=96;; - "build_libraries-mode") let key=97;; - "build_libraries_shared-mode") let key=98;; - "build_libraries_static-mode") let key=99;; - "build_name-mode") let key=100;; - "build_objects_library-mode") let key=101;; - "build_objects_library_shared-mode") let key=102;; - "build_objects_library_static-mode") let key=103;; - "build_objects_program-mode") let key=104;; - "build_objects_program_shared-mode") let key=105;; - "build_objects_program_static-mode") let key=106;; - "build_script-mode") let key=107;; - "build_shared-mode") let key=108;; - "build_sources_documentation-mode") let key=109;; - "build_sources_headers-mode") let key=110;; - "build_sources_headers_shared-mode") let key=111;; - "build_sources_headers_static-mode") let key=112;; - "build_sources_library-mode") let key=113;; - "build_sources_library_shared-mode") let key=114;; - "build_sources_library_static-mode") let key=115;; - "build_sources_object-mode") let key=116;; - "build_sources_object_shared-mode") let key=117;; - "build_sources_object_static-mode") let key=118;; - "build_sources_program-mode") let key=119;; - "build_sources_program_shared-mode") let key=120;; - "build_sources_program_static-mode") let key=121;; - "build_sources_script-mode") let key=122;; - "build_sources_setting-mode") let key=123;; - "build_static-mode") let key=124;; - "defines-mode") let key=125;; - "defines_library-mode") let key=126;; - "defines_library_shared-mode") let key=127;; - "defines_library_static-mode") let key=128;; - "defines_object-mode") let key=129;; - "defines_object_shared-mode") let key=130;; - "defines_object_static-mode") let key=131;; - "defines_program-mode") let key=132;; - "defines_program_shared-mode") let key=133;; - "defines_program_static-mode") let key=134;; - "defines_shared-mode") let key=135;; - "defines_static-mode") let key=136;; - "environment-mode") let key=137;; - "flags-mode") let key=138;; - "flags_library-mode") let key=139;; - "flags_library_shared-mode") let key=140;; - "flags_library_static-mode") let key=141;; - "flags_object-mode") let key=142;; - "flags_object_shared-mode") let key=143;; - "flags_object_static-mode") let key=144;; - "flags_program-mode") let key=145;; - "flags_program_shared-mode") let key=146;; - "flags_program_static-mode") let key=147;; - "flags_shared-mode") let key=148;; - "flags_static-mode") let key=149;; - "has_path_standard-mode") let key=150;; - "path_headers-mode") let key=151;; - "path_language-mode") let key=152;; - "path_library_script-mode") let key=153;; - "path_library_shared-mode") let key=154;; - "path_library_static-mode") let key=155;; - "path_object_script-mode") let key=156;; - "path_object_shared-mode") let key=157;; - "path_object_static-mode") let key=158;; - "path_program_script-mode") let key=159;; - "path_program_shared-mode") let key=160;; - "path_program_static-mode") let key=161;; - "path_sources-mode") let key=162;; - "path_sources_headers-mode") let key=163;; - "path_sources_library-mode") let key=164;; - "path_sources_object-mode") let key=165;; - "path_sources_program-mode") let key=166;; - "path_sources_script-mode") let key=167;; - "preserve_path_headers-mode") let key=168;; - "process_post-mode") let key=169;; - "process_pre-mode") let key=170;; - "search_exclusive-mode") let key=171;; - "search_shared-mode") let key=172;; - "search_static-mode") let key=173;; - "version_file-mode") let key=174;; - "version_major-mode") let key=175;; - "version_major_prefix-mode") let key=176;; - "version_micro-mode") let key=177;; - "version_micro_prefix-mode") let key=178;; - "version_minor-mode") let key=179;; - "version_minor_prefix-mode") let key=180;; - "version_nano-mode") let key=181;; - "version_nano_prefix-mode") let key=182;; - "version_target-mode") let key=183;; - - "has-build_compiler") let key=184;; - "has-build_indexer") let key=185;; - "has-build_indexer_arguments") let key=186;; - "has-build_name") let key=187;; - "has-has_path_standard") let key=188;; - "has-path_library_script") let key=189;; - "has-path_library_shared") let key=190;; - "has-path_library_static") let key=191;; - "has-path_object_script") let key=192;; - "has-path_object_shared") let key=193;; - "has-path_object_static") let key=194;; - "has-path_program_script") let key=195;; - "has-path_program_shared") let key=196;; - "has-path_program_static") let key=197;; - "has-path_sources") let key=198;; - "has-path_sources_headers") let key=199;; - "has-path_sources_library") let key=200;; - "has-path_sources_object") let key=201;; - "has-path_sources_program") let key=202;; - "has-path_sources_script") let key=203;; - "has-search_exclusive") let key=204;; - "has-search_shared") let key=205;; - "has-search_static") let key=206;; - "has-version_major_prefix") let key=207;; - "has-version_micro_prefix") let key=208;; - "has-version_minor_prefix") let key=209;; - "has-version_nano_prefix") let key=210;; - - "has-build_compiler-mode") let key=207;; - "has-build_indexer-mode") let key=208;; - "has-build_indexer_arguments-mode") let key=209;; - "has-build_name-mode") let key=210;; - "has-has_path_standard-mode") let key=211;; - "has-path_library_script-mode") let key=212;; - "has-path_library_shared-mode") let key=213;; - "has-path_library_static-mode") let key=214;; - "has-path_object_script-mode") let key=215;; - "has-path_object_shared-mode") let key=216;; - "has-path_object_static-mode") let key=217;; - "has-path_program_script-mode") let key=218;; - "has-path_program_shared-mode") let key=219;; - "has-path_program_static-mode") let key=220;; - "has-path_sources-mode") let key=221;; - "has-path_sources_headers-mode") let key=222;; - "has-path_sources_library-mode") let key=223;; - "has-path_sources_object-mode") let key=224;; - "has-path_sources_program-mode") let key=225;; - "has-path_sources_script-mode") let key=226;; - "has-search_exclusive-mode") let key=227;; - "has-search_shared-mode") let key=228;; - "has-search_static-mode") let key=229;; - "has-version_major_prefix-mode") let key=230;; - "has-version_micro_prefix-mode") let key=231;; - "has-version_minor_prefix-mode") let key=232;; - "has-version_nano_prefix-mode") let key=233;; + "stage") let key=83;; + "version_file") let key=84;; + "version_major") let key=85;; + "version_major_prefix") let key=86;; + "version_micro") let key=87;; + "version_micro_prefix") let key=88;; + "version_minor") let key=89;; + "version_minor_prefix") let key=90;; + "version_nano") let key=91;; + "version_nano_prefix") let key=92;; + "version_target") let key=93;; + + "build_compiler-mode") let key=94;; + "build_indexer-mode") let key=95;; + "build_indexer_arguments-mode") let key=96;; + "build_language-mode") let key=97;; + "build_libraries-mode") let key=98;; + "build_libraries_shared-mode") let key=99;; + "build_libraries_static-mode") let key=100;; + "build_name-mode") let key=101;; + "build_objects_library-mode") let key=102;; + "build_objects_library_shared-mode") let key=103;; + "build_objects_library_static-mode") let key=104;; + "build_objects_program-mode") let key=105;; + "build_objects_program_shared-mode") let key=106;; + "build_objects_program_static-mode") let key=107;; + "build_script-mode") let key=108;; + "build_shared-mode") let key=109;; + "build_sources_documentation-mode") let key=110;; + "build_sources_headers-mode") let key=111;; + "build_sources_headers_shared-mode") let key=112;; + "build_sources_headers_static-mode") let key=113;; + "build_sources_library-mode") let key=114;; + "build_sources_library_shared-mode") let key=115;; + "build_sources_library_static-mode") let key=116;; + "build_sources_object-mode") let key=117;; + "build_sources_object_shared-mode") let key=118;; + "build_sources_object_static-mode") let key=119;; + "build_sources_program-mode") let key=120;; + "build_sources_program_shared-mode") let key=121;; + "build_sources_program_static-mode") let key=122;; + "build_sources_script-mode") let key=123;; + "build_sources_setting-mode") let key=124;; + "build_static-mode") let key=125;; + "defines-mode") let key=126;; + "defines_library-mode") let key=127;; + "defines_library_shared-mode") let key=128;; + "defines_library_static-mode") let key=129;; + "defines_object-mode") let key=130;; + "defines_object_shared-mode") let key=131;; + "defines_object_static-mode") let key=132;; + "defines_program-mode") let key=133;; + "defines_program_shared-mode") let key=134;; + "defines_program_static-mode") let key=135;; + "defines_shared-mode") let key=136;; + "defines_static-mode") let key=137;; + "environment-mode") let key=138;; + "flags-mode") let key=139;; + "flags_library-mode") let key=140;; + "flags_library_shared-mode") let key=141;; + "flags_library_static-mode") let key=142;; + "flags_object-mode") let key=143;; + "flags_object_shared-mode") let key=144;; + "flags_object_static-mode") let key=145;; + "flags_program-mode") let key=146;; + "flags_program_shared-mode") let key=147;; + "flags_program_static-mode") let key=148;; + "flags_shared-mode") let key=149;; + "flags_static-mode") let key=150;; + "has_path_standard-mode") let key=151;; + "path_headers-mode") let key=152;; + "path_language-mode") let key=153;; + "path_library_script-mode") let key=154;; + "path_library_shared-mode") let key=155;; + "path_library_static-mode") let key=156;; + "path_object_script-mode") let key=157;; + "path_object_shared-mode") let key=158;; + "path_object_static-mode") let key=159;; + "path_program_script-mode") let key=160;; + "path_program_shared-mode") let key=161;; + "path_program_static-mode") let key=162;; + "path_sources-mode") let key=163;; + "path_sources_headers-mode") let key=164;; + "path_sources_library-mode") let key=165;; + "path_sources_object-mode") let key=166;; + "path_sources_program-mode") let key=167;; + "path_sources_script-mode") let key=168;; + "preserve_path_headers-mode") let key=169;; + "process_post-mode") let key=170;; + "process_pre-mode") let key=171;; + "search_exclusive-mode") let key=172;; + "search_shared-mode") let key=173;; + "search_static-mode") let key=174;; + "stage-mode") let key=175;; + "version_file-mode") let key=176;; + "version_major-mode") let key=177;; + "version_major_prefix-mode") let key=178;; + "version_micro-mode") let key=179;; + "version_micro_prefix-mode") let key=180;; + "version_minor-mode") let key=181;; + "version_minor_prefix-mode") let key=182;; + "version_nano-mode") let key=183;; + "version_nano_prefix-mode") let key=184;; + "version_target-mode") let key=185;; + + "has-build_compiler") let key=186;; + "has-build_indexer") let key=187;; + "has-build_indexer_arguments") let key=188;; + "has-build_name") let key=189;; + "has-has_path_standard") let key=190;; + "has-path_library_script") let key=191;; + "has-path_library_shared") let key=192;; + "has-path_library_static") let key=193;; + "has-path_object_script") let key=194;; + "has-path_object_shared") let key=195;; + "has-path_object_static") let key=196;; + "has-path_program_script") let key=197;; + "has-path_program_shared") let key=198;; + "has-path_program_static") let key=199;; + "has-path_sources") let key=200;; + "has-path_sources_headers") let key=201;; + "has-path_sources_library") let key=202;; + "has-path_sources_object") let key=203;; + "has-path_sources_program") let key=204;; + "has-path_sources_script") let key=205;; + "has-search_exclusive") let key=206;; + "has-search_shared") let key=207;; + "has-search_static") let key=208;; + "has-stage") let key=209;; + "has-version_major_prefix") let key=210;; + "has-version_micro_prefix") let key=211;; + "has-version_minor_prefix") let key=212;; + "has-version_nano_prefix") let key=213;; + + "has-build_compiler-mode") let key=214;; + "has-build_indexer-mode") let key=215;; + "has-build_indexer_arguments-mode") let key=216;; + "has-build_name-mode") let key=217;; + "has-has_path_standard-mode") let key=218;; + "has-path_library_script-mode") let key=219;; + "has-path_library_shared-mode") let key=220;; + "has-path_library_static-mode") let key=221;; + "has-path_object_script-mode") let key=222;; + "has-path_object_shared-mode") let key=223;; + "has-path_object_static-mode") let key=224;; + "has-path_program_script-mode") let key=225;; + "has-path_program_shared-mode") let key=226;; + "has-path_program_static-mode") let key=227;; + "has-path_sources-mode") let key=228;; + "has-path_sources_headers-mode") let key=229;; + "has-path_sources_library-mode") let key=230;; + "has-path_sources_object-mode") let key=231;; + "has-path_sources_program-mode") let key=232;; + "has-path_sources_script-mode") let key=233;; + "has-search_exclusive-mode") let key=234;; + "has-search_shared-mode") let key=235;; + "has-search_static-mode") let key=236;; + "has-stage-mode") let key=237;; + "has-version_major_prefix-mode") let key=238;; + "has-version_micro_prefix-mode") let key=239;; + "has-version_minor_prefix-mode") let key=240;; + "has-version_nano_prefix-mode") let key=241;; esac } @@ -807,7 +820,7 @@ bootstrap_load_settings() { fi # Single value Objects. - for i in build_compiler build_indexer build_language build_name build_script build_shared build_sources_object build_sources_object_shared build_sources_object_static build_static has_path_standard path_headers path_language path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_headers path_sources_library path_sources_object path_sources_program path_sources_script preserve_path_headers process_post process_pre search_exclusive search_shared search_static version_file version_major version_major_prefix version_micro version_micro_prefix version_minor version_minor_prefix version_nano version_nano_prefix version_target ; do + for i in build_compiler build_indexer build_language build_name build_script build_shared build_sources_object build_sources_object_shared build_sources_object_static build_static has_path_standard path_headers path_language path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_headers path_sources_library path_sources_object path_sources_program path_sources_script preserve_path_headers process_post process_pre search_exclusive search_shared search_static stage version_file version_major version_major_prefix version_micro version_micro_prefix version_minor version_minor_prefix version_nano version_nano_prefix version_target ; do bootstrap_id "${i}" @@ -902,7 +915,7 @@ bootstrap_load_settings_mode() { for m in ${modes} ; do # Single value Objects. - for i in build_compiler build_indexer build_language build_name build_script build_shared build_sources_object build_sources_object_shared build_sources_object_static build_static has_path_standard path_headers path_language path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_headers path_sources_library path_sources_object path_sources_program path_sources_script preserve_path_headers process_post process_pre search_exclusive search_shared search_static version_file version_major version_major_prefix version_micro version_micro_prefix version_minor version_minor_prefix version_nano version_nano_prefix version_target ; do + for i in build_compiler build_indexer build_language build_name build_script build_shared build_sources_object build_sources_object_shared build_sources_object_static build_static has_path_standard path_headers path_language path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_headers path_sources_library path_sources_object path_sources_program path_sources_script preserve_path_headers process_post process_pre search_exclusive search_shared search_static stage version_file version_major version_major_prefix version_micro version_micro_prefix version_minor version_minor_prefix version_nano version_nano_prefix version_target ; do bootstrap_id "${i}-mode" @@ -2679,6 +2692,12 @@ bootstrap_operation_build_prepare_remaining() { bootstrap_id "search_static-mode" search_static=${variables[${key}]} fi + + bootstrap_id "has-stage-mode" + if [[ ${variables[${key}]} == "yes" ]] ; then + bootstrap_id "stage-mode" + stage=${variables[${key}]} + fi } bootstrap_operation_build_prepare_settings() { diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index 627a007..2e51f79 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -432,7 +432,7 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = fake_build_operate(&data, 0, main->process_pipe); + status = fake_build_operate(&data, 0, main->process_pipe, f_string_empty_s); } } else if (data.operation == fake_operation_clean_e) { diff --git a/level_3/fake/c/private-build-load.c b/level_3/fake/c/private-build-load.c index 6655b6e..5236ce8 100644 --- a/level_3/fake/c/private-build-load.c +++ b/level_3/fake/c/private-build-load.c @@ -293,6 +293,7 @@ extern "C" { f_string_dynamics_t search_exclusive = f_string_dynamics_t_initialize; f_string_dynamics_t search_shared = f_string_dynamics_t_initialize; f_string_dynamics_t search_static = f_string_dynamics_t_initialize; + f_string_dynamics_t stage = f_string_dynamics_t_initialize; f_string_dynamics_t version_file = f_string_dynamics_t_initialize; f_string_dynamics_t version_major = f_string_dynamics_t_initialize; f_string_dynamics_t version_major_prefix = f_string_dynamics_t_initialize; @@ -388,6 +389,7 @@ extern "C" { fake_build_setting_name_search_exclusive_s, fake_build_setting_name_search_shared_s, fake_build_setting_name_search_static_s, + fake_build_setting_name_stage_s, fake_build_setting_name_version_file_s, fake_build_setting_name_version_major_s, fake_build_setting_name_version_major_prefix_s, @@ -484,6 +486,7 @@ extern "C" { &search_exclusive, &search_shared, &search_static, + &stage, &version_file, &version_major, &version_major_prefix, @@ -580,6 +583,7 @@ extern "C" { F_false, // search_exclusive F_false, // search_shared F_false, // search_static + F_false, // stage F_false, // version_file F_false, // version_major F_false, // version_major_prefix @@ -771,6 +775,7 @@ extern "C" { fake_build_setting_name_search_exclusive_s, fake_build_setting_name_search_shared_s, fake_build_setting_name_search_static_s, + fake_build_setting_name_stage_s, fake_build_setting_name_version_file_s, fake_build_setting_name_version_major_s, fake_build_setting_name_version_major_prefix_s, @@ -815,6 +820,7 @@ extern "C" { &search_exclusive, &search_shared, &search_static, + &stage, &version_file, &version_major, &version_major_prefix, @@ -859,6 +865,7 @@ extern "C" { &setting->search_exclusive, // search_exclusive &setting->search_shared, // search_shared &setting->search_static, // search_static + 0, // stage }; f_string_dynamic_t *settings_single_destination[] = { @@ -893,6 +900,7 @@ extern "C" { 0, // search_exclusive 0, // search_shared 0, // search_static + &setting->stage, // stage 0, // version_file &setting->version_major, // version_major &setting->version_major_prefix, // version_major_prefix @@ -937,16 +945,17 @@ extern "C" { settings_matches[80], // search_exclusive settings_matches[81], // search_shared settings_matches[82], // search_static - settings_matches[83], // version_file - settings_matches[84], // version_major - settings_matches[85], // version_major_prefix - settings_matches[86], // version_micro - settings_matches[87], // version_micro_prefix - settings_matches[88], // version_minor - settings_matches[89], // version_minor_prefix - settings_matches[90], // version_nano - settings_matches[91], // version_nano_prefix - settings_matches[92], // version_target + settings_matches[83], // stage + settings_matches[84], // version_file + settings_matches[85], // version_major + settings_matches[86], // version_major_prefix + settings_matches[87], // version_micro + settings_matches[88], // version_micro_prefix + settings_matches[89], // version_minor + settings_matches[90], // version_minor_prefix + settings_matches[91], // version_nano + settings_matches[92], // version_nano_prefix + settings_matches[93], // version_target }; const f_string_static_t settings_single_string_default[] = { @@ -981,6 +990,7 @@ extern "C" { fake_build_setting_default_yes_s, // search_exclusive f_string_empty_s, // search_shared f_string_empty_s, // search_static + f_string_empty_s, // stage f_string_empty_s, // version_file f_string_empty_s, // version_major fake_build_setting_default_version_prefix_s, // version_major_prefix @@ -1031,6 +1041,7 @@ extern "C" { 0, // search_exclusive 0, // search_shared 0, // search_static + 0, // stage &setting->version_file, // version_file 0, // version_major 0, // version_major_prefix @@ -1075,6 +1086,7 @@ extern "C" { 0, // search_exclusive 0, // search_shared 0, // search_static + 0, // stage fake_build_version_type_micro_e, // version_file 0, // version_major 0, // version_major_prefix @@ -1119,6 +1131,7 @@ extern "C" { f_string_empty_s, // search_exclusive f_string_empty_s, // search_shared f_string_empty_s, // search_static + f_string_empty_s, // stage fake_build_version_micro_s, // version_file f_string_empty_s, // version_major f_string_empty_s, // version_major_prefix @@ -1131,7 +1144,7 @@ extern "C" { fake_build_version_major_s, // version_target }; - // 1 = "yes" or "no", 2 = path/, 3 = literal, 4 = "bash", "c", or "c++", 5 = "major", "minor", "micro", or "nano". + // 1 = "yes" or "no", 2 = path/, 3 = literal, 4 = "bash", "c", or "c++", 5 = "major", "minor", "micro", or "nano", 6 = literal, no slash. const uint8_t settings_single_type[] = { 3, // build_compiler 3, // build_indexer @@ -1164,6 +1177,7 @@ extern "C" { 1, // search_exclusive 1, // search_shared 1, // search_static + 6, // stage 5, // version_file 3, // version_major 3, // version_major_prefix @@ -1176,7 +1190,9 @@ extern "C" { 5, // version_target }; - for (f_array_length_t i = 0; i < 41; ++i) { + f_array_length_t j = 0; + + for (f_array_length_t i = 0; i < 42; ++i) { // Assign the default for literal and path types. if (!settings_single_matches[i] && settings_single_destination[i]) { @@ -1318,6 +1334,35 @@ extern "C" { break; } + // Verify that there are no forward or backward slashes in the string. + if (settings_single_type[i] == 6) { + *status = F_none; + + for (j = 0; j < settings_single_source[i]->array[settings_single_source[i]->used - 1].used; ++j) { + + if (settings_single_source[i]->array[settings_single_source[i]->used - 1].string[j] == f_string_ascii_slash_forward_s.string[0] || settings_single_source[i]->array[settings_single_source[i]->used - 1].string[j] == f_string_ascii_slash_backward_s.string[0]) { + *status = F_warning; + + // Prevent the slash from being copied. + settings_single_source[i]->array[settings_single_source[i]->used - 1].string[j] = 0; + } + } // for + + if (*status == F_warning) { + if (data->main->warning.verbosity >= f_console_verbosity_verbose_e) { + flockfile(data->main->warning.to.stream); + + fl_print_format("%r%[%QThe setting '%]", data->main->warning.to.stream, f_string_eol_s, data->main->warning.context, data->main->warning.prefix, data->main->warning.context); + fl_print_format("%[%r%]", data->main->warning.to.stream, data->main->warning.notable, settings_single_name[i], data->main->warning.notable); + fl_print_format("%[' in the file '%]", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context); + fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, path_file, data->main->warning.notable); + fl_print_format("%[' has and must not have forward or backward slashes, ignoring slashes.%]%r", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context, f_string_eol_s); + + funlockfile(data->main->warning.to.stream); + } + } + } + *status = f_string_dynamic_append_nulless(settings_single_source[i]->array[settings_single_source[i]->used - 1], settings_single_destination[i]); if (F_status_is_error(*status)) { @@ -1480,6 +1525,7 @@ extern "C" { f_string_dynamics_resize(0, &search_exclusive); f_string_dynamics_resize(0, &search_shared); f_string_dynamics_resize(0, &search_static); + f_string_dynamics_resize(0, &stage); f_string_dynamics_resize(0, &version_file); f_string_dynamics_resize(0, &version_major); f_string_dynamics_resize(0, &version_major_prefix); @@ -1605,7 +1651,7 @@ extern "C" { #endif // _di_fake_build_load_setting_override_ #ifndef _di_fake_build_load_stage_ - void fake_build_load_stage(fake_data_t * const data, const f_string_static_t settings_file, fake_build_stage_t * const stage, f_status_t * const status) { + void fake_build_load_stage(fake_data_t * const data, fake_build_data_t * const data_build, const f_string_static_t fakefile_stage, const f_string_static_t settings_file, fake_build_stage_t * const stage, f_status_t * const status) { if (F_status_is_error(*status)) return; @@ -1704,6 +1750,22 @@ extern "C" { *status = f_string_dynamic_append_nulless(settings_file_base, values[i]); } + if (F_status_is_error_not(*status) && fakefile_stage.used) { + *status = f_string_dynamic_append_nulless(fake_build_stage_separate_s, values[i]); + + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append_nulless(fakefile_stage, values[i]); + } + } + + if (F_status_is_error_not(*status) && data_build->setting.stage.used) { + *status = f_string_dynamic_append_nulless(fake_build_stage_separate_s, values[i]); + + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append_nulless(data_build->setting.stage, values[i]); + } + } + if (F_status_is_error_not(*status)) { *status = f_string_dynamic_append_nulless(fake_build_stage_built_s, values[i]); } diff --git a/level_3/fake/c/private-build-load.h b/level_3/fake/c/private-build-load.h index 0f16293..54d20ee 100644 --- a/level_3/fake/c/private-build-load.h +++ b/level_3/fake/c/private-build-load.h @@ -135,6 +135,12 @@ extern "C" { * * @param data * The program data. + * @param data_build + * The build data. + * @param fakefile_stage + * (optional) The stage setting value from the fakefile. + * + * Set fakefile_stage.used to 0 to not use. * @param settings_file * The path to the settings file. * @param stage @@ -148,7 +154,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_load_stage_ - extern void fake_build_load_stage(fake_data_t * const data, const f_string_static_t settings_file, fake_build_stage_t * const stage, f_status_t * const status) F_attribute_visibility_internal_d; + extern void fake_build_load_stage(fake_data_t * const data, fake_build_data_t * const data_build, const f_string_static_t fakefile_stage, const f_string_static_t settings_file, fake_build_stage_t * const stage, f_status_t * const status) F_attribute_visibility_internal_d; #endif // _di_fake_build_load_stage_ #ifdef __cplusplus diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index e79af7b..6d89807 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -823,7 +823,7 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static #endif // _di_fake_build_objects_add_ #ifndef _di_fake_build_operate_ - f_status_t fake_build_operate(fake_data_t * const data, const f_string_statics_t * const build_arguments, const bool process_pipe) { + f_status_t fake_build_operate(fake_data_t * const data, const f_string_statics_t * const build_arguments, const bool process_pipe, const f_string_dynamic_t fakefile_stage) { if (!((++data->main->signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(data->main)) { @@ -897,7 +897,7 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static } } - fake_build_load_stage(data, build_arguments && build_arguments->array[0].used ? build_arguments->array[0] : f_string_empty_s, &stage, &status); + fake_build_load_stage(data, &data_build, fakefile_stage, build_arguments && build_arguments->array[0].used ? build_arguments->array[0] : f_string_empty_s, &stage, &status); fake_build_load_environment(data, &data_build, &data_build.environment, &status); diff --git a/level_3/fake/c/private-build.h b/level_3/fake/c/private-build.h index b22b07b..8b91d2a 100644 --- a/level_3/fake/c/private-build.h +++ b/level_3/fake/c/private-build.h @@ -200,6 +200,10 @@ extern "C" { * @param process_pipe * If TRUE, then use the program input pipe. * If FALSE, then ignore the program input pipe. + * @param fakefile_stage + * (optional) The stage setting value from the fakefile. + * + * Set fakefile_stage.used to 0 to not use. * * @return * F_none on success. @@ -207,7 +211,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_operate_ - extern f_status_t fake_build_operate(fake_data_t * const data, const f_string_statics_t * const build_arguments, const bool process_pipe) F_attribute_visibility_internal_d; + extern f_status_t fake_build_operate(fake_data_t * const data, const f_string_statics_t * const build_arguments, const bool process_pipe, const f_string_static_t fakefile_stage) F_attribute_visibility_internal_d; #endif // _di_fake_build_operate_ /** diff --git a/level_3/fake/c/private-common.c b/level_3/fake/c/private-common.c index c27bbae..d035af6 100644 --- a/level_3/fake/c/private-common.c +++ b/level_3/fake/c/private-common.c @@ -95,6 +95,7 @@ extern "C" { const f_string_static_t fake_build_setting_name_search_exclusive_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_search_exclusive_s, 0, FAKE_build_setting_name_search_exclusive_s_length); const f_string_static_t fake_build_setting_name_search_shared_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_search_shared_s, 0, FAKE_build_setting_name_search_shared_s_length); const f_string_static_t fake_build_setting_name_search_static_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_search_static_s, 0, FAKE_build_setting_name_search_static_s_length); + const f_string_static_t fake_build_setting_name_stage_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_stage_s, 0, FAKE_build_setting_name_stage_s_length); const f_string_static_t fake_build_setting_name_version_file_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_version_file_s, 0, FAKE_build_setting_name_version_file_s_length); const f_string_static_t fake_build_setting_name_version_major_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_version_major_s, 0, FAKE_build_setting_name_version_major_s_length); const f_string_static_t fake_build_setting_name_version_major_prefix_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_version_major_prefix_s, 0, FAKE_build_setting_name_version_major_prefix_s_length); @@ -177,6 +178,7 @@ extern "C" { const f_string_static_t fake_make_setting_load_build_s = macro_f_string_static_t_initialize(FAKE_make_setting_load_build_s, 0, FAKE_make_setting_load_build_s_length); const f_string_static_t fake_make_setting_parameter_s = macro_f_string_static_t_initialize(FAKE_make_setting_parameter_s, 0, FAKE_make_setting_parameter_s_length); const f_string_static_t fake_make_setting_return_s = macro_f_string_static_t_initialize(FAKE_make_setting_return_s, 0, FAKE_make_setting_return_s_length); + const f_string_static_t fake_make_setting_stage_s = macro_f_string_static_t_initialize(FAKE_make_setting_stage_s, 0, FAKE_make_setting_stage_s_length); #endif // _di_fake_make_setting_t_ #ifndef _di_fake_make_operation_ diff --git a/level_3/fake/c/private-common.h b/level_3/fake/c/private-common.h index 711c340..f7a5b05 100644 --- a/level_3/fake/c/private-common.h +++ b/level_3/fake/c/private-common.h @@ -252,6 +252,7 @@ extern "C" { * path_sources_script: The path_sources_script setting. * process_post: The process_post setting. * process_pre: The process_pre setting. + * stage: The stage setting. * version_major: The version_major setting. * version_major_prefix: The version_major_prefix setting. * version_micro: The version_micro setting. @@ -360,6 +361,7 @@ extern "C" { f_string_dynamic_t path_sources_script; f_string_dynamic_t process_post; f_string_dynamic_t process_pre; + f_string_dynamic_t stage; f_string_dynamic_t version_major; f_string_dynamic_t version_major_prefix; f_string_dynamic_t version_micro; @@ -466,6 +468,7 @@ extern "C" { f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ f_string_dynamics_t_initialize, \ f_string_dynamics_t_initialize, \ f_string_dynamics_t_initialize, \ @@ -543,6 +546,7 @@ extern "C" { macro_f_string_dynamic_t_delete_simple(setting.path_sources_script) \ macro_f_string_dynamic_t_delete_simple(setting.process_post) \ macro_f_string_dynamic_t_delete_simple(setting.process_pre) \ + macro_f_string_dynamic_t_delete_simple(setting.stage) \ macro_f_string_dynamic_t_delete_simple(setting.version_major) \ macro_f_string_dynamic_t_delete_simple(setting.version_major_prefix) \ macro_f_string_dynamic_t_delete_simple(setting.version_micro) \ @@ -693,6 +697,7 @@ extern "C" { #define FAKE_build_setting_name_search_exclusive_s "search_exclusive" #define FAKE_build_setting_name_search_shared_s "search_shared" #define FAKE_build_setting_name_search_static_s "search_static" + #define FAKE_build_setting_name_stage_s "stage" #define FAKE_build_setting_name_version_file_s "version_file" #define FAKE_build_setting_name_version_major_s "version_major" #define FAKE_build_setting_name_version_major_prefix_s "version_major_prefix" @@ -793,6 +798,7 @@ extern "C" { #define FAKE_build_setting_name_search_exclusive_s_length 16 #define FAKE_build_setting_name_search_shared_s_length 13 #define FAKE_build_setting_name_search_static_s_length 13 + #define FAKE_build_setting_name_stage_s_length 5 #define FAKE_build_setting_name_version_file_s_length 12 #define FAKE_build_setting_name_version_major_s_length 13 #define FAKE_build_setting_name_version_major_prefix_s_length 20 @@ -893,6 +899,7 @@ extern "C" { extern const f_string_static_t fake_build_setting_name_search_exclusive_s; extern const f_string_static_t fake_build_setting_name_search_shared_s; extern const f_string_static_t fake_build_setting_name_search_static_s; + extern const f_string_static_t fake_build_setting_name_stage_s; extern const f_string_static_t fake_build_setting_name_version_file_s; extern const f_string_static_t fake_build_setting_name_version_major_s; extern const f_string_static_t fake_build_setting_name_version_major_prefix_s; @@ -904,7 +911,7 @@ extern "C" { extern const f_string_static_t fake_build_setting_name_version_nano_prefix_s; extern const f_string_static_t fake_build_setting_name_version_target_s; - #define fake_build_setting_total_d 93 + #define fake_build_setting_total_d 94 #endif // _di_fake_build_setting_t_ #ifndef _di_fake_build_stage_t_ @@ -1194,16 +1201,19 @@ extern "C" { uint8_t fail; + f_string_dynamic_t stage; f_string_map_multis_t parameter; } fake_make_setting_t; #define fake_make_setting_t_initialize { \ 0, \ 0, \ + f_string_dynamic_t_initialize, \ f_string_map_multis_t_initialize, \ } #define macro_fake_make_setting_t_delete_simple(setting) \ + macro_f_string_dynamic_t_delete_simple(setting.stage) \ macro_f_string_map_multis_t_delete_simple(setting.parameter) #define FAKE_make_setting_compiler_s "compiler" @@ -1215,6 +1225,7 @@ extern "C" { #define FAKE_make_setting_load_build_s "load_build" #define FAKE_make_setting_parameter_s "parameter" #define FAKE_make_setting_return_s "return" + #define FAKE_make_setting_stage_s "stage" #define FAKE_make_setting_compiler_s_length 8 #define FAKE_make_setting_define_s_length 6 @@ -1225,6 +1236,7 @@ extern "C" { #define FAKE_make_setting_load_build_s_length 10 #define FAKE_make_setting_parameter_s_length 9 #define FAKE_make_setting_return_s_length 6 + #define FAKE_make_setting_stage_s_length 5 extern const f_string_static_t fake_make_setting_compiler_s; extern const f_string_static_t fake_make_setting_define_s; @@ -1235,6 +1247,7 @@ extern "C" { extern const f_string_static_t fake_make_setting_load_build_s; extern const f_string_static_t fake_make_setting_parameter_s; extern const f_string_static_t fake_make_setting_return_s; + extern const f_string_static_t fake_make_setting_stage_s; #endif // _di_fake_make_setting_t_ #ifndef _di_fake_make_operation_ diff --git a/level_3/fake/c/private-make-load_fakefile.c b/level_3/fake/c/private-make-load_fakefile.c index e7037e1..1f63045 100644 --- a/level_3/fake/c/private-make-load_fakefile.c +++ b/level_3/fake/c/private-make-load_fakefile.c @@ -255,23 +255,27 @@ extern "C" { for (f_array_length_t i = 0; i < settings.objects.used; ++i) { if (fl_string_dynamic_partial_compare_string(fake_make_setting_load_build_s.string, data_make->buffer, fake_make_setting_load_build_s.used, settings.objects.array[i]) == F_equal_to) { - fake_make_load_fakefile_setting_build(data_make, &settings.objects.array[i], &settings.contents.array[i]); + fake_make_load_fakefile_setting_build(data_make, settings.objects.array[i], &settings.contents.array[i]); } else if (fl_string_dynamic_partial_compare_string(fake_make_setting_compiler_s.string, data_make->buffer, fake_make_setting_compiler_s.used, settings.objects.array[i]) == F_equal_to) { - fake_make_load_fakefile_setting_compiler(data_make, &settings.objects.array[i], &settings.contents.array[i], &range_compiler); + fake_make_load_fakefile_setting_compiler(data_make, settings.objects.array[i], &settings.contents.array[i], &range_compiler); } else if (fl_string_dynamic_partial_compare_string(fake_make_setting_environment_s.string, data_make->buffer, fake_make_setting_environment_s.used, settings.objects.array[i]) == F_equal_to) { *status = fake_make_load_fakefile_setting_environment(data_make, &settings.contents.array[i]); if (F_status_is_error(*status)) break; } else if (fl_string_dynamic_partial_compare_string(fake_make_setting_fail_s.string, data_make->buffer, fake_make_setting_fail_s.used, settings.objects.array[i]) == F_equal_to) { - fake_make_load_fakefile_setting_fail(data_make, &settings.objects.array[i], &settings.contents.array[i]); + fake_make_load_fakefile_setting_fail(data_make, settings.objects.array[i], &settings.contents.array[i]); } else if (fl_string_dynamic_partial_compare_string(fake_make_setting_indexer_s.string, data_make->buffer, fake_make_setting_indexer_s.used, settings.objects.array[i]) == F_equal_to) { - fake_make_load_fakefile_setting_indexer(data_make, &settings.objects.array[i], &settings.contents.array[i], &range_indexer); + fake_make_load_fakefile_setting_indexer(data_make, settings.objects.array[i], &settings.contents.array[i], &range_indexer); } else if (fl_string_dynamic_partial_compare_string(fake_make_setting_parameter_s.string, data_make->buffer, fake_make_setting_parameter_s.used, settings.objects.array[i]) == F_equal_to) { - *status = fake_make_load_fakefile_setting_parameter(data_make, &settings.objects.array[i], &settings.contents.array[i]); + *status = fake_make_load_fakefile_setting_parameter(data_make, settings.objects.array[i], &settings.contents.array[i]); + if (F_status_is_error(*status)) break; + } + else if (fl_string_dynamic_partial_compare_string(fake_make_setting_stage_s.string, data_make->buffer, fake_make_setting_stage_s.used, settings.objects.array[i]) == F_equal_to) { + *status = fake_make_load_fakefile_setting_stage(data_make, &settings.contents.array[i]); if (F_status_is_error(*status)) break; } } // for @@ -328,7 +332,7 @@ extern "C" { #endif // _di_fake_make_load_fakefile_ #ifndef _di_fake_make_load_fakefile_setting_build_ - void fake_make_load_fakefile_setting_build(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) { + void fake_make_load_fakefile_setting_build(fake_make_data_t * const data_make, const f_fss_object_t object, f_fss_content_t * const content) { if (content->used) { if (fl_string_dynamic_partial_compare_string(fake_common_setting_bool_yes_s.string, data_make->buffer, fake_common_setting_bool_yes_s.used, content->array[0]) == F_equal_to) { @@ -338,7 +342,7 @@ extern "C" { data_make->setting_make.load_build = F_false; } else { - fake_print_warning_settings_content_invalid(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, *object, content->array[0], fake_make_section_settings_s); + fake_print_warning_settings_content_invalid(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, object, content->array[0], fake_make_section_settings_s); } if (content->used > 1) { @@ -346,13 +350,13 @@ extern "C" { } } else { - fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_load_build_s); + fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, object, fake_make_setting_load_build_s); } } #endif // _di_fake_make_load_fakefile_setting_build_ #ifndef _di_fake_make_load_fakefile_setting_compiler_ - void fake_make_load_fakefile_setting_compiler(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_compiler) { + void fake_make_load_fakefile_setting_compiler(fake_make_data_t * const data_make, const f_fss_object_t object, f_fss_content_t * const content, f_string_range_t ** const range_compiler) { if (content->used) { *range_compiler = &content->array[content->used - 1]; @@ -362,7 +366,7 @@ extern "C" { } } else { - fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_compiler_s); + fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, object, fake_make_setting_compiler_s); } } #endif // _di_fake_make_load_fakefile_setting_compiler_ @@ -562,7 +566,7 @@ extern "C" { #endif // _di_fake_make_load_fakefile_setting_environment_ #ifndef _di_fake_make_load_fakefile_setting_fail_ - void fake_make_load_fakefile_setting_fail(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) { + void fake_make_load_fakefile_setting_fail(fake_make_data_t * const data_make, const f_fss_object_t object, f_fss_content_t * const content) { if (content->used) { if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_exit_s.string, data_make->buffer, fake_make_operation_argument_exit_s.used, content->array[content->used - 1]) == F_equal_to) { @@ -575,7 +579,7 @@ extern "C" { data_make->setting_make.fail = fake_make_operation_fail_type_ignore_e; } else { - fake_print_warning_settings_content_invalid(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, *object, content->array[content->used - 1], fake_make_section_settings_s); + fake_print_warning_settings_content_invalid(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, object, content->array[content->used - 1], fake_make_section_settings_s); } if (content->used > 1) { @@ -583,13 +587,13 @@ extern "C" { } } else { - fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_fail_s); + fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, object, fake_make_setting_fail_s); } } #endif // _di_fake_make_load_fakefile_setting_fail_ #ifndef _di_fake_make_load_fakefile_setting_indexer_ - void fake_make_load_fakefile_setting_indexer(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_indexer) { + void fake_make_load_fakefile_setting_indexer(fake_make_data_t * const data_make, const f_fss_object_t object, f_fss_content_t * const content, f_string_range_t ** const range_indexer) { if (content->used) { *range_indexer = &content->array[content->used - 1]; @@ -599,13 +603,13 @@ extern "C" { } } else { - fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_indexer_s); + fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, object, fake_make_setting_indexer_s); } } #endif // _di_fake_make_load_fakefile_setting_indexer_ #ifndef _di_fake_make_load_fakefile_setting_parameter_ - f_status_t fake_make_load_fakefile_setting_parameter(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) { + f_status_t fake_make_load_fakefile_setting_parameter(fake_make_data_t * const data_make, const f_fss_object_t object, f_fss_content_t * const content) { if (content->used) { f_status_t status = F_none; @@ -640,13 +644,68 @@ extern "C" { } } else { - fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_return_s); + fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, data_make->buffer, object, fake_make_setting_return_s); } return F_none; } #endif // _di_fake_make_load_fakefile_setting_parameter_ +#ifndef _di_fake_make_load_fakefile_setting_stage_ + f_status_t fake_make_load_fakefile_setting_stage(fake_make_data_t * const data_make, f_fss_content_t * const content) { + + if (content->used) { + if (content->used > 1) { + fake_print_warning_settings_content_multiple(data_make->data, data_make->data->file_data_build_fakefile, fake_make_setting_stage_s); + } + + f_status_t status = F_none; + + // Verify that there are no forward or backward slashes in the string. + for (f_number_unsigned_t i = content->array[content->used - 1].start; i <= content->array[content->used - 1].stop; ++i) { + + if (data_make->buffer.string[i] == f_string_ascii_slash_forward_s.string[0] || data_make->buffer.string[i] == f_string_ascii_slash_backward_s.string[0]) { + status = F_warning; + + // Prevent the slash from being copied. + data_make->buffer.string[i] = 0; + } + } // for + + if (status == F_warning) { + if (data_make->main->warning.verbosity >= f_console_verbosity_verbose_e) { + flockfile(data_make->main->warning.to.stream); + + fl_print_format("%r%[%QThe setting '%]", data_make->main->warning.to.stream, f_string_eol_s, data_make->main->warning.context, data_make->main->warning.prefix, data_make->main->warning.context); + fl_print_format("%[%Q%]", data_make->main->warning.to.stream, data_make->main->warning.notable, fake_make_setting_stage_s, data_make->main->warning.notable); + fl_print_format("%[' in the file '%]", data_make->main->warning.to.stream, data_make->main->warning.context, data_make->main->warning.context); + fl_print_format("%[%Q%]", data_make->main->warning.to.stream, data_make->main->warning.notable, data_make->data->file_data_build_fakefile, data_make->main->warning.notable); + fl_print_format("%[' has and must not have forward or backward slashes, ignoring slashes.%]%r", data_make->main->warning.to.stream, data_make->main->warning.context, data_make->main->warning.context, f_string_eol_s); + + funlockfile(data_make->main->warning.to.stream); + } + } + + data_make->setting_make.stage.used = 0; + + status = f_string_dynamic_partial_append_nulless(data_make->buffer, content->array[content->used - 1], &data_make->setting_make.stage); + + if (F_status_is_error(status)) { + fll_error_print(data_make->main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true); + + return status; + } + } + else { + const f_string_range_t range = macro_f_string_range_t_initialize2(fake_make_setting_stage_s.used); + + fake_print_warning_settings_content_empty(data_make->data, data_make->data->file_data_build_fakefile, fake_make_setting_stage_s, range, fake_make_setting_stage_s); + } + + return F_none; + } +#endif // _di_fake_make_load_fakefile_setting_stage_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fake/c/private-make-load_fakefile.h b/level_3/fake/c/private-make-load_fakefile.h index 28c14f8..08fd7ba 100644 --- a/level_3/fake/c/private-make-load_fakefile.h +++ b/level_3/fake/c/private-make-load_fakefile.h @@ -48,7 +48,7 @@ extern "C" { * The setting content. */ #ifndef _di_fake_make_load_fakefile_setting_build_ - extern void fake_make_load_fakefile_setting_build(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) F_attribute_visibility_internal_d; + extern void fake_make_load_fakefile_setting_build(fake_make_data_t * const data_make, const f_fss_object_t object, f_fss_content_t * const content) F_attribute_visibility_internal_d; #endif // _di_fake_make_load_fakefile_setting_build_ /** @@ -64,7 +64,7 @@ extern "C" { * A pointer to the range that representing the compiler setting within the buffer. */ #ifndef _di_fake_make_load_fakefile_setting_compiler_ - extern void fake_make_load_fakefile_setting_compiler(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_compiler) F_attribute_visibility_internal_d; + extern void fake_make_load_fakefile_setting_compiler(fake_make_data_t * const data_make, const f_fss_object_t object, f_fss_content_t * const content, f_string_range_t ** const range_compiler) F_attribute_visibility_internal_d; #endif // _di_fake_make_load_fakefile_setting_compiler_ /** @@ -126,7 +126,7 @@ extern "C" { * The setting content. */ #ifndef _di_fake_make_load_fakefile_setting_fail_ - extern void fake_make_load_fakefile_setting_fail(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) F_attribute_visibility_internal_d; + extern void fake_make_load_fakefile_setting_fail(fake_make_data_t * const data_make, const f_fss_object_t object, f_fss_content_t * const content) F_attribute_visibility_internal_d; #endif // _di_fake_make_load_fakefile_setting_fail_ /** @@ -142,7 +142,7 @@ extern "C" { * A pointer to the range that representing the indexer setting within the buffer. */ #ifndef _di_fake_make_load_fakefile_setting_indexer_ - extern void fake_make_load_fakefile_setting_indexer(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_indexer) F_attribute_visibility_internal_d; + extern void fake_make_load_fakefile_setting_indexer(fake_make_data_t * const data_make, const f_fss_object_t object, f_fss_content_t * const content, f_string_range_t ** const range_indexer) F_attribute_visibility_internal_d; #endif // _di_fake_make_load_fakefile_setting_indexer_ /** @@ -170,9 +170,28 @@ extern "C" { * @see fake_make_load_fakefile_setting_define_and_parameter() */ #ifndef _di_fake_make_load_fakefile_setting_parameter_ - extern f_status_t fake_make_load_fakefile_setting_parameter(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) F_attribute_visibility_internal_d; + extern f_status_t fake_make_load_fakefile_setting_parameter(fake_make_data_t * const data_make, const f_fss_object_t object, f_fss_content_t * const content) F_attribute_visibility_internal_d; #endif // _di_fake_make_load_fakefile_setting_parameter_ +/** + * Load the fakefile setting "stage". + * + * @param data_make + * All make related setting data, including data from the fakefile and the build settings file. + * @param content + * The setting content. + * + * @return + * F_none on success. + * + * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * + * @see f_string_dynamic_partial_append_nulless() + */ +#ifndef _di_fake_make_load_fakefile_setting_stage_ + extern f_status_t fake_make_load_fakefile_setting_stage(fake_make_data_t * const data_make, f_fss_content_t * const content) F_attribute_visibility_internal_d; +#endif // _di_fake_make_load_fakefile_setting_stage_ + #ifdef __cplusplus } // extern "C" #endif 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 fd6691b..cf9bf1a 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -46,7 +46,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_build_ f_status_t fake_make_operate_process_type_build(fake_make_data_t * const data_make) { - const f_status_t status = fake_build_operate(data_make->data, data_make->cache_arguments.used ? &data_make->cache_arguments : 0, F_false); + const f_status_t status = fake_build_operate(data_make->data, data_make->cache_arguments.used ? &data_make->cache_arguments : 0, F_false, data_make->setting_make.stage); if (F_status_set_fine(status) == F_interrupt) return status; return fake_make_operate_process_return(data_make, F_status_is_error(status) ? 1 : 0, status); diff --git a/level_3/fake/documents/fakefile.txt b/level_3/fake/documents/fakefile.txt index 1197f1e..1e06958 100644 --- a/level_3/fake/documents/fakefile.txt +++ b/level_3/fake/documents/fakefile.txt @@ -1,7 +1,7 @@ # fss-0002 iki-0000 # # license: open-standard-license-1.0-or-later -# version 2024/03/23 +# version 2024/07/30 # # This file (assumed to be named fakefile.txt) can be more easily read using the following iki_read commands: # iki_read fakefile.txt +Q -w -rrr ASCII ASCII GCC GCC HTML HTML -WW character "'" "'" code '"' '"' @@ -94,6 +94,13 @@ Fakefile Documentation: The parameter variable name code:"return" is used to store the return result of a code:"run" or code:"shell" operation. Setting this here only sets the default code:"return" parameter variable value. + - code:"stage"\: + This defines a name that is added to the build stage files to help uniquely identify build stages associated with this file. + This name must only have valid characters for a particular file system. + The variables allowed are different from file system to file system and so special characters should generally be avoided. + + To help prevent problems with paths, slashes (forward slash and backward slash) are not allowed in the stage name. + - code:"main"\: This is the main entry point when processing the file:"fakefile". This is processed top-down until the end of the list is reached. @@ -586,6 +593,7 @@ Fakefile Documentation: - code:"documents"\: This variable holds the code:"documents" program parameters, such as code:"-O documents/". This supports both code:":option" and code:":value". + This is neither implemented nor supported by Featureless Make 0.6.x and earlier. - code:"fakefile"\: @@ -595,6 +603,7 @@ Fakefile Documentation: - code:"licenses"\: This variable holds the code:"licenses" program parameters, such as code:"-l licenses/". This supports both code:":option" and code:":value". + This is neither implemented nor supported by Featureless Make 0.6.x and earlier. - code:"mode"\: diff --git a/level_3/fake/documents/settings.txt b/level_3/fake/documents/settings.txt index c6f877b..f62170d 100644 --- a/level_3/fake/documents/settings.txt +++ b/level_3/fake/documents/settings.txt @@ -1,7 +1,7 @@ # fss-0002 iki-0000 # # license: open-standard-license-1.0-or-later -# version 2024/03/23 +# version 2024/07/30 # # This file (assumed to be named settings.txt) can be more easily read using the following iki_read commands: # iki_read settings.txt +Q -w -rrr ASCII ASCII FLL FLL GCC GCC -WW character "'" "'" code '"' '"' @@ -520,6 +520,13 @@ Settings Documentation: When code:"yes", static library paths are searched during compile. Both this and search_shared cannot be code:"no" at the same time. + - code:"stage"\: + This defines a name that is added to the build stage files to help uniquely identify build stages associated with this file. + This name must only have valid characters for a particular file system. + The variables allowed are different from file system to file system and so special characters should generally be avoided. + + To help prevent problems with paths, slashes (forward slash and backward slash) are not allowed in the stage name. + - code:"version_file"\: Designates which version should be used when building the symbolic links. Any version prefixes are used as defined. diff --git a/level_3/fake/specifications/fakefile.txt b/level_3/fake/specifications/fakefile.txt index 6489406..7a8134e 100644 --- a/level_3/fake/specifications/fakefile.txt +++ b/level_3/fake/specifications/fakefile.txt @@ -1,7 +1,7 @@ # fss-0002 iki-0000 # # license: open-standard-license-1.0-or-later -# version 2024/03/23 +# version 2024/07/30 # # This file (assumed to be named fakefile.txt) can be more easily read using the following iki_read commands: # iki_read fakefile.txt +Q -w -WW character "'" "'" code '"' '"' @@ -38,14 +38,15 @@ Fakefile Specification: The bold:"Settings Objects" are\: - code:"compiler": Only one bold:"Content", which must only be a valid filename. - - code:"define": First bold:"Content" represents variable name (case-sensitive), remaining bold:"Content" represents the value. + - code:"define": First bold:"Content" represents the variable name (case-sensitive), remaining bold:"Content" represents the value. - code:"environment": Zero or more bold:"Content" representing valid environment variable names (alpha-numeric with underscore, but cannot begin with a number). - code:"fail": Only one bold:"Content", which must be either code:"exit", code:"warn" or code:"ignore" (quotes not required) (case-sensitive). - code:"import": Only one bold:"Content", which must only be a valid filename. - code:"indexer": Only one bold:"Content", which must only be a valid filename. - code:"indexer_arguments: Zero or more arguments supported by the indexer specified in code:"build_indexer". - code:"load_build": Only one bold:"Content", which must be either code:"yes" or code:"no" (quotes not required) (case-sensitive). - - code:"parameter": First bold:"Content" represents variable name (case-sensitive), remaining bold:"Content" represents the value. + - code:"parameter": First bold:"Content" represents the variable name (case-sensitive), remaining bold:"Content" represents the value. + - code:"stage": Zero or one bold:"Content", which represents the build stage name (case-sensitive) (no slashes allowed). The build settings may also be specified in the bold:"Settings Section". @@ -126,5 +127,4 @@ Fakefile Specification: The code:"if" bold:"Section Operation" condition code:"parameter"\: The following reserved words are available for parameter names: code:"build", code:"color", code:"current", code:"data", code:"documents", code:"define", code:"fakefile", code:"licenses", code:"mode", code:"process", code:"return", code:"settings", code:"sources", code:"top", code:"under", code:"verbosity", and code:"work". - The reserved words code:"documents" and code:"licenses" are neither implemented nor supported by Featureless Make 0.6.x and earlier). Each of the reserved words supports having code:":option" and code:":value" appended, such as: code:"work:value". diff --git a/level_3/fake/specifications/settings.txt b/level_3/fake/specifications/settings.txt index 5fd1e63..3dc010e 100644 --- a/level_3/fake/specifications/settings.txt +++ b/level_3/fake/specifications/settings.txt @@ -1,7 +1,7 @@ # fss-0002 iki-0000 # # license: open-standard-license-1.0-or-later -# version 2024/03/23 +# version 2024/07/30 # # This file (assumed to be named settings.txt) can be more easily read using the following iki_read commands: # iki_read settings.txt +Q -w -WW character "'" "'" code '"' '"' @@ -104,6 +104,7 @@ Settings Specification: - code:"search_exclusive": Must only one of: code:"yes" or code:"no". - code:"search_shared": Must only one of: code:"yes" or code:"no". - code:"search_static": Must only one of: code:"yes" or code:"no". + - code:"stage": Only zero or one bold:"Content", which represents the build stage name (case-sensitive) (no slashes allowed). - code:"version_file": Must only be one of: code:"major", code:"minor", code:"micro", or code:"nano". - code:"version_major": Must only be a single value containing valid filename characters. - code:"version_major_prefix": Must be zero or more valid filename characters.