]> Kevux Git Server - fll/commitdiff
Progress: featureless make.
authorKevin Day <thekevinday@gmail.com>
Sat, 18 Jul 2020 05:08:58 +0000 (00:08 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 19 Jul 2020 03:00:49 +0000 (22:00 -0500)
Finish implementing the return code processing.

Allow the return failure strategy to be tweaked via the setting 'fail' which can have one of the following:
- exit: exit program on failure.
- warn: do not exit and if in verbose mode, print warning.
- ignore: do nothing.

The reserved parameter variable "return" is populated with the return result value.
For example, you can see the return result by adding the following after a run, shell, or similar operation:
  print Return Code is parameter:"return"

Add some additional warnings when loading settings.

level_3/fake/c/fake.h
level_3/fake/c/private-build.h
level_3/fake/c/private-make.c
level_3/fake/c/private-make.h
level_3/fake/c/private-print.c
level_3/fake/c/private-print.h
level_3/fake/data/build/fakefile

index 99f12d6b6e99ca04aff0191f07c0f176264dfd3d..8621bf89b19633467e5b0c10ea52f75563d3758f 100644 (file)
@@ -64,6 +64,7 @@
 // fll-1 includes
 #include <level_1/color.h>
 #include <level_1/console.h>
+#include <level_1/conversion.h>
 #include <level_1/directory.h>
 #include <level_1/iki.h>
 #include <level_1/string.h>
index 207cccbe265112608883cf0f808b0257fa4be8f1..50a14a2614dc160d8c87f744b33ac9754261166a 100644 (file)
@@ -436,6 +436,8 @@ extern "C" {
  *
  * @param data
  *   The program data.
+ * @param data_build
+ *   The build data.
  * @param program
  *   The program to be executed.
  * @param arguments
index cbbbf72ad2c078d628b3f50fac7ce863e759ff36..ef2d797c28776b94cc572658c0ea99f1f002b396 100644 (file)
@@ -209,9 +209,11 @@ extern "C" {
 
       data_make->setting_make.parameter.array[0].value.used = 1;
       data_make->setting_make.load_build = F_true;
+      data_make->setting_make.fail = fake_make_operation_fail_type_exit;
 
       if (settings.objects.used) {
         bool unmatched_load = F_true;
+        bool unmatched_fail = F_true;
 
         for (f_array_length i = 0; i < settings.objects.used; i++) {
           if (fl_string_dynamic_partial_compare_string(fake_make_setting_load_build, data_make->buffer, fake_make_setting_load_build_length, settings.objects.array[i]) == F_equal_to) {
@@ -228,16 +230,49 @@ extern "C" {
                 }
 
                 unmatched_load = F_false;
-              }
 
-              if (settings.contents.array[i].used > 1) {
-                fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_load_build);
+                if (settings.contents.array[i].used > 1) {
+                  fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_load_build);
+                }
+              }
+              else {
+                fake_print_error_fakefile_settings_content_empty(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings);
               }
             }
             else {
               fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_load_build);
             }
           }
+          else if (fl_string_dynamic_partial_compare_string(fake_make_setting_fail, data_make->buffer, fake_make_setting_fail_length, settings.objects.array[i]) == F_equal_to) {
+            if (unmatched_fail) {
+              if (settings.contents.array[i].used) {
+                if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_exit, data_make->buffer, fake_make_operation_argument_exit_length, settings.contents.array[i].array[0]) == F_equal_to) {
+                  data_make->setting_make.fail = fake_make_operation_fail_type_exit;
+                }
+                else if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_warn, data_make->buffer, fake_make_operation_argument_warn_length, settings.contents.array[i].array[0]) == F_equal_to) {
+                  data_make->setting_make.fail = fake_make_operation_fail_type_warn;
+                }
+                else if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_ignore, data_make->buffer, fake_make_operation_argument_ignore_length, settings.contents.array[i].array[0]) == F_equal_to) {
+                  data_make->setting_make.fail = fake_make_operation_fail_type_ignore;
+                }
+                else {
+                  fake_print_error_fakefile_settings_content_invalid(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], settings.contents.array[i].array[0], fake_make_section_settings);
+                }
+
+                if (settings.contents.array[i].used > 1) {
+                  fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_fail);
+                }
+
+                unmatched_fail = F_false;
+              }
+              else {
+                fake_print_error_fakefile_settings_content_empty(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings);
+              }
+            }
+            else {
+              fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_fail);
+            }
+          }
           else if (fl_string_dynamic_partial_compare_string(fake_make_setting_parameter, data_make->buffer, fake_make_setting_parameter_length, settings.objects.array[i]) == F_equal_to) {
             if (settings.contents.array[i].used) {
               if (fl_string_dynamic_partial_compare_string(fake_make_setting_return, data_make->buffer, fake_make_setting_return_length, settings.contents.array[i].array[0]) == F_equal_to) {
@@ -271,6 +306,9 @@ extern "C" {
                 }
               }
             }
+            else {
+              fake_print_error_fakefile_settings_content_empty(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], fake_make_section_settings);
+            }
           }
         } // for
       }
@@ -373,8 +411,6 @@ extern "C" {
 
     f_macro_mode_set_default_umask(mode, data.umask);
 
-    data_make.fail = fake_make_operation_fail_type_exit;
-
     fake_make_load_fakefile(data, &data_make, &status);
 
     fake_make_operate_section(data, data_make.main, &data_make, &list_stack, &status);
@@ -823,7 +859,7 @@ extern "C" {
       }
 
       if (F_status_is_fine(*status)) {
-        fake_make_operate_perform(data, section->name, operation, *operation_name, arguments[i], operation_if, data_make, status);
+        fake_make_operate_process(data, section->name, operation, *operation_name, arguments[i], operation_if, data_make, status);
       }
 
       if (F_status_is_error(*status)) {
@@ -838,8 +874,8 @@ extern "C" {
   }
 #endif // _di_fake_make_operate_section_
 
-#ifndef _di_fake_make_operate_perform_
-  void fake_make_operate_perform(const fake_data data, const f_string_range section_name, const uint8_t operation, const f_string_static operation_name, const f_string_dynamics arguments, const uint8_t operation_if, fake_make_data *data_make, f_status *status) {
+#ifndef _di_fake_make_operate_process_
+  void fake_make_operate_process(const fake_data data, const f_string_range section_name, const uint8_t operation, const f_string_static operation_name, const f_string_dynamics arguments, const uint8_t operation_if, fake_make_data *data_make, f_status *status) {
     if (F_status_is_error(*status)) return;
 
     if (operation == fake_make_operation_type_archive) {
@@ -853,14 +889,14 @@ extern "C" {
     if (operation == fake_make_operation_type_build) {
       *status = fake_build_operate(data);
 
-      fake_make_operate_perform_process_return(data, 0, data_make, status);
+      fake_make_operate_process_return(data, 0, data_make, status);
       return;
     }
 
     if (operation == fake_make_operation_type_clean) {
       *status = fake_clean_operate(data);
 
-      fake_make_operate_perform_process_return(data, 0, data_make, status);
+      fake_make_operate_process_return(data, 0, data_make, status);
       return;
     }
 
@@ -989,19 +1025,19 @@ extern "C" {
     }
 
     if (operation == fake_make_operation_type_run) {
-      *status = fake_make_operation_process_run(data, *data_make, arguments, F_false);
+      *status = fake_make_operate_process_run(data, arguments, F_false, data_make);
       return;
     }
 
     if (operation == fake_make_operation_type_shell) {
-      *status = fake_make_operation_process_run(data, *data_make, arguments, F_true);
+      *status = fake_make_operate_process_run(data, arguments, F_true, data_make);
       return;
     }
 
     if (operation == fake_make_operation_type_skeleton) {
       *status = fake_skeleton_operate(data);
 
-      fake_make_operate_perform_process_return(data, 0, data_make, status);
+      fake_make_operate_process_return(data, 0, data_make, status);
       return;
     }
 
@@ -1105,65 +1141,139 @@ extern "C" {
       return;
     }
   }
-#endif // _di_fake_make_operate_perform_
+#endif // _di_fake_make_operate_process_
 
-#ifndef _di_fake_make_operate_perform_process_return_
-  void fake_make_operate_perform_process_return(const fake_data data, const f_number_signed return_code, fake_make_data *data_make, f_status *status) {
-    f_status status2 = F_none;
+#ifndef _di_fake_make_operate_process_execute_
+  f_return_status fake_make_operate_process_execute(const fake_data data, const f_string_static program, const f_string_statics arguments, const bool as_shell, fake_make_data *data_make) {
 
-    // @todo: assiging the return status should be moved to a function.
-    data_make->setting_make.parameter.array[0].value.array[0].used = 0;
+    if (data.verbosity == fake_verbosity_verbose) {
+      printf("%s", program.string);
+
+      for (f_array_length i = 0; i < arguments.used; i++) {
+        if (arguments.array[i].used == 0) continue;
 
-    if (F_status_is_error(*status)) {
-      // @todo: convert F_status_set_fine(*status) to a string and assign that instead of 1. (need a convert function from llu to string.)
-      status2 = fl_string_append("1", 1, &data_make->setting_make.parameter.array[0].value.array[0]);
+        printf(" %s", arguments.array[i].string);
+      } // for
+
+      printf("%c", f_string_eol[0]);
 
-      // fake_print_error_fakefile_path_stack(data, F_status_set_fine(*status), "fake_clean_operate", data_make.buffer, section_name, operation_range, arguments.array[0].string);
+      // flush to stdout before executing command.
+      fflush(f_type_output);
+    }
+
+    int result = 0;
+    f_status status = F_none;
+
+    if (as_shell) {
+      status = fll_execute_path_environment(program.string, arguments, data_make->environment.names, data_make->environment.values, &result);
     }
     else {
-      // @todo: convert return_code to a string and assign that instead of 0. (need a convert function from llu to string.)
-      status2 = fl_string_append("0", 1, &data_make->setting_make.parameter.array[0].value.array[0]);
-      if (F_status_is_error(status2)) {
-        *status = status2;
-        // @todo print error.
-      }
+      status = fll_execute_program_environment(program.string, arguments, data_make->environment.names, data_make->environment.values, &result);
     }
 
-    if (F_status_is_fine(status2)) {
-      status2 = fl_string_dynamic_terminate_after(&data_make->setting_make.parameter.array[0].value.array[0]);
-      if (F_status_is_error(status2)) {
-        *status = status2;
-        // @todo print error.
+    if (F_status_is_error(status)) {
+      if (F_status_set_fine(status) == F_file_found_not) {
+        if (data.verbosity != fake_verbosity_quiet) {
+          fprintf(f_type_error, "%c", f_string_eol[0]);
+          fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: failed to find program '");
+          fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", program.string);
+          fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' for executing.");
+        }
+      }
+      else if (F_status_set_fine(status) != F_failure) {
+        fake_print_error(data, F_status_set_fine(status), "fll_execute_program_environment", F_true);
       }
     }
+
+    fake_make_operate_process_return(data, result, data_make, &status);
+
+    return status;
   }
-#endif // _di_fake_make_operate_perform_process_return_
+#endif // _di_fake_make_operate_process_execute_
 
-#ifndef _di_fake_make_operation_process_run_
-  f_return_status fake_make_operation_process_run(const fake_data data, const fake_make_data data_make, const f_string_statics arguments, const bool as_shell) {
+#ifndef _di_fake_make_operate_process_return_
+  void fake_make_operate_process_return(const fake_data data, const int return_code, fake_make_data *data_make, f_status *status) {
+    f_status status2 = F_none;
 
-    if (data.verbosity == fake_verbosity_verbose) {
-      for (f_array_length i = 0; i < arguments.used; i++) {
-        if (arguments.array[i].used == 0) continue;
+    data_make->setting_make.parameter.array[0].value.array[0].used = 0;
+
+    if (return_code == 0) {
+      if (F_status_is_error(*status)) {
+        status2 = fl_string_append("1", 1, &data_make->setting_make.parameter.array[0].value.array[0]);
+      }
+      else {
+        status2 = fl_string_append("0", 1, &data_make->setting_make.parameter.array[0].value.array[0]);
+      }
+    }
+    else {
+      if (return_code) {
+        f_string_dynamic number = f_string_dynamic_initialize;
 
-        printf("%s", arguments.array[i].string);
+        status2 = f_conversion_number_signed_to_string(return_code, 10, &number);
+        if (F_status_is_error(status2)) {
+          *status = status2;
 
-        if (i + 1 < arguments.used) {
-          printf(" ");
+          fake_print_error(data, F_status_set_fine(*status), "f_conversion_number_signed_to_string", F_true);
+
+          f_macro_string_dynamic_delete_simple(number);
+          return;
         }
-      } // for
 
-      printf("%c", f_string_eol[0]);
+        status2 = fl_string_dynamic_append(number, &data_make->setting_make.parameter.array[0].value.array[0]);
 
-      // flush to stdout before executing command.
-      fflush(f_type_output);
+        f_macro_string_dynamic_delete_simple(number);
+      }
+      else {
+        status2 = fl_string_append("0", 1, &data_make->setting_make.parameter.array[0].value.array[0]);
+      }
     }
 
-    const f_string_static *program = &arguments.array[0];
+    if (F_status_is_error(status2)) {
+      *status = status2;
 
-    f_string_dynamics args = f_string_dynamics_initialize;
+      fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true);
+      return;
+    }
+
+    status2 = fl_string_dynamic_terminate_after(&data_make->setting_make.parameter.array[0].value.array[0]);
+    if (F_status_is_error(status2)) {
+      *status = status2;
+
+      fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true);
+      return;
+    }
+
+    if (data_make->setting_make.fail == fake_make_operation_fail_type_exit) {
+      if (data.verbosity != fake_verbosity_quiet) {
+        fprintf(f_type_error, "%c", f_string_eol[0]);
+        fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Failed with return code '");
+        fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", data_make->setting_make.parameter.array[0].value.array[0].string);
+        fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'.");
+      }
+
+      *status = F_status_set_error(F_failure);
+      return;
+    }
+
+    *status = F_none;
+
+    if (data_make->setting_make.fail == fake_make_operation_fail_type_warn) {
+      if (data.verbosity == fake_verbosity_verbose) {
+        fprintf(f_type_warning, "%c", f_string_eol[0]);
+        fl_color_print(f_type_warning, data.context.warning, data.context.reset, "WARNING: Failed with return code '");
+        fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", data_make->setting_make.parameter.array[0].value.array[0].string);
+        fl_color_print_line(f_type_warning, data.context.warning, data.context.reset, "'.");
+      }
+    }
+  }
+#endif // _di_fake_make_operate_process_return_
+
+#ifndef _di_fake_make_operate_process_run_
+  f_return_status fake_make_operate_process_run(const fake_data data, const f_string_statics arguments, const bool as_shell, fake_make_data *data_make) {
+    const f_string_static *program = &arguments.array[0];
 
     f_status status = F_none;
+    f_string_dynamics args = f_string_dynamics_initialize;
 
     f_macro_string_dynamics_new(status, args, arguments.used - 1);
     if (F_status_is_error(status)) {
@@ -1191,37 +1301,13 @@ extern "C" {
       args.used++;
     } // for
 
-    int result = 0;
-
-    if (as_shell) {
-      status = fll_execute_path_environment(program->string, args, data_make.environment.names, data_make.environment.values, &result);
-    }
-    else {
-      status = fll_execute_program_environment(program->string, args, data_make.environment.names, data_make.environment.values, &result);
-    }
+    status = fake_make_operate_process_execute(data, *program, args, as_shell, data_make);
 
     f_macro_string_dynamics_delete_simple(args);
 
-    if (result != 0) {
-      status = F_status_set_error(F_failure);
-    }
-    else if (F_status_is_error(status)) {
-      if (F_status_set_fine(status) == F_file_found_not) {
-        if (data.verbosity != fake_verbosity_quiet) {
-          fprintf(f_type_error, "%c", f_string_eol[0]);
-          fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: failed to find program '");
-          fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", program->string);
-          fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' for executing.");
-        }
-      }
-      else {
-        fake_print_error(data, F_status_set_fine(status), "fll_execute_program_environment", F_true);
-      }
-    }
-
     return status;
   }
-#endif // _di_fake_make_operation_process_run_
+#endif // _di_fake_make_operate_process_run_
 
 #ifndef _di_fake_make_operate_validate_
   void fake_make_operate_validate(const fake_data data, const f_string_range section_name, const f_array_length operation, const f_string_static operation_name, const fake_make_data data_make, const f_string_dynamics arguments, const uint8_t operation_if, f_status *status) {
index c3b73e63ca192af4f4e483d94284fbd223416eaf..f57329651b029e3187966d6feb040369a3ab09b7 100644 (file)
@@ -27,12 +27,15 @@ extern "C" {
   typedef struct {
     bool load_build;
 
+    uint8_t fail;
+
     f_string_map_multis define;
     f_string_map_multis parameter;
   } fake_make_setting;
 
   #define fake_make_setting_initialize { \
     0, \
+    0, \
     f_string_map_multis_initialize, \
     f_string_map_multis_initialize, \
   }
@@ -42,16 +45,16 @@ extern "C" {
     f_macro_string_map_multis_delete_simple(setting.parameter)
 
   #define fake_make_setting_define     "define"
+  #define fake_make_setting_fail       "fail"
   #define fake_make_setting_load_build "load_build"
   #define fake_make_setting_parameter  "parameter"
   #define fake_make_setting_return     "return"
 
   #define fake_make_setting_define_length     6
+  #define fake_make_setting_fail_length       4
   #define fake_make_setting_load_build_length 10
   #define fake_make_setting_parameter_length  9
   #define fake_make_setting_return_length     6
-
-  #define fake_make_setting_total 3
 #endif // _di_fake_make_setting_
 
 // @todo "operate" should use a call stack, but do not allow recursive calls (check to see if named operation is already on the call stack).
@@ -135,6 +138,7 @@ extern "C" {
   #define fake_make_operation_argument_file      "file"
   #define fake_make_operation_argument_directory "directory"
   #define fake_make_operation_argument_error     "error"
+  #define fake_make_operation_argument_exit      "exit"
   #define fake_make_operation_argument_ignore    "ignore"
   #define fake_make_operation_argument_point     "point"
   #define fake_make_operation_argument_recursive "recursive"
@@ -144,6 +148,7 @@ extern "C" {
   #define fake_make_operation_argument_file_length      4
   #define fake_make_operation_argument_directory_length 9
   #define fake_make_operation_argument_error_length     5
+  #define fake_make_operation_argument_exit_length      4
   #define fake_make_operation_argument_ignore_length    6
   #define fake_make_operation_argument_point_length     5
   #define fake_make_operation_argument_recursive_length 9
@@ -276,8 +281,6 @@ extern "C" {
     f_string_dynamic path_cache;
 
     f_array_length main;
-
-    uint8_t fail;
   } fake_make_data;
 
   #define fake_make_data_initialize { \
@@ -290,7 +293,6 @@ extern "C" {
     f_string_dynamic_initialize, \
     f_string_dynamic_initialize, \
     0, \
-    0, \
   }
 
   #define fake_macro_make_data_delete_simple(data) \
@@ -436,9 +438,31 @@ extern "C" {
  *
  *   Status codes (with error bit) are returned on any problem.
  */
-#ifndef _di_fake_make_operate_perform_
-  extern void fake_make_operate_perform(const fake_data data, const f_string_range section_name, const uint8_t operation, const f_string_static operation_name, const f_string_dynamics arguments, const uint8_t operation_if, fake_make_data *data_make, f_status *status) f_gcc_attribute_visibility_internal;
-#endif // _di_fake_make_operate_perform_
+#ifndef _di_fake_make_operate_process_
+  extern void fake_make_operate_process(const fake_data data, const f_string_range section_name, const uint8_t operation, const f_string_static operation_name, const f_string_dynamics arguments, const uint8_t operation_if, fake_make_data *data_make, f_status *status) f_gcc_attribute_visibility_internal;
+#endif // _di_fake_make_operate_process_
+
+/**
+ * Execute either the run operation or the shell operation.
+ *
+ * @param data
+ *   The program data.
+ * @param program
+ *   The program to be executed.
+ * @param arguments
+ *   The arguments for the run or shell operation.
+ * @param as_shell
+ *   When TRUE, this is a shell operation.
+ *   When FALSE, this is a run operation.
+ * @param data_make
+ *   All make related setting data, including data from the fakefile and optionally build settings file.
+ *
+ * @return
+ *   Status codes (with error bit) are returned on any problem.
+ */
+#ifndef _di_fake_make_operate_process_execute_
+  extern f_return_status fake_make_operate_process_execute(const fake_data data, const f_string_static program, const f_string_statics arguments, const bool as_shell, fake_make_data *data_make) f_gcc_attribute_visibility_internal;
+#endif // _di_fake_make_operate_process_execute_
 
 /**
  * Handle the return code, converting it to a number.
@@ -452,29 +476,29 @@ extern "C" {
  *
  *   Status codes (with error bit) are returned on any problem.
  */
-#ifndef _di_fake_make_operate_perform_process_return_
-  extern void fake_make_operate_perform_process_return(const fake_data data, const f_number_signed return_code, fake_make_data *data_make, f_status *status) f_gcc_attribute_visibility_internal;
-#endif // _di_fake_make_operate_perform_process_return_
+#ifndef _di_fake_make_operate_process_return_
+  extern void fake_make_operate_process_return(const fake_data data, const int return_code, fake_make_data *data_make, f_status *status) f_gcc_attribute_visibility_internal;
+#endif // _di_fake_make_operate_process_return_
 
 /**
  * Execute either the run operation or the shell operation.
  *
  * @param data
  *   The program data.
- * @param data_make
- *   All make related setting data, including data from the fakefile and optionally build settings file.
  * @param arguments
  *   The arguments for the run or shell operation.
  * @param as_shell
  *   When TRUE, this is a shell operation.
  *   When FALSE, this is a run operation.
+ * @param data_make
+ *   All make related setting data, including data from the fakefile and optionally build settings file.
  *
  * @return
  *   Status codes (with error bit) are returned on any problem.
  */
-#ifndef _di_fake_make_operation_process_run_
-  extern f_return_status fake_make_operation_process_run(const fake_data data, const fake_make_data data_make, const f_string_statics arguments, const bool as_shell) f_gcc_attribute_visibility_internal;
-#endif // _di_fake_make_operation_process_run_
+#ifndef _di_fake_make_operate_process_run_
+  extern f_return_status fake_make_operate_process_run(const fake_data data, const f_string_statics arguments, const bool as_shell, fake_make_data *data_make) f_gcc_attribute_visibility_internal;
+#endif // _di_fake_make_operate_process_run_
 
 /**
  * For a given make section operation, validate the given operation.
index 413950f0b4ddde38c2b724c8f549ba44fa0bdda0..cab4fc2c5d91264c06be103d689f77e7dbb7106e 100644 (file)
@@ -391,6 +391,26 @@ extern "C" {
   }
 #endif // _di_fake_print_error_fakefile_section_operation_unknown_
 
+#ifndef _di_fake_print_error_fakefile_settings_content_empty_
+  void fake_print_error_fakefile_settings_content_empty(const fake_data data, const f_string path_file, const f_string_dynamic buffer, const f_string_range range_object, const f_string settings_name) {
+    if (data.verbosity != fake_verbosity_verbose) return;
+
+    fprintf(f_type_error, "%c", f_string_eol[0]);
+
+    fl_color_print(f_type_warning, data.context.warning, data.context.reset, "WARNING: the fakefile '");
+    fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", path_file);
+    fl_color_print(f_type_warning, data.context.warning, data.context.reset, "' has empty content for the '");
+    fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", settings_name);
+    fl_color_print(f_type_warning, data.context.warning, data.context.reset, "' object '");
+
+    fl_color_print_code(f_type_warning, data.context.notable);
+    f_print_string_dynamic_partial(f_type_warning, buffer, range_object);
+    fl_color_print_code(f_type_warning, data.context.reset);
+
+    fl_color_print_line(f_type_warning, data.context.warning, data.context.reset, "'.");
+  }
+#endif // _di_fake_print_error_fakefile_settings_content_empty_
+
 #ifndef _di_fake_print_error_fakefile_settings_content_invalid_
   void fake_print_error_fakefile_settings_content_invalid(const fake_data data, const f_string path_file, const f_string_dynamic buffer, const f_string_range range_object, const f_string_range range_content, const f_string settings_name) {
     if (data.verbosity != fake_verbosity_verbose) return;
index f76bb82ae12f04f4286b03e66c2f91e774c2e896..9211a7bf220775d1d53cc4aa1f8942503cd9d968 100644 (file)
@@ -149,6 +149,24 @@ extern "C" {
 #endif // _di_fake_print_error_fakefile_section_operation_unknown_
 
 /**
+ * Print error message when fake settings content is empty.
+ *
+ * @param data
+ *   The program data.
+ * @param path_file
+ *   The path to the fakefile.
+ * @param buffer
+ *   The buffer containing the loaded file content.
+ * @param range_object
+ *   The range within the buffer representing the object.
+ * @param settings_name
+ *   The name of the setting that has an invalid value.
+ */
+#ifndef _di_fake_print_error_fakefile_settings_content_empty_
+  extern void fake_print_error_fakefile_settings_content_empty(const fake_data data, const f_string path_file, const f_string_dynamic buffer, const f_string_range range_object, const f_string settings_name) f_gcc_attribute_visibility_internal;
+#endif // _di_fake_print_error_fakefile_settings_content_empty_
+
+/**
  * Print error message when fake settings content is invalid.
  *
  * @param data
index 788852de9682e18d01f01879cc427d10374cba43..9e3836c7dc3855f5192deeac986c003a1937f4ef 100644 (file)
@@ -2,8 +2,9 @@
 
 settings:
   load_build yes
+  fail exit
 
-  parameter verbose +v
+  parameter verbose +V
 
 main: