]> Kevux Git Server - fll/commitdiff
Progress: featureless make
authorKevin Day <thekevinday@gmail.com>
Sun, 17 May 2020 03:06:16 +0000 (22:06 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 17 May 2020 03:06:16 +0000 (22:06 -0500)
level_3/fake/c/fake.c
level_3/fake/c/fake.h
level_3/fake/c/private-build.c
level_3/fake/c/private-fake.c
level_3/fake/c/private-fake.h
level_3/fake/c/private-make.c
level_3/fake/data/build/settings

index 656ba06bb5536bfaee5d66c47b180706273d74da..8a778889f13379a1e4bd307654a11718f82c9c31 100644 (file)
@@ -330,7 +330,7 @@ extern "C" {
           fprintf(f_standard_error, "%c", f_string_eol);
         }
         else {
-          fprintf(f_standard_output, "%c", f_string_eol);
+          fprintf(f_standard_output, "%cAll operations complete.%c%c", f_string_eol, f_string_eol, f_string_eol);
         }
       }
     }
index ca20d8a4aa04d6685fa6bc66992fbc6899be32eb..447bd51526bcb208097302737deea54deccfea3e 100644 (file)
@@ -179,23 +179,23 @@ extern "C" {
   #define fake_path_part_sources   "sources"   f_path_separator
   #define fake_path_part_static    "static"    f_path_separator
 
-  #define fake_path_part_bash_length      (4 + f_path_separator_length)
-  #define fake_path_part_build_length     (5 + f_path_separator_length)
-  #define fake_path_part_c_length         (1 + f_path_separator_length)
-  #define fake_path_part_cpp_length       (3 + f_path_separator_length)
-  #define fake_path_part_data_length      (4 + f_path_separator_length)
-  #define fake_path_part_documents_length (9 + f_path_separator_length)
-  #define fake_path_part_includes_length  (8 + f_path_separator_length)
-  #define fake_path_part_libraries_length (9 + f_path_separator_length)
-  #define fake_path_part_licenses_length  (8 + f_path_separator_length)
-  #define fake_path_part_objects_length   (7 + f_path_separator_length)
-  #define fake_path_part_process_length   (7 + f_path_separator_length)
-  #define fake_path_part_programs_length  (8 + f_path_separator_length)
-  #define fake_path_part_script_length    (6 + f_path_separator_length)
-  #define fake_path_part_settings_length  (8 + f_path_separator_length)
-  #define fake_path_part_shared_length    (6 + f_path_separator_length)
-  #define fake_path_part_sources_length   (7 + f_path_separator_length)
-  #define fake_path_part_static_length    (6 + f_path_separator_length)
+  #define fake_path_part_bash_length      5
+  #define fake_path_part_build_length     6
+  #define fake_path_part_c_length         2
+  #define fake_path_part_cpp_length       4
+  #define fake_path_part_data_length      5
+  #define fake_path_part_documents_length 10
+  #define fake_path_part_includes_length  9
+  #define fake_path_part_libraries_length 10
+  #define fake_path_part_licenses_length  9
+  #define fake_path_part_objects_length   8
+  #define fake_path_part_process_length   8
+  #define fake_path_part_programs_length  9
+  #define fake_path_part_script_length    7
+  #define fake_path_part_settings_length  9
+  #define fake_path_part_shared_length    7
+  #define fake_path_part_sources_length   8
+  #define fake_path_part_static_length    7
 #endif // _di_fake_path_
 
 #ifndef _di_fake_file_
@@ -223,9 +223,9 @@ extern "C" {
   #define fake_default_path_sources "sources" f_path_separator
   #define fake_default_path_work    ""
 
-  #define fake_default_path_build_length   (5 + f_path_separator_length)
-  #define fake_default_path_data_length    (4 + f_path_separator_length)
-  #define fake_default_path_sources_length (7 + f_path_separator_length)
+  #define fake_default_path_build_length   6
+  #define fake_default_path_data_length    5
+  #define fake_default_path_sources_length 8
   #define fake_default_path_work_length    0
 
   #define fake_default_defines  ""
index 5897e3b0192ad71ec1727584be2dc896c8969cd7..8afe26bce8c55e4facddf648e0fba520d181773b 100644 (file)
@@ -154,9 +154,96 @@ extern "C" {
     }
 
     {
+      f_string_dynamics environment_names = f_string_dynamics_initialize;
+      f_string_dynamics environment_values = f_string_dynamics_initialize;
+
+      // @todo add support for allowing specific environment variables
+      const f_string variables_name[] = {
+        f_path_environment,
+        f_path_present_working
+      };
+
+      const f_string_length variables_length[] = {
+        f_path_environment_length,
+        f_path_present_working_length
+      };
+
+      f_string_dynamic variable_name = f_string_dynamic_initialize;
+      f_string_dynamic variable_value = f_string_dynamic_initialize;
+
+      for (uint8_t i = 0; i < 2; i++) {
+        status = f_environment_get(variables_name[i], &variable_value);
+        if (f_status_is_error(status)) {
+          status = f_status_set_fine(status);
+
+          if (status == f_error_reallocation) {
+            fake_print_error(data.context, data.verbosity, status, "f_environment_get", f_true);
+
+            f_macro_string_dynamic_delete_simple(variable_name);
+            f_macro_string_dynamic_delete_simple(variable_value);
+            f_macro_string_dynamic_delete_simple(path);
+            f_macro_string_dynamics_delete_simple(environment_names);
+            f_macro_string_dynamics_delete_simple(environment_values);
+            f_macro_string_dynamics_delete_simple(arguments);
+            return status;
+          }
+        }
+
+        if (environment_names.used + 1 > environment_names.size) {
+          f_macro_string_dynamics_resize(status, environment_names, environment_names.size + f_memory_default_allocation_step);
+
+          if (!f_status_is_error(status)) {
+            f_macro_string_dynamics_resize(status, environment_values, environment_values.size + f_memory_default_allocation_step);
+          }
+
+          if (f_status_is_error(status)) {
+            fake_print_error(data.context, data.verbosity, status, "f_macro_string_dynamics_resize", f_true);
+
+            f_macro_string_dynamic_delete_simple(variable_name);
+            f_macro_string_dynamic_delete_simple(variable_value);
+            f_macro_string_dynamic_delete_simple(path);
+            f_macro_string_dynamics_delete_simple(environment_names);
+            f_macro_string_dynamics_delete_simple(environment_values);
+            f_macro_string_dynamics_delete_simple(arguments);
+            return status;
+          }
+        }
+
+        status = fl_string_append(variables_name[i], variables_length[i], &variable_name);
+
+        if (f_status_is_error(status)) {
+          fake_print_error(data.context, data.verbosity, status, "fl_string_append", f_true);
+
+          f_macro_string_dynamic_delete_simple(variable_name);
+          f_macro_string_dynamic_delete_simple(variable_value);
+          f_macro_string_dynamic_delete_simple(path);
+          f_macro_string_dynamics_delete_simple(environment_names);
+          f_macro_string_dynamics_delete_simple(environment_values);
+          f_macro_string_dynamics_delete_simple(arguments);
+          return status;
+        }
+
+        environment_names.array[environment_names.used].string = variable_name.string;
+        environment_names.array[environment_names.used].used = variable_name.used;
+        environment_names.array[environment_names.used].size = variable_name.size;
+        environment_names.used++;
+
+        environment_values.array[environment_values.used].string = variable_value.string;
+        environment_values.array[environment_values.used].used = variable_value.used;
+        environment_values.array[environment_values.used].size = variable_value.size;
+        environment_values.used++;
+
+        f_macro_string_dynamic_clear(variable_name);
+        f_macro_string_dynamic_clear(variable_value);
+      }
+
       int result = 0;
 
-      status = fll_execute_path(path.string, arguments, &result);
+      status = fll_execute_path_environment(path.string, arguments, environment_names, environment_values, &result);
+
+      f_macro_string_dynamics_delete_simple(environment_names);
+      f_macro_string_dynamics_delete_simple(environment_values);
+      f_macro_string_dynamics_delete_simple(arguments);
     }
 
     if (f_status_is_error(status)) {
@@ -169,12 +256,11 @@ extern "C" {
         }
       }
       else {
-        fake_print_error(data.context, data.verbosity, f_status_set_fine(status), "fll_execute_path", f_true);
+        fake_print_error(data.context, data.verbosity, f_status_set_fine(status), "fll_execute_path_environment", f_true);
       }
     }
 
     f_macro_string_dynamic_delete_simple(path);
-    f_macro_string_dynamics_delete_simple(arguments);
 
     return status;
   }
@@ -182,6 +268,11 @@ extern "C" {
 
 #ifndef _di_fake_build_operate_
   f_return_status fake_build_operate(const fake_data data) {
+    if (data.verbosity != fake_verbosity_quiet) {
+      printf("%c", f_string_eol);
+      fl_color_print_line(f_standard_output, data.context.important, data.context.reset, "Building project.");
+    }
+
     f_status status = f_none;
     fake_build_settings settings = fake_build_settings_initialize;
 
index 51b5d4b1e3d6a88638997a5dd47a029ea9913922..2243032ab5dd3496b92f32904c2cf3127e0e00e0 100644 (file)
@@ -398,11 +398,11 @@ extern "C" {
 #endif // _di_fake_path_generate_
 
 #ifndef _di_fake_path_generate_string_dynamic_
-  f_return_status fake_path_generate_string_dynamic(fake_data *data, const f_string_dynamic source, f_string_dynamic *value[], const uint8_t length) {
+  f_return_status fake_path_generate_string_dynamic(fake_data *data, const f_string_dynamic source, f_string_dynamic *destination[], const uint8_t length) {
     f_status status = f_none;
 
     for (uint8_t i = 0; i < length; i++) {
-      status = fl_string_dynamic_append_nulless(source, value[i]);
+      status = fl_string_dynamic_append_nulless(source, destination[i]);
       if (f_status_is_error(status)) return status;
     } // for
 
@@ -469,7 +469,7 @@ extern "C" {
     if (status == f_invalid_parameter) {
       if (verbosity != fake_verbosity_quiet) {
         fprintf(f_standard_error, "%c", f_string_eol);
-        fl_color_print(f_standard_error, context.error, context.reset, "INTERNAL ERROR: Invalid parameter when calling ", function, name);
+        fl_color_print(f_standard_error, context.error, context.reset, "INTERNAL ERROR: Invalid parameter when calling ");
         fl_color_print(f_standard_error, context.notable, context.reset, "%s", function);
         fl_color_print(f_standard_error, context.error, context.reset, "() for the %s '", file_or_directory);
         fl_color_print(f_standard_error, context.notable, context.reset, "%s", name);
@@ -689,7 +689,7 @@ extern "C" {
           }
 
           f_string_length location = data->parameters[parameters_id[i]].additional.array[0];
-          f_string_length length = strnlen(arguments.argv[location], f_console_max_size);
+          f_string_length length = strnlen(arguments.argv[location], f_console_length_size);
 
           if (length > 0) {
             status = fl_string_append(arguments.argv[location], length, parameters_value[i]);
index 82692be053d8e0d2a050a2d39882182bed3788aa..f22f5b942e3b3dbd1c29b844f1c57279d57f7a65 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
  *   The program data.
  * @param source
  *   The string to copy from.
- * @param value
+ * @param destination
  *   An array of pointers to the strings to append onto.
  * @param length
  *   The size of the values.
@@ -43,7 +43,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fake_path_generate_string_dynamic_
-  extern f_return_status fake_path_generate_string_dynamic(fake_data *data, const f_string_dynamic source, f_string_dynamic *value[], const uint8_t size) f_gcc_attribute_visibility_internal;
+  extern f_return_status fake_path_generate_string_dynamic(fake_data *data, const f_string_dynamic source, f_string_dynamic *destination[], const uint8_t size) f_gcc_attribute_visibility_internal;
 #endif // _di_fake_path_generate_string_dynamic_
 
 /**
index ff48fa674d609c2ca0b599e856b17ad4108486dc..cc70223da20ce48199badb47aa716af356446abe 100644 (file)
@@ -6,7 +6,6 @@
 extern "C" {
 #endif
 
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 7a7f600c30548e09625bd03f2b359ceb7878336f..e9c26eccde84bd3a9568b695a830d59f0a972b62 100644 (file)
@@ -16,10 +16,10 @@ modes_default individual
 build_compiler gcc
 build_linker ar
 build_libraries -lc
-build_libraries_fll -lfll_program -lfll_fss -lfll_execute -lfl_utf -lfl_string -lfl_file -lfl_fss -lfl_directory -lfl_console -lfl_color -lf_utf -lf_print -lf_environment -lf_file -lf_conversion -lf_console -lf_memory
+build_libraries_fll -lfll_program -lfll_fss -lfll_execute -lfl_utf -lfl_string -lfl_file -lfl_fss -lfl_directory -lfl_console -lfl_color -lf_utf -lf_print -lf_path -lf_environment -lf_file -lf_conversion -lf_console -lf_memory
 build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0
 build_libraries_fll-monolithic -lfll
-build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lfl_utf -lfl_string -lfl_file -lfl_fss -lfl_directory -lfl_console -lfl_color -lf_utf -lf_print -lf_environment -lf_file -lf_conversion -lf_console -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lfl_utf -lfl_string -lfl_file -lfl_fss -lfl_directory -lfl_console -lfl_color -lf_utf -lf_print -lf_path -lf_environment -lf_file -lf_conversion -lf_console -lf_memory
 build_libraries-level -lfll_2 -lfll_1 -lfll_0
 build_libraries-monolithic -lfll
 build_sources_library fake.c private-fake.c private-clean.c private-build.c private-make.c private-skeleton.c