]> Kevux Git Server - fll/commitdiff
Update: The build setting path_sources is not being properly used and improve skeleto...
authorKevin Day <thekevinday@gmail.com>
Tue, 15 Feb 2022 06:47:20 +0000 (00:47 -0600)
committerKevin Day <thekevinday@gmail.com>
Tue, 15 Feb 2022 07:02:08 +0000 (01:02 -0600)
Resolve the fixme regarding the path_sources_object and similar.
Consolidate the static source build into functions.

The fake_build_setting_name_preserve_path_headers_s is in the wrong location, resulting in the incorrect loading of build settings data.

Provide default for path_sources.
Make the main->path_sources a prefix path where all sources exist (there will likely need to be a follow up commit to address this in bootstrap.sh).

Get rid of the path_source_* forr bash, c, and other custom paths.

Get rid of the redundant version default assignment in fake_build_load_setting_defaults().
Rename fake_build_load_setting_defaults() to fake_build_load_setting_override().

Update the skeleton generation.
Add "specifications" directory creation.
Add "sources/script" directory creation.

13 files changed:
level_3/fake/c/common.c
level_3/fake/c/common.h
level_3/fake/c/fake.c
level_3/fake/c/private-build-load.c
level_3/fake/c/private-build-load.h
level_3/fake/c/private-build-objects.c
level_3/fake/c/private-build.c
level_3/fake/c/private-build.h
level_3/fake/c/private-fake-path_generate.c
level_3/fake/c/private-fake.c
level_3/fake/c/private-make-operate_process.c
level_3/fake/c/private-skeleton.c
level_3/fake/c/private-skeleton.h

index 9ee2b2b10bf71916c03f87381d1b59d9d984e4e7..f76ccc8dc8f7c2f96c6983ab5047a90c3d5b4e06 100644 (file)
@@ -37,6 +37,7 @@ extern "C" {
   const f_string_static_t fake_path_part_script_s = macro_f_string_static_t_initialize(FAKE_path_part_script_s, 0, FAKE_path_part_script_s_length);
   const f_string_static_t fake_path_part_settings_s = macro_f_string_static_t_initialize(FAKE_path_part_settings_s, 0, FAKE_path_part_settings_s_length);
   const f_string_static_t fake_path_part_shared_s = macro_f_string_static_t_initialize(FAKE_path_part_shared_s, 0, FAKE_path_part_shared_s_length);
+  const f_string_static_t fake_path_part_specifications_s = macro_f_string_static_t_initialize(FAKE_path_part_specifications_s, 0, FAKE_path_part_specifications_s_length);
   const f_string_static_t fake_path_part_stage_s = macro_f_string_static_t_initialize(FAKE_path_part_stage_s, 0, FAKE_path_part_stage_s_length);
   const f_string_static_t fake_path_part_static_s = macro_f_string_static_t_initialize(FAKE_path_part_static_s, 0, FAKE_path_part_static_s_length);
 #endif // _di_fake_path_
@@ -154,16 +155,6 @@ extern "C" {
     f_string_dynamic_resize(0, &main->path_licenses);
 
     f_string_dynamic_resize(0, &main->path_sources);
-    f_string_dynamic_resize(0, &main->path_sources_bash);
-    f_string_dynamic_resize(0, &main->path_sources_c);
-    f_string_dynamic_resize(0, &main->path_sources_cpp);
-    f_string_dynamic_resize(0, &main->path_sources_script);
-
-    f_string_dynamic_resize(0, &main->path_sources_object);
-    f_string_dynamic_resize(0, &main->path_sources_object_bash);
-    f_string_dynamic_resize(0, &main->path_sources_object_c);
-    f_string_dynamic_resize(0, &main->path_sources_object_cpp);
-    f_string_dynamic_resize(0, &main->path_sources_object_script);
 
     f_string_dynamic_resize(0, &main->path_work);
     f_string_dynamic_resize(0, &main->path_work_includes);
index 0088f4aeb187d53e1c677b8c948bc422b15bcf33..7fa7a5eb45dc56c88d410e7d21ded8f8b18ad2b1 100644 (file)
@@ -84,41 +84,43 @@ extern "C" {
  * These structures are hard-coded by their individual pieces to be constructed later on.
  */
 #ifndef _di_fake_path_
-  #define FAKE_path_part_bash_s      "bash"      F_path_separator_s
-  #define FAKE_path_part_build_s     "build"     F_path_separator_s
-  #define FAKE_path_part_c_s         "c"         F_path_separator_s
-  #define FAKE_path_part_cpp_s       "c++"       F_path_separator_s
-  #define FAKE_path_part_data_s      "data"      F_path_separator_s
-  #define FAKE_path_part_documents_s "documents" F_path_separator_s
-  #define FAKE_path_part_includes_s  "includes"  F_path_separator_s
-  #define FAKE_path_part_libraries_s "libraries" F_path_separator_s
-  #define FAKE_path_part_licenses_s  "licenses"  F_path_separator_s
-  #define FAKE_path_part_objects_s   "objects"   F_path_separator_s
-  #define FAKE_path_part_process_s   "process"   F_path_separator_s
-  #define FAKE_path_part_programs_s  "programs"  F_path_separator_s
-  #define FAKE_path_part_script_s    "script"    F_path_separator_s
-  #define FAKE_path_part_settings_s  "settings"  F_path_separator_s
-  #define FAKE_path_part_shared_s    "shared"    F_path_separator_s
-  #define FAKE_path_part_stage_s     "stage"     F_path_separator_s
-  #define FAKE_path_part_static_s    "static"    F_path_separator_s
-
-  #define FAKE_path_part_bash_s_length      5 + F_path_separator_s_length
-  #define FAKE_path_part_build_s_length     6 + F_path_separator_s_length
-  #define FAKE_path_part_c_s_length         2 + F_path_separator_s_length
-  #define FAKE_path_part_cpp_s_length       4 + F_path_separator_s_length
-  #define FAKE_path_part_data_s_length      5 + F_path_separator_s_length
-  #define FAKE_path_part_documents_s_length 10 + F_path_separator_s_length
-  #define FAKE_path_part_includes_s_length  9 + F_path_separator_s_length
-  #define FAKE_path_part_libraries_s_length 10 + F_path_separator_s_length
-  #define FAKE_path_part_licenses_s_length  9 + F_path_separator_s_length
-  #define FAKE_path_part_objects_s_length   8 + F_path_separator_s_length
-  #define FAKE_path_part_process_s_length   8 + F_path_separator_s_length
-  #define FAKE_path_part_programs_s_length  9 + F_path_separator_s_length
-  #define FAKE_path_part_script_s_length    7 + F_path_separator_s_length
-  #define FAKE_path_part_settings_s_length  9 + F_path_separator_s_length
-  #define FAKE_path_part_shared_s_length    7 + F_path_separator_s_length
-  #define FAKE_path_part_stage_s_length     6 + F_path_separator_s_length
-  #define FAKE_path_part_static_s_length    7 + F_path_separator_s_length
+  #define FAKE_path_part_bash_s           "bash"           F_path_separator_s
+  #define FAKE_path_part_build_s          "build"          F_path_separator_s
+  #define FAKE_path_part_c_s              "c"              F_path_separator_s
+  #define FAKE_path_part_cpp_s            "c++"            F_path_separator_s
+  #define FAKE_path_part_data_s           "data"           F_path_separator_s
+  #define FAKE_path_part_documents_s      "documents"      F_path_separator_s
+  #define FAKE_path_part_includes_s       "includes"       F_path_separator_s
+  #define FAKE_path_part_libraries_s      "libraries"      F_path_separator_s
+  #define FAKE_path_part_licenses_s       "licenses"       F_path_separator_s
+  #define FAKE_path_part_objects_s        "objects"        F_path_separator_s
+  #define FAKE_path_part_process_s        "process"        F_path_separator_s
+  #define FAKE_path_part_programs_s       "programs"       F_path_separator_s
+  #define FAKE_path_part_script_s         "script"         F_path_separator_s
+  #define FAKE_path_part_settings_s       "settings"       F_path_separator_s
+  #define FAKE_path_part_shared_s         "shared"         F_path_separator_s
+  #define FAKE_path_part_specifications_s "specifications" F_path_separator_s
+  #define FAKE_path_part_stage_s          "stage"          F_path_separator_s
+  #define FAKE_path_part_static_s         "static"         F_path_separator_s
+
+  #define FAKE_path_part_bash_s_length           4 + F_path_separator_s_length
+  #define FAKE_path_part_build_s_length          5 + F_path_separator_s_length
+  #define FAKE_path_part_c_s_length              1 + F_path_separator_s_length
+  #define FAKE_path_part_cpp_s_length            3 + F_path_separator_s_length
+  #define FAKE_path_part_data_s_length           4 + F_path_separator_s_length
+  #define FAKE_path_part_documents_s_length      9 + F_path_separator_s_length
+  #define FAKE_path_part_includes_s_length       8 + F_path_separator_s_length
+  #define FAKE_path_part_libraries_s_length      9 + F_path_separator_s_length
+  #define FAKE_path_part_licenses_s_length       8 + F_path_separator_s_length
+  #define FAKE_path_part_objects_s_length        7 + F_path_separator_s_length
+  #define FAKE_path_part_process_s_length        7 + F_path_separator_s_length
+  #define FAKE_path_part_programs_s_length       8 + F_path_separator_s_length
+  #define FAKE_path_part_script_s_length         6 + F_path_separator_s_length
+  #define FAKE_path_part_settings_s_length       8 + F_path_separator_s_length
+  #define FAKE_path_part_shared_s_length         6 + F_path_separator_s_length
+  #define FAKE_path_part_specifications_s_length 14 + F_path_separator_s_length
+  #define FAKE_path_part_stage_s_length          5 + F_path_separator_s_length
+  #define FAKE_path_part_static_s_length         6 + F_path_separator_s_length
 
   extern const f_string_static_t fake_path_part_bash_s;
   extern const f_string_static_t fake_path_part_build_s;
@@ -135,6 +137,7 @@ extern "C" {
   extern const f_string_static_t fake_path_part_script_s;
   extern const f_string_static_t fake_path_part_settings_s;
   extern const f_string_static_t fake_path_part_shared_s;
+  extern const f_string_static_t fake_path_part_specifications_s;
   extern const f_string_static_t fake_path_part_stage_s;
   extern const f_string_static_t fake_path_part_static_s;
 #endif // _di_fake_path_
@@ -507,16 +510,6 @@ extern "C" {
     f_string_dynamic_t path_licenses;
 
     f_string_dynamic_t path_sources;
-    f_string_dynamic_t path_sources_bash;
-    f_string_dynamic_t path_sources_c;
-    f_string_dynamic_t path_sources_cpp;
-    f_string_dynamic_t path_sources_script;
-
-    f_string_dynamic_t path_sources_object;
-    f_string_dynamic_t path_sources_object_bash;
-    f_string_dynamic_t path_sources_object_c;
-    f_string_dynamic_t path_sources_object_cpp;
-    f_string_dynamic_t path_sources_object_script;
 
     f_string_dynamic_t path_work;
     f_string_dynamic_t path_work_includes;
@@ -599,15 +592,6 @@ extern "C" {
       f_string_dynamic_t_initialize, \
       f_string_dynamic_t_initialize, \
       f_string_dynamic_t_initialize, \
-      f_string_dynamic_t_initialize, \
-      f_string_dynamic_t_initialize, \
-      f_string_dynamic_t_initialize, \
-      f_string_dynamic_t_initialize, \
-      f_string_dynamic_t_initialize, \
-      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_color_context_t_initialize, \
index f52b7a5976d3841c99c8f98c52a81c44a055b80b..f3a33decf85439bddc6329f1d48dacf01be33273 100644 (file)
@@ -304,7 +304,7 @@ extern "C" {
           }
 
           if (F_status_is_error_not(status)) {
-            status = fake_build_operate(f_string_empty_s, main);
+            status = fake_build_operate(main, f_string_empty_s);
           }
         }
         else if (main->operation == fake_operation_clean_e) {
index f21edc89929c9baae1807c1e326b2b80c3d30f6c..c4ef95287d02e319505a1b94c39a7b7d4840b4fa 100644 (file)
@@ -173,7 +173,7 @@ extern "C" {
       }
     }
 
-    fake_build_load_setting_defaults(main, setting, status);
+    fake_build_load_setting_override(main, setting, status);
   }
 #endif // _di_fake_build_load_setting_
 
@@ -292,7 +292,6 @@ extern "C" {
       fake_build_setting_name_modes_s,
       fake_build_setting_name_modes_default_s,
       fake_build_setting_name_path_headers_s,
-      fake_build_setting_name_preserve_path_headers_s,
       fake_build_setting_name_path_language_s,
       fake_build_setting_name_path_library_script_s,
       fake_build_setting_name_path_library_shared_s,
@@ -305,6 +304,7 @@ extern "C" {
       fake_build_setting_name_path_program_static_s,
       fake_build_setting_name_path_sources_s,
       fake_build_setting_name_path_sources_object_s,
+      fake_build_setting_name_preserve_path_headers_s,
       fake_build_setting_name_process_post_s,
       fake_build_setting_name_process_pre_s,
       fake_build_setting_name_search_exclusive_s,
@@ -834,7 +834,7 @@ extern "C" {
         fake_path_part_script_s,                     // path_program_script
         fake_path_part_shared_s,                     // path_program_shared
         fake_path_part_static_s,                     // path_program_static
-        f_string_empty_s,                            // path_sources
+        fake_default_path_sources_s,                 // path_sources
         f_string_empty_s,                            // path_sources_object
         f_string_empty_s,                            // preserve_path_headers
         f_string_empty_s,                            // process_post
@@ -1299,53 +1299,29 @@ extern "C" {
   }
 #endif // _di_fake_build_load_setting_process_
 
-#ifndef _di_fake_build_load_setting_defaults_
-  void fake_build_load_setting_defaults(fake_main_t * const main, fake_build_setting_t * const setting, f_status_t * const status) {
+#ifndef _di_fake_build_load_setting_override_
+  void fake_build_load_setting_override(fake_main_t * const main, fake_build_setting_t * const setting, f_status_t * const status) {
 
     if (F_status_is_error(*status)) return;
 
-    if (fake_signal_received(main)) {
-      *status = F_status_set_error(F_interrupt);
-
-      return;
-    }
+    if (main->parameters.array[fake_parameter_path_sources_e].result == f_console_result_additional_e && main->path_sources.used) {
+      *status = f_string_dynamic_append_assure(f_path_separator_s, &main->path_sources);
 
-    {
-      const f_string_static_t sources[] = {
-        fake_build_setting_default_version_s,
-        fake_build_setting_default_version_s,
-        fake_build_setting_default_version_s,
-      };
-
-      f_string_dynamic_t * const destinations[] = {
-        &setting->version_major,
-        &setting->version_minor,
-        &setting->version_micro,
-      };
-
-      for (uint8_t i = 0; i < 3; ++i) {
-
-        if (destinations[i]->used) continue;
+      if (F_status_is_error(*status)) {
+        fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_assure", F_true);
 
-        *status = f_string_dynamic_append_assure(sources[i], destinations[i]);
+        return;
+      }
 
-        if (F_status_is_error(*status)) {
-          fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_assure", F_true);
-          break;
-        }
+      *status = f_string_dynamic_terminate_after(&main->path_sources);
 
-        *status = f_string_dynamic_terminate_after(destinations[i]);
+      if (F_status_is_error(*status)) {
+        fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true);
 
-        if (F_status_is_error(*status)) {
-          fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true);
-          break;
-        }
-      } // for
+        return;
+      }
     }
 
-    if (F_status_is_error(*status)) return;
-
-    // Override setting file when any of these are specified in the command line.
     if (main->parameters.array[fake_parameter_shared_disabled_e].result == f_console_result_found_e) {
       if (main->parameters.array[fake_parameter_shared_enabled_e].result == f_console_result_found_e) {
         if (main->parameters.array[fake_parameter_shared_enabled_e].location > main->parameters.array[fake_parameter_shared_disabled_e].location) {
@@ -1436,7 +1412,7 @@ extern "C" {
       }
     }
   }
-#endif // _di_fake_build_load_setting_defaults_
+#endif // _di_fake_build_load_setting_override_
 
 #ifndef _di_fake_build_load_stage_
   void fake_build_load_stage(fake_main_t * const main, const f_string_static_t settings_file, fake_build_stage_t * const stage, f_status_t * const status) {
index c70c1a38674f0751d7dddd534d76196f8b2a2c35..43acce20728c7a849332cbaa8625a7c78ec5b636 100644 (file)
@@ -36,7 +36,7 @@ extern "C" {
 #endif // _di_fake_build_load_setting_
 
 /**
- * Assign build setting defaults.
+ * Override build settings based on command line arguments.
  *
  * @param main
  *   The main program data.
@@ -55,9 +55,9 @@ extern "C" {
  *
  *   Status codes (with error bit) are returned on any problem.
  */
-#ifndef _di_fake_build_load_setting_defaults_
-  extern void fake_build_load_setting_defaults(fake_main_t * const main, fake_build_setting_t * const setting, f_status_t * const status) F_attribute_visibility_internal_d;
-#endif // _di_fake_build_load_setting_defaults_
+#ifndef _di_fake_build_load_setting_override_
+  extern void fake_build_load_setting_override(fake_main_t * const main, fake_build_setting_t * const setting, f_status_t * const status) F_attribute_visibility_internal_d;
+#endif // _di_fake_build_load_setting_override_
 
 /**
  * Load and process the setting buffer.
index 7610c0521f5560e5d232fa27e15dc29a5edfcda0..60d450cd748cda69aa41df226c728159dc1e9453 100644 (file)
@@ -37,21 +37,8 @@ extern "C" {
     f_string_static_t destination = f_string_static_t_initialize;
     f_string_static_t source = f_string_static_t_initialize;
 
-    const f_string_static_t *path_sources = &main->path_sources;
-
     int result = main->child;
 
-    if (data_build->setting.has_path_standard) {
-      path_sources = &main->path_sources_c;
-
-      if (data_build->setting.build_language == fake_build_language_type_cpp_e) {
-        path_sources = &main->path_sources_cpp;
-      }
-    }
-    else if (main->parameters.array[fake_parameter_path_sources_e].result != f_console_result_additional_e) {
-      path_sources = &data_build->setting.path_sources;
-    }
-
     const f_string_dynamics_t *sources[2] = {
       &data_build->setting.build_sources_library,
       &data_build->setting.build_sources_library_static,
@@ -67,14 +54,17 @@ extern "C" {
 
         file_name.used = 0;
         destination_path.used = 0;
-        source.used = path_sources->used + sources[i]->array[j].used;
 
-        char source_string[source.used + 1];
+        fake_build_path_source_length(main, data_build, &data_build->setting.path_sources_object, &source);
+
+        char source_string[source.used + sources[i]->array[j].used + 1];
         source.string = source_string;
-        source_string[source.used] = 0;
 
-        memcpy(source_string, path_sources->string, path_sources->used);
-        memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used);
+        fake_build_path_source_string(main, data_build, &data_build->setting.path_sources_object, &source);
+
+        memcpy(source_string + source.used, sources[i]->array[j].string, sources[i]->array[j].used);
+        source.used += sources[i]->array[j].used;
+        source.string[source.used] = 0;
 
         *status = fake_build_get_file_name_without_extension(main, sources[i]->array[j], &file_name);
 
index 9f0e4ae7a2979fbbcf5774a4c75abf7c6dc156ab..2ebff22552ad144448986fab17e520cb5193efbd 100644 (file)
@@ -864,7 +864,7 @@ extern "C" {
 #endif // _di_fake_build_objects_add_
 
 #ifndef _di_fake_build_operate_
-  f_status_t fake_build_operate(const f_string_static_t setting_file, fake_main_t *main) {
+  f_status_t fake_build_operate(fake_main_t * const main, const f_string_static_t setting_file) {
 
     if (fake_signal_received(main)) {
       return F_status_set_error(F_interrupt);
@@ -910,23 +910,32 @@ extern "C" {
       fake_build_program_script(main, &data_build, mode, stage.file_program_script, &status);
 
       if (data_build.setting.build_script) {
-        fake_build_copy(main, mode, fake_build_scripts_s, main->path_sources_script, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status);
+        f_string_static_t source = f_string_static_t_initialize;
+
+        fake_build_path_source_length(main, &data_build, &data_build.setting.path_sources, &source);
+
+        char source_string[source.used + fake_path_part_script_s.used + 1];
+        source.string = source_string;
+
+        fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source);
+
+        memcpy(source_string + source.used, fake_path_part_script_s.string, fake_path_part_script_s.used);
+        source.used += fake_path_part_script_s.used;
+        source.string[source.used] = 0;
+
+        fake_build_copy(main, mode, fake_build_scripts_s, source, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status);
       }
     }
     else {
       if (data_build.setting.build_sources_headers.used) {
-        f_string_static_t path_sources = main->path_sources;
+        f_string_static_t source = f_string_static_t_initialize;
 
-        if (data_build.setting.has_path_standard) {
-          path_sources = main->path_sources_c;
+        fake_build_path_source_length(main, &data_build, &data_build.setting.path_sources, &source);
 
-          if (data_build.setting.build_language == fake_build_language_type_cpp_e) {
-            path_sources = main->path_sources_cpp;
-          }
-        }
-        else if (main->parameters.array[fake_parameter_path_sources_e].result != f_console_result_additional_e) {
-          path_sources = data_build.setting.path_sources;
-        }
+        char source_string[source.used + 1];
+        source.string = source_string;
+
+        fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source);
 
         f_string_static_t path_headers = f_string_static_t_initialize;
         path_headers.used = main->path_build_includes.used + data_build.setting.path_headers.used;
@@ -942,14 +951,14 @@ extern "C" {
 
         path_headers_string[path_headers.used] = 0;
 
-        fake_build_copy(main, mode, fake_build_header_files_s, path_sources, path_headers, data_build.setting.build_sources_headers, stage.file_sources_headers, data_build.setting.preserve_path_headers ? path_sources.used : 0, &status);
+        fake_build_copy(main, mode, fake_build_header_files_s, source, path_headers, data_build.setting.build_sources_headers, stage.file_sources_headers, data_build.setting.preserve_path_headers ? source.used : 0, &status);
 
         if (data_build.setting.build_shared) {
-          fake_build_copy(main, mode, fake_build_header_files_shared_s, path_sources, path_headers, data_build.setting.build_sources_headers_shared, stage.file_sources_headers, data_build.setting.preserve_path_headers ? path_sources.used : 0, &status);
+          fake_build_copy(main, mode, fake_build_header_files_shared_s, source, path_headers, data_build.setting.build_sources_headers_shared, stage.file_sources_headers, data_build.setting.preserve_path_headers ? source.used : 0, &status);
         }
 
         if (data_build.setting.build_static) {
-          fake_build_copy(main, mode, fake_build_header_files_static_s, path_sources, path_headers, data_build.setting.build_sources_headers_static, stage.file_sources_headers, data_build.setting.preserve_path_headers ? path_sources.used : 0, &status);
+          fake_build_copy(main, mode, fake_build_header_files_static_s, source, path_headers, data_build.setting.build_sources_headers_static, stage.file_sources_headers, data_build.setting.preserve_path_headers ? source.used : 0, &status);
         }
       }
 
@@ -972,7 +981,20 @@ extern "C" {
       }
 
       if (data_build.setting.build_script) {
-        fake_build_copy(main, mode, fake_build_scripts_s, main->path_sources_script, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status);
+        f_string_static_t source = f_string_static_t_initialize;
+
+        fake_build_path_source_length(main, &data_build, &data_build.setting.path_sources, &source);
+
+        char source_string[source.used + fake_path_part_script_s.used + 1];
+        source.string = source_string;
+
+        fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source);
+
+        memcpy(source_string + source.used, fake_path_part_script_s.string, fake_path_part_script_s.used);
+        source.used += fake_path_part_script_s.used;
+        source.string[source.used] = 0;
+
+        fake_build_copy(main, mode, fake_build_scripts_s, source, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status);
       }
     }
 
@@ -985,6 +1007,64 @@ extern "C" {
   }
 #endif // _di_fake_build_operate_
 
+#ifndef _di_fake_build_path_source_length_
+  void fake_build_path_source_length(fake_main_t * const main, fake_build_data_t * const data_build, f_string_static_t * const setting_path_source, f_string_static_t * const source) {
+
+    source->used = main->path_sources.used;
+
+    if (setting_path_source->used) {
+      source->used += setting_path_source->used;
+    }
+
+    if (data_build->setting.has_path_standard) {
+      if (data_build->setting.build_language == fake_build_language_type_c_e) {
+        source->used += fake_build_language_c_s.used;
+      }
+      else if (data_build->setting.build_language == fake_build_language_type_cpp_e) {
+        source->used += fake_build_language_cpp_s.used;
+      }
+      else if (data_build->setting.build_language == fake_build_language_type_bash_e) {
+        source->used += fake_build_language_bash_s.used;
+      }
+
+      source->used += f_path_separator_s.used;
+    }
+  }
+#endif // _di_fake_build_path_source_length_
+
+#ifndef _di_fake_build_path_source_string_
+  void fake_build_path_source_string(fake_main_t * const main, fake_build_data_t * const data_build, f_string_static_t * const setting_path_source, f_string_static_t * const source) {
+
+    source->used = 0;
+
+    memcpy(source->string, main->path_sources.string, main->path_sources.used);
+    source->used += main->path_sources.used;
+
+    memcpy(source->string + source->used, setting_path_source->string, setting_path_source->used);
+    source->used += setting_path_source->used;
+
+    if (data_build->setting.has_path_standard) {
+      if (data_build->setting.build_language == fake_build_language_type_c_e) {
+        memcpy(source->string + source->used, fake_build_language_c_s.string, fake_build_language_c_s.used);
+        source->used += fake_build_language_c_s.used;
+      }
+      else if (data_build->setting.build_language == fake_build_language_type_cpp_e) {
+        memcpy(source->string + source->used, fake_build_language_cpp_s.string, fake_build_language_cpp_s.used);
+        source->used += fake_build_language_cpp_s.used;
+      }
+      else if (data_build->setting.build_language == fake_build_language_type_bash_e) {
+        memcpy(source->string + source->used, fake_build_language_bash_s.string, fake_build_language_bash_s.used);
+        source->used += fake_build_language_bash_s.used;
+      }
+
+      memcpy(source->string + source->used, f_path_separator_s.string, f_path_separator_s.used);
+      source->used += f_path_separator_s.used;
+    }
+
+    source->string[source->used] = 0;
+  }
+#endif // _di_fake_build_path_source_string_
+
 #ifndef _di_fake_build_sources_add_
   f_status_t fake_build_sources_add(fake_main_t * const main, fake_build_data_t * const data_build, const f_string_statics_t *generic, const f_string_statics_t *specific, f_string_dynamics_t *arguments) {
 
@@ -992,26 +1072,12 @@ extern "C" {
     f_array_length_t i = 0;
     f_array_length_t j = 0;
 
-    f_string_static_t source = f_string_static_t_initialize;
-
-    // @fixme review this, these paths (like path_sources_object) need to be build on a per-settings basis rather than using a global value.
-    f_string_dynamic_t *path_sources = &main->path_sources;
     const f_string_statics_t *sources[2] = {
       generic,
       specific,
     };
 
-    if (data_build->setting.has_path_standard) {
-      if (data_build->setting.build_language == fake_build_language_type_c_e) {
-        path_sources = &main->path_sources_c;
-      }
-      else {
-        path_sources = &main->path_sources_cpp;
-      }
-    }
-    else if (main->parameters.array[fake_parameter_path_sources_e].result != f_console_result_additional_e) {
-      path_sources = &data_build->setting.path_sources;
-    }
+    f_string_static_t source = f_string_static_t_initialize;
 
     for (; i < 2; ++i) {
 
@@ -1019,14 +1085,16 @@ extern "C" {
 
         if (!sources[i]->array[j].used) continue;
 
-        source.used = path_sources->used + sources[i]->array[j].used;
+        fake_build_path_source_length(main, data_build, &data_build->setting.path_sources, &source);
 
-        char source_string[source.used + 1];
+        char source_string[source.used + sources[i]->array[j].used + 1];
         source.string = source_string;
-        source_string[source.used] = 0;
 
-        memcpy(source_string, path_sources->string, path_sources->used);
-        memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used);
+        fake_build_path_source_string(main, data_build, &data_build->setting.path_sources, &source);
+
+        memcpy(source_string + source.used, sources[i]->array[j].string, sources[i]->array[j].used);
+        source.used += sources[i]->array[j].used;
+        source.string[source.used] = 0;
 
         status = fll_execute_arguments_add(source, arguments);
         if (F_status_is_error(status)) return status;
@@ -1042,45 +1110,34 @@ extern "C" {
 
     if (!generic->used && !specific->used) return F_none;
 
-    f_status_t status = F_none;
-
     f_string_static_t source = f_string_static_t_initialize;
-    f_string_dynamic_t *path_sources = &main->path_sources_object;
 
-    // @fixme review this, these paths (like path_sources_object) need to be build on a per-settings basis rather than using a global value.
-    if (data_build->setting.has_path_standard) {
-      if (data_build->setting.build_language == fake_build_language_type_c_e) {
-        path_sources = &main->path_sources_object_c;
-      }
-      else {
-        path_sources = &main->path_sources_object_cpp;
-      }
-    }
-    else if (main->parameters.array[fake_parameter_path_sources_e].result != f_console_result_additional_e) {
-      path_sources = &data_build->setting.path_sources_object;
-    }
+    fake_build_path_source_length(main, data_build, &data_build->setting.path_sources_object, &source);
 
     if (specific->used) {
-      source.used = path_sources->used + specific->used;
+      source.used += specific->used;
     }
     else {
-      source.used = path_sources->used + generic->used;
+      source.used += generic->used;
     }
 
     char source_string[source.used + 1];
     source.string = source_string;
-    source_string[source.used] = 0;
 
-    memcpy(source_string, path_sources->string, path_sources->used);
+    fake_build_path_source_string(main, data_build, &data_build->setting.path_sources_object, &source);
 
     if (specific->used) {
-      memcpy(source_string + path_sources->used, specific->string, specific->used);
+      memcpy(source_string + source.used, specific->string, specific->used);
+      source.used += specific->used;
     }
     else {
-      memcpy(source_string + path_sources->used, generic->string, generic->used);
+      memcpy(source_string + source.used, generic->string, generic->used);
+      source.used += generic->used;
     }
 
-    status = fll_execute_arguments_add(source, arguments);
+    source_string[source.used] = 0;
+
+    const f_status_t status = fll_execute_arguments_add(source, arguments);
     if (F_status_is_error(status)) return status;
 
     return F_none;
index c8b9b3822bd26f862151fd58a3deb162619abc72..27c9caa6331e00fbe6d13218dbb5c7192f46fa61 100644 (file)
@@ -178,15 +178,14 @@ extern "C" {
   extern f_status_t fake_build_objects_add(fake_main_t * const main, fake_build_data_t * const data_build, const f_string_static_t *path, const f_string_statics_t *generic, const f_string_statics_t *specific, f_string_dynamics_t *arguments) F_attribute_visibility_internal_d;
 #endif // _di_fake_build_objects_add_
 
-
 /**
  * Execute the build operation.
  *
+ * @param main
+ *   The main program data.
  * @param setting_file
  *   The name of the settings file to use.
  *   If setting_file.used is 0, then the default or program parameter supplied file is used.
- * @param main
- *   The main program data.
  *
  * @return
  *   F_none on success.
@@ -194,10 +193,48 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fake_build_operate_
-  extern f_status_t fake_build_operate(const f_string_static_t setting_file, fake_main_t *main) F_attribute_visibility_internal_d;
+  extern f_status_t fake_build_operate(fake_main_t * const main, const f_string_static_t setting_file) F_attribute_visibility_internal_d;
 #endif // _di_fake_build_operate_
 
 /**
+ * Calculate the length of the sources path so that it can be used to manually construct a static string.
+ *
+ * @param main
+ *   The main program data.
+ * @param data_build
+ *   The build data.
+ * @param setting_path_source
+ *   The source path from the build settings file.
+ * @param source
+ *   The static string.
+ *   The path_sources.string is not expected to be defined at this point.
+ *   The path_sources.used is updated.
+ *   The path_sources.size is ignored.
+ */
+#ifndef _di_fake_build_path_source_length_
+  extern void fake_build_path_source_length(fake_main_t * const main, fake_build_data_t * const data_build, f_string_static_t * const setting_path_source, f_string_static_t * const source) F_attribute_visibility_internal_d;
+#endif // _di_fake_build_path_source_length_
+
+/**
+ * Construct a static string array of the sources path.
+ *
+ * @param main
+ *   The main program data.
+ * @param data_build
+ *   The build data.
+ * @param setting_path_source
+ *   The source path from the build settings file.
+ * @param source
+ *   The static string.
+ *   The path_sources.string is expected to be defined and set to a size from path_sources.used + 1.
+ *   The path_sources.used is updated.
+ *   The path_sources.size is ignored.
+ */
+#ifndef _di_fake_build_path_source_string_
+  extern void fake_build_path_source_string(fake_main_t * const main, fake_build_data_t * const data_build, f_string_static_t * const setting_path_source, f_string_static_t * const source) F_attribute_visibility_internal_d;
+#endif // _di_fake_build_path_source_string_
+
+/**
  * Add the sources to the execute arguments array.
  *
  * @param main
index d6ada657778d84cbe3db9e5dc21ad4deae4baf78..f5fd737eeddfb61264948b347b5481d8379e107e 100644 (file)
@@ -20,15 +20,11 @@ extern "C" {
       const f_string_dynamic_t *parameters_source[] = {
         &main->path_build,
         &main->path_data,
-        &main->path_sources,
-        &main->path_sources_object,
       };
 
       const uint8_t parameters_size[] = {
         7,
         2,
-        4,
-        4,
       };
 
       f_string_dynamic_t *parameters_value_0[] = {
@@ -46,28 +42,12 @@ extern "C" {
         &main->path_data_settings,
       };
 
-      f_string_dynamic_t *parameters_value_2[] = {
-        &main->path_sources_bash,
-        &main->path_sources_c,
-        &main->path_sources_cpp,
-        &main->path_sources_script,
-      };
-
-      f_string_dynamic_t *parameters_value_3[] = {
-        &main->path_sources_object_bash,
-        &main->path_sources_object_c,
-        &main->path_sources_object_cpp,
-        &main->path_sources_object_script,
-      };
-
       f_string_dynamic_t **const parameters_value[] = {
         parameters_value_0,
         parameters_value_1,
-        parameters_value_2,
-        parameters_value_3,
       };
 
-      for (i = 0; i < 4; ++i) {
+      for (i = 0; i < 2; ++i) {
 
         // Initialize all string lengths to 0.
         for (uint8_t j = 0; j < parameters_size[i]; ++j) {
@@ -97,14 +77,6 @@ extern "C" {
         fake_path_part_settings_s,
         fake_path_part_documents_s,
         fake_path_part_licenses_s,
-        fake_path_part_bash_s,
-        fake_path_part_c_s,
-        fake_path_part_cpp_s,
-        fake_path_part_script_s,
-        fake_path_part_bash_s,
-        fake_path_part_c_s,
-        fake_path_part_cpp_s,
-        fake_path_part_script_s,
       };
 
       f_string_dynamic_t * const parameters_value[] = {
@@ -119,17 +91,9 @@ extern "C" {
         &main->path_data_settings,
         &main->path_documents,
         &main->path_licenses,
-        &main->path_sources_bash,
-        &main->path_sources_c,
-        &main->path_sources_cpp,
-        &main->path_sources_script,
-        &main->path_sources_object_bash,
-        &main->path_sources_object_c,
-        &main->path_sources_object_cpp,
-        &main->path_sources_object_script,
       };
 
-      for (i = 0; i < 19; ++i) {
+      for (i = 0; i < 11; ++i) {
 
         status = f_string_dynamic_append_nulless(parameters_source[i], parameters_value[i]);
 
@@ -408,11 +372,9 @@ extern "C" {
         &main->path_build_stage,
         &main->path_data_build,
         &main->path_data_settings,
+        &main->path_documents,
         &main->path_licenses,
-        &main->path_sources_bash,
-        &main->path_sources_c,
-        &main->path_sources_cpp,
-        &main->path_sources_script,
+        &main->path_sources,
         &main->path_work_includes,
         &main->path_work_libraries,
         &main->path_work_libraries_script,
@@ -424,6 +386,8 @@ extern "C" {
         &main->path_work_programs_static,
         &main->file_data_build_defines,
         &main->file_data_build_dependencies,
+        &main->file_data_build_process_post_s,
+        &main->file_data_build_process_pre_s,
         &main->file_data_build_fakefile,
         &main->file_data_build_settings,
         &main->file_documents_readme,
index 0f1ca1c26af899690c6cb808c4ae70cb6f3ac273..89e94e0b517ac5065f77e7a891fc3f98e13257e8 100644 (file)
@@ -334,32 +334,28 @@ extern "C" {
       const uint8_t parameters_id[] = {
         fake_parameter_path_build_e,
         fake_parameter_path_data_e,
-        fake_parameter_path_sources_e,
         fake_parameter_path_work_e,
       };
 
       const f_string_static_t parameters_name[] = {
         fake_long_path_build_s,
         fake_long_path_data_s,
-        fake_long_path_sources_s,
         fake_long_path_work_s,
       };
 
       const f_string_static_t parameter_defaults[] = {
         fake_default_path_build_s,
         fake_default_path_data_s,
-        fake_default_path_sources_s,
         fake_default_path_work_s,
       };
 
       f_string_dynamic_t * const parameters_value[] = {
         &main->path_build,
         &main->path_data,
-        &main->path_sources,
         &main->path_work,
       };
 
-      for (uint8_t i = 0; i < 4; ++i) {
+      for (uint8_t i = 0; i < 3; ++i) {
 
         if (main->parameters.array[parameters_id[i]].result == f_console_result_found_e) {
           fake_print_error_parameter_missing_value(main, parameters_name[i]);
index 769c8053787499ec981be6564deac1bf4a1a55d7..f05161435355fa5b0caadc6e6cda83cc2096d3c0 100644 (file)
@@ -99,7 +99,7 @@ extern "C" {
     }
 
     if (state_process->operation == fake_make_operation_type_build_e) {
-      *status = fake_build_operate(arguments.used ? arguments.array[0] : f_string_empty_s, data_make->main);
+      *status = fake_build_operate(data_make->main, arguments.used ? arguments.array[0] : f_string_empty_s);
 
       if (F_status_set_fine(*status) == F_interrupt) {
         return 0;
index bc843e765fed81facf084bc741295c5133334676..47285cbe4475e20199d4d2960cafcd684e7a0a32 100644 (file)
@@ -17,10 +17,44 @@ extern "C" {
 
     if (main->output.verbosity != f_console_verbosity_quiet_e) {
       fll_print_format("%rGenerating skeleton structure.%r", main->output.to.stream, f_string_eol_s, f_string_eol_s);
+
+      if (main->output.verbosity == f_console_verbosity_verbose_e) {
+        fll_print_dynamic(f_string_eol_s, main->output.to.stream);
+      }
     }
 
     {
-      const f_string_dynamic_t *parameters_value[] = {
+      f_string_static_t sources = f_string_static_t_initialize;
+      f_string_static_t sources_bash = f_string_static_t_initialize;
+      f_string_static_t sources_c = f_string_static_t_initialize;
+      f_string_static_t sources_cpp = f_string_static_t_initialize;
+      f_string_static_t sources_script = f_string_static_t_initialize;
+
+      fake_skeleton_path_source_length(main, &f_string_empty_s, &sources);
+      fake_skeleton_path_source_length(main, &fake_path_part_bash_s, &sources_bash);
+      fake_skeleton_path_source_length(main, &fake_path_part_c_s, &sources_c);
+      fake_skeleton_path_source_length(main, &fake_path_part_cpp_s, &sources_cpp);
+      fake_skeleton_path_source_length(main, &fake_path_part_script_s, &sources_script);
+
+      char sources_string[sources.used + 1];
+      char sources_bash_string[sources_bash.used + 1];
+      char sources_c_string[sources_c.used + 1];
+      char sources_cpp_string[sources_cpp.used + 1];
+      char sources_script_string[sources_script.used + 1];
+
+      sources.string = sources_string;
+      sources_bash.string = sources_bash_string;
+      sources_c.string = sources_c_string;
+      sources_cpp.string = sources_cpp_string;
+      sources_script.string = sources_script_string;
+
+      fake_skeleton_path_source_string(main, &f_string_empty_s, &sources);
+      fake_skeleton_path_source_string(main, &fake_path_part_bash_s, &sources_bash);
+      fake_skeleton_path_source_string(main, &fake_path_part_c_s, &sources_c);
+      fake_skeleton_path_source_string(main, &fake_path_part_cpp_s, &sources_cpp);
+      fake_skeleton_path_source_string(main, &fake_path_part_script_s, &sources_script);
+
+      const f_string_static_t *parameters_value[] = {
         &main->path_build,
         &main->path_data,
         &main->path_data_build,
@@ -28,9 +62,11 @@ extern "C" {
         &main->path_documents,
         &main->path_licenses,
         &main->path_sources,
-        &main->path_sources_bash,
-        &main->path_sources_c,
-        &main->path_sources_cpp,
+        &sources,
+        &sources_bash,
+        &sources_c,
+        &sources_cpp,
+        &sources_script,
         &main->path_work,
         &main->path_work_includes,
         &main->path_work_libraries,
@@ -41,9 +77,10 @@ extern "C" {
         &main->path_work_programs_script,
         &main->path_work_programs_shared,
         &main->path_work_programs_static,
+        &fake_path_part_specifications_s,
       };
 
-      for (uint8_t i = 0; i < 20; ++i) {
+      for (uint8_t i = 0; i < 23; ++i) {
 
         status = fake_skeleton_operate_directory_create(main, *parameters_value[i]);
 
@@ -53,6 +90,10 @@ extern "C" {
           return status;
         }
       } // for
+
+      if (main->output.verbosity == f_console_verbosity_verbose_e) {
+        fll_print_dynamic(f_string_eol_s, main->output.to.stream);
+      }
     }
 
     if (F_status_is_error_not(status)) {
@@ -90,13 +131,11 @@ extern "C" {
 #endif // _di_fake_skeleton_operate_
 
 #ifndef _di_fake_skeleton_operate_directory_create_
-  f_status_t fake_skeleton_operate_directory_create(fake_main_t * const main, const f_string_dynamic_t path) {
-
-    f_status_t status = F_none;
+  f_status_t fake_skeleton_operate_directory_create(fake_main_t * const main, const f_string_static_t path) {
 
     if (!path.used) return F_none;
 
-    status = f_directory_exists(path);
+    f_status_t status = f_directory_exists(path);
 
     if (status == F_true) {
       if (main->error.verbosity == f_console_verbosity_verbose_e) {
@@ -154,7 +193,7 @@ extern "C" {
 #endif // _di_fake_skeleton_operate_directory_create_
 
 #ifndef _di_fake_skeleton_operate_file_create_
-  f_status_t fake_skeleton_operate_file_create(fake_main_t * const main, const f_string_dynamic_t path, const bool executable, const f_string_static_t content) {
+  f_status_t fake_skeleton_operate_file_create(fake_main_t * const main, const f_string_static_t path, const bool executable, const f_string_static_t content) {
 
     f_status_t status = F_none;
 
@@ -240,6 +279,7 @@ extern "C" {
           fll_error_file_print(main->error, F_status_set_fine(status), "f_file_write", F_true, path, fake_common_file_populate_pre_s, fll_error_file_type_file_e);
 
           f_file_stream_close(F_true, &file);
+
           return status;
         }
 
@@ -260,6 +300,31 @@ extern "C" {
   }
 #endif // _di_fake_skeleton_operate_file_create_
 
+#ifndef _di_fake_skeleton_path_source_length_
+  void fake_skeleton_path_source_length(fake_main_t * const main, const f_string_static_t *partial, f_string_static_t * const source) {
+
+    source->used = main->path_sources.used + fake_default_path_sources_s.used + partial->used;
+  }
+#endif // _di_fake_skeleton_path_source_length_
+
+#ifndef _di_fake_skeleton_path_source_string_
+  void fake_skeleton_path_source_string(fake_main_t * const main, const f_string_static_t *partial, f_string_static_t * const source) {
+
+    source->used = 0;
+
+    memcpy(source->string, main->path_sources.string, main->path_sources.used);
+    source->used += main->path_sources.used;
+
+    memcpy(source->string, fake_default_path_sources_s.string, fake_default_path_sources_s.used);
+    source->used += fake_default_path_sources_s.used;
+
+    memcpy(source->string + source->used, partial->string, partial->used);
+    source->used += partial->used;
+
+    source->string[source->used] = 0;
+  }
+#endif // _di_fake_skeleton_path_source_string_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index c786b1a8b84970e946f5d93a71e48e5debc61bb6..cf5dc212ac65390b52686e472fe5dfd3858db1d3 100644 (file)
@@ -44,7 +44,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fake_skeleton_operate_directory_create_
-  extern f_status_t fake_skeleton_operate_directory_create(fake_main_t * const main, const f_string_dynamic_t path) F_attribute_visibility_internal_d;
+  extern f_status_t fake_skeleton_operate_directory_create(fake_main_t * const main, const f_string_static_t path) F_attribute_visibility_internal_d;
 #endif // _di_fake_skeleton_operate_directory_create_
 
 /**
@@ -67,9 +67,43 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fake_skeleton_operate_file_create_
-  extern f_status_t fake_skeleton_operate_file_create(fake_main_t * const main, const f_string_dynamic_t path, const bool executable, const f_string_static_t content) F_attribute_visibility_internal_d;
+  extern f_status_t fake_skeleton_operate_file_create(fake_main_t * const main, const f_string_static_t path, const bool executable, const f_string_static_t content) F_attribute_visibility_internal_d;
 #endif // _di_fake_skeleton_operate_file_create_
 
+/**
+ * Calculate the length of the sources path so that it can be used to manually construct a static string.
+ *
+ * @param main
+ *   The main program data.
+ * @param partial
+ *   The partial path string, such as "bash".
+ * @param source
+ *   The static string.
+ *   The path_sources.string is not expected to be defined at this point.
+ *   The path_sources.used is updated.
+ *   The path_sources.size is ignored.
+ */
+#ifndef _di_fake_skeleton_path_source_length_
+  extern void fake_skeleton_path_source_length(fake_main_t * const main, const f_string_static_t *partial, f_string_static_t * const source) F_attribute_visibility_internal_d;
+#endif // _di_fake_skeleton_path_source_length_
+
+/**
+ * Construct a static string array of the sources path.
+ *
+ * @param main
+ *   The main program data.
+ * @param partial
+ *   The partial path string, such as "bash".
+ * @param source
+ *   The static string.
+ *   The path_sources.string is expected to be defined and set to a size from path_sources.used + 1.
+ *   The path_sources.used is updated.
+ *   The path_sources.size is ignored.
+ */
+#ifndef _di_fake_skeleton_path_source_string_
+  extern void fake_skeleton_path_source_string(fake_main_t * const main, const f_string_static_t *partial, f_string_static_t * const source) F_attribute_visibility_internal_d;
+#endif // _di_fake_skeleton_path_source_string_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif