]> Kevux Git Server - fll/commitdiff
Progress: Continue program related work and make f_console related changes.
authorKevin Day <kevin@kevux.org>
Mon, 23 Jan 2023 05:16:55 +0000 (23:16 -0600)
committerKevin Day <kevin@kevux.org>
Mon, 23 Jan 2023 05:16:55 +0000 (23:16 -0600)
Work on fake and then focus on the relating console changes.

I imported the recent bugfix regarding console arguments (ccd15d4e64848f29d36823ca92ee639057f544b7).
I opted to just copy and paste and then re-convert to the latest practice.
Look out for regressions, but this is development anyway.

I've added it to the console function.
As far as how the main programs declaring and using f_state_t to pass to the console program, I'm not sure how I want to handle f_state.

86 files changed:
level_0/f_console/c/console.c
level_0/f_console/c/console.h
level_0/f_console/c/console/common.c
level_0/f_console/c/console/common.h
level_0/f_console/tests/unit/c/test-console-parameter_process.c
level_0/f_console/tests/unit/c/test-console-parameter_process.h
level_0/f_console/tests/unit/c/test-console.c
level_0/f_iki/c/iki.c
level_0/f_type/c/type.h
level_3/byte_dump/c/byte_dump.h
level_3/byte_dump/c/common.c
level_3/byte_dump/c/common.h
level_3/byte_dump/c/main.c
level_3/control/c/common.c
level_3/control/c/common.h
level_3/control/c/main.c
level_3/controller/c/common.c
level_3/controller/c/common.h
level_3/controller/c/main.c
level_3/fake/c/main/common-print.c
level_3/fake/c/main/common-print.h
level_3/fake/c/main/common.c
level_3/fake/c/main/common.h
level_3/fake/c/main/fake.c
level_3/fake/c/main/main.c
level_3/fake/c/main/print.c
level_3/fake/c/main/print.h
level_3/fake/c/main/private-build.c
level_3/fake/c/main/private-common.c
level_3/fake/c/main/private-common.h
level_3/fake/c/main/private-fake.c
level_3/fake/c/main/private-fake.h
level_3/firewall/c/common.c
level_3/firewall/c/common.h
level_3/firewall/c/main.c
level_3/fss_basic_list_read/c/common.c
level_3/fss_basic_list_read/c/common.h
level_3/fss_basic_list_read/c/fss_basic_list_read.c
level_3/fss_basic_list_read/c/main.c
level_3/fss_basic_read/c/common.c
level_3/fss_basic_read/c/common.h
level_3/fss_basic_read/c/fss_basic_read.c
level_3/fss_basic_read/c/main.c
level_3/fss_embedded_list_read/c/common.c
level_3/fss_embedded_list_read/c/common.h
level_3/fss_embedded_list_read/c/main.c
level_3/fss_extended_list_read/c/common.c
level_3/fss_extended_list_read/c/common.h
level_3/fss_extended_list_read/c/fss_extended_list_read.c
level_3/fss_extended_list_read/c/main.c
level_3/fss_extended_read/c/common.c
level_3/fss_extended_read/c/common.h
level_3/fss_extended_read/c/fss_extended_read.c
level_3/fss_extended_read/c/main.c
level_3/fss_identify/c/common.c
level_3/fss_identify/c/common.h
level_3/fss_identify/c/main.c
level_3/fss_payload_read/c/common.c
level_3/fss_payload_read/c/common.h
level_3/fss_payload_read/c/fss_payload_read.c
level_3/fss_payload_read/c/main.c
level_3/fss_write/c/basic/main.c
level_3/fss_write/c/basic_list/main.c
level_3/fss_write/c/embedded_list/main.c
level_3/fss_write/c/extended/main.c
level_3/fss_write/c/extended_list/main.c
level_3/fss_write/c/main/common.c
level_3/fss_write/c/main/common.h
level_3/fss_write/c/main/main.c
level_3/fss_write/c/main/main.h
level_3/fss_write/c/payload/fss_write.c
level_3/fss_write/c/payload/fss_write.h
level_3/fss_write/c/payload/main.c
level_3/iki_read/c/main/common.c
level_3/iki_read/c/main/common.h
level_3/iki_read/c/main/main.c
level_3/iki_write/c/main/common.c
level_3/iki_write/c/main/common.h
level_3/iki_write/c/main/main.c
level_3/status_code/c/fss/main.c
level_3/status_code/c/main/common.c
level_3/status_code/c/main/common.h
level_3/status_code/c/main/main.c
level_3/utf8/c/main/common.c
level_3/utf8/c/main/common.h
level_3/utf8/c/main/main.c

index e0d092be7c02b71151c7af0356eb03b6408ffb41..c5f8d03d33cfd523ae91cdad59a85f5c3ab16cad 100644 (file)
@@ -149,7 +149,7 @@ extern "C" {
 #endif // _di_f_console_parameter_prioritize_right_
 
 #ifndef _di_f_console_parameter_process_
-  f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, void * const data) {
+  f_status_t f_console_parameter_process(f_state_t state_passed, const f_console_arguments_t arguments, f_console_parameters_t * const parameters, void * const data) {
     #ifndef _di_level_0_parameter_checking_
       if (!parameters) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
@@ -160,43 +160,52 @@ extern "C" {
 
     f_console_parameter_state_t state = f_console_parameter_state_t_initialize;
 
+    state.state = (f_state_t) state_passed;
+
     state.status = f_string_dynamics_increase_by(arguments.argc, &parameters->arguments);
     if (F_status_is_error(state.status)) return state.status;
 
-    // Parameter 0 represents the program name so skip it.
-    state.location = 1;
+    state.status = f_array_lengths_increase(state_passed.step_small, &state.needs);
+    if (F_status_is_error(state.status)) return state.status;
 
     // Append the program name parameter as a static string.
     parameters->arguments.array[parameters->arguments.used].string = arguments.argv[0];
     parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[0], F_console_parameter_size_d);
     parameters->arguments.array[parameters->arguments.used++].size = 0;
 
-    uint8_t width = 0;
-    f_utf_char_t character_utf_argument = 0;
-    f_utf_char_t character_utf_symbol = 0;
-    f_array_length_t i;
-    f_array_length_t values;
-    f_number_unsigned_t width_max = 0;
+    // Parameter 0 represents the program name so skip it.
+    state.location = 1;
+
+    f_array_length_t i = 0;
+    f_array_length_t j = 0;
+
+    f_utf_char_t utf_argument = 0;
+    f_utf_char_t utf_console = 0;
 
     while (state.location < arguments.argc && arguments.argv[state.location]) {
 
+      if (state_passed.interrupt) {
+        state.status = state_passed.interrupt((void * const) &state_passed, 0);
+
+        if (F_status_set_fine(state.status) == F_interrupt) {
+          state.status = F_status_set_error(F_interrupt);
+
+          break;
+        }
+      }
+
       parameters->arguments.array[parameters->arguments.used].string = arguments.argv[state.location];
       parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[state.location], F_console_parameter_size_d);
       parameters->arguments.array[parameters->arguments.used++].size = 0;
 
       // Additional parameters must always follow what requests them.
-      if (state.value_need.used) {
+      if (state.needs.used) {
         if (parameters->callback) {
-          state.type = f_console_parameter_state_type_value_need_e;
+          state.type = f_console_parameter_state_type_need_e;
+          state.at = state.needs.array[0];
 
           parameters->callback(arguments, (void * const) parameters, &state, data);
-
-          if (F_status_is_error(state.status)) {
-            f_array_lengths_resize(0, &state.value_need);
-
-            return state.status;
-          }
-
+          if (F_status_is_error(state.status)) break;
           if (state.status == F_break) break;
           if (state.status == F_continue) continue;
         }
@@ -205,23 +214,18 @@ extern "C" {
         }
 
         if (state.status == F_process) {
-          i = state.value_need.array[0];
-
-          state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, &parameters->array[i].values);
-          if (F_status_is_error(state.status)) break;
+          i = state.needs.array[0];
 
-          parameters->array[i].result |= f_console_result_value_e;
-          parameters->array[i].values.array[parameters->array[i].values.used++] = state.location;
+          parameters->array[i].result = f_console_result_value_e;
+          parameters->array[i].values.array[parameters->array[i].values.used++] = state.location++;
+        }
 
-          --state.value_need.used;
+        --state.needs.used;
 
-          // Pop the matched parameter off of the top of the state.value_need array.
-          for (i = 0; i < state.value_need.used; ++i) {
-            state.value_need.array[i] = state.value_need.array[i + 1];
-          } // for
-        }
+        for (i = 0; i < state.needs.used; ++i) {
+          state.needs.array[i] = state.needs.array[i + 1];
+        } // for
 
-        ++state.location;
         state.status = F_none;
 
         continue;
@@ -229,15 +233,10 @@ extern "C" {
 
       if (parameters->callback) {
         state.type = f_console_parameter_state_type_identify_e;
+        state.at = 0;
 
         parameters->callback(arguments, (void * const) parameters, &state, data);
-
-        if (F_status_is_error(state.status)) {
-          f_array_lengths_resize(0, &state.value_need);
-
-          return state.status;
-        }
-
+        if (F_status_is_error(state.status)) break;
         if (state.status == F_break) break;
         if (state.status == F_continue) continue;
       }
@@ -247,234 +246,389 @@ extern "C" {
 
       if (state.status == F_process) {
         private_f_console_identify(arguments.argv[state.location], &state.result);
-
-        // Process the current parameter.
-        if (state.result & f_console_result_short_e) {
-          state.increment_by = 1;
-          state.location_sub = 1;
-        }
-        else if (state.result & f_console_result_long_e) {
-          state.increment_by = parameters->arguments.array[state.location].used;
-          state.location_sub = 2;
-        }
-        else {
-          state.increment_by = parameters->arguments.array[state.location].used;
-          state.location_sub = 0;
-        }
-
-        state.found = F_false;
       }
 
+      state.found = F_false;
       state.status = F_none;
 
-      if (state.result & (f_console_result_short_e | f_console_result_long_e)) {
+      if (state.result & f_console_result_short_e) {
+
+        // Perform pre-process.
+        for (state.location_sub = 1; state.location_sub < parameters->arguments.array[state.location].used; ++state.location_sub) {
 
-        // The state.location_sub is used on a per increment basis.
-        while (state.location_sub < parameters->arguments.array[state.location].used) {
+          state.found = F_false;
 
           for (i = 0; i < parameters->used; ++i) {
 
+            if (state_passed.interrupt) {
+              state.status = state_passed.interrupt((void * const) &state_passed, 0);
+
+              if (F_status_set_fine(state.status) == F_interrupt) {
+                state.status = F_status_set_error(F_interrupt);
+
+                break;
+              }
+            }
+
             if (parameters->array[i].flag & f_console_flag_disable_e) continue;
             if ((state.result & f_console_result_normal_e) && !(parameters->array[i].flag & f_console_flag_normal_e)) continue;
             if ((state.result & f_console_result_inverse_e) && !(parameters->array[i].flag & f_console_flag_inverse_e)) continue;
+            if (!parameters->array[i].match_short.used && !parameters->array[i].match_short.string) continue;
+            if (arguments.argv[state.location][state.location_sub] != *parameters->array[i].match_short.string) continue;
 
-            // For sublocation processing of 'tar -xcf', the '-' would have an increment of 1, therefore x, c, and f would all be three separate parameters)
-            if (state.result & f_console_result_short_e) {
-              if (!parameters->array[i].symbol_short) continue;
+            state.width = macro_f_utf_byte_width_is(arguments.argv[state.location][state.location_sub]);
 
-              width = macro_f_utf_byte_width_is(arguments.argv[state.location][state.location_sub]);
-              if (width) state.increment_by = width;
+            if (parameters->callback) {
+              state.type = f_console_parameter_state_type_short_preprocess_e;
+              state.at = i;
 
-              if (arguments.argv[state.location][state.location_sub] != *parameters->array[i].symbol_short) continue;
+              parameters->callback(arguments, (void * const) parameters, &state, data);
+              if (F_status_is_error(state.status)) break;
 
-              if (width) {
-                character_utf_argument = 0;
-                character_utf_symbol = 0;
-                width_max = parameters->arguments.array[state.location].used - state.location_sub;
+              if (state.status == F_break || state.status == F_continue) {
+                if (state.depth) {
+                  --state.depth;
 
-                state.status = f_utf_char_to_character(arguments.argv[state.location] + state.location_sub, width_max, &character_utf_argument);
-                if (F_status_is_error(state.status)) break;
+                  break;
+                }
 
-                width_max = strlen(parameters->array[i].symbol_short);
+                state.status = F_none;
 
-                state.status = f_utf_char_to_character((f_string_t) parameters->array[i].symbol_short, width_max, &character_utf_symbol);
-                if (F_status_is_error(state.status)) break;
+                if (state.status == F_break) break;
 
-                if (character_utf_argument != character_utf_symbol) continue;
+                continue;
               }
             }
-            else if (state.result & f_console_result_long_e) {
-              if (!parameters->array[i].symbol_long) continue;
-              if (strncmp(&arguments.argv[state.location][state.location_sub], parameters->array[i].symbol_long, state.increment_by + 1)) continue;
-            }
             else {
-              continue;
+              state.status = F_process;
+            }
+
+            if (state.status == F_process) {
+              if (state.width) {
+                utf_argument = 0;
+                utf_console = 0;
+
+                state.status = f_utf_char_to_character(arguments.argv[state.location] + state.location_sub, parameters->arguments.array[state.location].used - state.location_sub, &utf_argument);
+                if (F_status_is_error(state.status)) break;
+
+                state.status = f_utf_char_to_character(parameters->array[i].match_short.string, parameters->array[i].match_short.used, &utf_console);
+                if (F_status_is_error(state.status)) break;
+
+                if (utf_argument != utf_console) continue;
+              }
+            }
+
+            state.found = F_true;
+
+            break;
+          } // for
+
+          if (F_status_is_error(state.status)) break;
+
+          if (state.status == F_break || state.status == F_continue) {
+            if (state.depth) {
+              --state.depth;
+
+              break;
             }
 
             state.status = F_none;
 
-            if (parameters->callback) {
-              state.type = f_console_parameter_state_type_match_normal_e;
+            if (state.status == F_break) break;
 
-              parameters->callback(arguments, (void * const) parameters, &state, data);
+            continue;
+          }
 
-              if (F_status_is_error(state.status)) {
-                f_array_lengths_resize(0, &state.value_need);
+          if (!state.found) break;
+        } // for
 
-                return state.status;
-              }
+        if (F_status_is_error(state.status)) break;
 
-              if (state.status == F_break) break;
+        if (state.status == F_break || state.status == F_continue) {
+          state.depth = 0;
+          state.status = F_none;
 
-              if (state.status == F_continue) {
-                if (state.depth) break;
+          if (state.status == F_break) break;
 
-                continue;
-              }
+          continue;
+        }
+
+        // The entire string references valid parameters.
+        if (state.found) {
+          state.location_sub = 1;
+          state.needs.used = 0;
+
+          state.status = f_array_lengths_increase_by(parameters->arguments.array[state.location].used, &state.needs);
+          if (F_status_is_error(state.status)) break;
+
+          // The state.location_sub is used on a per-increment basis (such as 'tar -xcf', the '-' would have an increment of 1, therefore x, c, and f would all be three separate parameters).
+          while (state.location_sub < parameters->arguments.array[state.location].used) {
+
+            state.width = macro_f_utf_byte_width_is(arguments.argv[state.location][state.location_sub]);
+
+            if (state.width) {
+              utf_argument = 0;
+              utf_console = 0;
+
+              state.status = f_utf_char_to_character(arguments.argv[state.location] + state.location_sub, parameters->arguments.array[state.location].used - state.location_sub, &utf_argument);
+              if (F_status_is_error(state.status)) break;
+
+              state.status = f_utf_char_to_character(parameters->array[i].match_short.string, parameters->array[i].match_short.used, &utf_console);
+              if (F_status_is_error(state.status)) break;
+
+              if (utf_argument != utf_console) continue;
             }
             else {
-              state.status = F_process;
+              state.width = 1;
             }
 
-            if (state.status == F_process) {
-              state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, &parameters->array[i].locations);
-              if (F_status_is_error(state.status)) break;
+            for (i = 0; i < parameters->used; ++i) {
 
-              state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, &parameters->array[i].locations_sub);
-              if (F_status_is_error(state.status)) break;
+              if (state_passed.interrupt) {
+                state.status = state_passed.interrupt((void * const) &state_passed, 0);
 
-              state.found = F_true;
+                if (F_status_set_fine(state.status) == F_interrupt) {
+                  state.status = F_status_set_error(F_interrupt);
 
-              parameters->array[i].locations.array[parameters->array[i].locations.used++] = state.location;
+                  break;
+                }
+              }
 
-              parameters->array[i].result = state.result | (parameters->array[i].result & f_console_result_value_e);
-              parameters->array[i].location = state.location;
-              parameters->array[i].location_sub = 0;
+              if (parameters->array[i].flag & f_console_flag_disable_e) continue;
+              if ((state.result & f_console_result_normal_e) && !(parameters->array[i].flag & f_console_flag_normal_e)) continue;
+              if ((state.result & f_console_result_inverse_e) && !(parameters->array[i].flag & f_console_flag_inverse_e)) continue;
+              if (!parameters->array[i].match_short.used && !parameters->array[i].match_short.string) continue;
+              if (arguments.argv[state.location][state.location_sub] != *parameters->array[i].match_short.string) continue;
 
-              if (state.result & f_console_result_short_e) {
-                parameters->array[i].location_sub = state.location_sub;
-                parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = state.location_sub;
+              if (parameters->callback) {
+                state.type = f_console_parameter_state_type_short_e;
+                state.at = i;
+
+                parameters->callback(arguments, (void * const) parameters, &state, data);
+                if (F_status_is_error(state.status)) break;
+
+                if (state.status == F_break || state.status == F_continue) {
+                  if (state.depth) {
+                    --state.depth;
+
+                    break;
+                  }
+
+                  state.status = F_none;
+
+                  if (state.status == F_break) break;
+
+                  continue;
+                }
               }
               else {
-                parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = 0;
+                state.status = F_process;
               }
 
-              if (parameters->array[i].values_total) {
-                state.status = f_array_lengths_increase_by(parameters->array[i].values_total, &state.value_need);
+              if (state.status == F_process) {
+                state.status = f_array_lengths_increase(state_passed.step_small, &parameters->array[i].locations);
                 if (F_status_is_error(state.status)) break;
 
-                for (values = 0; values < parameters->array[i].values_total; ++values) {
-                  state.value_need.array[state.value_need.used++] = i;
+                state.status = f_array_lengths_increase(state_passed.step_small, &parameters->array[i].locations_sub);
+                if (F_status_is_error(state.status)) break;
+
+                if (parameters->array[i].location != state.location) {
+                  parameters->array[i].locations.array[parameters->array[i].locations.used++] = state.location;
+                }
+
+                parameters->array[i].result = f_console_result_found_e;
+                parameters->array[i].location = state.location;
+                parameters->array[i].location_sub = state.location_sub;
+                parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = state.location_sub;
+
+                for (j = 0; j < parameters->array[i].values_total; ++j) {
+                  state.needs.array[state.needs.used++] = i;
                 } // for
+
+                state.status = f_array_lengths_increase_by(state.needs.used, &parameters->array[i].values);
+                if (F_status_is_error(state.status)) break;
               }
-            }
 
-            state.status = F_none;
+              state.status = F_none;
 
-            break;
-          } // for
+              break;
+            } // for
 
-          if (F_status_is_error(state.status)) break;
+            if (F_status_is_error(state.status)) break;
 
-          if (state.status == F_break || state.status == F_continue) {
-            if (state.depth) {
-              --state.depth;
+            if (state.status == F_break || state.status == F_continue) {
+              if (state.depth) {
+                --state.depth;
+
+                break;
+              }
+
+              state.status = F_none;
 
               if (state.status == F_break) break;
 
               continue;
             }
-          }
 
-          state.location_sub += state.increment_by;
-        } // while
-
-        if (F_status_is_error(state.status)) break;
+            state.location_sub += state.width;
+          } // while
 
-        if (state.status == F_break || state.status == F_continue) {
-          if (state.depth) {
-            --state.depth;
+          if (state.status == F_break || state.status == F_continue) {
+            state.depth = 0;
+            state.status = F_none;
 
             if (state.status == F_break) break;
 
             continue;
           }
         }
-
-        state.status = F_none;
       }
       else {
-        if (parameters->callback) {
-          state.type = f_console_parameter_state_type_match_remaining_e;
+        if (state.result & f_console_result_long_e) {
+          state.location_sub = 2;
+          state.needs.used = 0;
 
-          parameters->callback(arguments, (void * const) parameters, &state, data);
+          for (i = 0; i < parameters->used; ++i) {
 
-          if (F_status_is_error(state.status)) {
-            f_array_lengths_resize(0, &state.value_need);
+            if (state_passed.interrupt) {
+              state.status = state_passed.interrupt((void * const) &state_passed, 0);
 
-            return state.status;
-          }
+              if (F_status_set_fine(state.status) == F_interrupt) {
+                state.status = F_status_set_error(F_interrupt);
 
-          if (state.status == F_break) break;
-          if (state.status == F_continue) continue;
+                break;
+              }
+            }
+
+            if (parameters->array[i].flag & f_console_flag_disable_e) continue;
+            if ((state.result & f_console_result_normal_e) && !(parameters->array[i].flag & f_console_flag_normal_e)) continue;
+            if ((state.result & f_console_result_inverse_e) && !(parameters->array[i].flag & f_console_flag_inverse_e)) continue;
+            if (!parameters->array[i].match_long.used && !parameters->array[i].match_long.string) continue;
+            if (strncmp(&arguments.argv[state.location][state.location_sub], parameters->array[i].match_long.string, parameters->array[i].match_long.used + 1)) continue;
+
+            if (parameters->callback) {
+              state.type = f_console_parameter_state_type_long_e;
+              state.at = i;
+
+              parameters->callback(arguments, (void * const) parameters, &state, data);
+              if (F_status_is_error(state.status)) break;
+
+              if (state.status == F_break || state.status == F_continue) {
+                if (state.depth) {
+                  --state.depth;
+
+                  break;
+                }
+
+                state.status = F_none;
+
+                if (state.status == F_break) break;
+
+                continue;
+              }
+            }
+            else {
+              state.status = F_process;
+            }
+
+            state.found = F_true;
+
+            break;
+          } // for
         }
         else {
-          state.status = F_process;
-        }
-
-        if (state.status == F_process) {
           for (i = 0; i < parameters->used; ++i) {
 
+            if (state_passed.interrupt) {
+              state.status = state_passed.interrupt((void * const) &state_passed, 0);
+
+              if (F_status_set_fine(state.status) == F_interrupt) {
+                state.status = F_status_set_error(F_interrupt);
+
+                break;
+              }
+            }
+
             if (parameters->array[i].flag & f_console_flag_disable_e) continue;
             if (!(parameters->array[i].flag & f_console_result_alone_e)) continue;
-            if (!parameters->array[i].symbol_simple) continue;
+            if (!parameters->array[i].match_simple.used && !parameters->array[i].match_simple.string) continue;
+            if (strncmp(arguments.argv[state.location], parameters->array[i].match_simple.string, parameters->array[i].match_simple.used + 1)) continue;
 
-            if (strncmp(arguments.argv[state.location], parameters->array[i].symbol_simple, parameters->arguments.array[state.location].used + 1) != 0) continue;
+            if (parameters->callback) {
+              state.type = f_console_parameter_state_type_simple_e;
+              state.at = i;
 
-            state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, &parameters->array[i].locations);
-            if (F_status_is_error(state.status)) break;
+              parameters->callback(arguments, (void * const) parameters, &state, data);
+              if (F_status_is_error(state.status)) break;
 
-            state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, &parameters->array[i].locations_sub);
-            if (F_status_is_error(state.status)) break;
+              if (state.status == F_break || state.status == F_continue) {
+                if (state.depth) {
+                  --state.depth;
 
-            parameters->array[i].locations.array[parameters->array[i].locations.used++] = state.location;
-            parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = 0;
+                  break;
+                }
 
-            parameters->array[i].result = state.result | (parameters->array[i].result & f_console_result_value_e);
-            parameters->array[i].location = state.location;
-            parameters->array[i].location_sub = 0;
+                state.status = F_none;
 
-            if (parameters->array[i].values_total) {
-              if (state.value_need.used + parameters->array[i].values_total > state.value_need.size) {
-                state.status = f_array_lengths_resize(state.value_need.used + parameters->array[i].values_total, &state.value_need);
-                if (F_status_is_error(state.status)) break;
-              }
+                if (state.status == F_break) break;
 
-              for (values = 0; values < parameters->array[i].values_total; ++values) {
-                state.value_need.array[state.value_need.used++] = i;
-              } // for
+                continue;
+              }
+            }
+            else {
+              state.status = F_process;
             }
 
             state.found = F_true;
 
             break;
           } // for
+        }
+
+        if (F_status_is_error(state.status)) break;
 
+        if (state.status == F_break || state.status == F_continue) {
+          state.depth = 0;
+          state.status = F_none;
+
+          if (state.status == F_break) break;
+
+          continue;
+        }
+
+        if (state.status == F_process && state.found) {
+          state.status = f_array_lengths_increase(state_passed.step_small, &parameters->array[i].locations);
+          if (F_status_is_error(state.status)) break;
+
+          state.status = f_array_lengths_increase(state_passed.step_small, &parameters->array[i].locations_sub);
+          if (F_status_is_error(state.status)) break;
+
+          parameters->array[i].result = f_console_result_found_e;
+          parameters->array[i].location = state.location;
+          parameters->array[i].location_sub = 0;
+          parameters->array[i].locations.array[parameters->array[i].locations.used++] = state.location;
+          parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = 0;
+
+          for (j = 0; j < parameters->array[i].values_total; ++j) {
+            state.needs.array[state.needs.used++] = i;
+          } // for
+
+          state.status = f_array_lengths_increase_by(state.needs.used, &parameters->array[i].values);
           if (F_status_is_error(state.status)) break;
         }
 
         state.status = F_none;
       }
 
-      if (state.found) {
-        ++state.location;
-      }
-      else {
+      if (F_status_is_error(state.status)) break;
+
+      // Add the missed parameter to the remaining array.
+      if (!state.found) {
         if (parameters->callback) {
-          state.type = f_console_parameter_state_type_match_not_e;
+          state.type = f_console_parameter_state_type_miss_e;
+          state.at = 0;
 
           parameters->callback(arguments, (void * const) parameters, &state, data);
-
           if (F_status_is_error(state.status)) break;
           if (state.status == F_break) break;
           if (state.status == F_continue) continue;
@@ -484,51 +638,55 @@ extern "C" {
         }
 
         if (state.status == F_process) {
-
-          // Populate list of remaining parameters->array that are not associated with anything.
-          state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, &parameters->remaining);
+          state.status = f_array_lengths_increase(state_passed.step_small, &parameters->remaining);
           if (F_status_is_error(state.status)) break;
 
-          parameters->remaining.array[parameters->remaining.used++] = state.location++;
+          parameters->remaining.array[parameters->remaining.used++] = state.location;
         }
 
         state.status = F_none;
       }
-    } // while
 
-    if (F_status_is_error_not(state.status)) {
-      if (parameters->callback) {
-        state.type = f_console_parameter_state_type_wrap_up_e;
+      ++state.location;
+    } // while
 
-        parameters->callback(arguments, (void * const) parameters, &state, data);
+    // Make sure the entire parameters arguments array is populated.
+    if (parameters->callback) {
+      state.type = f_console_parameter_state_type_wrap_up_e;
+      state.at = 0;
 
-        if (F_status_is_error(state.status)) {
-          f_array_lengths_resize(0, &state.value_need);
+      parameters->callback(arguments, (void * const) parameters, &state, data);
+    }
+    else {
+      state.status = F_process;
+    }
 
-          return state.status;
-        }
-      }
-      else {
-        state.status = F_process;
-      }
+    if (state.status == F_process) {
+      state.status == F_none;
 
-      if (state.status == F_process) {
+      for (; state.location < arguments.argc && arguments.argv[state.location]; ++state.location) {
 
-        // Make sure the entire parameters arguments array is populated.
-        for (; state.location < arguments.argc && arguments.argv[state.location]; ++state.location) {
+        if (state_passed.interrupt) {
+          state.status = state_passed.interrupt((void * const) &state_passed, 0);
 
-          parameters->arguments.array[parameters->arguments.used].string = arguments.argv[state.location];
-          parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[state.location], F_console_parameter_size_d);
-          parameters->arguments.array[parameters->arguments.used++].size = 0;
-        } // for
+          if (F_status_set_fine(state.status) == F_interrupt) {
+            state.status = F_status_set_error(F_interrupt);
 
-        if (F_status_is_error_not(state.status)) {
-          state.status = state.value_need.used ? F_complete_not : F_none;
+            break;
+          }
         }
+
+        parameters->arguments.array[parameters->arguments.used].string = arguments.argv[state.location];
+        parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[state.location], F_console_parameter_size_d);
+        parameters->arguments.array[parameters->arguments.used++].size = 0;
+      } // for
+
+      if (F_status_is_error_not(state.status)) {
+        state.status = state.needs.used ? F_complete_not : F_none;
       }
     }
 
-    f_array_lengths_resize(0, &state.value_need);
+    f_array_lengths_resize(0, &state.needs);
 
     return state.status;
   }
index b614d2f49cb42b9ec186489a7d99833bfc14825f..3055a27e8da47d4027e5d0d3047f7740b7c1fbdc 100644 (file)
@@ -155,6 +155,8 @@ extern "C" {
  *
  * Any changes to this function may likely require changes to f_console_parameter_state_t and callbacks.
  *
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param arguments
  *   The parameters passed to the process.
  * @param parameters
@@ -170,18 +172,21 @@ extern "C" {
  *
  *   F_array_too_large (with error bit) if a buffer would exceed max length.
  *   F_failure (with error bit) if width is not long enough to convert when processing arguments as UTF-8.
+ *   F_interrupt (with error bit) if an interrupt is received via the state.interrupt callback.
  *   F_parameter (with error bit) if a parameter is invalid.
  *
  *   Errors (with error bit) from: f_array_lengths_increase().
  *   Errors (with error bit) from: f_array_lengths_increase_by().
+ *   Errors (with error bit) from: f_string_dynamics_increase_by().
  *   Errors (with error bit) from: f_utf_char_to_character().
  *
  * @see f_array_lengths_increase()
  * @see f_array_lengths_increase_by()
+ * @see f_string_dynamics_increase_by()
  * @see f_utf_char_to_character()
  */
 #ifndef _di_f_console_parameter_process_
-  extern f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, void * const data);
+  extern f_status_t f_console_parameter_process(f_state_t state, const f_console_arguments_t arguments, f_console_parameters_t * const parameters, void * const data);
 #endif // _di_f_console_parameter_process_
 
 #ifdef __cplusplus
index 9b04b9ce4c66dfd2617b04b36b014914b4c43f2e..efaf6c9793047fc9735e6e8b8d3bed95718ebb14 100644 (file)
@@ -136,6 +136,26 @@ extern "C" {
   #endif // _di_f_console_symbol_long_inverse_s_
 #endif // _di_f_console_symbol_s_
 
+#ifndef _di_f_console_parameter_state_delete_
+  f_status_t f_console_parameter_state_delete(f_console_parameter_state_t * const state) {
+    #ifndef _di_level_0_parameter_checking_
+      if (!state) return F_status_set_error(F_parameter);
+    #endif // _di_level_0_parameter_checking_
+
+    return f_array_lengths_resize(0, &state->needs);
+  }
+#endif // _di_f_console_parameter_state_delete_
+
+#ifndef _di_f_console_parameter_state_destroy_
+  f_status_t f_console_parameter_state_destroy(f_console_parameter_state_t * const state) {
+    #ifndef _di_level_0_parameter_checking_
+      if (!state) return F_status_set_error(F_parameter);
+    #endif // _di_level_0_parameter_checking_
+
+    return f_array_lengths_adjust(0, &state->needs);
+  }
+#endif // _di_f_console_parameter_state_destroy_
+
 #ifndef _di_f_console_parameters_delete_
   f_status_t f_console_parameters_delete(f_console_parameters_t * const parameters) {
     #ifndef _di_level_0_parameter_checking_
index de963809786f1a2a6b9f7284fa30c90ee860753c..5b6185c1979c4354da80014e4520c5243637f3fb 100644 (file)
@@ -123,22 +123,24 @@ extern "C" {
  * Provide a special type explicitly intended to be used for f_console_parameter_state_t.
  *
  * f_console_parameter_state_type_*_e:
- *   - none:            No type set.
- *   - identify:        Perform identify processing.
- *   - match_normal:    Perform short or long parameter match processing.
- *   - match_not:       Perform no parameter match processing.
- *   - match_remaining: Perform remaining parameter match processing.
- *   - value_need:      Perform value is needed processing.
- *   - wrap_up:         Perform wrap up processing.
+ *   - none:         No type set.
+ *   - identify:     Perform identify processing.
+ *   - match_normal: Perform short or long parameter match processing.
+ *   - match_not:    Perform no parameter match processi
+ *   - match_other:  Perform other parameter match processing.ng.
+ *   - need:         Perform value is needed processing.
+ *   - wrap_up:      Perform wrap up processing.
  */
 #ifndef _di_f_console_parameter_state_type_e_
   enum {
     f_console_parameter_state_type_none_e = 0,
     f_console_parameter_state_type_identify_e,
-    f_console_parameter_state_type_match_normal_e,
-    f_console_parameter_state_type_match_not_e,
-    f_console_parameter_state_type_match_remaining_e,
-    f_console_parameter_state_type_value_need_e,
+    f_console_parameter_state_type_long_e,
+    f_console_parameter_state_type_miss_e,
+    f_console_parameter_state_type_short_e,
+    f_console_parameter_state_type_short_preprocess_e,
+    f_console_parameter_state_type_simple_e,
+    f_console_parameter_state_type_need_e,
     f_console_parameter_state_type_wrap_up_e,
   }; // enum
 #endif // _di_f_console_parameter_state_type_e_
@@ -229,31 +231,112 @@ extern "C" {
  * The description here is a relatively generalized description.
  *
  * Any changes to the f_console_parameter_process() code likely requires changes or re-interpretation of these properties.
+ *
+ * type:  Describe the kind of processing is being performed.
+ * depth: Designate how many loops to break or continue out of (0 = one loop, 1 = two loops).
+ * width: Used like a cache to store width results such as from macro_f_utf_byte_width_is().
+ * found: Designate that the currently process parameter has been matched.
+ *
+ * status: The return status.
+ * result: The parameter result state determined by the appropriate f_console_identify() or similar call.
+ * state:  The state information used during pocessing (this primarily utilizes the interrupt and the allocation steps).
+ *
+ * at:           The location in the parameters array currently being processed (not all types use this).
+ * location:     The current location within the argv array.
+ * location_sub: The current location within the argv[location] string.
+ * increment_by: The amount of characters being processed within the argv[location] for the current pass.
+ * need:         The number of additional parameters that need to be grabbed.
+ *
+ * The expected processing of each type (f_console_parameter_state_type_*_e) is as follows:
+ *   - identify:          Determine what type of parameter is being processed.
+ *                        Set status to F_process to perform normal operations after executing the callback.
+ *                        Set status to F_break or F_continue to break or continue after executing the callback.
+ *                        The depth is not used for this type.
+ *
+ *   - long:              A long parameter is being processed.
+ *                        Set status to F_process to perform normal operations after executing the callback.
+ *                        Set status to F_break or F_continue to break or continue after executing the callback.
+ *                        The depth can be from 0 to 1.
+ *                        This utilizes "at".
+ *
+ *   - miss:              A no parameter has been matched at the location situation is being processed.
+ *                        This is generally used to populate the parameters.remaining array.
+ *                        Set status to F_process to perform normal operations after executing the callback.
+ *                        Set status to F_break or F_continue to break or continue after executing the callback.
+ *                        The depth is not used for this type.
+ *
+ *   - short:             A short parameter is being processed.
+ *                        Set status to F_process to perform normal operations after executing the callback.
+ *                        Set status to F_break or F_continue to break or continue after executing the callback.
+ *                        The depth can be from 0 to 2.
+ *                        This utilizes "at".
+ *
+ *   - short_preprocess:  A short parameter is being pre-processed.
+ *                        Set status to F_process to perform normal operations after executing the callback.
+ *                        Set status to F_break or F_continue to break or continue after executing the callback.
+ *                        The depth can be from 0 to 2.
+ *                        This utilizes "at".
+ *
+ *   - simple:            A simple parameter is being processed.
+ *                        Set status to F_process to perform normal operations after executing the callback.
+ *                        Set status to F_break or F_continue to break or continue after executing the callback.
+ *                        The depth can be set up to 1.
+ *                        This utilizes "at".
+ *
+ *   - need:              Additional parameters are needed based on the match variable.
+ *                        This is processed for every location before any parameter matching is performed.
+ *                        Set status to F_process to perform normal operations after executing the callback.
+ *                        Set status to F_break or F_continue to break or continue after executing the callback.
+ *                        The depth is not used for this type.
+ *                        This utilizes "at".
+ *
+ *   - wrap_up:           This is called after all parameters have been processed or when the main loop has been broken out of.
+ *                        This is used to perform after processing clean up and data management.
+ *                        Set status to F_process to perform normal operations after executing the callback.
+ *                        The F_break, F_continue, and depth are not used for this type.
+ *
+ * When using the callback, then the responsibility of ensuring the proper and secure handling of the data is on in the callback.
+ * Failure to properly handle this can lead to integrity and security issues.
+ *
+ * The result is used to determine what type of parameter is being processed (a short, a long, a remaining, etc..).
+ *
+ * The location_sub should start after any of the symbols (for example for '--parameter', the symbol is the two '-', so the initial location_sub should be 2).
+ *
+ * The increment_by is generally set to 1 when performing the short matches and is generally set to the entire length of the string (minus the length of the symbol) for long matches.
+ * Each character in a short parameter potentially represents a parameter.
+ * There will be a loop pass for each character in the short string due to the value of the increment_by.
+ *
+ * The need represents the total number of arguments that are needed by the parameter that is just matched.
+ * The index of the parameter that is just matched is stored in the "match" variable.
  */
 #ifndef _di_f_console_parameter_state_t_
   typedef struct {
     uint8_t type;
     uint8_t depth;
+    uint8_t width;
     bool found;
 
     f_status_t status;
     f_console_result_t result;
+    f_state_t state;
 
-    unsigned long location;
+    f_array_length_t at;
+    f_array_length_t location;
     f_array_length_t location_sub;
-    f_array_length_t increment_by;
-    f_array_lengths_t value_need;
+    f_array_lengths_t needs;
   } f_console_parameter_state_t;
 
   #define f_console_parameter_state_t_initialize { \
     f_console_parameter_state_type_none_e, \
     0, \
+    0, \
     F_false, \
     F_none, \
     f_console_result_t_initialize, \
-    0, \
-    0, \
-    0, \
+    f_state_t_initialize, \
+    f_array_length_t_initialize, \
+    f_array_length_t_initialize, \
+    f_array_length_t_initialize, \
     f_array_lengths_t_initialize, \
   }
 #endif // _di_f_console_parameter_state_t_
@@ -265,47 +348,54 @@ extern "C" {
  * The long parameters are prepended with either '--' or '++'.
  * The simple parameters have no prefix characters.
  *
- * symbol_short:  The NULL terminated single character string, such as 'h' in '-h'.
- * symbol_long:   The NULL terminated multi-character string, such as 'help' in '--help'.
- * symbol_simple: The NULL terminated parameter that has no prefix, such as 'all' in 'make all'.
- * values_total:  Designates that a parameter will have a given number of values arguments, such as 'blue' in '--color blue'.
- * flag:          A set of bits for providing states associated with the parameter.
- * result:        A set of bits representing if and how the parameter is found (such as '-h' vs '--help').
- * location:      The last location in argv[] where this parameter is found.
- * location_sub:  The last sub-location at location in argv (only used by short parameters, such as -h or +l).
+ * match_short:  The NULL terminated single character string, such as 'h' in '-h'.
+ * match_long:   The NULL terminated multi-character string, such as 'help' in '--help'.
+ * match_simple: The NULL terminated parameter that has no prefix, such as 'all' in 'make all'.
+ *
+ * values_total: Designates that a parameter will have a given number of values arguments, such as 'blue' in '--color blue'.
+ *
+ * flag:   A set of bits for providing states associated with the parameter.
+ * result: A set of bits representing if and how the parameter is found (such as '-h' vs '--help').
+ *
+ * location:     The last location in argv[] where this parameter is found.
+ * location_sub: The last sub-location at location in argv (only used by short parameters, such as -h or +l).
+ *
  * locations:     All locations within argv where this parameter is found (order is preserved).
  * locations_sub: All sub-locations within argv where this parameter is found (order is preserved).
- * values:        An array of locations representing where in the argv[] the values arguments are found.
+ *
+ * values: An array of locations representing where in the argv[] the values arguments are found.
  *
  * The macro_f_console_parameter_t_initialize_1() all arguments.
- * The macro_f_console_parameter_t_initialize_2() reduced arguments.
- * The macro_f_console_parameter_t_initialize_3() reduced arguments, strings are of f_string_static_t, has short, long, and simple.
- * The macro_f_console_parameter_t_initialize_4() reduced arguments, strings are of f_string_static_t, has short and long.
- * The macro_f_console_parameter_t_initialize_5() reduced arguments, strings are of f_string_static_t, has short.
- * The macro_f_console_parameter_t_initialize_6() reduced arguments, strings are of f_string_static_t, has long.
- * The macro_f_console_parameter_t_initialize_7() reduced arguments, strings are of f_string_static_t, has simple.
+ * The macro_f_console_parameter_t_initialize_2() reduced arguments has short, long, and simple.
+ * The macro_f_console_parameter_t_initialize_3() reduced arguments has short and long.
+ * The macro_f_console_parameter_t_initialize_4() reduced arguments has short.
+ * The macro_f_console_parameter_t_initialize_5() reduced arguments has long.
+ * The macro_f_console_parameter_t_initialize_6() reduced arguments has simple.
  */
 #ifndef _di_f_console_parameter_t_
   typedef struct {
-    f_string_t symbol_short;
-    f_string_t symbol_long;
-    f_string_t symbol_simple;
+    f_string_static_t match_short;
+    f_string_static_t match_long;
+    f_string_static_t match_simple;
 
     f_array_length_t values_total;
 
     f_console_flag_t flag;
     f_console_result_t result;
+
     f_array_length_t location;
     f_array_length_t location_sub;
+
     f_array_lengths_t locations;
     f_array_lengths_t locations_sub;
+
     f_array_lengths_t values;
   } f_console_parameter_t;
 
   #define f_console_parameter_t_initialize { \
-    0, \
-    0, \
-    0, \
+    f_string_static_t_initialize, \
+    f_string_static_t_initialize, \
+    f_string_static_t_initialize, \
     f_console_flag_t_initialize, \
     f_console_result_t_initialize, \
     f_array_length_t_initialize, \
@@ -316,10 +406,10 @@ extern "C" {
     f_array_lengths_t_initialize, \
   }
 
-  #define macro_f_console_parameter_t_initialize_1(symbol_short, symbol_long, symbol_simple, values_total, flag, result, location, location_sub, locations, locations_sub, values) { \
-    symbol_short, \
-    symbol_long, \
-    symbol_simple, \
+  #define macro_f_console_parameter_t_initialize_1(match_short, match_long, match_simple, values_total, flag, result, location, location_sub, locations, locations_sub, values) { \
+    match_short, \
+    match_long, \
+    match_simple, \
     values_total, \
     flag, \
     result, \
@@ -331,10 +421,10 @@ extern "C" {
     values, \
   }
 
-  #define macro_f_console_parameter_t_initialize_2(symbol_short, symbol_long, symbol_simple, values_total, flag) { \
-    symbol_short, \
-    symbol_long, \
-    symbol_simple, \
+  #define macro_f_console_parameter_t_initialize_2(match_short, match_long, match_simple, values_total, flag) { \
+    match_short, \
+    match_long, \
+    match_simple, \
     values_total, \
     flag, \
     f_console_result_none_e, \
@@ -345,10 +435,10 @@ extern "C" {
     f_array_lengths_t_initialize, \
   }
 
-  #define macro_f_console_parameter_t_initialize_3(symbol_short, symbol_long, symbol_simple, values_total, flag) { \
-    symbol_short.string, \
-    symbol_long.string, \
-    symbol_simple.string, \
+  #define macro_f_console_parameter_t_initialize_3(match_short, match_long, values_total, flag) { \
+    match_short, \
+    match_long, \
+    f_string_empty_s, \
     values_total, \
     flag, \
     f_console_result_none_e, \
@@ -359,24 +449,10 @@ extern "C" {
     f_array_lengths_t_initialize, \
   }
 
-  #define macro_f_console_parameter_t_initialize_4(symbol_short, symbol_long, values_total, flag) { \
-    symbol_short.string, \
-    symbol_long.string, \
-    0, \
-    values_total, \
-    flag, \
-    f_console_result_none_e, \
-    0, \
-    0, \
-    f_array_lengths_t_initialize, \
-    f_array_lengths_t_initialize, \
-    f_array_lengths_t_initialize, \
-  }
-
-  #define macro_f_console_parameter_t_initialize_5(symbol_short, values_total, flag) { \
-    symbol_short.string, \
-    0, \
-    0, \
+  #define macro_f_console_parameter_t_initialize_4(match_short, values_total, flag) { \
+    match_short, \
+    f_string_empty_s, \
+    f_string_empty_s, \
     values_total, \
     flag, \
     f_console_result_none_e, \
@@ -387,10 +463,10 @@ extern "C" {
     f_array_lengths_t_initialize, \
   }
 
-  #define macro_f_console_parameter_t_initialize_6(symbol_long, values_total, flag) { \
-    0, \
-    symbol_long.string, \
-    0, \
+  #define macro_f_console_parameter_t_initialize_5(match_long, values_total, flag) { \
+    f_string_empty_s, \
+    match_long, \
+    f_string_empty_s, \
     values_total, \
     flag, \
     f_console_result_none_e, \
@@ -399,13 +475,12 @@ extern "C" {
     f_array_lengths_t_initialize, \
     f_array_lengths_t_initialize, \
     f_array_lengths_t_initialize, \
-    callback \
   }
 
-  #define macro_f_console_parameter_t_initialize_7(symbol_simple, values_total, flag) { \
-    0, \
-    0, \
-    symbol_simple.string, \
+  #define macro_f_console_parameter_t_initialize_6(match_simple, values_total, flag) { \
+    f_string_empty_s, \
+    f_string_empty_s, \
+    match_simple, \
     values_total, \
     flag, \
     f_console_result_none_e, \
@@ -428,11 +503,12 @@ extern "C" {
  * arguments: An array of arguments pointing to the argv[] strings with the string lengths already calculated (This is a dynamic array of f_string_static_t).
  * remaining: An array of indexes within the arguments representing unmatched parameters.
  * length:    The total number of parameters in the parameters array.
- * callback:  A callback to perform when matched in order to handle condition values.
+ *
+ * callback: A callback to perform when matched in order to handle condition values.
  *
  * The callback function arguments:
  *   - arguments:  The console arguments being processed.
- *   - parameters: A pointer to this parameter structure and must be of type f_console_parameter_t.
+ *   - parameters: A pointer to this parameter structure and must be of type f_console_parameters_t.
  *   - state:      The state information shared between the processing function and any callbacks.
  *   - data:       The structure determined by the caller for passing to the parameter processing function and is intended to be used for updating based on results.
  *
@@ -442,22 +518,35 @@ extern "C" {
  *   - F_continue: To tell the caller to continue the loop (based on depth, when applicable).
  *   - F_process:  To tell the caller to perform the built in functionality.
  *   - Any status with error bit set is treated as an error and calling function returns.
+ *
+ * When using the callback, then the responsibility of ensuring the proper and secure handling of the data is on in the callback.
+ * Failure to properly handle this can lead to integrity and security issues.
  */
 #ifndef _di_f_console_parameters_t_
   typedef struct {
     f_console_parameter_t *array;
-
     f_string_dynamics_t arguments;
     f_array_lengths_t remaining;
-
     f_array_length_t used;
 
     void (*callback)(const f_console_arguments_t arguments, void * const parameters, f_console_parameter_state_t * const state, void * const data);
   } f_console_parameters_t;
 
-  #define f_console_parameters_t_initialize {0, f_string_dynamics_t_initialize, f_array_lengths_t_initialize, 0, 0 }
+  #define f_console_parameters_t_initialize { \
+    0, \
+    f_string_dynamics_t_initialize, \
+    f_array_lengths_t_initialize, \
+    0, \
+    0 \
+  }
 
-  #define macro_f_console_parameters_t_initialize(parameter, used, callback) { parameter, f_string_dynamics_t_initialize, f_array_lengths_t_initialize, used, callback }
+  #define macro_f_console_parameters_t_initialize(parameters, used, callback) { \
+    parameters, \
+    f_string_dynamics_t_initialize, \
+    f_array_lengths_t_initialize, \
+    used, \
+    callback \
+  }
 #endif // _di_f_console_parameters_t_
 
 /**
@@ -672,6 +761,48 @@ extern "C" {
 #endif // _di_f_console_standard_s_
 
 /**
+ * Delete any dynamic allocated data on the state object.
+ *
+ * @param state
+ *   The state object.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ *   Errors (with error bit) from: f_string_dynamics_resize().
+ *   Errors (with error bit) from: f_array_lengths_resize().
+ *
+ * @see f_string_dynamics_resize()
+ * @see f_array_lengths_resize()
+ */
+#ifndef _di_f_console_parameter_state_delete_
+  extern f_status_t f_console_parameter_state_delete(f_console_parameter_state_t * const state);
+#endif // _di_f_console_parameter_state_delete_
+
+/**
+ * Destroy any dynamic allocated data on the state object.
+ *
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ *   Errors (with error bit) from: f_string_dynamics_adjust().
+ *   Errors (with error bit) from: f_array_lengths_adjust().
+ *
+ * @see f_string_dynamics_adjust()
+ * @see f_array_lengths_adjust()
+ */
+#ifndef _di_f_console_parameter_state_destroy_
+  extern f_status_t f_console_parameter_state_destroy(f_console_parameter_state_t * const state);
+#endif // _di_f_console_parameter_state_destroy_
+
+/**
  * Delete any dynamic allocated data on the parameters object.
  *
  * @param parameters
index b43f48e7a935306683ace7dd75e6c4f039270b00..0f1db0216edc1646659bfbf3a60e7bcaa89a74bd 100644 (file)
@@ -5,6 +5,106 @@
 extern "C" {
 #endif
 
+void test__f_console_parameter_process__incomplete_arguments(void **state) {
+
+  const f_string_t argv[] = {
+    "program",
+    "--second",
+    0,
+  };
+
+  const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(2, argv, 0);
+
+  f_console_parameter_t parameter[] = {
+    macro_f_console_parameter_t_initialize("f", 0, 0, 1, f_console_type_normal_e),
+    macro_f_console_parameter_t_initialize("s", "second", 0, 1, f_console_type_normal_e),
+    macro_f_console_parameter_t_initialize("t", "third", 0, 1, f_console_type_normal_e),
+    macro_f_console_parameter_t_initialize("F", 0, 0, 0, f_console_type_inverse_e),
+    macro_f_console_parameter_t_initialize(0, "fifth", 0, 1, f_console_type_inverse_e),
+    macro_f_console_parameter_t_initialize(0, "sixth", 0, 1, f_console_type_normal_e),
+    macro_f_console_parameter_t_initialize(0, "seventh", 0, 2, f_console_type_normal_e),
+    macro_f_console_parameter_t_initialize("N", "not_found", 0, 0, f_console_type_normal_e),
+    macro_f_console_parameter_t_initialize(0, 0, "other", 0, f_console_type_other_e),
+  };
+
+  f_console_parameters_t parameters = macro_f_console_parameters_t_initialize(parameter, 9);
+
+  {
+    const f_status_t status = f_console_parameter_process(arguments, &parameters);
+
+    assert_int_equal(status, F_complete_not);
+
+    assert_int_equal(parameter[0].result, f_console_result_none_e);
+    assert_int_equal(parameter[0].locations.used, 0);
+    assert_int_equal(parameter[0].locations_sub.used, 0);
+    assert_int_equal(parameter[0].values.used, 0);
+    assert_int_equal(parameter[0].location, 0);
+    assert_int_equal(parameter[0].location_sub, 0);
+
+    assert_int_equal(parameter[1].result, f_console_result_found_e);
+    assert_int_equal(parameter[1].locations.used, 1);
+    assert_int_equal(parameter[1].locations_sub.used, 1);
+    assert_int_equal(parameter[1].values.used, 0);
+    assert_int_equal(parameter[1].location, 1);
+    assert_int_equal(parameter[1].location_sub, 0);
+    assert_int_equal(parameter[1].locations.array[0], 1);
+    assert_int_equal(parameter[1].locations_sub.array[0], 0);
+
+    assert_int_equal(parameter[2].result, f_console_result_none_e);
+    assert_int_equal(parameter[2].locations.used, 0);
+    assert_int_equal(parameter[2].locations_sub.used, 0);
+    assert_int_equal(parameter[2].values.used, 0);
+    assert_int_equal(parameter[2].location, 0);
+    assert_int_equal(parameter[2].location_sub, 0);
+
+    assert_int_equal(parameter[3].result, f_console_result_none_e);
+    assert_int_equal(parameter[3].locations.used, 0);
+    assert_int_equal(parameter[3].locations_sub.used, 0);
+    assert_int_equal(parameter[3].values.used, 0);
+    assert_int_equal(parameter[3].location, 0);
+    assert_int_equal(parameter[3].location_sub, 0);
+
+    assert_int_equal(parameter[4].result, f_console_result_none_e);
+    assert_int_equal(parameter[4].locations.used, 0);
+    assert_int_equal(parameter[4].locations_sub.used, 0);
+    assert_int_equal(parameter[4].values.used, 0);
+    assert_int_equal(parameter[4].location, 0);
+    assert_int_equal(parameter[4].location_sub, 0);
+
+    assert_int_equal(parameter[5].result, f_console_result_none_e);
+    assert_int_equal(parameter[5].locations.used, 0);
+    assert_int_equal(parameter[5].locations_sub.used, 0);
+    assert_int_equal(parameter[5].values.used, 0);
+    assert_int_equal(parameter[5].location, 0);
+    assert_int_equal(parameter[5].location_sub, 0);
+
+    assert_int_equal(parameter[6].result, f_console_result_none_e);
+    assert_int_equal(parameter[6].locations.used, 0);
+    assert_int_equal(parameter[6].locations_sub.used, 0);
+    assert_int_equal(parameter[6].values.used, 0);
+    assert_int_equal(parameter[6].location, 0);
+    assert_int_equal(parameter[6].location_sub, 0);
+
+    assert_int_equal(parameter[7].result, f_console_result_none_e);
+    assert_int_equal(parameter[7].locations.used, 0);
+    assert_int_equal(parameter[7].locations_sub.used, 0);
+    assert_int_equal(parameter[7].values.used, 0);
+    assert_int_equal(parameter[7].location, 0);
+    assert_int_equal(parameter[7].location_sub, 0);
+
+    assert_int_equal(parameter[8].result, f_console_result_none_e);
+    assert_int_equal(parameter[8].locations.used, 0);
+    assert_int_equal(parameter[8].locations_sub.used, 0);
+    assert_int_equal(parameter[8].values.used, 0);
+    assert_int_equal(parameter[8].location, 0);
+    assert_int_equal(parameter[8].location_sub, 0);
+
+    assert_int_equal(parameters.remaining.used, 0);
+  }
+
+  f_console_parameters_delete(&parameters);
+}
+
 void test__f_console_parameter_process__no_arguments_no_program(void **state) {
 
   const f_string_t argv[] = {
@@ -104,7 +204,7 @@ void test__f_console_parameter_process__no_arguments(void **state) {
   };
 
   // Test both valid and invalid argc.
-  for (uint8_t argc = 0; argc < 3; ++argc) {
+  for (uint8_t argc = 0; argc < 2; ++argc) {
 
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, 0);
 
@@ -129,54 +229,63 @@ void test__f_console_parameter_process__no_arguments(void **state) {
 
       assert_int_equal(parameter[0].result, f_console_result_none_e);
       assert_int_equal(parameter[0].locations.used, 0);
+      assert_int_equal(parameter[0].locations_sub.used, 0);
       assert_int_equal(parameter[0].values.used, 0);
       assert_int_equal(parameter[0].location, 0);
       assert_int_equal(parameter[0].location_sub, 0);
 
       assert_int_equal(parameter[1].result, f_console_result_none_e);
       assert_int_equal(parameter[1].locations.used, 0);
+      assert_int_equal(parameter[1].locations_sub.used, 0);
       assert_int_equal(parameter[1].values.used, 0);
       assert_int_equal(parameter[1].location, 0);
       assert_int_equal(parameter[1].location_sub, 0);
 
       assert_int_equal(parameter[2].result, f_console_result_none_e);
       assert_int_equal(parameter[2].locations.used, 0);
+      assert_int_equal(parameter[2].locations_sub.used, 0);
       assert_int_equal(parameter[2].values.used, 0);
       assert_int_equal(parameter[2].location, 0);
       assert_int_equal(parameter[2].location_sub, 0);
 
       assert_int_equal(parameter[3].result, f_console_result_none_e);
       assert_int_equal(parameter[3].locations.used, 0);
+      assert_int_equal(parameter[3].locations_sub.used, 0);
       assert_int_equal(parameter[3].values.used, 0);
       assert_int_equal(parameter[3].location, 0);
       assert_int_equal(parameter[3].location_sub, 0);
 
       assert_int_equal(parameter[4].result, f_console_result_none_e);
       assert_int_equal(parameter[4].locations.used, 0);
+      assert_int_equal(parameter[4].locations_sub.used, 0);
       assert_int_equal(parameter[4].values.used, 0);
       assert_int_equal(parameter[4].location, 0);
       assert_int_equal(parameter[4].location_sub, 0);
 
       assert_int_equal(parameter[5].result, f_console_result_none_e);
       assert_int_equal(parameter[5].locations.used, 0);
+      assert_int_equal(parameter[5].locations_sub.used, 0);
       assert_int_equal(parameter[5].values.used, 0);
       assert_int_equal(parameter[5].location, 0);
       assert_int_equal(parameter[5].location_sub, 0);
 
       assert_int_equal(parameter[6].result, f_console_result_none_e);
       assert_int_equal(parameter[6].locations.used, 0);
+      assert_int_equal(parameter[6].locations_sub.used, 0);
       assert_int_equal(parameter[6].values.used, 0);
       assert_int_equal(parameter[6].location, 0);
       assert_int_equal(parameter[6].location_sub, 0);
 
       assert_int_equal(parameter[7].result, f_console_result_none_e);
       assert_int_equal(parameter[7].locations.used, 0);
+      assert_int_equal(parameter[7].locations_sub.used, 0);
       assert_int_equal(parameter[7].values.used, 0);
       assert_int_equal(parameter[7].location, 0);
       assert_int_equal(parameter[7].location_sub, 0);
 
       assert_int_equal(parameter[8].result, f_console_result_none_e);
       assert_int_equal(parameter[8].locations.used, 0);
+      assert_int_equal(parameter[8].locations_sub.used, 0);
       assert_int_equal(parameter[8].values.used, 0);
       assert_int_equal(parameter[8].location, 0);
       assert_int_equal(parameter[8].location_sub, 0);
@@ -217,54 +326,63 @@ void test__f_console_parameter_process__null_arguments(void **state) {
 
       assert_int_equal(parameter[0].result, f_console_result_none_e);
       assert_int_equal(parameter[0].locations.used, 0);
+      assert_int_equal(parameter[0].locations_sub.used, 0);
       assert_int_equal(parameter[0].values.used, 0);
       assert_int_equal(parameter[0].location, 0);
       assert_int_equal(parameter[0].location_sub, 0);
 
       assert_int_equal(parameter[1].result, f_console_result_none_e);
       assert_int_equal(parameter[1].locations.used, 0);
+      assert_int_equal(parameter[1].locations_sub.used, 0);
       assert_int_equal(parameter[1].values.used, 0);
       assert_int_equal(parameter[1].location, 0);
       assert_int_equal(parameter[1].location_sub, 0);
 
       assert_int_equal(parameter[2].result, f_console_result_none_e);
       assert_int_equal(parameter[2].locations.used, 0);
+      assert_int_equal(parameter[2].locations_sub.used, 0);
       assert_int_equal(parameter[2].values.used, 0);
       assert_int_equal(parameter[2].location, 0);
       assert_int_equal(parameter[2].location_sub, 0);
 
       assert_int_equal(parameter[3].result, f_console_result_none_e);
       assert_int_equal(parameter[3].locations.used, 0);
+      assert_int_equal(parameter[3].locations_sub.used, 0);
       assert_int_equal(parameter[3].values.used, 0);
       assert_int_equal(parameter[3].location, 0);
       assert_int_equal(parameter[3].location_sub, 0);
 
       assert_int_equal(parameter[4].result, f_console_result_none_e);
       assert_int_equal(parameter[4].locations.used, 0);
+      assert_int_equal(parameter[4].locations_sub.used, 0);
       assert_int_equal(parameter[4].values.used, 0);
       assert_int_equal(parameter[4].location, 0);
       assert_int_equal(parameter[4].location_sub, 0);
 
       assert_int_equal(parameter[5].result, f_console_result_none_e);
       assert_int_equal(parameter[5].locations.used, 0);
+      assert_int_equal(parameter[5].locations_sub.used, 0);
       assert_int_equal(parameter[5].values.used, 0);
       assert_int_equal(parameter[5].location, 0);
       assert_int_equal(parameter[5].location_sub, 0);
 
       assert_int_equal(parameter[6].result, f_console_result_none_e);
       assert_int_equal(parameter[6].locations.used, 0);
+      assert_int_equal(parameter[6].locations_sub.used, 0);
       assert_int_equal(parameter[6].values.used, 0);
       assert_int_equal(parameter[6].location, 0);
       assert_int_equal(parameter[6].location_sub, 0);
 
       assert_int_equal(parameter[7].result, f_console_result_none_e);
       assert_int_equal(parameter[7].locations.used, 0);
+      assert_int_equal(parameter[7].locations_sub.used, 0);
       assert_int_equal(parameter[7].values.used, 0);
       assert_int_equal(parameter[7].location, 0);
       assert_int_equal(parameter[7].location_sub, 0);
 
       assert_int_equal(parameter[8].result, f_console_result_none_e);
       assert_int_equal(parameter[8].locations.used, 0);
+      assert_int_equal(parameter[8].locations_sub.used, 0);
       assert_int_equal(parameter[8].values.used, 0);
       assert_int_equal(parameter[8].location, 0);
       assert_int_equal(parameter[8].location_sub, 0);
@@ -286,10 +404,24 @@ void test__f_console_parameter_process__only_remaining(void **state) {
     "+h",
     "--help",
     "../`~!@#$%^&*()_-+={[}]:;\"'<,>./?",
+    "-soo",
+    "-oso",
+    "-oos",
+    "+soo",
+    "+oso",
+    "+oos",
+    "--seconds",
+    "--seconds",
+    "--seconds",
+    "++seconds",
+    "++seconds",
+    "++seconds",
     0,
   };
 
-  const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(7, argv, 0);
+  const int total = 19;
+
+  const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(total, argv, 0);
 
   f_console_parameter_t parameter[] = {
     macro_f_console_parameter_t_initialize("f", 0, 0, 1, f_console_type_normal_e),
@@ -364,7 +496,25 @@ void test__f_console_parameter_process__only_remaining(void **state) {
     assert_int_equal(parameter[8].location, 0);
     assert_int_equal(parameter[8].location_sub, 0);
 
-    assert_int_equal(parameters.remaining.used, 6);
+    assert_int_equal(parameters.remaining.used, total - 1);
+    assert_string_equal(argv[parameters.remaining.array[0]], argv[1]);
+    assert_string_equal(argv[parameters.remaining.array[1]], argv[2]);
+    assert_string_equal(argv[parameters.remaining.array[2]], argv[3]);
+    assert_string_equal(argv[parameters.remaining.array[3]], argv[4]);
+    assert_string_equal(argv[parameters.remaining.array[4]], argv[5]);
+    assert_string_equal(argv[parameters.remaining.array[5]], argv[6]);
+    assert_string_equal(argv[parameters.remaining.array[6]], argv[7]);
+    assert_string_equal(argv[parameters.remaining.array[7]], argv[8]);
+    assert_string_equal(argv[parameters.remaining.array[8]], argv[9]);
+    assert_string_equal(argv[parameters.remaining.array[9]], argv[10]);
+    assert_string_equal(argv[parameters.remaining.array[10]], argv[11]);
+    assert_string_equal(argv[parameters.remaining.array[11]], argv[12]);
+    assert_string_equal(argv[parameters.remaining.array[12]], argv[13]);
+    assert_string_equal(argv[parameters.remaining.array[13]], argv[14]);
+    assert_string_equal(argv[parameters.remaining.array[14]], argv[15]);
+    assert_string_equal(argv[parameters.remaining.array[15]], argv[16]);
+    assert_string_equal(argv[parameters.remaining.array[16]], argv[17]);
+    assert_string_equal(argv[parameters.remaining.array[17]], argv[18]);
   }
 
   f_console_parameters_delete(&parameters);
@@ -388,7 +538,7 @@ void test__f_console_parameter_process__works(void **state) {
     "-f",
     "first",
     "-st",
-    "second",
+    "--second",
     "third",
     "other",
     "+F",
@@ -402,10 +552,16 @@ void test__f_console_parameter_process__works(void **state) {
     "other",
     "free",
     "-4",
+    "+fast",
+    "-staff",
+    "-mMxx",
+    "mixed 1",
+    "mixed 2, value 1",
+    "mixed 2, value 2",
     0,
   };
 
-  const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(18, argv, 0);
+  const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(24, argv, 0);
 
   f_console_parameter_t parameter[] = {
     macro_f_console_parameter_t_initialize("f", 0, 0, 1, f_console_type_normal_e),
@@ -416,10 +572,13 @@ void test__f_console_parameter_process__works(void **state) {
     macro_f_console_parameter_t_initialize(0, "sixth", 0, 1, f_console_type_normal_e),
     macro_f_console_parameter_t_initialize(0, "seventh", 0, 2, f_console_type_normal_e),
     macro_f_console_parameter_t_initialize("N", "not_found", 0, 0, f_console_type_normal_e),
+    macro_f_console_parameter_t_initialize("m", "mixed_1", 0, 1, f_console_type_normal_e),
+    macro_f_console_parameter_t_initialize("M", "mixed_2", 0, 2, f_console_type_normal_e),
+    macro_f_console_parameter_t_initialize("x", "mixed_3", 0, 0, f_console_type_normal_e),
     macro_f_console_parameter_t_initialize(0, 0, "other", 0, f_console_type_other_e),
   };
 
-  f_console_parameters_t parameters = macro_f_console_parameters_t_initialize(parameter, 9);
+  f_console_parameters_t parameters = macro_f_console_parameters_t_initialize(parameter, 12);
 
   {
     const f_status_t status = f_console_parameter_process(arguments, &parameters);
@@ -428,77 +587,127 @@ void test__f_console_parameter_process__works(void **state) {
 
     assert_int_equal(parameter[0].result, f_console_result_additional_e);
     assert_int_equal(parameter[0].locations.used, 1);
+    assert_int_equal(parameter[0].locations_sub.used, 1);
     assert_int_equal(parameter[0].values.used, 1);
     assert_int_equal(parameter[0].location, 1);
     assert_int_equal(parameter[0].location_sub, 1);
     assert_int_equal(parameter[0].locations.array[0], 1);
-    assert_string_equal(argv[parameter[0].values.array[0]], "first");
+    assert_int_equal(parameter[0].locations_sub.array[0], 1);
+    assert_string_equal(argv[parameter[0].values.array[0]], argv[2]);
 
     assert_int_equal(parameter[1].result, f_console_result_additional_e);
     assert_int_equal(parameter[1].locations.used, 1);
+    assert_int_equal(parameter[1].locations_sub.used, 1);
     assert_int_equal(parameter[1].values.used, 1);
     assert_int_equal(parameter[1].location, 3);
     assert_int_equal(parameter[1].location_sub, 1);
     assert_int_equal(parameter[1].locations.array[0], 3);
-    assert_string_equal(argv[parameter[1].values.array[0]], "second");
+    assert_int_equal(parameter[1].locations_sub.array[0], 1);
+    assert_string_equal(argv[parameter[1].values.array[0]], argv[4]);
 
     assert_int_equal(parameter[2].result, f_console_result_additional_e);
     assert_int_equal(parameter[2].locations.used, 1);
+    assert_int_equal(parameter[2].locations_sub.used, 1);
     assert_int_equal(parameter[2].values.used, 1);
     assert_int_equal(parameter[2].location, 3);
     assert_int_equal(parameter[2].location_sub, 2);
     assert_int_equal(parameter[2].locations.array[0], 3);
-    assert_string_equal(argv[parameter[2].values.array[0]], "third");
+    assert_int_equal(parameter[2].locations_sub.array[0], 2);
+    assert_string_equal(argv[parameter[2].values.array[0]], argv[5]);
 
     assert_int_equal(parameter[3].result, f_console_result_found_e);
     assert_int_equal(parameter[3].locations.used, 1);
+    assert_int_equal(parameter[3].locations_sub.used, 1);
     assert_int_equal(parameter[3].values.used, 0);
     assert_int_equal(parameter[3].location, 7);
     assert_int_equal(parameter[3].location_sub, 1);
     assert_int_equal(parameter[3].locations.array[0], 7);
+    assert_int_equal(parameter[3].locations_sub.array[0], 1);
 
     assert_int_equal(parameter[4].result, f_console_result_additional_e);
     assert_int_equal(parameter[4].locations.used, 1);
+    assert_int_equal(parameter[4].locations_sub.used, 1);
     assert_int_equal(parameter[4].values.used, 1);
     assert_int_equal(parameter[4].location, 8);
     assert_int_equal(parameter[4].location_sub, 0);
     assert_int_equal(parameter[4].locations.array[0], 8);
-    assert_string_equal(argv[parameter[4].values.array[0]], "fifth");
+    assert_int_equal(parameter[4].locations_sub.array[0], 0);
+    assert_string_equal(argv[parameter[4].values.array[0]], argv[9]);
 
     assert_int_equal(parameter[5].result, f_console_result_additional_e);
     assert_int_equal(parameter[5].locations.used, 1);
+    assert_int_equal(parameter[5].locations_sub.used, 1);
     assert_int_equal(parameter[5].values.used, 1);
     assert_int_equal(parameter[5].location, 10);
     assert_int_equal(parameter[5].location_sub, 0);
     assert_int_equal(parameter[5].locations.array[0], 10);
-    assert_string_equal(argv[parameter[5].values.array[0]], "sixth");
+    assert_int_equal(parameter[5].locations_sub.array[0], 0);
+    assert_string_equal(argv[parameter[5].values.array[0]], argv[11]);
 
     assert_int_equal(parameter[6].result, f_console_result_additional_e);
     assert_int_equal(parameter[6].locations.used, 1);
+    assert_int_equal(parameter[6].locations_sub.used, 1);
     assert_int_equal(parameter[6].values.used, 2);
     assert_int_equal(parameter[6].location, 12);
     assert_int_equal(parameter[6].location_sub, 0);
     assert_int_equal(parameter[6].locations.array[0], 12);
-    assert_string_equal(argv[parameter[6].values.array[0]], "seventh");
-    assert_string_equal(argv[parameter[6].values.array[1]], "7");
+    assert_int_equal(parameter[6].locations_sub.array[0], 0);
+    assert_string_equal(argv[parameter[6].values.array[0]], argv[13]);
+    assert_string_equal(argv[parameter[6].values.array[1]], argv[14]);
 
     assert_int_equal(parameter[7].result, f_console_result_none_e);
     assert_int_equal(parameter[7].locations.used, 0);
+    assert_int_equal(parameter[7].locations_sub.used, 0);
     assert_int_equal(parameter[7].values.used, 0);
     assert_int_equal(parameter[7].location, 0);
     assert_int_equal(parameter[7].location_sub, 0);
 
-    assert_int_equal(parameter[8].result, f_console_result_found_e);
-    assert_int_equal(parameter[8].locations.used, 2);
-    assert_int_equal(parameter[8].values.used, 0);
-    assert_int_equal(parameter[8].location, 15);
-    assert_int_equal(parameter[8].location_sub, 0);
-    assert_int_equal(parameter[8].locations.array[0], 6);
-    assert_int_equal(parameter[8].locations.array[1], 15);
-
-    assert_int_equal(parameters.remaining.used, 2);
-    assert_string_equal(argv[parameters.remaining.array[0]], "free");
-    assert_string_equal(argv[parameters.remaining.array[1]], "-4");
+    assert_int_equal(parameter[8].result, f_console_result_additional_e);
+    assert_int_equal(parameter[8].locations.used, 1);
+    assert_int_equal(parameter[8].locations_sub.used, 1);
+    assert_int_equal(parameter[8].values.used, 1);
+    assert_int_equal(parameter[8].location, 20);
+    assert_int_equal(parameter[8].location_sub, 1);
+    assert_int_equal(parameter[8].locations.array[0], 20);
+    assert_int_equal(parameter[8].locations_sub.array[0], 1);
+    assert_string_equal(argv[parameter[8].values.array[0]], argv[21]);
+
+    assert_int_equal(parameter[9].result, f_console_result_additional_e);
+    assert_int_equal(parameter[9].locations.used, 1);
+    assert_int_equal(parameter[9].locations_sub.used, 1);
+    assert_int_equal(parameter[9].values.used, 2);
+    assert_int_equal(parameter[9].location, 20);
+    assert_int_equal(parameter[9].location_sub, 2);
+    assert_int_equal(parameter[9].locations.array[0], 20);
+    assert_int_equal(parameter[9].locations_sub.array[0], 2);
+    assert_string_equal(argv[parameter[9].values.array[0]], argv[22]);
+    assert_string_equal(argv[parameter[9].values.array[1]], argv[23]);
+
+    assert_int_equal(parameter[10].result, f_console_result_found_e);
+    assert_int_equal(parameter[10].locations.used, 1);
+    assert_int_equal(parameter[10].locations_sub.used, 2);
+    assert_int_equal(parameter[10].values.used, 0);
+    assert_int_equal(parameter[10].location, 20);
+    assert_int_equal(parameter[10].location_sub, 4);
+    assert_int_equal(parameter[10].locations.array[0], 20);
+    assert_int_equal(parameter[10].locations_sub.array[0], 3);
+    assert_int_equal(parameter[10].locations_sub.array[1], 4);
+
+    assert_int_equal(parameter[11].result, f_console_result_found_e);
+    assert_int_equal(parameter[11].locations.used, 2);
+    assert_int_equal(parameter[11].locations_sub.used, 2);
+    assert_int_equal(parameter[11].values.used, 0);
+    assert_int_equal(parameter[11].location, 15);
+    assert_int_equal(parameter[11].location_sub, 0);
+    assert_int_equal(parameter[11].locations.array[0], 6);
+    assert_int_equal(parameter[11].locations.array[1], 15);
+    assert_int_equal(parameter[11].locations_sub.array[0], 0);
+
+    assert_int_equal(parameters.remaining.used, 4);
+    assert_string_equal(argv[parameters.remaining.array[0]], argv[16]);
+    assert_string_equal(argv[parameters.remaining.array[1]], argv[17]);
+    assert_string_equal(argv[parameters.remaining.array[2]], argv[18]);
+    assert_string_equal(argv[parameters.remaining.array[3]], argv[19]);
   }
 
   f_console_parameters_delete(&parameters);
index 44c606ee4e58e895766decc9854781606e3f68d1..13413cdc37342384106abc9a70aa383f4d64b7de 100644 (file)
 // f_console_parameter_process() only returns memory failures.
 
 /**
+ * Test that function works with incomplete arguments.
+ *
+ * @see f_console_parameter_process()
+ */
+extern void test__f_console_parameter_process__incomplete_arguments(void **state);
+
+/**
  * Test that function works with no (argv) arguments (but does have program name).
  *
  * @see f_console_parameter_process()
index 055d99eabe3358831ab51ddeab57fcc465a823ab..fe9a67a87eceae9fdd3d090e091d07f3135e3c51 100644 (file)
@@ -31,6 +31,7 @@ int main(void) {
     cmocka_unit_test(test__f_console_parameter_prioritize_right__fails),
     cmocka_unit_test(test__f_console_parameter_prioritize_right__works),
 
+    cmocka_unit_test(test__f_console_parameter_process__incomplete_arguments),
     cmocka_unit_test(test__f_console_parameter_process__no_arguments_no_program),
     cmocka_unit_test(test__f_console_parameter_process__no_arguments),
     cmocka_unit_test(test__f_console_parameter_process__null_arguments),
index 6b894a51b2bb7897f0f3795b1dacd58d54084b62..f6be1907083d2629e31008c219fa95e3d616abba 100644 (file)
@@ -105,7 +105,7 @@ extern "C" {
       while (range->start <= range->stop && range->start < buffer->used) {
 
         if (state.interrupt) {
-          status = state.interrupt((void *) &state, 0);
+          status = state.interrupt((void * const) &state, 0);
 
           if (F_status_set_fine(status) == F_interrupt) {
             status = F_status_set_error(F_interrupt);
@@ -149,7 +149,7 @@ extern "C" {
       while (F_status_is_error_not(status) && range->start <= range->stop && range->start < buffer->used) {
 
         if (state.interrupt) {
-          status = state.interrupt((void *) &state, 0);
+          status = state.interrupt((void * const) &state, 0);
 
           if (F_status_set_fine(status) == F_interrupt) {
             status = F_status_set_error(F_interrupt);
@@ -192,7 +192,7 @@ extern "C" {
           while (range->start <= range->stop && range->start < buffer->used) {
 
             if (state.interrupt) {
-              status = state.interrupt((void *) &state, 0);
+              status = state.interrupt((void * const) &state, 0);
 
               if (F_status_set_fine(status) == F_interrupt) {
                 status = F_status_set_error(F_interrupt);
@@ -290,7 +290,7 @@ extern "C" {
         while (range->start <= range->stop && range->start < buffer->used) {
 
           if (state.interrupt) {
-            status = state.interrupt((void *) &state, 0);
+            status = state.interrupt((void * const) &state, 0);
 
             if (F_status_set_fine(status) == F_interrupt) {
               status = F_status_set_error(F_interrupt);
index 44aded4182279a6bbbde4b02f809c269297eca53..ceeabde4cf0abe65fb76e79874249546f7d503c6 100644 (file)
@@ -117,7 +117,16 @@ extern "C" {
     void *data;
   } f_state_t;
 
-  #define f_state_t_initialize { F_memory_default_allocation_large_d, F_memory_default_allocation_small_d, 0, 0, 0, 0, 0, 0 }
+  #define f_state_t_initialize { \
+    F_memory_default_allocation_large_d, \
+    F_memory_default_allocation_small_d, \
+    0, \
+    0, \
+    0, \
+    0, \
+    0, \
+    0, \
+  }
 
   #define macro_f_state_t_initialize(step_large, step_small, flag, handle, interrupt, callbacks, custom, data) { \
     step_large, \
index 60294204996a71ee8cb5c653f7e8f26446534ee2..08a862f14e1834627774a77162f55daa940a5c74 100644 (file)
@@ -108,6 +108,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -123,7 +125,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_byte_dump_setting_load_
-  extern void byte_dump_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, byte_dump_setting_t * const setting);
+  extern void byte_dump_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, byte_dump_setting_t * const setting);
 #endif // _di_byte_dump_setting_load_
 
 /**
index 0bb4556e2f51ab43e4a55d955599d93f053cf3be..e99de3228a9848186a0e2c7e8f12ff8e38e9a971 100644 (file)
@@ -77,14 +77,14 @@ extern "C" {
 #endif // _di_byte_dump_setting_delete_
 
 #ifndef _di_byte_dump_setting_load_
-  void byte_dump_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, byte_dump_setting_t * const setting) {
+  void byte_dump_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, byte_dump_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       byte_dump_print_line_first_locked(setting, main->error);
index 6a6d557b7acbe4a46e246de20d1847739c7b32ea..5557932c4684200b705385aa04cabd21e84051f8 100644 (file)
@@ -319,36 +319,36 @@ extern "C" {
 
   #define byte_dump_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_binary_s,      byte_dump_long_binary_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_decimal_s,     byte_dump_long_decimal_s,     0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_duodecimal_s,  byte_dump_long_duodecimal_s,  0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_hexidecimal_s, byte_dump_long_hexidecimal_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_octal_s,       byte_dump_long_octal_s,       0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_unicode_s,     byte_dump_long_unicode_s,     0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_first_s,       byte_dump_long_first_s,       1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_last_s,        byte_dump_long_last_s,        1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_narrow_s,      byte_dump_long_narrow_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_placeholder_s, byte_dump_long_placeholder_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_text_s,        byte_dump_long_text_s,        0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_wide_s,        byte_dump_long_wide_s,        0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(byte_dump_short_width_s,       byte_dump_long_width_s,       1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_binary_s,      byte_dump_long_binary_s,      0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_decimal_s,     byte_dump_long_decimal_s,     0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_duodecimal_s,  byte_dump_long_duodecimal_s,  0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_hexidecimal_s, byte_dump_long_hexidecimal_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_octal_s,       byte_dump_long_octal_s,       0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_unicode_s,     byte_dump_long_unicode_s,     0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_first_s,       byte_dump_long_first_s,       1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_last_s,        byte_dump_long_last_s,        1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_narrow_s,      byte_dump_long_narrow_s,      0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_placeholder_s, byte_dump_long_placeholder_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_text_s,        byte_dump_long_text_s,        0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_wide_s,        byte_dump_long_wide_s,        0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(byte_dump_short_width_s,       byte_dump_long_width_s,       1, f_console_flag_normal_e), \
       \
-      macro_f_console_parameter_t_initialize_6(byte_dump_long_normal_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_6(byte_dump_long_simple_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_6(byte_dump_long_classic_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_5(byte_dump_long_normal_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_5(byte_dump_long_simple_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_5(byte_dump_long_classic_s, 0, f_console_flag_normal_e), \
     }
 
   #define byte_dump_total_parameters_d 28
index d32ca7f7f9787eb14c47dba4500c586c330a79d9..2106bbaf2ba266960dc4bffb1fd83fa5f31d695f 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    byte_dump_setting_load(arguments, &data, &setting);
+    byte_dump_setting_load(arguments, state, &data, &setting);
   }
 
   byte_dump_main(&data, &setting);
index 108c18ec8c33ad0f64a4828770ee19e4c8d4c9d5..959418284549c5844621640ed9228779b48974e0 100644 (file)
@@ -180,14 +180,14 @@ extern "C" {
 #endif // _di_control_setting_delete_
 
 #ifndef _di_control_setting_load_
-  void control_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, control_setting_t * const setting) {
+  void control_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, control_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       control_print_line_first_locked(setting, main->error);
index 4c7a32c302c317ddc8033f8419b967f3dede2d19..69b844db8e86e233f9c24290be52b559e0289d86 100644 (file)
@@ -115,23 +115,23 @@ extern "C" {
 
   #define control_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(control_short_name_s,     control_long_name_s,     1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(control_short_return_s,   control_long_return_s,   1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(control_short_settings_s, control_long_settings_s, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(control_short_socket_s,   control_long_socket_s,   1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(control_short_name_s,     control_long_name_s,     1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(control_short_return_s,   control_long_return_s,   1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(control_short_settings_s, control_long_settings_s, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(control_short_socket_s,   control_long_socket_s,   1, f_console_flag_normal_e), \
     }
 
   #define control_total_parameters_d 16
@@ -329,6 +329,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -344,7 +346,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_control_setting_load_
-  extern void control_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, control_setting_t * const setting);
+  extern void control_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, control_setting_t * const setting);
 #endif // _di_control_setting_load_
 
 /**
index 910a490b61b86143638acab8c571bc2f30a4a654..be3036332aa3338216d3a0aebb21b2fb45fd00a9 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    control_setting_load(arguments, &data, &setting);
+    control_setting_load(arguments, state, &data, &setting);
   }
 
   control_main(&data, &setting);
index 828cb64c502c203230d4d3a476fd32a9fff5a379..2caf0a1170ec50e10831dbff62c6b334ce5a50bd 100644 (file)
@@ -612,14 +612,14 @@ extern "C" {
 #endif // _di_controller_setting_delete_
 
 #ifndef _di_controller_setting_load_
-  void controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, controller_setting_t * const setting) {
+  void controller_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, controller_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       controller_print_line_first_locked(setting, main->error);
index 39a8a6c75e9c8d21ff5a1477871210a646122a6b..01a69a007e62b930228329faef5dbc194f87c3e0 100644 (file)
@@ -143,29 +143,29 @@ extern "C" {
 
   #define controller_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(controller_short_cgroup_s,          controller_long_cgroup_s,          1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(controller_short_daemon_s,          controller_long_daemon_s,          0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(controller_short_init_s,            controller_long_init_s,            0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(controller_short_interruptible_s,   controller_long_interruptible_s,   0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(controller_short_pid_s,             controller_long_pid_s,             1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(controller_short_settings_s,        controller_long_settings_s,        1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(controller_short_simulate_s,        controller_long_simulate_s,        0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(controller_short_socket_s,          controller_long_socket_s,          1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(controller_short_uninterruptible_s, controller_long_uninterruptible_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(controller_short_validate_s,        controller_long_validate_s,        0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(controller_short_cgroup_s,          controller_long_cgroup_s,          1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(controller_short_daemon_s,          controller_long_daemon_s,          0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(controller_short_init_s,            controller_long_init_s,            0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(controller_short_interruptible_s,   controller_long_interruptible_s,   0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(controller_short_pid_s,             controller_long_pid_s,             1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(controller_short_settings_s,        controller_long_settings_s,        1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(controller_short_simulate_s,        controller_long_simulate_s,        0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(controller_short_socket_s,          controller_long_socket_s,          1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(controller_short_uninterruptible_s, controller_long_uninterruptible_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(controller_short_validate_s,        controller_long_validate_s,        0, f_console_flag_normal_e), \
     }
 
   #define controller_total_parameters_d 22
@@ -722,6 +722,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -737,7 +739,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_controller_setting_load_
-  extern void controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, controller_setting_t * const setting);
+  extern void controller_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, controller_setting_t * const setting);
 #endif // _di_controller_setting_load_
 
 /**
index 9a81235143bbd8383aecd5b5f4ed0daa8a95d1f5..5451809b047821297faa64a9b1c08ad37824bddb 100644 (file)
@@ -44,8 +44,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    controller_setting_load(arguments, &data, &setting);
+    controller_setting_load(arguments, state, &data, &setting);
   }
 
   controller_main(&data, &setting);
index 711afd3c04727696692fe2f71c067e0a36a0b8d8..9e635eb8e26aa06fdb229e739cf1e396a41e466d 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
     "f_console_parameter_process",
     "f_file_is",
     "f_file_name_base",
+    "f_path_directory_cleanup",
     "f_string_append",
     "f_string_dynamic_append",
     "f_string_dynamic_append_nulless",
@@ -17,12 +18,14 @@ extern "C" {
     "f_string_dynamic_mash",
     "f_string_dynamic_resize",
     "f_string_dynamics_increase_by",
+    "f_uint8s_increase",
     "f_uint8s_increase_by",
     "f_utf_is_word_dash_plus",
     "fl_directory_copy",
     "fll_execute_arguments_add",
     "fll_execute_arguments_add_parameter_set",
     "fll_execute_program",
+    "fll_program_parameter_additional_rip",
     "fll_program_parameter_process_context",
     "fll_program_parameter_process_verbosity",
   };
index 85cca371a8116e7f00e4b3a6ea94b1fc688adf41..56c5c4e116c5c0a3c527f26f8962f01c699829a9 100644 (file)
@@ -43,6 +43,7 @@ extern "C" {
     fake_f_f_console_parameter_process_e,
     fake_f_f_file_is_e,
     fake_f_f_file_name_base_e,
+    fake_f_f_path_directory_cleanup_e,
     fake_f_f_string_append_e,
     fake_f_f_string_dynamic_append_e,
     fake_f_f_string_dynamic_append_nulless_e,
@@ -50,12 +51,14 @@ extern "C" {
     fake_f_f_string_dynamic_mash_e,
     fake_f_f_string_dynamic_resize_e,
     fake_f_f_string_dynamics_increase_by_e,
+    fake_f_f_uint8s_increase_e,
     fake_f_f_uint8s_increase_by_e,
     fake_f_f_utf_is_word_dash_plus_e,
     fake_f_fl_directory_copy_e,
     fake_f_fll_execute_arguments_add_e,
     fake_f_fll_execute_arguments_add_parameter_set_e,
     fake_f_fll_execute_program_e,
+    fake_f_fll_program_parameter_additional_rip_e,
     fake_f_fll_program_parameter_process_context_e,
     fake_f_fll_program_parameter_process_verbosity_e,
   }; // enum
index 52a3828f398201ed5e02a68e4892f5f4464bdd7a..31dd4d657422d00b2ead2afe3b243d7147c52c15 100644 (file)
@@ -51,10 +51,10 @@ extern "C" {
  * Provide default settings.
  */
 #ifndef _di_fake_default_s_
-  const f_string_static_t fake_default_path_build_s = macro_f_string_static_t_initialize(FAKE_default_path_build_s, 0, FAKE_default_path_build_s_length);
-  const f_string_static_t fake_default_path_data_s = macro_f_string_static_t_initialize(FAKE_default_path_data_s, 0, FAKE_default_path_data_s_length);
-  const f_string_static_t fake_default_path_sources_s = macro_f_string_static_t_initialize(FAKE_default_path_sources_s, 0, FAKE_default_path_sources_s_length);
-  const f_string_static_t fake_default_path_work_s = macro_f_string_static_t_initialize(FAKE_default_path_work_s, 0, FAKE_default_path_work_s_length);
+  const f_string_static_t fake_default_build_s = macro_f_string_static_t_initialize(FAKE_default_build_s, 0, FAKE_default_build_s_length);
+  const f_string_static_t fake_default_data_s = macro_f_string_static_t_initialize(FAKE_default_data_s, 0, FAKE_default_data_s_length);
+  const f_string_static_t fake_default_sources_s = macro_f_string_static_t_initialize(FAKE_default_sources_s, 0, FAKE_default_sources_s_length);
+  const f_string_static_t fake_default_work_s = macro_f_string_static_t_initialize(FAKE_default_work_s, 0, FAKE_default_work_s_length);
 
   const f_string_static_t fake_default_fakefile_s = macro_f_string_static_t_initialize(FAKE_default_fakefile_s, 0, FAKE_default_fakefile_s_length);
   const f_string_static_t fake_default_process_s = macro_f_string_static_t_initialize(FAKE_default_process_s, 0, FAKE_default_process_s_length);
@@ -123,48 +123,6 @@ extern "C" {
     f_string_dynamic_resize(0, &setting->settings);
     f_string_dynamic_resize(0, &setting->sources);
     f_string_dynamic_resize(0, &setting->work);
-    f_string_dynamic_resize(0, &setting->path_build);
-    f_string_dynamic_resize(0, &setting->path_build_documentation);
-    f_string_dynamic_resize(0, &setting->path_build_documents);
-    f_string_dynamic_resize(0, &setting->path_build_includes);
-    f_string_dynamic_resize(0, &setting->path_build_libraries);
-    f_string_dynamic_resize(0, &setting->path_build_libraries_script);
-    f_string_dynamic_resize(0, &setting->path_build_libraries_shared);
-    f_string_dynamic_resize(0, &setting->path_build_libraries_static);
-    f_string_dynamic_resize(0, &setting->path_build_objects);
-    f_string_dynamic_resize(0, &setting->path_build_objects_script);
-    f_string_dynamic_resize(0, &setting->path_build_objects_shared);
-    f_string_dynamic_resize(0, &setting->path_build_objects_static);
-    f_string_dynamic_resize(0, &setting->path_build_programs);
-    f_string_dynamic_resize(0, &setting->path_build_programs_script);
-    f_string_dynamic_resize(0, &setting->path_build_programs_shared);
-    f_string_dynamic_resize(0, &setting->path_build_programs_static);
-    f_string_dynamic_resize(0, &setting->path_build_settings);
-    f_string_dynamic_resize(0, &setting->path_build_stage);
-    f_string_dynamic_resize(0, &setting->path_data);
-    f_string_dynamic_resize(0, &setting->path_data_build);
-    f_string_dynamic_resize(0, &setting->path_data_documentation);
-    f_string_dynamic_resize(0, &setting->path_data_settings);
-    f_string_dynamic_resize(0, &setting->path_documents);
-    f_string_dynamic_resize(0, &setting->path_licenses);
-    f_string_dynamic_resize(0, &setting->path_sources);
-    f_string_dynamic_resize(0, &setting->path_work);
-    f_string_dynamic_resize(0, &setting->path_work_includes);
-    f_string_dynamic_resize(0, &setting->path_work_libraries);
-    f_string_dynamic_resize(0, &setting->path_work_libraries_script);
-    f_string_dynamic_resize(0, &setting->path_work_libraries_shared);
-    f_string_dynamic_resize(0, &setting->path_work_libraries_static);
-    f_string_dynamic_resize(0, &setting->path_work_programs);
-    f_string_dynamic_resize(0, &setting->path_work_programs_script);
-    f_string_dynamic_resize(0, &setting->path_work_programs_shared);
-    f_string_dynamic_resize(0, &setting->path_work_programs_static);
-    f_string_dynamic_resize(0, &setting->file_data_build_defines);
-    f_string_dynamic_resize(0, &setting->file_data_build_dependencies);
-    f_string_dynamic_resize(0, &setting->file_data_build_fakefile);
-    f_string_dynamic_resize(0, &setting->file_data_build_process_post);
-    f_string_dynamic_resize(0, &setting->file_data_build_process_pre);
-    f_string_dynamic_resize(0, &setting->file_data_build_settings);
-    f_string_dynamic_resize(0, &setting->file_documents_readme);
 
     f_string_dynamics_resize(0, &setting->defines);
     f_string_dynamics_resize(0, &setting->modes);
@@ -176,17 +134,15 @@ extern "C" {
 #endif // _di_fake_setting_delete_
 
 #ifndef _di_fake_setting_load_
-  void fake_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fake_setting_t * const setting) {
+  void fake_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fake_setting_t * const setting) {
 
     if (!main || !setting) return;
 
-    setting->flag = 0;
-
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, (void *) setting);
+    setting->status = f_console_parameter_process(arguments, state, &main->parameters, (void *) setting);
 
     if (F_status_is_error(setting->status)) {
-      fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_console_parameter_process));
+      fake_print_error(setting, setting->status, main->error, macro_fake_f(f_console_parameter_process));
 
       return;
     }
@@ -206,7 +162,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_process_context));
+          fake_print_error(setting, setting->status, main->error, macro_fake_f(fll_program_parameter_process_context));
 
           return;
         }
@@ -237,7 +193,7 @@ extern "C" {
         setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
         if (F_status_is_error(setting->status)) {
-          fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_process_verbosity));
+          fake_print_error(setting, setting->status, main->error, macro_fake_f(fll_program_parameter_process_verbosity));
 
           return;
         }
@@ -315,7 +271,6 @@ extern "C" {
           fake_parameter_path_work_e,
           fake_parameter_process_e,
           fake_parameter_settings_e,
-          fake_parameter_sources_e,
         };
 
         const f_string_static_t names[] = {
@@ -326,32 +281,47 @@ extern "C" {
           fake_long_path_work_s,
           fake_long_process_s,
           fake_long_settings_s,
-          fake_long_sources_s,
         };
 
         f_string_dynamic_t * const variable[] = {
           &setting->fakefile,
-          &setting->path_build,
-          &setting->path_data,
-          &setting->path_sources,
-          &setting->path_work,
+          &setting->build,
+          &setting->data,
+          &setting->sources,
+          &setting->work,
           &setting->process,
           &setting->settings,
-          &setting->sources,
         };
 
-        f_string_static_t * const defaults[] = {
-          &fake_default_fakefile_s, // fake_parameter_fakefile_e
-          0,                        // fake_parameter_path_build_e
-          0,                        // fake_parameter_path_data_e
-          0,                        // fake_parameter_path_sources_e
-          0,                        // fake_parameter_path_work_e
-          &fake_default_process_s,  // fake_parameter_process_e
-          &fake_default_settings_s, // fake_parameter_settings_e
-          0,                        // fake_parameter_sources_e
+        f_string_dynamic_resize(0, &setting->build);
+        f_string_dynamic_resize(0, &setting->data);
+        f_string_dynamic_resize(0, &setting->fakefile);
+        f_string_dynamic_resize(0, &setting->process);
+        f_string_dynamic_resize(0, &setting->settings);
+        f_string_dynamic_resize(0, &setting->sources);
+        f_string_dynamic_resize(0, &setting->work);
+
+        const f_string_static_t defaults[] = {
+          fake_default_fakefile_s,
+          fake_default_build_s,
+          fake_default_data_s,
+          fake_default_sources_s,
+          fake_default_work_s,
+          fake_default_process_s,
+          fake_default_settings_s,
         };
 
-        for (i = 0; i < 8; ++i) {
+        const bool cleanups[] = {
+          F_false, // fake_parameter_fakefile_e
+          F_true,  // fake_parameter_path_build_e
+          F_true,  // fake_parameter_path_data_e
+          F_false, // fake_parameter_path_sources_e
+          F_true,  // fake_parameter_path_work_e
+          F_false, // fake_parameter_process_e
+          F_false, // fake_parameter_settings_e
+        };
+
+        for (i = 0; i < 7; ++i) {
 
           if (main->parameters.array[parameters[i]].result & f_console_result_found_e) {
             setting->status = F_status_set_error(F_parameter);
@@ -363,7 +333,7 @@ extern "C" {
             return;
           }
 
-          if (main->parameters.array[parameters[i]].result & f_console_result_additional_e) {
+          if (main->parameters.array[parameters[i]].result & f_console_result_value_e) {
             index = data->main->parameters.array[parameters[i]].values.array[data->main->parameters.array[parameters[i]].values.used - 1];
 
             if (data->main->parameters.arguments.array[index].used) {
@@ -394,39 +364,65 @@ extern "C" {
                 } // for
               }
 
-              // De-allocate memory before replacing it with a statically allocated string.
-              if (variable[i]->size) {
-                setting->status = f_string_dynamic_resize(0, variable[i]);
+              if (cleanups[i]) {
+                status = f_path_directory_cleanup(data->main->parameters.arguments.array[index], parameters_value[i]);
 
                 if (F_status_is_error(setting->status)) {
-                  fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_string_dynamic_resize));
+                  if (print.verbosity > f_console_verbosity_quiet_e) {
+                    fake_print_line_first_locked(setting, print);
+
+                    if (fll_error_print(data->main->error, F_status_set_fine(setting->status), macro_fake_f(f_path_directory_cleanup), F_false) == F_false) {
+                      fll_program_print_error_parameter_process(data->main->error, F_status_set_fine(setting->status), f_console_symbol_long_normal_s, names[i]);
+                    }
+                  }
 
                   return;
                 }
               }
+              else {
 
-              variable[i]->string = data->main->parameters.arguments.array[index].string;
-              variable[i]->used = data->main->parameters.arguments.array[index].used;
-              variable[i]->size = 0;
+                // De-allocate memory before replacing it with a statically allocated string.
+                if (variable[i]->size) {
+                  setting->status = f_string_dynamic_resize(0, variable[i]);
+
+                  if (F_status_is_error(setting->status)) {
+                    fake_print_error(setting, setting->status, main->error, macro_fake_f(f_string_dynamic_resize));
+
+                    return;
+                  }
+                }
+
+                variable[i]->string = data->main->parameters.arguments.array[index].string;
+                variable[i]->used = data->main->parameters.arguments.array[index].used;
+                variable[i]->size = 0;
+              }
+
+              if (!variable[i]->used) {
+                setting->status = F_status_set_error(F_parameter);
+
+                fake_print_error_parameter_not_empty(setting, data->main->error, f_console_symbol_long_normal_s, names[i], data->main->parameters.arguments.array[index]);
+
+                return;
+              }
 
               setting->status = F_none;
             }
           }
-          else if (defaults[i]) {
+          else {
 
             // De-allocate memory before replacing it with a statically allocated string.
             if (variable[i]->size) {
               setting->status = f_string_dynamic_resize(0, variable[i]);
 
               if (F_status_is_error(setting->status)) {
-                fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_string_dynamic_resize));
+                fake_print_error(setting, setting->status, main->error, macro_fake_f(f_string_dynamic_resize));
 
                 return;
               }
             }
 
-            variable[i]->string = defaults[i]->string;
-            variable[i]->used = defaults[i]->used;
+            variable[i]->string = defaults[i].string;
+            variable[i]->used = defaults[i].used;
             variable[i]->size = 0;
           }
         } // for
@@ -460,149 +456,137 @@ extern "C" {
             return;
           }
 
-          if (main->parameters.array[parameters[i]].result & f_console_result_additional_e) {
-            variable[i]->used = 0;
-
-            setting->status = f_string_dynamics_increase_by(data->main->parameters.array[parameters[i]].values.used, variable[i]);
+          if (main->parameters.array[parameters[i]].result & f_console_result_value_e) {
+            setting->status = fll_program_parameter_additional_rip(data->main->parameters.arguments.array, data->main->parameters.array[parameters[i]].values, variable[i]);
 
             if (F_status_is_error(setting->status)) {
-              fake_print_error(setting, main->error, macro_fake_f(f_string_dynamics_increase_by));
+              if (print.verbosity > f_console_verbosity_quiet_e) {
+                fake_print_line_first_locked(setting, print);
+
+                if (fll_error_print(data->main->error, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_additional_rip), F_false) == F_false) {
+                  fll_program_print_error_parameter_process(data->main->error, F_status_set_fine(setting->status), f_console_symbol_long_normal_s, names[i]);
+                }
+              }
 
               return;
             }
 
-            for (; variable[i]->used < data->main->parameters.array[parameters[i]].values.used; ) {
+            if (parameters[i] == fake_parameter_mode_e) {
+              f_array_length_t i = 0;
+              f_array_length_t j = 0;
+              f_array_length_t width_max = 0;
 
-              // De-allocate memory before replacing it with a statically allocated string.
-              if (variable[i]->size) {
-                setting->status = f_string_dynamic_resize(0, variable[i]);
+              for (; i < data->mode.used; ++i) {
 
-                if (F_status_is_error(setting->status)) {
-                  fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_string_dynamic_resize));
+                for (j = 0; j < data->mode.array[i].used; ++j) {
 
-                  return;
-                }
-              }
+                  width_max = data->mode.array[i].used - j;
+
+                  setting->status = f_utf_is_word_dash_plus(data->main->parameters.arguments.array[i].string + j, data->main->parameters.arguments.array[i].used - j, F_false);
 
-              index = data->main->parameters.array[parameters[i]].values.array[variable[i]->used];
+                  if (F_status_is_error(setting->status)) {
+                    if (print.verbosity > f_console_verbosity_quiet_e) {
+                      fake_print_line_first_locked(setting, print);
+
+                      if (fll_error_print(data->main->error, F_status_set_fine(setting->status), macro_fake_f(f_utf_is_word_dash_plus), F_false) == F_false) {
+                        fll_program_print_error_parameter_process(data->main->error, F_status_set_fine(setting->status), f_console_symbol_long_normal_s, names[i]);
+                      }
+                    }
 
-              variable[i]->array[variable[i]->used].string = main->parameters.arguments.array[index].string;
-              variable[i]->array[variable[i]->used].used = main->parameters.arguments.array[index].used;
-              variable[i]->array[variable[i]->used++].size = 0;
-            } // for
+                    return;
+                  }
+
+                  if (setting->status == F_false) {
+                    setting->status = F_status_set_error(F_parameter);
+
+                    fake_print_error_parameter_not_word(setting, data->main->error, f_console_symbol_long_normal_s, names[i], data->main->parameters.arguments.array[index]);
+
+                    return;
+                  }
+                } // for
+              } // for
+            }
           }
         } // for
       }
     }
 
-    {
-      f_array_length_t locations = main->parameters.array[fake_parameter_operation_build_e].locations.used;
-      locations += main->parameters.array[fake_parameter_operation_clean_e].locations.used;
-      locations += main->parameters.array[fake_parameter_operation_make_e].locations.used;
-      locations += main->parameters.array[fake_parameter_operation_skeleton_e].locations.used;
-
-      setting->operations.used = 0;
+    if (setting->operations.used) {
+      setting->flag |= fake_data_flag_operation_e;
+    }
+    else {
+      setting->flag |= fake_data_flag_operation_make_e;
+      setting->flag -= setting->flag & fake_data_flag_operation_e;
 
-      setting->status = f_uint8s_increase_by(locations ? locations : 1, &setting->operations);
+      setting->status = f_uint8s_increase_by(1, &setting->operations);
 
       if (F_status_is_error(setting->status)) {
-        fake_print_error(setting, main->error, macro_fake_f(f_uint8s_increase_by));
+        fake_print_error(setting, setting->status, main->error, macro_fake_f(f_uint8s_increase_by));
 
         return;
       }
 
-      if (locations) {
-        data.flag |= fake_data_flag_operation_e;
-
-        f_array_length_t i = 0;
-
-        //f_string_static_t * const args = main->parameters.arguments.array;
-
-        /*
-          fake_process_console_parameters
-          fake_parameter_operation_build_e,
-          fake_parameter_operation_clean_e,
-          fake_parameter_operation_make_e,
-          fake_parameter_operation_skeleton_e,
-        */
-        /*
-        f_array_length_t locations[operations_length];
-        f_array_length_t locations_length = 0;
-        f_array_length_t i = 0;
-        f_array_length_t j = 0;
-        f_array_length_t k = 0;
+      setting->operations.array[setting->operations.used++] = fake_operation_make_e;
+    }
+  }
+#endif // _di_fake_setting_load_
 
-        for (; i < main->parameters.array[fake_parameter_operation_build_e].locations.used; ++i, ++locations_length) {
+#ifndef _di_fake_setting_load_parameter_callback_
+  void fake_setting_load_parameter_callback(const f_console_arguments_t arguments, void * const void_parameters, f_console_parameter_state_t * const state, void * const void_data) {
 
-          operations[locations_length] = fake_operation_build_e;
-          locations[locations_length] = main->parameters.array[fake_parameter_operation_build_e].locations.array[i];
-        } // for
+    if (!state) return;
 
-        for (i = 0; i < main->parameters.array[fake_parameter_operation_clean_e].locations.used; ++i) {
+    if (!parameters || !data || state->type != f_console_parameter_state_type_match_other_e)) {
+      state->status = F_process;
 
-          for (j = 0; j < locations_length; ++j) {
+      return;
+    }
 
-            if (main->parameters.array[fake_parameter_operation_clean_e].locations.array[i] < locations[j]) {
-              for (k = locations_length; k > j; --k) {
-                locations[k] = locations[k - 1];
-                operations[k] = operations[k - 1];
-              } // for
+    f_console_parameters_t * const parameters = (f_console_parameters_t * const) void_parameters;
+    fake_setting_t * const setting = (fake_setting_t * const) void_data;
 
-              break;
-            }
-          } // for
+    state->status = f_uint8s_increase(fake_default_allocation_small_d, &setting->operations);
 
-          locations[j] = main->parameters.array[fake_parameter_operation_clean_e].locations.array[i];
-          operations[j] = fake_operation_clean_e;
-          ++locations_length;
-        } // for
+    if (F_status_is_error(state->status)) {
+      fake_print_error(setting, state->status, main->error, macro_fake_f(f_uint8s_increase));
 
-        for (i = 0; i < main->parameters.array[fake_parameter_operation_make_e].locations.used; ++i) {
+      return;
+    }
 
-          for (j = 0; j < locations_length; ++j) {
+    switch (state.match) {
+      case fake_parameter_operation_build_e:
+        setting->operations.array[setting->operations.used++] = fake_operation_build_e;
+        setting->flag |= fake_data_flag_operation_build_e;
 
-            if (main->parameters.array[fake_parameter_operation_make_e].locations.array[i] < locations[j]) {
-              for (k = locations_length; k > j; --k) {
-                locations[k] = locations[k - 1];
-                operations[k] = operations[k - 1];
-              } // for
+        break;
 
-              break;
-            }
-          } // for
+      case fake_parameter_operation_clean_e:
+        setting->operations.array[setting->operations.used++] = fake_operation_clean_e;
+        setting->flag |= fake_data_flag_operation_clean_e;
 
-          locations[j] = main->parameters.array[fake_parameter_operation_make_e].locations.array[i];
-          operations[j] = fake_operation_make_e;
-          ++locations_length;
-        } // for
+        break;
 
-        for (i = 0; i < main->parameters.array[fake_parameter_operation_skeleton_e].locations.used; ++i) {
+      case fake_parameter_operation_make_e:
+        setting->operations.array[setting->operations.used++] = fake_operation_make_e;
+        setting->flag |= fake_data_flag_operation_make_e;
 
-          for (j = 0; j < locations_length; ++j) {
+        break;
 
-            if (main->parameters.array[fake_parameter_operation_skeleton_e].locations.array[i] < locations[j]) {
-              for (k = locations_length; k > j; --k) {
+      case fake_parameter_operation_skeleton_e:
+        setting->operations.array[setting->operations.used++] = fake_operation_skeleton_e;
+        setting->flag |= fake_data_flag_operation_skeleton_e;
 
-                locations[k] = locations[k - 1];
-                operations[k] = operations[k - 1];
-              } // for
+        break;
 
-              break;
-            }
-          } // for
+      default:
+        state->status = F_process;
 
-          locations[j] = main->parameters.array[fake_parameter_operation_skeleton_e].locations.array[i];
-          operations[j] = fake_operation_skeleton_e;
-          ++locations_length;
-        } // for
-        */
-      }
-      else {
-        setting->operations.array[setting->operations.used++] = fake_parameter_operation_make_e;
-      }
+        return;
     }
+
+    state->status = F_none;
   }
-#endif // _di_fake_setting_load_
+#endif // _di_fake_setting_load_parameter_callback_
 
 #ifndef _di_fake_setting_unload_
   f_status_t fake_setting_unload(fll_program_data_t * const main, fake_setting_t * const setting) {
index 191561e8894f25e9a56a2229f751a4daf8e00eed..31c3438fb5d82d4efd0f65876217db2db7d94a10 100644 (file)
@@ -179,28 +179,28 @@ extern "C" {
  * Provide default settings.
  */
 #ifndef _di_fake_default_s_
-  #define FAKE_default_path_build_s   "build"   F_path_separator_s
-  #define FAKE_default_path_data_s    "data"    F_path_separator_s
-  #define FAKE_default_path_sources_s "sources" F_path_separator_s
-  #define FAKE_default_path_work_s    ""
+  #define FAKE_default_build_s   "build"   F_path_separator_s
+  #define FAKE_default_data_s    "data"    F_path_separator_s
+  #define FAKE_default_sources_s "sources" F_path_separator_s
+  #define FAKE_default_work_s    ""
 
   #define FAKE_default_fakefile_s "fakefile"
   #define FAKE_default_process_s  ""
   #define FAKE_default_settings_s "settings"
 
-  #define FAKE_default_path_build_s_length   5 + F_path_separator_s_length
-  #define FAKE_default_path_data_s_length    4 + F_path_separator_s_length
-  #define FAKE_default_path_sources_s_length 7 + F_path_separator_s_length
-  #define FAKE_default_path_work_s_length    0
+  #define FAKE_default_build_s_length   5 + F_path_separator_s_length
+  #define FAKE_default_data_s_length    4 + F_path_separator_s_length
+  #define FAKE_default_sources_s_length 7 + F_path_separator_s_length
+  #define FAKE_default_work_s_length    0
 
   #define FAKE_default_fakefile_s_length 8
   #define FAKE_default_process_s_length  0
   #define FAKE_default_settings_s_length 8
 
-  extern const f_string_static_t fake_default_path_build_s;
-  extern const f_string_static_t fake_default_path_data_s;
-  extern const f_string_static_t fake_default_path_sources_s;
-  extern const f_string_static_t fake_default_path_work_s;
+  extern const f_string_static_t fake_default_build_s;
+  extern const f_string_static_t fake_default_data_s;
+  extern const f_string_static_t fake_default_sources_s;
+  extern const f_string_static_t fake_default_work_s;
 
   extern const f_string_static_t fake_default_fakefile_s;
   extern const f_string_static_t fake_default_process_s;
@@ -462,40 +462,40 @@ extern "C" {
 
   #define fake_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(fake_short_define_s,       fake_long_define_s,             1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fake_short_fakefile_s,     fake_long_fakefile_s,           1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fake_short_mode_s,         fake_long_mode_s,               1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fake_short_process_s,      fake_long_process_s,            1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fake_short_settings_s,     fake_long_settings_s,           1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fake_short_path_build_s,   fake_long_path_build_s,         1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fake_short_path_data_s,    fake_long_path_data_s,          1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fake_short_path_sources_s, fake_long_path_sources_s,       1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fake_short_path_work_s,    fake_long_path_work_s,          1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fake_short_define_s,       fake_long_define_s,             1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fake_short_fakefile_s,     fake_long_fakefile_s,           1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fake_short_mode_s,         fake_long_mode_s,               1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fake_short_process_s,      fake_long_process_s,            1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fake_short_settings_s,     fake_long_settings_s,           1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fake_short_path_build_s,   fake_long_path_build_s,         1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fake_short_path_data_s,    fake_long_path_data_s,          1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fake_short_path_sources_s, fake_long_path_sources_s,       1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fake_short_path_work_s,    fake_long_path_work_s,          1, f_console_flag_normal_e), \
       \
-      macro_f_console_parameter_t_initialize_6(fake_long_documents_disabled_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_6(fake_long_documents_enabled_s,  0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_6(fake_long_shared_disabled_s,    0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_6(fake_long_shared_enabled_s,     0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_6(fake_long_static_disabled_s,    0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_6(fake_long_static_enabled_s,     0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_5(fake_long_documents_disabled_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_5(fake_long_documents_enabled_s,  0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_5(fake_long_shared_disabled_s,    0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_5(fake_long_shared_enabled_s,     0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_5(fake_long_static_disabled_s,    0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_5(fake_long_static_enabled_s,     0, f_console_flag_normal_e), \
       \
-      macro_f_console_parameter_t_initialize_7(fake_other_operation_build_s,    0, f_console_flag_simple_e), \
-      macro_f_console_parameter_t_initialize_7(fake_other_operation_clean_s,    0, f_console_flag_simple_e), \
-      macro_f_console_parameter_t_initialize_7(fake_other_operation_make_s,     0, f_console_flag_simple_e), \
-      macro_f_console_parameter_t_initialize_7(fake_other_operation_skeleton_s, 0, f_console_flag_simple_e), \
+      macro_f_console_parameter_t_initialize_6(fake_other_operation_build_s,    0, f_console_flag_simple_e), \
+      macro_f_console_parameter_t_initialize_6(fake_other_operation_clean_s,    0, f_console_flag_simple_e), \
+      macro_f_console_parameter_t_initialize_6(fake_other_operation_make_s,     0, f_console_flag_simple_e), \
+      macro_f_console_parameter_t_initialize_6(fake_other_operation_skeleton_s, 0, f_console_flag_simple_e), \
     }
 
   #define fake_total_parameters_d 31
@@ -505,35 +505,43 @@ extern "C" {
  * Flags passed to the main function or program.
  *
  * fake_main_flag_*_e:
- *   - none:             No flags set.
- *   - enable_documents: Enable documents, as-in --enable-doc (not specifying means --disable-doc).
- *   - enable_shared:    Enable shared, as-in --enable-shared (not specifying means --disable-shared).
- *   - enable_static:    Enable static, as-in --enable-static (not specifying means --disable-static).
- *   - file_from:        Using a specified source file.
- *   - file_to:          Using a specified destination file.
- *   - header:           Enable printing of headers.
- *   - help:             Print help.
- *   - operation:        Designate that an operation is explicitly passed.
- *   - separate:         Enable printing of separators.
- *   - strip_invalid:    Using strip invalid character mode.
- *   - verify:           Using verify mode.
- *   - version:          Print version.
+ *   - none:               No flags set.
+ *   - enable_documents:   Enable documents, as-in --enable-doc (not specifying means --disable-doc).
+ *   - enable_shared:      Enable shared, as-in --enable-shared (not specifying means --disable-shared).
+ *   - enable_static:      Enable static, as-in --enable-static (not specifying means --disable-static).
+ *   - file_from:          Using a specified source file.
+ *   - file_to:            Using a specified destination file.
+ *   - header:             Enable printing of headers.
+ *   - help:               Print help.
+ *   - operation:          Designate that an operation is explicitly passed.
+ *   - operation_build:    The build operation is designated.
+ *   - operation_clean:    The clean operation is designated.
+ *   - operation_make:     The make operation is designated (or enabled as default).
+ *   - operation_skeleton: The skeleton operation is designated.
+ *   - separate:           Enable printing of separators.
+ *   - strip_invalid:      Using strip invalid character mode.
+ *   - verify:             Using verify mode.
+ *   - version:            Print version.
  */
 #ifndef _di_fake_main_flag_e_
   enum {
-    fake_main_flag_none_e             = 0x0,
-    fake_main_flag_enable_documents_e = 0x1,
-    fake_main_flag_enable_shared_e    = 0x2,
-    fake_main_flag_enable_static_e    = 0x4,
-    fake_main_flag_file_from_e        = 0x8,
-    fake_main_flag_file_to_e          = 0x10,
-    fake_main_flag_header_e           = 0x20,
-    fake_main_flag_help_e             = 0x40,
-    fake_data_flag_operation_e        = 0x80,
-    fake_main_flag_separate_e         = 0x100,
-    fake_main_flag_strip_invalid_e    = 0x200,
-    fake_main_flag_verify_e           = 0x400,
-    fake_main_flag_version_e          = 0x800,
+    fake_main_flag_none_e               = 0x0,
+    fake_main_flag_enable_documents_e   = 0x1,
+    fake_main_flag_enable_shared_e      = 0x2,
+    fake_main_flag_enable_static_e      = 0x4,
+    fake_main_flag_file_from_e          = 0x8,
+    fake_main_flag_file_to_e            = 0x10,
+    fake_main_flag_header_e             = 0x20,
+    fake_main_flag_help_e               = 0x40,
+    fake_data_flag_operation_e          = 0x80,
+    fake_data_flag_operation_build_e    = 0x100,
+    fake_data_flag_operation_clean_e    = 0x200,
+    fake_data_flag_operation_make_e     = 0x400,
+    fake_data_flag_operation_skeleton_e = 0x800,
+    fake_main_flag_separate_e           = 0x1000,
+    fake_main_flag_strip_invalid_e      = 0x2000,
+    fake_main_flag_verify_e             = 0x4000,
+    fake_main_flag_version_e            = 0x8000,
   }; // enum
 #endif // _di_fake_main_flag_e_
 
@@ -558,54 +566,6 @@ extern "C" {
  * settings: The settings file path.
  * sources:  The sources directory.
  * work:     The work directory.
- *
- * path_build:                  The build path.
- * path_build_documentation:    The build documentation path.
- * path_build_documents:        The build documents path.
- * path_build_includes:         The build includes path.
- * path_build_libraries:        The build libraries path.
- * path_build_libraries_script: The build libraries_script path.
- * path_build_libraries_shared: The build libraries_shared path.
- * path_build_libraries_static: The build libraries_static path.
- * path_build_objects:          The build objects path.
- * path_build_objects_script:   The build objects_script path.
- * path_build_objects_shared:   The build objects_shared path.
- * path_build_objects_static:   The build objects_static path.
- * path_build_programs:         The build programs path.
- * path_build_programs_script:  The build programs_script path.
- * path_build_programs_shared:  The build programs_shared path.
- * path_build_programs_static:  The build programs_static path.
- * path_build_settings:         The build settings path.
- * path_build_stage:            The build stage path.
- *
- * path_data:               The data path.
- * path_data_build:         The build data path.
- * path_data_documentation: The documentation data path.
- * path_data_settings:      The settings data path.
- *
- * path_documents: The documents path.
- * path_licenses:  The licenses path.
- * path_sources:   The sources path.
- *
- * path_work:                  The work path.
- * path_work_includes:         The includes work path.
- * path_work_libraries:        The libraries work path.
- * path_work_libraries_script: The libraries_script work path.
- * path_work_libraries_shared: The libraries_shared work path.
- * path_work_libraries_static: The libraries_static work path.
- * path_work_programs:         The programs work path.
- * path_work_programs_script:  The programs_script work path.
- * path_work_programs_shared:  The programs_shared work path.
- * path_work_programs_static:  The programs_static work path.
- *
- * file_data_build_defines:      The defines build file data.
- * file_data_build_dependencies: The dependencies build file data.
- * file_data_build_fakefile:     The fakefile build file data.
- * file_data_build_process_post: The process_post_s build file data.
- * file_data_build_process_pre:  The process_pre_s build file data.
- * file_data_build_settings:     The settings build file data.
- *
- * file_documents_readme: The documents readme file data.
 
  * defines: The define data.
  * modes:   The mode data.
@@ -630,57 +590,6 @@ extern "C" {
     f_string_dynamic_t sources;
     f_string_dynamic_t work;
 
-    f_string_dynamic_t path_build;
-    f_string_dynamic_t path_build_documentation;
-    f_string_dynamic_t path_build_documents;
-    f_string_dynamic_t path_build_includes;
-    f_string_dynamic_t path_build_libraries;
-    f_string_dynamic_t path_build_libraries_script;
-    f_string_dynamic_t path_build_libraries_shared;
-    f_string_dynamic_t path_build_libraries_static;
-    f_string_dynamic_t path_build_objects;
-    f_string_dynamic_t path_build_objects_script;
-    f_string_dynamic_t path_build_objects_shared;
-    f_string_dynamic_t path_build_objects_static;
-    f_string_dynamic_t path_build_programs;
-    f_string_dynamic_t path_build_programs_script;
-    f_string_dynamic_t path_build_programs_shared;
-    f_string_dynamic_t path_build_programs_static;
-    f_string_dynamic_t path_build_settings;
-    f_string_dynamic_t path_build_stage;
-
-    f_string_dynamic_t path_data;
-    f_string_dynamic_t path_data_build;
-    f_string_dynamic_t path_data_documentation;
-    f_string_dynamic_t path_data_settings;
-
-    f_string_dynamic_t path_documents;
-
-    f_string_dynamic_t path_licenses;
-
-    f_string_dynamic_t path_sources;
-
-    f_string_dynamic_t path_work;
-    f_string_dynamic_t path_work_includes;
-    f_string_dynamic_t path_work_libraries;
-    f_string_dynamic_t path_work_libraries_script;
-    f_string_dynamic_t path_work_libraries_shared;
-    f_string_dynamic_t path_work_libraries_static;
-    f_string_dynamic_t path_work_programs;
-    f_string_dynamic_t path_work_programs_script;
-    f_string_dynamic_t path_work_programs_shared;
-    f_string_dynamic_t path_work_programs_static;
-
-    // @fixme there is overlap here with setting->fakefile and similar.
-    f_string_dynamic_t file_data_build_defines;
-    f_string_dynamic_t file_data_build_dependencies;
-    f_string_dynamic_t file_data_build_fakefile;
-    f_string_dynamic_t file_data_build_process_post;
-    f_string_dynamic_t file_data_build_process_pre;
-    f_string_dynamic_t file_data_build_settings;
-
-    f_string_dynamic_t file_documents_readme;
-
     f_string_dynamics_t defines;
     f_string_dynamics_t modes;
 
@@ -701,48 +610,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_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_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_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_uint8s_t_initialize, \
@@ -775,6 +642,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -790,10 +659,34 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_fake_setting_load_
-  extern void fake_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fake_setting_t * const setting);
+  extern void fake_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fake_setting_t * const setting);
 #endif // _di_fake_setting_load_
 
 /**
+ * Callback used by f_console_parameter_process() for custom handling of parameters.
+ *
+ * This prints error messages as appropriate.
+ *
+ * If either main or setting is NULL, then this immediately returns without doing anything.
+ *
+ * @param arguments
+ *   The parameters passed to the process (often referred to as command line arguments).
+ * @param parameters
+ *   The parameters array (generally from main.parameters) representing all of the parameters to look for.
+ *   This must be of type f_console_parameters_t.
+ * @param state
+ *   The internal state data primarily managed by f_console_parameter_process().
+ *   The state.status is used to represent the return status of this callback.
+ * @param data
+ *   This must be of the type fake_setting_t.
+ *
+ * @see f_console_parameter_process()
+ */
+#ifndef _di_fake_setting_load_parameter_callback_
+  extern void fake_setting_load_parameter_callback(const f_console_arguments_t arguments, void * const parameters, f_console_parameter_state_t * const state, void * const data);
+#endif // _di_fake_setting_load_parameter_callback_
+
+/**
  * Perform the standard program setting unload process.
  *
  * @param main
index 9d41f5ff553a73bb2584d29fd6d506b65ad8b65a..513f875eb5262b27bca4e83ec8bdbb5d53dcf82f 100644 (file)
@@ -38,181 +38,176 @@ extern "C" {
       return;
     }
 
-    // @todo everything below is old, mostly.
+    if ((setting->flag & fake_data_flag_operation_build_e) && (setting->flag & fake_data_flag_operation_make_e)) {
+      setting->status = F_status_set_error(F_parameter);
+
+      fake_print_error_parameter_operation_not_with(setting, main->error, fake_other_operation_build_s, fake_other_operation_make_s);
+
+      return;
+    }
+
     fake_data_t data = fake_data_t_initialize;
     data.main = main;
     data.setting = setting;
-    data.argv = main->parameters.arguments.array;
 
-    if (F_status_is_error_not(setting->status)) {
-      if (main->parameters.array[fake_parameter_operation_build_e].locations.used && main->parameters.array[fake_parameter_operation_make_e].locations.used) {
-        setting->status = F_status_set_error(F_parameter);
+    setting->status = fake_path_generate(&data); // @todo needs to be updated regarding the new data structure.
 
-        fake_print_error_parameter_operation_not_with(setting, main->error, fake_other_operation_build_s, fake_other_operation_make_s);
-      }
-    }
+    if (F_status_is_error(setting->status)) {
+      fake_data_delete(&data);
 
-    if (F_status_is_error_not(setting->status)) {
-      bool validate_parameter_paths = F_true;
+      return;
+    }
 
-      setting->status = fake_process_console_parameters(&data);
+    if ((main->pipe & fll_program_data_pipe_input_e) && !(data.setting->flag & fake_data_flag_operation_e)) {
+      data.file_data_build_fakefile.used = 0;
 
-      if (F_status_is_error_not(setting->status)) {
-        setting->status = fake_path_generate(&data);
-      }
+      setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &data.file_data_build_fakefile);
 
       if (F_status_is_error(setting->status)) {
-        fake_data_delete(&data);
-
-        return;
+        fake_print_error(setting, setting->status, main->error, macro_fake_f(f_string_dynamic_append));
       }
+      else {
+        setting->fakefile.used = 0;
 
-      {
-        uint8_t i = 0;
+        setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &setting->fakefile);
+      }
+    }
 
-        if ((main->pipe & fll_program_data_pipe_input_e) && !(data.setting->flag & fake_data_flag_operation_e)) {
-          data.file_data_build_fakefile.used = 0;
+    {
+      f_array_length_t i = 0;
 
-          setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &data.file_data_build_fakefile);
+      // Pre-process and perform validation when "clean" is before a "build" or "make" command as a safety check.
+      {
+        uint8_t has_clean = F_false;
 
-          if (F_status_is_error(setting->status)) {
-            fake_print_error(setting, setting->status, main->error, macro_fake_f(f_string_dynamic_append));
-          }
-          else {
-            data.fakefile.used = 0;
+        for (; i < setting->operations.used; ++i) {
 
-            setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &data.fakefile);
+          if (setting->operations.array[i] == fake_operation_clean_e) {
+            has_clean = F_true;
           }
-        }
-
-        // Pre-process and perform validation when "clean" is before a "build" or "make" command as a safety check.
-        if (operations_length) {
-          for (uint8_t has_clean = F_false; i < operations_length; ++i) {
+          else if (setting->operations.array[i] == fake_operation_build_e || setting->operations.array[i] == fake_operation_make_e) {
 
-            if (operations[i] == fake_operation_clean_e) {
-              has_clean = F_true;
-            }
-            else if (operations[i] == fake_operation_build_e || operations[i] == fake_operation_make_e) {
+            // If the first operation is clean and a make or build operation exists, then the clean operation requires the appropriate settings file or fakefile file.
+            if (has_clean) {
+              data.operation = setting->operations.array[i];
 
-              // If the first operation is clean and a make or build operation exists, then the clean operation requires the appropriate settings file or fakefile file.
-              if (has_clean) {
-                operations_name = fake_other_operation_clean_s;
-                data.operation = operations[i];
+              setting->status = fake_validate_parameter_paths(&data);
 
-                setting->status = fake_validate_parameter_paths(&data);
+              if (F_status_is_error_not(setting->status) && !(main->pipe & fll_program_data_pipe_input_e)) {
+                setting->status = f_file_is(
+                  setting->operations.array[i] == fake_operation_build_e
+                    ? data.file_data_build_settings
+                    : data.file_data_build_fakefile,
+                  F_file_type_regular_d, F_false
+                );
 
-                if (F_status_is_error_not(setting->status) && !(main->pipe & fll_program_data_pipe_input_e)) {
-                  f_string_static_t *path = 0;
+                if (setting->status == F_false) {
+                  setting->status = F_status_set_error(F_file_not);
+                }
 
-                  if (operations[i] == fake_operation_build_e) {
-                    path = &data.file_data_build_settings;
-                  }
-                  else {
-                    path = &data.file_data_build_fakefile;
-                  }
+                if (F_status_is_error(setting->status)) {
+                  fake_print_error_file(
+                    setting,
+                    F_status_set_fine(setting->status),
+                    main->error,
+                    macro_fake_f(f_file_is),
+                    setting->operations.array[i] == fake_operation_build_e
+                      ? data.file_data_build_settings
+                      : data.file_data_build_fakefile,
+                    fake_common_file_path_access_s,
+                    fll_error_file_type_file_e
+                  );
+                }
+              }
+            }
 
-                  setting->status = f_file_is(*path, F_file_type_regular_d, F_false);
+            break;
+          }
 
-                  if (setting->status == F_false) {
-                    setting->status = F_status_set_error(F_file_not);
-                  }
+          if (!((++main->signal_check) % fake_signal_check_short_d)) {
+            if (fll_program_standard_signal_received(main)) {
+              fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
 
-                  if (F_status_is_error(setting->status)) {
-                    fll_error_file_print(data.main->error, F_status_set_fine(setting->status), "f_file_is", F_true, *path, fake_common_file_path_access_s, fll_error_file_type_file_e);
-                  }
-                }
-              }
+              setting->status = F_status_set_error(F_interrupt);
 
               break;
             }
-          } // for
-        }
 
-        if (F_status_is_error_not(setting->status)) {
-          for (i = 0; i < operations_length; ++i) {
+            main->signal_check = 0;
+          }
+        } // for
+      }
 
-            data.operation = operations[i];
+      {
+        bool check_paths = F_true;
 
-            if (data.operation == fake_operation_build_e) {
-              operations_name = fake_other_operation_build_s;
-            }
-            else if (data.operation == fake_operation_clean_e) {
-              operations_name = fake_other_operation_clean_s;
-            }
-            else if (data.operation == fake_operation_make_e) {
-              operations_name = fake_other_operation_make_s;
-            }
-            else if (data.operation == fake_operation_skeleton_e) {
-              operations_name = fake_other_operation_skeleton_s;
-            }
+        for (i = 0; i < setting->operations.used; ++i) {
 
-            if (data.operation == fake_operation_build_e) {
-              if (validate_parameter_paths) {
-                setting->status = fake_validate_parameter_paths(&data);
-                validate_parameter_paths = F_false;
-              }
+          data.operation = setting->operations.array[i];
 
-              if (F_status_is_error_not(setting->status)) {
-                setting->status = fake_build_operate(&data, 0, main->pipe & fll_program_data_pipe_input_e);
-              }
+          if (data.operation == fake_operation_build_e) {
+            if (check_paths) {
+              setting->status = fake_validate_parameter_paths(&data);
+              check_paths = F_false;
             }
-            else if (data.operation == fake_operation_clean_e) {
-              setting->status = fake_clean_operate(&data);
 
-              // Reset in case next operation needs files.
-              validate_parameter_paths = F_true;
+            if (F_status_is_error_not(setting->status)) {
+              setting->status = fake_build_operate(&data, 0, main->pipe & fll_program_data_pipe_input_e);
             }
-            else if (data.operation == fake_operation_make_e) {
-              if (validate_parameter_paths) {
-                setting->status = fake_validate_parameter_paths(&data);
-                validate_parameter_paths = F_false;
-              }
+          }
+          else if (data.operation == fake_operation_clean_e) {
+            setting->status = fake_clean_operate(&data);
 
-              if (F_status_is_error_not(setting->status)) {
-                setting->status = fake_make_operate(&data);
-                if (setting->status == F_child) break;
-              }
+            // Reset in case next operation needs files.
+            check_paths = F_true;
+          }
+          else if (data.operation == fake_operation_make_e) {
+            if (check_paths) {
+              setting->status = fake_validate_parameter_paths(&data);
+              check_paths = F_false;
             }
-            else if (data.operation == fake_operation_skeleton_e) {
-              setting->status = fake_skeleton_operate(&data);
 
-              // Skeleton is supposed to guarantee these.
-              validate_parameter_paths = F_false;
+            if (F_status_is_error_not(setting->status)) {
+              setting->status = fake_make_operate(&data);
+              if (setting->status == F_child) break;
             }
+          }
+          else if (data.operation == fake_operation_skeleton_e) {
+            setting->status = fake_skeleton_operate(&data);
 
-            if (setting->status == F_child) break;
+            // Skeleton is supposed to guarantee these.
+            check_paths = F_false;
+          }
 
-            if (F_status_set_fine(setting->status) == F_interrupt || !(i % fake_signal_check_short_d)) {
-              if (fll_program_standard_signal_received(main)) {
-                fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
+          if (setting->status == F_child) break;
 
-                setting->status = F_status_set_error(F_interrupt);
+          if (!((++main->signal_check) % fake_signal_check_short_d)) {
+            if (fll_program_standard_signal_received(main)) {
+              fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
 
-                break;
-              }
+              setting->status = F_status_set_error(F_interrupt);
 
-              main->signal_check = 0;
+              break;
             }
 
-            if (F_status_is_error(setting->status)) break;
-          } // for
-        }
-
-        if (F_status_is_error(setting->status)) {
-          fake_print_error_failure_operation(setting, main->error, operations_name);
-        }
-      }
+            main->signal_check = 0;
+          }
 
-      if (setting->status != F_child) {
-        fake_print_operation_all_complete(setting, main->message);
+          if (F_status_is_error(setting->status)) break;
+        } // for
       }
     }
 
     if (F_status_is_error(setting->status)) {
+      fake_print_error_failure_operation(setting, main->error, data.operation);
       fake_print_line_last_locked(setting, main->error);
     }
-    else if (setting->status != F_interrupt && setting->status != F_child) {
-      fake_print_line_last_locked(setting, main->message);
+    else if (setting->status != F_child) {
+      fake_print_operation_all_complete(setting, main->message);
+
+      if (setting->status != F_interrupt) {
+        fake_print_line_last_locked(setting, main->message);
+      }
     }
 
     fake_data_delete(&data);
index c4da12442198ea7e9f1797cac7e4d141cd5742cc..f7070c0bba9ed556c627114547dc0de6f1b4c117 100644 (file)
@@ -11,6 +11,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   f_console_parameter_t parameters[] = fake_console_parameter_t_initialize;
   data.parameters.array = parameters;
   data.parameters.used = fake_total_parameters_d;
+  data.parameters.callback = &fake_setting_load_parameter_callback;
   data.environment = envp;
 
   if (f_pipe_input_exists()) {
@@ -23,8 +24,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fake_setting_load(arguments, &data, &setting);
+    fake_setting_load(arguments, state, &data, &setting);
   }
 
   fake_main(&data, &setting);
index da0afc74d5a55539c017369c537eb87369a9c41e..a9277dea418319613687e5a34c2038d69c3e1a0d 100644 (file)
@@ -17,8 +17,20 @@ extern "C" {
   }
 #endif // _di_fake_print_error_
 
+#ifndef _di_fake_print_error_file_
+  f_status_t fake_print_error_file(fake_setting_t * const setting, const f_status_t status, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
+
+    if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+
+    fake_print_line_first_locked(setting, print);
+    fll_error_file_print(print, F_status_set_fine(status), function, F_true, name, operation, type);
+
+    return F_none;
+  }
+#endif // _di_fake_print_error_file_
+
 #ifndef _di_fake_print_error_failure_operation_
-  f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation) {
+  f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const uint8_t operation) {
 
     if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
 
@@ -26,9 +38,22 @@ extern "C" {
 
     fake_print_line_first_unlocked(setting, print);
 
-    fl_print_format("%[%QThe operation '%]", print.to, print.context, print.prefix, print.context);
-    fl_print_format("%[%Q%]", print.to, print.notable, operation, print.notable);
-    fl_print_format("%[' failed.%]%r", print.to, print.context, print.context, f_string_eol_s);
+    fl_print_format("%[%QThe operation '%]%[", print.to, print.context, print.prefix, print.context, print.notable);
+
+    if (data.operation == fake_operation_build_e) {
+      f_print_dynamic(print.to, fake_other_operation_build_s);
+    }
+    else if (data.operation == fake_operation_clean_e) {
+      f_print_dynamic(print.to, fake_other_operation_clean_s);
+    }
+    else if (data.operation == fake_operation_make_e) {
+      f_print_dynamic(print.to, fake_other_operation_make_s);
+    }
+    else if (data.operation == fake_operation_skeleton_e) {
+      f_print_dynamic(print.to, fake_other_operation_skeleton_s);
+    }
+
+    fl_print_format("%]%[' failed.%]%r", print.to, print.notable, print.context, print.context, f_string_eol_s);
 
     f_file_stream_unlock(print.to);
 
@@ -55,6 +80,29 @@ extern "C" {
   }
 #endif // _di_fake_print_error_failure_script_
 
+#ifndef _di_fake_print_error_parameter_not_empty_
+  f_status_t fake_print_error_parameter_not_empty(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) {
+
+    if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    if (!F_status_is_error(setting->status)) {
+      if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+    }
+
+    f_file_stream_lock(print.to);
+
+    fake_print_line_first_unlocked(setting, print);
+
+    fl_print_format("%[%QThe '%]", print.to, print.context, print.prefix, print.context);
+    fl_print_format("%[%Q%Q%]", print.to, print.notable, symbol, name, print.notable);
+    fl_print_format("%[' parameter must not be empty and must not contain only white space.%]%r", print.to, print.context, print.context, f_string_eol_s);
+
+    f_file_stream_unlock(print.to);
+
+    return F_none;
+  }
+#endif // _di_fake_print_error_parameter_not_empty_
+
 #ifndef _di_fake_print_error_parameter_not_word_
   f_status_t fake_print_error_parameter_not_word(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) {
 
index d3fe1a5ff2196fbda78e77ca6b44a8e55773db08..ca05d8d984794ca6f5a45f3fe94566f44725ff76 100644 (file)
@@ -36,6 +36,33 @@ extern "C" {
 #endif // _di_fake_print_error_
 
 /**
+ * Print file related error message regarding a function failing in some way.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param status
+ *   The status to use.
+ *   This is provided, ignoring setting.status, for thread-safety reasons.
+ * @param print
+ *   Designates the how and where to print.
+ * @param name
+ *   The name of the file or directory.
+ * @param operation
+ *   The operation that fails, such as 'create' or 'access'.
+ * @param type
+ *   A valid file type code from the fll_error_file_type enum.
+ *
+ * @return
+ *   F_true is returned if the status code has no print message.
+ *   F_false is returned on successful print of known errors.
+ */
+#ifndef _di_fake_print_error_file_
+  extern f_status_t fake_print_error_file(fake_setting_t * const setting, const f_status_t status, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type);
+#endif // _di_fake_print_error_file_
+
+/**
  * Print error message for when an operation fails.
  *
  * @param setting
@@ -45,14 +72,14 @@ extern "C" {
  * @param print
  *   Designates the how and where to print.
  * @param operation
- *   The name of the operation that failed.
+ *   The identifier of the operation that failed.
  *
  * @return
  *   F_none on success.
  *   F_output_not on success, but no printing is performed.
  */
 #ifndef _di_fake_print_error_failure_operation_
-  extern f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation);
+  extern f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const uint8_t operation);
 #endif // _di_fake_print_error_failure_operation_
 
 /**
@@ -76,6 +103,30 @@ extern "C" {
 #endif // _di_fake_print_error_failure_script_
 
 /**
+ * Print error message for when the parameter value is an empty string.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates the how and where to print.
+ * @param symbol
+ *   The symbol of the parameter.
+ * @param name
+ *   The name of the parameter.
+ * @param value
+ *   The value that is invalid.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fake_print_error_parameter_not_empty_
+  extern f_status_t fake_print_error_parameter_not_empty(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value);
+#endif // _di_fake_print_error_parameter_not_empty_
+
+/**
  * Print error message for when the parameter value contains a non-word, non-minus, and non-plus character.
  *
  * @param setting
index 738820b21b1d8cf66b48570c806c29bf14001b16..e59511682a7024a0fd714c18b07f59c56082f52f 100644 (file)
@@ -389,7 +389,7 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static
 
     for (f_array_length_t i = 0; i < files.used; ++i) {
 
-      if (!(i % fake_signal_check_short_d)) {
+      if (!((++data->main->signal_check) % fake_signal_check_short_d)) {
         if (fll_program_standard_signal_received(data->main)) {
           fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received);
 
@@ -398,7 +398,7 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static
           break;
         }
 
-        data->main->signal_check = 0;
+        main->signal_check = 0;
       }
 
       if (!files.array[i].used) continue;
index c95b85d3337053f20a1a0b6b217fdd22398f3218..8d33b620e7b9aa310eb6588b6e5dd7fa1322ff75 100644 (file)
@@ -322,12 +322,6 @@ extern "C" {
 #ifndef _di_fake_data_delete_
   f_status_t fake_data_delete(fake_data_t * const data) {
 
-    f_string_dynamics_resize(0, &data->define);
-    f_string_dynamic_resize(0, &data->fakefile);
-    f_string_dynamics_resize(0, &data->mode);
-    f_string_dynamic_resize(0, &data->process);
-    f_string_dynamic_resize(0, &data->settings);
-
     f_string_dynamic_resize(0, &data->path_build);
     f_string_dynamic_resize(0, &data->path_build_documentation);
     f_string_dynamic_resize(0, &data->path_build_documents);
index 4c7801226742ab9e5d4f8a69a79f1fba216ee0e9..ab3a4b640884ff1296518ff3301faebe3414ab76 100644 (file)
@@ -15,19 +15,115 @@ extern "C" {
 /**
  * The program data.
  *
+ * operation: A code representing the currrent operation.
+ *
  * main:    The main program data.
  * setting: The settings data.
- * argv:    The argument structure in the progam data parameters for simplifying syntax.
  *
- * operation: A code representing the currrent operation.
+ * path_build:                  The build path.
+ * path_build_documentation:    The build documentation path.
+ * path_build_documents:        The build documents path.
+ * path_build_includes:         The build includes path.
+ * path_build_libraries:        The build libraries path.
+ * path_build_libraries_script: The build libraries_script path.
+ * path_build_libraries_shared: The build libraries_shared path.
+ * path_build_libraries_static: The build libraries_static path.
+ * path_build_objects:          The build objects path.
+ * path_build_objects_script:   The build objects_script path.
+ * path_build_objects_shared:   The build objects_shared path.
+ * path_build_objects_static:   The build objects_static path.
+ * path_build_programs:         The build programs path.
+ * path_build_programs_script:  The build programs_script path.
+ * path_build_programs_shared:  The build programs_shared path.
+ * path_build_programs_static:  The build programs_static path.
+ * path_build_settings:         The build settings path.
+ * path_build_stage:            The build stage path.
+ *
+ * path_data:               The data path.
+ * path_data_build:         The build data path.
+ * path_data_documentation: The documentation data path.
+ * path_data_settings:      The settings data path.
+ *
+ * path_documents: The documents path.
+ * path_licenses:  The licenses path.
+ * path_sources:   The sources path.
+ *
+ * path_work:                  The work path.
+ * path_work_includes:         The includes work path.
+ * path_work_libraries:        The libraries work path.
+ * path_work_libraries_script: The libraries_script work path.
+ * path_work_libraries_shared: The libraries_shared work path.
+ * path_work_libraries_static: The libraries_static work path.
+ * path_work_programs:         The programs work path.
+ * path_work_programs_script:  The programs_script work path.
+ * path_work_programs_shared:  The programs_shared work path.
+ * path_work_programs_static:  The programs_static work path.
+ *
+ * file_data_build_defines:      The defines build file data.
+ * file_data_build_dependencies: The dependencies build file data.
+ * file_data_build_fakefile:     The fakefile build file data.
+ * file_data_build_process_post: The process_post_s build file data.
+ * file_data_build_process_pre:  The process_pre_s build file data.
+ * file_data_build_settings:     The settings build file data.
+ *
+ * file_documents_readme: The documents readme file data.
  */
 #ifndef _di_fake_data_t_
   typedef struct {
+    uint8_t operation;
+
     fll_program_data_t *main;
     fake_setting_t *setting;
-    f_string_static_t *argv; // @todo this might be removable now that settings exists.
 
-    uint8_t operation;
+    f_string_dynamic_t path_build;
+    f_string_dynamic_t path_build_documentation;
+    f_string_dynamic_t path_build_documents;
+    f_string_dynamic_t path_build_includes;
+    f_string_dynamic_t path_build_libraries;
+    f_string_dynamic_t path_build_libraries_script;
+    f_string_dynamic_t path_build_libraries_shared;
+    f_string_dynamic_t path_build_libraries_static;
+    f_string_dynamic_t path_build_objects;
+    f_string_dynamic_t path_build_objects_script;
+    f_string_dynamic_t path_build_objects_shared;
+    f_string_dynamic_t path_build_objects_static;
+    f_string_dynamic_t path_build_programs;
+    f_string_dynamic_t path_build_programs_script;
+    f_string_dynamic_t path_build_programs_shared;
+    f_string_dynamic_t path_build_programs_static;
+    f_string_dynamic_t path_build_settings;
+    f_string_dynamic_t path_build_stage;
+
+    f_string_dynamic_t path_data;
+    f_string_dynamic_t path_data_build;
+    f_string_dynamic_t path_data_documentation;
+    f_string_dynamic_t path_data_settings;
+
+    f_string_dynamic_t path_documents;
+
+    f_string_dynamic_t path_licenses;
+
+    f_string_dynamic_t path_sources;
+
+    f_string_dynamic_t path_work;
+    f_string_dynamic_t path_work_includes;
+    f_string_dynamic_t path_work_libraries;
+    f_string_dynamic_t path_work_libraries_script;
+    f_string_dynamic_t path_work_libraries_shared;
+    f_string_dynamic_t path_work_libraries_static;
+    f_string_dynamic_t path_work_programs;
+    f_string_dynamic_t path_work_programs_script;
+    f_string_dynamic_t path_work_programs_shared;
+    f_string_dynamic_t path_work_programs_static;
+
+    f_string_dynamic_t file_data_build_defines;
+    f_string_dynamic_t file_data_build_dependencies;
+    f_string_dynamic_t file_data_build_fakefile;
+    f_string_dynamic_t file_data_build_process_post;
+    f_string_dynamic_t file_data_build_process_pre;
+    f_string_dynamic_t file_data_build_settings;
+
+    f_string_dynamic_t file_documents_readme;
   } fake_data_t;
 
   #define fake_data_t_initialize \
@@ -35,7 +131,48 @@ extern "C" {
       0, \
       0, \
       0, \
-      0, \
+      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_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_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_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, \
     }
 #endif // _di_fake_main_t_
 
index 58a3af03f28d4cda24b7d61fd04fe490bcc428be..11b1af0acba93071a0d95b4f771ad9b2a03cab2f 100644 (file)
@@ -188,363 +188,6 @@ extern "C" {
   }
 #endif // _di_fake_pipe_buffer_
 
-// @todo move this into the common.
-#ifndef _di_fake_process_console_parameters_
-  f_status_t fake_process_console_parameters(fake_data_t * const data) {
-
-    f_status_t status = F_none;
-
-    {
-      const uint8_t parameters_id[] = {
-        fake_parameter_fakefile_e,
-        fake_parameter_process_e,
-        fake_parameter_settings_e,
-      };
-
-      const f_string_static_t parameters_name[] = {
-        fake_long_fakefile_s,
-        fake_long_process_s,
-        fake_long_settings_s,
-      };
-
-      const f_string_static_t parameter_defaults[] = {
-        fake_default_fakefile_s,
-        fake_default_process_s,
-        fake_default_settings_s,
-      };
-
-      f_string_dynamic_t * const parameters_value[] = {
-        &data->fakefile,
-        &data->process,
-        &data->settings,
-      };
-
-      bool parameters_validate_word[] = {
-        F_false,
-        F_true,
-        F_false,
-      };
-
-      for (uint8_t i = 0; i < 3; ++i) {
-
-        if (data->main->parameters.array[parameters_id[i]].result & f_console_result_found_e) {
-          fake_print_error_parameter_missing_value(data, parameters_name[i]);
-
-          return F_status_set_error(F_parameter);
-        }
-
-        if (data->main->parameters.array[parameters_id[i]].result & f_console_result_value_e) {
-          if (data->main->parameters.array[parameters_id[i]].locations.used > 1) {
-            fake_print_error_parameter_too_many(data, parameters_name[i]);
-
-            return F_status_set_error(F_parameter);
-          }
-
-          f_array_length_t index = data->main->parameters.array[parameters_id[i]].values.array[0];
-
-          if (data->main->parameters.arguments.array[index].used) {
-            if (parameters_validate_word[i]) {
-              f_array_length_t j = 0;
-              f_array_length_t width_max = 0;
-
-              for (j = 0; j < data->main->parameters.arguments.array[index].used; ++j) {
-
-                width_max = data->main->parameters.arguments.array[index].used - j;
-
-                status = f_utf_is_word_dash_plus(data->main->parameters.arguments.array[index].string + j, width_max, F_false);
-
-                if (F_status_is_error(status)) {
-                  if (fll_error_print(data->main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
-                    f_file_stream_lock(data->main->error.to);
-
-                    fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-                    fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_process_s, data->main->error.notable);
-                    fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
-                    f_file_stream_unlock(data->main->error.to);
-                  }
-
-                  return status;
-                }
-
-                if (status == F_false) {
-                  if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
-                    f_file_stream_lock(data->main->error.to);
-
-                    fl_print_format("%r%[%QThe '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-                    fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_process_s, data->main->error.notable);
-                    fl_print_format("%[' parameters value '%]", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-                    fl_print_format("%[%Q%]", data->main->error.to, data->main->error.notable, data->main->parameters.arguments.array[index], data->main->error.notable);
-                    fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
-                    f_file_stream_unlock(data->main->error.to);
-                  }
-
-                  return F_status_set_error(F_parameter);
-                }
-              } // for
-            }
-
-            status = f_string_dynamic_increase_by(data->main->parameters.arguments.array[index].used + 1, parameters_value[i]);
-
-            if (F_status_is_error(status)) {
-              fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
-
-              return status;
-            }
-
-            status = f_string_dynamic_append(data->main->parameters.arguments.array[index], parameters_value[i]);
-
-            if (F_status_is_error(status)) {
-              if (status == F_status_set_error(F_string_too_large)) {
-                if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
-                  f_file_stream_lock(data->main->error.to);
-
-                  fl_print_format("%r%[%QThe parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-                  fl_print_format("%[%r%Q%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, parameters_name[i], data->main->error.notable);
-                  fl_print_format("%[' is too long.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
-                  f_file_stream_unlock(data->main->error.to);
-                }
-              }
-              else {
-                fll_error_print(data->main->error, F_status_set_fine(status), "f_string_append", F_true);
-              }
-
-              return status;
-            }
-
-            status = F_none;
-          }
-
-          if (!data->main->parameters.arguments.array[index].used || status == F_data_not) {
-            if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
-              f_file_stream_lock(data->main->error.to);
-
-              fl_print_format("%r%[%QThe parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-              fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, parameters_name[i], data->main->error.notable);
-              fl_print_format("%[' must not be empty and must not contain only white space.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
-              f_file_stream_unlock(data->main->error.to);
-            }
-          }
-        }
-        else if (parameter_defaults[i].used) {
-          parameters_value[i]->used = 0;
-
-          status = f_string_dynamic_increase_by(parameter_defaults[i].used + 1, parameters_value[i]);
-
-          if (F_status_is_error(status)) {
-            fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
-
-            return status;
-          }
-
-          status = f_string_dynamic_append(parameter_defaults[i], parameters_value[i]);
-
-          if (F_status_is_error(status)) {
-            fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
-
-            return status;
-          }
-        }
-      } // for
-    }
-
-    if (data->main->parameters.array[fake_parameter_define_e].result & f_console_result_found_e) {
-      fake_print_error_parameter_missing_value(data, fake_long_define_s);
-
-      return F_status_set_error(F_parameter);
-    }
-
-    {
-      const uint8_t parameters_id[] = {
-        fake_parameter_path_build_e,
-        fake_parameter_path_data_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_work_s,
-      };
-
-      const f_string_static_t parameter_defaults[] = {
-        fake_default_path_build_s,
-        fake_default_path_data_s,
-        fake_default_path_work_s,
-      };
-
-      f_string_dynamic_t * const parameters_value[] = {
-        &data->path_build,
-        &data->path_data,
-        &data->path_work,
-      };
-
-      for (uint8_t i = 0; i < 3; ++i) {
-
-        if (data->main->parameters.array[parameters_id[i]].result & f_console_result_found_e) {
-          fake_print_error_parameter_missing_value(data, parameters_name[i]);
-
-          return F_status_set_error(F_parameter);
-        }
-
-        if (data->main->parameters.array[parameters_id[i]].result & f_console_result_value_e) {
-          if (data->main->parameters.array[parameters_id[i]].values.used > 1) {
-            fake_print_error_parameter_too_many(data, parameters_name[i]);
-
-            return F_status_set_error(F_parameter);
-          }
-
-          const f_array_length_t index = data->main->parameters.array[parameters_id[i]].values.array[data->main->parameters.array[parameters_id[i]].values.used - 1];
-
-          parameters_value[i]->used = 0;
-
-          status = f_string_dynamic_increase_by(data->main->parameters.arguments.array[index].used + 1, parameters_value[i]);
-
-          if (F_status_is_error(status)) {
-            fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
-
-            return status;
-          }
-
-          status = f_path_directory_cleanup(data->main->parameters.arguments.array[index], parameters_value[i]);
-
-          if (F_status_is_error(status)) {
-            if (fll_error_print(data->main->error, F_status_set_fine(status), "f_path_directory_cleanup", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
-              f_file_stream_lock(data->main->error.to);
-
-              fl_print_format("%r%[%QFailed to process parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-              fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, parameters_name[i], data->main->error.notable);
-              fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
-              f_file_stream_unlock(data->main->error.to);
-            }
-
-            return status;
-          }
-        }
-        else if (parameter_defaults[i].used) {
-          parameters_value[i]->used = 0;
-
-          status = f_string_dynamic_increase_by(parameter_defaults[i].used + 1, parameters_value[i]);
-
-          if (F_status_is_error(status)) {
-            fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
-
-            return status;
-          }
-
-          status = f_string_dynamic_append(parameter_defaults[i], parameters_value[i]);
-
-          if (F_status_is_error(status)) {
-            if (fll_error_print(data->main->error, F_status_set_fine(status), " f_string_dynamic_append", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
-              f_file_stream_lock(data->main->error.to);
-
-              fl_print_format("%r%[%QFailed to load default for the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-              fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, parameters_name[i], data->main->error.notable);
-              fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
-              f_file_stream_unlock(data->main->error.to);
-            }
-
-            return status;
-          }
-        }
-      } // for
-    }
-
-    if (data->main->parameters.array[fake_parameter_define_e].result & f_console_result_value_e) {
-      status = fll_program_parameter_additional_rip(data->main->parameters.arguments.array, data->main->parameters.array[fake_parameter_define_e].values, &data->define);
-
-      if (F_status_is_error(status)) {
-        if (fll_error_print(data->main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
-          f_file_stream_lock(data->main->error.to);
-
-          fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-          fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_define_s, data->main->error.notable);
-          fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
-          f_file_stream_unlock(data->main->error.to);
-        }
-
-        return status;
-      }
-    }
-
-    if (data->main->parameters.array[fake_parameter_mode_e].result & f_console_result_found_e) {
-      fake_print_error_parameter_missing_value(data, fake_long_mode_s);
-
-      return F_status_set_error(F_parameter);
-    }
-
-    if (data->main->parameters.array[fake_parameter_mode_e].result & f_console_result_value_e) {
-      status = fll_program_parameter_additional_rip(data->main->parameters.arguments.array, data->main->parameters.array[fake_parameter_mode_e].values, &data->mode);
-
-      if (F_status_is_error(status)) {
-        if (fll_error_print(data->main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
-          f_file_stream_lock(data->main->error.to);
-
-          fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-          fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_mode_s, data->main->error.notable);
-          fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
-          f_file_stream_unlock(data->main->error.to);
-        }
-
-        return status;
-      }
-
-      f_array_length_t i = 0;
-      f_array_length_t j = 0;
-      f_array_length_t width_max = 0;
-
-      for (; i < data->mode.used; ++i) {
-
-        for (j = 0; j < data->mode.array[i].used; ++j) {
-
-          width_max = data->mode.array[i].used - j;
-
-          status = f_utf_is_word_dash_plus(data->mode.array[i].string + j, width_max, F_false);
-
-          if (F_status_is_error(status)) {
-            if (fll_error_print(data->main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
-              f_file_stream_lock(data->main->error.to);
-
-              fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-              fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_mode_s, data->main->error.notable);
-              fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
-              f_file_stream_unlock(data->main->error.to);
-            }
-
-            return status;
-          }
-
-          if (status == F_false) {
-            if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
-              f_file_stream_lock(data->main->error.to);
-
-              fl_print_format("%r%[%QThe '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-              fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_mode_s, data->main->error.notable);
-              fl_print_format("%[' parameters value '%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_mode_s, data->main->error.notable);
-              fl_print_format("%[%Q%]", data->main->error.to, data->main->error.notable, data->mode.array[i], data->main->error.notable);
-              fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
-              f_file_stream_unlock(data->main->error.to);
-            }
-
-            return F_status_set_error(F_parameter);
-          }
-        } // for
-      } // for
-    }
-
-    return F_none;
-  }
-#endif // _di_fake_process_console_parameters_
-
 #ifndef _di_fake_validate_parameter_paths_
   f_status_t fake_validate_parameter_paths(fake_data_t * const data) {
 
@@ -554,19 +197,19 @@ extern "C" {
       return F_status_set_error(F_interrupt);
     }
 
-    const f_string_static_t parameters_name[] = {
+    const f_string_static_t names[] = {
       fake_long_path_build_s,
       fake_long_path_data_s,
       fake_long_path_work_s,
     };
 
-    const f_string_dynamic_t parameters_value[] = {
+    const f_string_dynamic_t values[] = {
       data->path_build,
       data->path_data,
       data->path_work,
     };
 
-    uint8_t parameters_required[] = {
+    uint8_t requireds[] = {
       F_false,
       (data->main->pipe & fll_program_data_pipe_input_e) ? F_false : F_true,
       F_false,
@@ -579,41 +222,31 @@ extern "C" {
       if (data->main->parameters.array[fake_parameter_fakefile_e].result == f_console_result_none_e) {
         if (data->path_build.used && f_file_exists(data->path_build, F_false) != F_true) {
           if (f_file_exists(fake_default_fakefile_s, F_false) == F_true) {
-            parameters_required[1] = F_false;
-          }
-        }
-      }
-
-      // If a custom --data or a custom --fakefile parameter is passed and uses an absolute or relative to current path, then do not check.
-      if (data->main->parameters.array[fake_parameter_fakefile_e].result & f_console_result_value_e) {
-        const f_array_length_t index = data->main->parameters.array[fake_parameter_fakefile_e].values.array[data->main->parameters.array[fake_parameter_fakefile_e].values.used - 1];
-
-        if (f_path_is_absolute(data->main->parameters.arguments.array[index]) == F_true || f_path_is_relative_current(data->main->parameters.arguments.array[index]) == F_true) {
-          parameters_required[1] = F_none;
-        }
-        else {
-          status = f_file_exists(data->main->parameters.arguments.array[index], F_true);
-
-          if (F_status_is_error_not(status) && status == F_true) {
-            parameters_required[1] = F_none;
+            requireds[1] = F_false;
           }
         }
       }
     }
-    else if (data->operation == fake_operation_build_e) {
 
-      // If a custom --data or a custom --settings parameter is passed and uses an absolute or relative to current path, then do not check.
-      if (data->main->parameters.array[fake_parameter_settings_e].result & f_console_result_value_e) {
-        const f_array_length_t index = data->main->parameters.array[fake_parameter_settings_e].values.array[data->main->parameters.array[fake_parameter_settings_e].values.used - 1];
+    // If a custom --data or a custom --fakefile parameter is passed and uses an absolute or relative to current path, then do not check.
+    if (data->operation == fake_operation_make_e || data->operation == fake_operation_build_e) {
+      f_console_parameter_t * const parameter = &data->main->parameters.array[
+        data->operation == fake_operation_make_e
+          ? fake_parameter_fakefile_e
+          : fake_parameter_settings_e
+        ];
+
+      if (parameter->result & f_console_result_value_e) {
+        const f_array_length_t index = parameter->values.array[parameter->values.used - 1];
 
         if (f_path_is_absolute(data->main->parameters.arguments.array[index]) == F_true || f_path_is_relative_current(data->main->parameters.arguments.array[index]) == F_true) {
-          parameters_required[1] = F_none;
+          requireds[1] = F_none;
         }
         else {
           status = f_file_exists(data->main->parameters.arguments.array[index], F_true);
 
           if (F_status_is_error_not(status) && status == F_true) {
-            parameters_required[1] = F_none;
+            requireds[1] = F_none;
           }
         }
       }
@@ -623,26 +256,26 @@ extern "C" {
 
     for (uint8_t i = 0; i < 3; ++i) {
 
-      if (parameters_required[i] != F_none && parameters_value[i].used) {
+      if (requireds[i] != F_none && values[i].used) {
         memset(&directory_stat, 0, sizeof(struct stat));
 
-        status = f_file_stat(parameters_value[i], F_true, &directory_stat);
+        status = f_file_stat(values[i], F_true, &directory_stat);
 
         if (status == F_status_set_error(F_file_found_not)) status = F_status_set_error(F_directory_found_not);
 
         if (F_status_is_error(status)) {
-          if (F_status_set_fine(status) != F_directory_found_not || parameters_required[i]) {
-            fll_error_file_print(data->main->error, F_status_set_fine(status), "f_file_stat", F_true, parameters_value[i], f_file_operation_access_s, fll_error_file_type_directory_e);
+          if (F_status_set_fine(status) != F_directory_found_not || requireds[i]) {
+            fll_error_file_print(data->main->error, F_status_set_fine(status), "f_file_stat", F_true, values[i], f_file_operation_access_s, fll_error_file_type_directory_e);
 
             return status;
           }
         }
       }
-      else if (parameters_required[i] == F_true) {
+      else if (requireds[i] == F_true) {
         f_file_stream_lock(data->main->error.to);
 
         fl_print_format("%r%[%QNo valid path for the (required) directory parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
-        fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, parameters_name[i], data->main->error.notable);
+        fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, names[i], data->main->error.notable);
         fl_print_format("%[' was found.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
 
         f_file_stream_unlock(data->main->error.to);
index f47ff6c77f8952f1fa108c406de45b002f913556..2bcb2b0c179f193796a47d924b3acd4b5cc2659e 100644 (file)
@@ -84,21 +84,6 @@ extern "C" {
 #endif // _di_fake_pipe_buffer_
 
 /**
- * Validate console arguments and print any relating error messages.
- *
- * @param data
- *   The program data.
- *
- * @return
- *   F_none on success.
- *
- *   Status codes (with error bit) are returned on any problem.
- */
-#ifndef _di_fake_process_console_parameters_
-  extern f_status_t fake_process_console_parameters(fake_data_t * const data) F_attribute_visibility_internal_d;
-#endif // _di_validate_console_parameters_
-
-/**
  * Validate directories and print any relating error messages.
  *
  * This should not be called for skeleton as in that case the directories probably do not exist.
index c022c8bc68ba0c0f826f9f8082699a68fb507a08..b371cdc7b42438861bba149177da08435a712912 100644 (file)
@@ -113,14 +113,14 @@ extern "C" {
 #endif // _di_firewall_setting_delete_
 
 #ifndef _di_firewall_setting_load_
-  void firewall_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, firewall_setting_t * const setting) {
+  void firewall_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, firewall_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       firewall_print_line_first_locked(setting, main->error);
index 801e49199246762606c88b24af549411ce07739c..a3e45924bf9fc0329b91e071f2868754e8be2cb9 100644 (file)
@@ -386,24 +386,24 @@ extern "C" {
 
   #define firewall_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_7(firewall_command_start_s,   0, f_console_flag_simple_e), \
-      macro_f_console_parameter_t_initialize_7(firewall_command_stop_s,    0, f_console_flag_simple_e), \
-      macro_f_console_parameter_t_initialize_7(firewall_command_restart_s, 0, f_console_flag_simple_e), \
-      macro_f_console_parameter_t_initialize_7(firewall_command_lock_s,    0, f_console_flag_simple_e), \
-      macro_f_console_parameter_t_initialize_7(firewall_command_show_s,    0, f_console_flag_simple_e), \
+      macro_f_console_parameter_t_initialize_6(firewall_command_start_s,   0, f_console_flag_simple_e), \
+      macro_f_console_parameter_t_initialize_6(firewall_command_stop_s,    0, f_console_flag_simple_e), \
+      macro_f_console_parameter_t_initialize_6(firewall_command_restart_s, 0, f_console_flag_simple_e), \
+      macro_f_console_parameter_t_initialize_6(firewall_command_lock_s,    0, f_console_flag_simple_e), \
+      macro_f_console_parameter_t_initialize_6(firewall_command_show_s,    0, f_console_flag_simple_e), \
     }
 
   #define firewall_total_parameters_d 17
@@ -495,6 +495,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -510,7 +512,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_firewall_setting_load_
-  extern void firewall_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, firewall_setting_t * const setting);
+  extern void firewall_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, firewall_setting_t * const setting);
 #endif // _di_firewall_setting_load_
 
 /**
index 09a0c725bfe0472bdc86c2e246c429f13bc33625..2d41d0d16ec7fe92865c0cc3ccaadc18909154e4 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    firewall_setting_load(arguments, &data, &setting);
+    firewall_setting_load(arguments, state, &data, &setting);
   }
 
   firewall_main(&data, &setting);
index 6056b1aa3dd5dd2d40e615e750efcd3038778b7b..940455ff054c3e123265ba2d9eef90aec5af24e6 100644 (file)
@@ -71,14 +71,14 @@ extern "C" {
 #endif // _di_fss_basic_list_read_setting_delete_
 
 #ifndef _di_fss_basic_list_read_setting_load_
-  void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting) {
+  void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       fss_basic_list_read_print_line_first_locked(setting, main->error);
index 11da846f2d8eff13bb384117b7e0d142957a8840..83b359eb3b931bfbd3a167ba5a52e644030d2a75 100644 (file)
@@ -223,33 +223,33 @@ extern "C" {
 
   #define fss_basic_list_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_original_s, fss_basic_list_read_long_original_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_original_s, fss_basic_list_read_long_original_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
     }
 
   #define fss_basic_list_read_total_parameters_d 26
@@ -391,6 +391,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -406,7 +408,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_fss_basic_list_read_setting_load_
-  extern void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting);
+  extern void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting);
 #endif // _di_fss_basic_list_read_setting_load_
 
 /**
index d4e6a58d840c107a462ee193635570c5d8472b5b..774ceacdfae1111d3ed63634576f0404107a5203 100644 (file)
@@ -154,10 +154,10 @@ extern "C" {
         };
 
         const uint8_t parameter_match[] = {
-          f_console_result_additional_e,
-          f_console_result_additional_e,
+          f_console_result_value_e,
+          f_console_result_value_e,
           f_console_result_found_e,
-          f_console_result_additional_e,
+          f_console_result_value_e,
           f_console_result_found_e,
         };
 
index f4f6dbcf582af6570efda7904d4f073b55fbb41d..342a8a1ffc8a0040e7ab5a10a2aa083315e6103e 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_basic_list_read_setting_load(arguments, &data, &setting);
+    fss_basic_list_read_setting_load(arguments, state, &data, &setting);
   }
 
   fss_basic_list_read_main(&data, &setting);
index 4ef7867f7a97025f42f0ee7cfbe03d30638cde4e..62ed9c8acd7168f52153389b97b23c74efc929ec 100644 (file)
@@ -70,14 +70,14 @@ extern "C" {
 #endif // _di_fss_basic_read_setting_delete_
 
 #ifndef _di_fss_basic_read_setting_load_
-  void fss_basic_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_read_setting_t * const setting) {
+  void fss_basic_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_basic_read_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       fss_basic_read_print_line_first_locked(setting, main->error);
index 7e033feeb85f7861fc713ac73e9f2014a3bb39f9..4743856ef4d95dc4ac445260a30591f370837b17 100644 (file)
@@ -221,33 +221,33 @@ extern "C" {
 
   #define fss_basic_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_at_s, fss_basic_read_long_at_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_content_s, fss_basic_read_long_content_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_columns_s, fss_basic_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_delimit_s, fss_basic_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_depth_s, fss_basic_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_empty_s, fss_basic_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_line_s, fss_basic_read_long_line_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_name_s, fss_basic_read_long_name_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_object_s, fss_basic_read_long_object_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_pipe_s, fss_basic_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_original_s, fss_basic_read_long_original_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_select_s, fss_basic_read_long_select_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_total_s, fss_basic_read_long_total_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_basic_read_short_trim_s, fss_basic_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_at_s, fss_basic_read_long_at_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_content_s, fss_basic_read_long_content_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_columns_s, fss_basic_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_delimit_s, fss_basic_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_depth_s, fss_basic_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_empty_s, fss_basic_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_line_s, fss_basic_read_long_line_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_name_s, fss_basic_read_long_name_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_object_s, fss_basic_read_long_object_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_pipe_s, fss_basic_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_original_s, fss_basic_read_long_original_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_select_s, fss_basic_read_long_select_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_total_s, fss_basic_read_long_total_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_basic_read_short_trim_s, fss_basic_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
     }
 
   #define fss_basic_read_total_parameters_d 26
@@ -389,6 +389,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -404,7 +406,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_fss_basic_read_setting_load_
-  extern void fss_basic_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_read_setting_t * const setting);
+  extern void fss_basic_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_basic_read_setting_t * const setting);
 #endif // _di_fss_basic_read_setting_load_
 
 /**
index bf8888998b693668711f495d7e12dbd779190726..5d1dd2a5ad7885e8862b6c957d41bdf84079044c 100644 (file)
@@ -154,10 +154,10 @@ extern "C" {
         };
 
         const uint8_t parameter_match[] = {
-          f_console_result_additional_e,
-          f_console_result_additional_e,
+          f_console_result_value_e,
+          f_console_result_value_e,
           f_console_result_found_e,
-          f_console_result_additional_e,
+          f_console_result_value_e,
           f_console_result_found_e,
         };
 
index 33b3e5880efa98791ffd17d5423fc9b4b50366e9..829bea2d9315c7258c0cf7ac6e2c1f27156aa039 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_basic_read_setting_load(arguments, &data, &setting);
+    fss_basic_read_setting_load(arguments, state, &data, &setting);
   }
 
   fss_basic_read_main(&data, &setting);
index ec94e8409e10ea30cd87a7e1b1209dc5f87e53a0..c9325bbde5dcf01aaf3d3f2822955bcd15441a7f 100644 (file)
@@ -69,14 +69,14 @@ extern "C" {
 #endif // _di_fss_embedded_list_read_setting_delete_
 
 #ifndef _di_fss_embedded_list_read_setting_load_
-  void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting) {
+  void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       fss_embedded_list_read_print_line_first_locked(setting, main->error);
index 88afdf85ca72f9de6d3ce18e14dc003a47be2ffc..a9cfd08d429575b46a02715cf3e585e217ae7633 100644 (file)
@@ -221,33 +221,33 @@ extern "C" {
 
   #define fss_embedded_list_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_at_s.string, fss_embedded_list_read_long_at_s.string, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_content_s.string, fss_embedded_list_read_long_content_s.string, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_columns_s.string, fss_embedded_list_read_long_columns_s.string, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_delimit_s.string, fss_embedded_list_read_long_delimit_s.string, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_depth_s.string, fss_embedded_list_read_long_depth_s.string, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_empty_s.string, fss_embedded_list_read_long_empty_s.string, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_line_s.string, fss_embedded_list_read_long_line_s.string, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_name_s.string, fss_embedded_list_read_long_name_s.string, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_object_s.string, fss_embedded_list_read_long_object_s.string, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_pipe_s.string, fss_embedded_list_read_long_pipe_s.string, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_original_s.string, fss_embedded_list_read_long_original_s.string, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_select_s.string, fss_embedded_list_read_long_select_s.string, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_total_s.string, fss_embedded_list_read_long_total_s.string, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_trim_s.string, fss_embedded_list_read_long_trim_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_at_s.string, fss_embedded_list_read_long_at_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_content_s.string, fss_embedded_list_read_long_content_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_columns_s.string, fss_embedded_list_read_long_columns_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_delimit_s.string, fss_embedded_list_read_long_delimit_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_depth_s.string, fss_embedded_list_read_long_depth_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_empty_s.string, fss_embedded_list_read_long_empty_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_line_s.string, fss_embedded_list_read_long_line_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_name_s.string, fss_embedded_list_read_long_name_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_object_s.string, fss_embedded_list_read_long_object_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_pipe_s.string, fss_embedded_list_read_long_pipe_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_original_s.string, fss_embedded_list_read_long_original_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_select_s.string, fss_embedded_list_read_long_select_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_total_s.string, fss_embedded_list_read_long_total_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_trim_s.string, fss_embedded_list_read_long_trim_s.string, 0, 0, f_console_flag_normal_e), \
     }
 
   #define fss_embedded_list_read_total_parameters_d 26
@@ -372,6 +372,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -387,7 +389,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_fss_embedded_list_read_setting_load_
-  extern void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting);
+  extern void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting);
 #endif // _di_fss_embedded_list_read_setting_load_
 
 /**
index db1288bc6c72a006de3ad58aaafa2ef6934962d5..a35b5aab079800542cd539dffece7c02778bad34 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_embedded_list_read_setting_load(arguments, &data, &setting);
+    fss_embedded_list_read_setting_load(arguments, state, &data, &setting);
   }
 
   fss_embedded_list_read_main(&data, &setting);
index 7a032e7ad77c999f83d042eb5ad97e0a8b652be0..45a689f9404f04afc0a52e8657a09284f24f0cb0 100644 (file)
@@ -77,14 +77,14 @@ extern "C" {
 #endif // _di_fss_extended_list_read_setting_delete_
 
 #ifndef _di_fss_extended_list_read_setting_load_
-  void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting) {
+  void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       fss_extended_list_read_print_line_first_locked(setting, main->error);
index ce09c892b6c5b014590c4fd186880cffb8930789..48b39dca14cb553bc8f08340fdf2fa63fc8c696c 100644 (file)
@@ -221,33 +221,33 @@ extern "C" {
 
   #define fss_extended_list_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_at_s, fss_extended_list_read_long_at_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_content_s, fss_extended_list_read_long_content_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_columns_s, fss_extended_list_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_delimit_s, fss_extended_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_depth_s, fss_extended_list_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_empty_s, fss_extended_list_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_line_s, fss_extended_list_read_long_line_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_name_s, fss_extended_list_read_long_name_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_object_s, fss_extended_list_read_long_object_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_pipe_s, fss_extended_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_original_s, fss_extended_list_read_long_original_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_select_s, fss_extended_list_read_long_select_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_total_s, fss_extended_list_read_long_total_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_trim_s, fss_extended_list_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_at_s, fss_extended_list_read_long_at_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_content_s, fss_extended_list_read_long_content_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_columns_s, fss_extended_list_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_delimit_s, fss_extended_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_depth_s, fss_extended_list_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_empty_s, fss_extended_list_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_line_s, fss_extended_list_read_long_line_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_name_s, fss_extended_list_read_long_name_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_object_s, fss_extended_list_read_long_object_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_pipe_s, fss_extended_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_original_s, fss_extended_list_read_long_original_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_select_s, fss_extended_list_read_long_select_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_total_s, fss_extended_list_read_long_total_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_trim_s, fss_extended_list_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
     }
 
   #define fss_extended_list_read_total_parameters_d 26
@@ -406,6 +406,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -421,7 +423,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_fss_extended_list_read_setting_load_
-  extern void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting);
+  extern void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting);
 #endif // _di_fss_extended_list_read_setting_load_
 
 /**
index a2e2629221abba50fa986d67e4045c5d4ef4de3f..f6e3ea2fa95e40c126993569a78f963a44140456 100644 (file)
@@ -154,10 +154,10 @@ extern "C" {
         };
 
         const uint8_t parameter_match[] = {
-          f_console_result_additional_e,
-          f_console_result_additional_e,
+          f_console_result_value_e,
+          f_console_result_value_e,
           f_console_result_found_e,
-          f_console_result_additional_e,
+          f_console_result_value_e,
           f_console_result_found_e,
         };
 
index aff8ca90eabba275e3f91963768e55b5b95dd727..1c384e7edccdf10a31aefd6b6eec624b3574a098 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_extended_list_read_setting_load(arguments, &data, &setting);
+    fss_extended_list_read_setting_load(arguments, state, &data, &setting);
   }
 
   fss_extended_list_read_main(&data, &setting);
index d4c02f692a34682d231a7e6a30f72d2958eda046..e78fd2d9819fde4f94917ead8b884ff709f811ae 100644 (file)
@@ -70,14 +70,14 @@ extern "C" {
 #endif // _di_fss_extended_read_setting_delete_
 
 #ifndef _di_fss_extended_read_setting_load_
-  void fss_extended_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_read_setting_t * const setting) {
+  void fss_extended_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_extended_read_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       fss_extended_read_print_line_first_locked(setting, main->error);
index 5cbf2dd410b080fb2079543e1b15bc5005ce26e4..da94ab39a97608498dd334a39dd0190594f9676a 100644 (file)
@@ -221,32 +221,32 @@ extern "C" {
 
   #define fss_extended_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_content_s, fss_extended_read_long_content_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_columns_s, fss_extended_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_delimit_s, fss_extended_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_depth_s, fss_extended_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_empty_s, fss_extended_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_line_s, fss_extended_read_long_line_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_name_s, fss_extended_read_long_name_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_object_s, fss_extended_read_long_object_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_pipe_s, fss_extended_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_original_s, fss_extended_read_long_original_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_select_s, fss_extended_read_long_select_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_total_s, fss_extended_read_long_total_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_extended_read_short_trim_s, fss_extended_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_content_s, fss_extended_read_long_content_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_columns_s, fss_extended_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_delimit_s, fss_extended_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_depth_s, fss_extended_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_empty_s, fss_extended_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_line_s, fss_extended_read_long_line_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_name_s, fss_extended_read_long_name_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_object_s, fss_extended_read_long_object_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_pipe_s, fss_extended_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_original_s, fss_extended_read_long_original_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_select_s, fss_extended_read_long_select_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_total_s, fss_extended_read_long_total_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_extended_read_short_trim_s, fss_extended_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
     }
 
   #define fss_extended_read_total_parameters_d 26
@@ -388,6 +388,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -403,7 +405,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_fss_extended_read_setting_load_
-  extern void fss_extended_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_read_setting_t * const setting);
+  extern void fss_extended_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_extended_read_setting_t * const setting);
 #endif // _di_fss_extended_read_setting_load_
 
 /**
index 1f80de3492870c2d4a77a76e0b1f405cc0fe9f93..f3342f2c37f6e4f898e086c57f2729581e64e266 100644 (file)
@@ -153,10 +153,10 @@ extern "C" {
         };
 
         const uint8_t parameter_match[] = {
-          f_console_result_additional_e,
-          f_console_result_additional_e,
+          f_console_result_value_e,
+          f_console_result_value_e,
           f_console_result_found_e,
-          f_console_result_additional_e,
+          f_console_result_value_e,
           f_console_result_found_e,
         };
 
index 5998ee6159a304f8cdb61297632ea1268a656083..50d567974888c3262e46da9f28b61cec220f3b21 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_extended_read_setting_load(arguments, &data, &setting);
+    fss_extended_read_setting_load(arguments, state, &data, &setting);
   }
 
   fss_extended_read_main(&data, &setting);
index ec308c3d1593840045ce0f90e3c8ec3117c63bcb..79ccfc649778e3c56211197a8add25c7b0b86f6f 100644 (file)
@@ -37,14 +37,14 @@ extern "C" {
 #endif // _di_fss_identify_setting_delete_
 
 #ifndef _di_fss_identify_setting_load_
-  void fss_identify_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_identify_setting_t * const setting) {
+  void fss_identify_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_identify_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       fss_identify_print_line_first_locked(setting, main->error);
index e08dac81fd8b3f58141adeca286a825b51cfe21a..cafb8f5c6b770c7f34e857ad66362afb7b80ab55 100644 (file)
@@ -129,24 +129,24 @@ extern "C" {
 
   #define fss_identify_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(fss_identify_short_content_s, fss_identify_long_content_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_identify_short_line_s, fss_identify_long_line_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_identify_short_name_s, fss_identify_long_name_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_identify_short_object_s, fss_identify_long_object_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_identify_short_total_s, fss_identify_long_total_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_identify_short_content_s, fss_identify_long_content_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_identify_short_line_s, fss_identify_long_line_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_identify_short_name_s, fss_identify_long_name_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_identify_short_object_s, fss_identify_long_object_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_identify_short_total_s, fss_identify_long_total_s, 0, 0, f_console_flag_normal_e), \
     }
 
   #define fss_identify_total_parameters_d 17
@@ -238,6 +238,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -253,7 +255,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_fss_identify_setting_load_
-  extern void fss_identify_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_identify_setting_t * const setting);
+  extern void fss_identify_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_identify_setting_t * const setting);
 #endif // _di_fss_identify_setting_load_
 
 /**
index 5ef29a147a6da842ee4adc02355a4cfdcf986b4a..2017cd2fcd96c98e98bfce89d7d3cdb1223696df 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_identify_setting_load(arguments, &data, &setting);
+    fss_identify_setting_load(arguments, state, &data, &setting);
   }
 
   fss_identify_main(&data, &setting);
index f705c95b938854e00230ceac0a20f15c44bbfbdb..322e213030270474e4bb60c553c19e56eb881603 100644 (file)
@@ -71,14 +71,14 @@ extern "C" {
 #endif // _di_fss_payload_read_setting_delete_
 
 #ifndef _di_fss_payload_read_setting_load_
-  void fss_payload_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_payload_read_setting_t * const setting) {
+  void fss_payload_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_payload_read_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       fss_payload_read_print_line_first_locked(setting, main->error);
index acd48aa43e7e555f7a0c9031136fc2223cda1023..239912c17cae3d6227a708402370c75ca6e48b15 100644 (file)
@@ -215,33 +215,33 @@ extern "C" {
 
   #define fss_payload_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e,  0), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_at_s, fss_payload_read_long_at_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_content_s, fss_payload_read_long_content_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_columns_s, fss_payload_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_delimit_s, fss_payload_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_depth_s, fss_payload_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_empty_s, fss_payload_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_line_s, fss_payload_read_long_line_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_name_s, fss_payload_read_long_name_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_object_s, fss_payload_read_long_object_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_pipe_s, fss_payload_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_original_s, fss_payload_read_long_original_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_select_s, fss_payload_read_long_select_s, 0, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_total_s, fss_payload_read_long_total_s, 0, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_payload_read_short_trim_s, fss_payload_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_at_s, fss_payload_read_long_at_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_content_s, fss_payload_read_long_content_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_columns_s, fss_payload_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_delimit_s, fss_payload_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_depth_s, fss_payload_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_empty_s, fss_payload_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_line_s, fss_payload_read_long_line_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_name_s, fss_payload_read_long_name_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_object_s, fss_payload_read_long_object_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_pipe_s, fss_payload_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_original_s, fss_payload_read_long_original_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_select_s, fss_payload_read_long_select_s, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_total_s, fss_payload_read_long_total_s, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_payload_read_short_trim_s, fss_payload_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
     }
 
   #define fss_payload_read_total_parameters_d 26
@@ -395,6 +395,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -410,7 +412,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_fss_payload_read_setting_load_
-  extern void fss_payload_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_payload_read_setting_t * const setting);
+  extern void fss_payload_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_payload_read_setting_t * const setting);
 #endif // _di_fss_payload_read_setting_load_
 
 /**
index ec6bef92deb54adaf7bec69965ff8afbcfcf9924..778f84b36cecb929964ac76e95e1bf1d2a292c7e 100644 (file)
@@ -153,10 +153,10 @@ extern "C" {
         };
 
         const uint8_t parameter_match[] = {
-          f_console_result_additional_e,
-          f_console_result_additional_e,
+          f_console_result_value_e,
+          f_console_result_value_e,
           f_console_result_found_e,
-          f_console_result_additional_e,
+          f_console_result_value_e,
           f_console_result_found_e,
         };
 
index 1fa6db4cd899c20704e45bc64c25782b48989863..ee2685c7d39273192e9fcc4567b458e1d765bafe 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_payload_read_setting_load(arguments, &data, &setting);
+    fss_payload_read_setting_load(arguments, state, &data, &setting);
   }
 
   fss_payload_read_main(&data, &setting);
index 362b7d5fb609a0b36248ae62e297aab30a35da68..a0ed10c5855e08789a0acef3701a8adb80dc25d8 100644 (file)
@@ -28,8 +28,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_write_setting_load(arguments, &data, &setting, 0);
+    fss_write_setting_load(arguments, state, &data, &setting, 0);
   }
 
   fss_write_main(&data, &setting);
index cb51dc0843720f791ef531c7c078ac3630c25415..e8c38b710911b6ed42f97cb034effefddf75336d 100644 (file)
@@ -28,8 +28,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_write_setting_load(arguments, &data, &setting, 0);
+    fss_write_setting_load(arguments, state, &data, &setting, 0);
   }
 
   fss_write_main(&data, &setting);
index 60dcd371e9c86d4de8c5fbfca8029b522279f096..e956aaa7ad973ae36034b910d09bf0171e8a96f4 100644 (file)
@@ -30,8 +30,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_write_setting_load(arguments, &data, &setting, 0);
+    fss_write_setting_load(arguments, state, &data, &setting, 0);
   }
 
   fss_write_main(&data, &setting);
index 5af6874fab4b88d1616423191826c5520b90642a..479dcac93db2370cf10638bccde1444faf7d26ce 100644 (file)
@@ -29,8 +29,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_write_setting_load(arguments, &data, &setting, 0);
+    fss_write_setting_load(arguments, state, &data, &setting, 0);
   }
 
   fss_write_main(&data, &setting);
index b77b74b9b6fdca8f5f21669fade025d2c779dde5..b6571bee1eeb8b10c94361632d71ad2f7f7203cb 100644 (file)
@@ -29,8 +29,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_write_setting_load(arguments, &data, &setting, 0);
+    fss_write_setting_load(arguments, state, &data, &setting, 0);
   }
 
   fss_write_main(&data, &setting);
index 805211bafa216329c9d7e9d5c854bffd570fd59b..15974cf7a86fe3f9b56128142c4388000d3ac418 100644 (file)
@@ -74,12 +74,12 @@ extern "C" {
 #endif // _di_fss_write_setting_delete_
 
 #ifndef _di_fss_write_setting_load_
-  void fss_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, void (*callback)(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting)) {
+  void fss_write_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting, void (*callback)(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting)) {
 
     if (!main || !setting) return;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       fss_write_print_error(setting, main->error, macro_fss_write_f(f_console_parameter_process));
@@ -153,7 +153,7 @@ extern "C" {
     }
 
     if (callback) {
-      callback(arguments, main, setting);
+      callback(arguments, state, main, setting);
       if (F_status_is_error(setting->status)) return;
 
       if (setting->status == F_done) {
index c89455e78e39bcfae254841356fafdfc505ba1b9..aee7ca0f5084d0bab6c24e045c1690fe5255661a 100644 (file)
@@ -251,33 +251,33 @@ extern "C" {
 
   #define fss_write_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_as_s,           fss_write_long_as_s,           1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_backtick_s,     fss_write_long_backtick_s,     0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_content_s,      fss_write_long_content_s,      1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_content_end_s,  fss_write_long_content_end_s,  0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_content_next_s, fss_write_long_content_next_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_double_s,       fss_write_long_double_s,       0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_file_s,         fss_write_long_file_s,         1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_ignore_s,       fss_write_long_ignore_s,       2, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_object_s,       fss_write_long_object_s,       1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_object_open_s,  fss_write_long_object_open_s,  0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_partial_s,      fss_write_long_partial_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_prepend_s,      fss_write_long_prepend_s,      1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_single_s,       fss_write_long_single_s,       0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(fss_write_short_trim_s,         fss_write_long_trim_s,         0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_as_s,           fss_write_long_as_s,           1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_backtick_s,     fss_write_long_backtick_s,     0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_content_s,      fss_write_long_content_s,      1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_content_end_s,  fss_write_long_content_end_s,  0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_content_next_s, fss_write_long_content_next_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_double_s,       fss_write_long_double_s,       0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_file_s,         fss_write_long_file_s,         1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_ignore_s,       fss_write_long_ignore_s,       2, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_object_s,       fss_write_long_object_s,       1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_object_open_s,  fss_write_long_object_open_s,  0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_partial_s,      fss_write_long_partial_s,      0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_prepend_s,      fss_write_long_prepend_s,      1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_single_s,       fss_write_long_single_s,       0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(fss_write_short_trim_s,         fss_write_long_trim_s,         0, f_console_flag_normal_e), \
     }
 
   #define fss_write_total_parameters_d 26
@@ -452,6 +452,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -480,7 +482,7 @@ extern "C" {
  * @see fll_program_parameter_process_verbosity()
  */
 #ifndef _di_fss_write_setting_load_
-  extern void fss_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, void (*callback)(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting));
+  extern void fss_write_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting, void (*callback)(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting));
 #endif // _di_fss_write_setting_load_
 
 /**
index 1339e8679fd465284f0ad86ebf08f84a368b8640..7264ce6704428177a971766494c60ff6786c418c 100644 (file)
@@ -27,8 +27,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_write_setting_load(arguments, &data, &setting, &fss_write_main_setting_load_as);
+    fss_write_setting_load(arguments, state, &data, &setting, &fss_write_main_setting_load_as);
   }
 
   fss_write_main(&data, &setting);
@@ -52,7 +53,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 #endif // _di_fss_write_main_process_help_
 
 #ifndef _di_fss_write_main_setting_load_as_
-  void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) {
+  void fss_write_main_setting_load_as(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting) {
 
     if (!main || !setting || F_status_is_error(setting->status) || (setting->flag & fss_write_flag_version_e)) return;
 
index 0bfb66a9f31419acd48542d7da8eec4caef7d976..c44a75f1a0b23f2c219c657465b2f8ca16dc00cb 100644 (file)
@@ -59,6 +59,8 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp);
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -91,7 +93,7 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp);
  * @see fss_write_setting_load()
  */
 #ifndef _di_fss_write_main_setting_load_as_
-  extern void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting);
+  extern void fss_write_main_setting_load_as(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting);
 #endif // _di_fss_write_main_setting_load_as_
 
 #ifdef __cplusplus
index ada935145097e754b3fd86c72bcfb5a6270d9803..53063a40f0b6948ef7269c3883f7c712693e74d2 100644 (file)
@@ -541,7 +541,7 @@ extern "C" {
 #endif // _di_fss_write_payload_process_set_
 
 #ifndef _di_fss_write_payload_setting_load_
-  void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) {
+  void fss_write_payload_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting) {
 
     if (!main || !setting) return;
 
index 4b1fb689878270a2ad5cc1692c7767ded4510761..e5b5a908209e2d7719bdbee3e6167aefc0a3a578 100644 (file)
@@ -122,6 +122,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -143,7 +145,7 @@ extern "C" {
  * @see fss_write_setting_load()
  */
 #ifndef _di_fss_write_payload_setting_load_
-  extern void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting);
+  extern void fss_write_payload_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting);
 #endif // _di_fss_write_payload_setting_load_
 
 #ifdef __cplusplus
index a6795d5c31843b33be4dcc60f4da3750f6dd803c..e8bf57b8c2038fdab7131d83f65aab0ffb0e2634 100644 (file)
@@ -28,8 +28,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    fss_write_setting_load(arguments, &data, &setting, &fss_write_payload_setting_load);
+    fss_write_setting_load(arguments, state, &data, &setting, &fss_write_payload_setting_load);
   }
 
   fss_write_main(&data, &setting);
index c37dcbe1b211fc3b9c0598bdc06ae77a315fc318..c1e68037bc8aab21400033ee4476e5f4cdab1eef 100644 (file)
@@ -75,14 +75,14 @@ extern "C" {
 #endif // _di_iki_read_setting_delete_
 
 #ifndef _di_iki_read_setting_load_
-  void iki_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_read_setting_t * const setting) {
+  void iki_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, iki_read_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       iki_read_print_error(setting, main->error, macro_iki_read_f(f_console_parameter_process));
index 278184be82bb498061a1c771db97156c1959d292..f323261c9583db77609b18e2a6cc58a2d577a54d 100644 (file)
@@ -192,31 +192,31 @@ extern "C" {
 
   #define iki_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_at_s,         iki_read_long_at_s,         1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_content_s,    iki_read_long_content_s,    0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_line_s,       iki_read_long_line_s,       1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_literal_s,    iki_read_long_literal_s,    0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_name_s,       iki_read_long_name_s,       1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_object_s,     iki_read_long_object_s,     0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_reassign_s,   iki_read_long_reassign_s,   3, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_replace_s,    iki_read_long_replace_s,    2, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_substitute_s, iki_read_long_substitute_s, 3, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_total_s,      iki_read_long_total_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_whole_s,      iki_read_long_whole_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_read_short_wrap_s,       iki_read_long_wrap_s,       3, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_at_s,         iki_read_long_at_s,         1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_content_s,    iki_read_long_content_s,    0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_line_s,       iki_read_long_line_s,       1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_literal_s,    iki_read_long_literal_s,    0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_name_s,       iki_read_long_name_s,       1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_object_s,     iki_read_long_object_s,     0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_reassign_s,   iki_read_long_reassign_s,   3, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_replace_s,    iki_read_long_replace_s,    2, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_substitute_s, iki_read_long_substitute_s, 3, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_total_s,      iki_read_long_total_s,      0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_whole_s,      iki_read_long_whole_s,      0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_read_short_wrap_s,       iki_read_long_wrap_s,       3, f_console_flag_normal_e), \
     }
 
   #define iki_read_total_parameters_d 24
@@ -386,6 +386,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -413,7 +415,7 @@ extern "C" {
  * @see fll_program_parameter_process_verbosity()
  */
 #ifndef _di_iki_read_setting_load_
-  extern void iki_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_read_setting_t * const setting);
+  extern void iki_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, iki_read_setting_t * const setting);
 #endif // _di_iki_read_setting_load_
 
 /**
index 36132a1dc78ed724d69842f8fadd9b39e31fa128..058f37d450f619e8dd6b36012ec99da928174e9d 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    iki_read_setting_load(arguments, &data, &setting);
+    iki_read_setting_load(arguments, state, &data, &setting);
   }
 
   iki_read_main(&data, &setting);
index 555943956dec4f16cf1287b50a71dcde7fa27d9c..726326101bffa0ba8499cc616d40dc63087420d6 100644 (file)
@@ -51,14 +51,14 @@ extern "C" {
 #endif // _di_iki_write_setting_delete_
 
 #ifndef _di_iki_write_setting_load_
-  void iki_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_write_setting_t * const setting) {
+  void iki_write_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, iki_write_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       iki_write_print_error(setting, main->error, macro_iki_write_f(f_console_parameter_process));
index 3517dc98a662558a53898608667cf836a30884c8..c8725d58ddcac66a7488c5591ea702d4f7cc175d 100644 (file)
@@ -147,25 +147,25 @@ extern "C" {
 
   #define iki_write_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(iki_write_short_backtick_s, iki_write_long_backtick_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_write_short_content_s,  iki_write_long_content_s,  1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_write_short_double_s,   iki_write_long_double_s,   0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_write_short_file_s,     iki_write_long_file_s,     1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_write_short_object_s,   iki_write_long_object_s,   1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(iki_write_short_single_s,   iki_write_long_single_s,   0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_write_short_backtick_s, iki_write_long_backtick_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_write_short_content_s,  iki_write_long_content_s,  1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_write_short_double_s,   iki_write_long_double_s,   0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_write_short_file_s,     iki_write_long_file_s,     1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_write_short_object_s,   iki_write_long_object_s,   1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(iki_write_short_single_s,   iki_write_long_single_s,   0, f_console_flag_normal_e), \
     }
 
   #define iki_write_total_parameters_d 18
@@ -277,6 +277,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -298,7 +300,7 @@ extern "C" {
  * @see fll_program_parameter_process_verbosity()
  */
 #ifndef _di_iki_write_setting_load_
-  extern void iki_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_write_setting_t * const setting);
+  extern void iki_write_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, iki_write_setting_t * const setting);
 #endif // _di_iki_write_setting_load_
 
 /**
index b4dfcf8e85a0552dd3ee25beee8c3a87d0628b27..f6fca27f7c4383d9ca117727be3ef78ac848928a 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    iki_write_setting_load(arguments, &data, &setting);
+    iki_write_setting_load(arguments, state, &data, &setting);
   }
 
   iki_write_main(&data, &setting);
index 6da78bbc998ea15513ff3ddcba259a094038f912..bbd1669a72e0c39235d9fa090530237456125017 100644 (file)
@@ -25,8 +25,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    status_code_setting_load(arguments, &data, &setting);
+    status_code_setting_load(arguments, state, &data, &setting);
   }
 
   status_code_main(&data, &setting);
index 94df8ff6df962f86c8e7a0c6e0b59c132c544a8d..c21cbb0ed06b384bac00fc0ef84ff5ad30cc5c68 100644 (file)
@@ -49,12 +49,12 @@ extern "C" {
 #endif // _di_status_code_setting_delete_
 
 #ifndef _di_status_code_setting_load_
-  void status_code_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, status_code_setting_t * const setting) {
+  void status_code_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, status_code_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       status_code_print_error(setting, main->error, macro_status_code_f(f_console_parameter_process));
index a09ca00a6e3330509dc04d533de7b50ac417645d..514e6af81676a264f673ff863c10b070e8593cc3 100644 (file)
@@ -168,23 +168,23 @@ extern "C" {
 
   #define status_code_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(status_code_short_fine_s,    status_code_long_fine_s,    0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(status_code_short_warning_s, status_code_long_warning_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(status_code_short_error_s,   status_code_long_error_s,   0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(status_code_short_number_s,  status_code_long_number_s,  0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(status_code_short_fine_s,    status_code_long_fine_s,    0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(status_code_short_warning_s, status_code_long_warning_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(status_code_short_error_s,   status_code_long_error_s,   0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(status_code_short_number_s,  status_code_long_number_s,  0, f_console_flag_normal_e), \
     }
 
   #define status_code_total_parameters_d 16
@@ -290,6 +290,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -305,7 +307,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_status_code_setting_load_
-  extern void status_code_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, status_code_setting_t * const setting);
+  extern void status_code_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, status_code_setting_t * const setting);
 #endif // _di_status_code_setting_load_
 
 /**
index 205f5576e79a0716fcad4519111b2ee44d8f7762..ad08ffab4e737ca876f99271dba1f3ff18e8fbac 100644 (file)
@@ -23,8 +23,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    status_code_setting_load(arguments, &data, &setting);
+    status_code_setting_load(arguments, state, &data, &setting);
   }
 
   status_code_main(&data, &setting);
index b797888569185c183c1eec122716371113ea1d58..6756ae820c8d04b6755e7f32ab825b315f67b4a0 100644 (file)
@@ -88,14 +88,14 @@ extern "C" {
 #endif // _di_utf8_setting_delete_
 
 #ifndef _di_utf8_setting_load_
-  void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting) {
+  void utf8_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, utf8_setting_t * const setting) {
 
     if (!main || !setting) return;
 
     setting->flag = 0;
 
     // Load parameters.
-    setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+    setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
 
     if (F_status_is_error(setting->status)) {
       utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_process));
index c1a0084517ff81cdf1deba7e48499d0ed9f618a6..1012a9b35dd0e804c136bf043fd30195ed429944 100644 (file)
@@ -275,31 +275,31 @@ extern "C" {
 
   #define utf8_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
-      macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
       \
-      macro_f_console_parameter_t_initialize_4(utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_from_codepoint_s,    utf8_long_from_codepoint_s,    0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_from_file_s,         utf8_long_from_file_s,         1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_headers_s,           utf8_long_headers_s,           0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_separate_s,          utf8_long_separate_s,          0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_strip_invalid_s,     utf8_long_strip_invalid_s,     0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_to_bytesequence_s,   utf8_long_to_bytesequence_s,   0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_to_codepoint_s,      utf8_long_to_codepoint_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_to_combining_s,      utf8_long_to_combining_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_to_file_s,           utf8_long_to_file_s,           1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_to_width_s,          utf8_long_to_width_s,          0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(utf8_short_verify_s,            utf8_long_verify_s,            0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_from_codepoint_s,    utf8_long_from_codepoint_s,    0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_from_file_s,         utf8_long_from_file_s,         1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_headers_s,           utf8_long_headers_s,           0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_separate_s,          utf8_long_separate_s,          0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_strip_invalid_s,     utf8_long_strip_invalid_s,     0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_to_bytesequence_s,   utf8_long_to_bytesequence_s,   0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_to_codepoint_s,      utf8_long_to_codepoint_s,      0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_to_combining_s,      utf8_long_to_combining_s,      0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_to_file_s,           utf8_long_to_file_s,           1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_to_width_s,          utf8_long_to_width_s,          0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(utf8_short_verify_s,            utf8_long_verify_s,            0, f_console_flag_normal_e), \
     }
 
   #define utf8_total_parameters_d 24
@@ -459,6 +459,8 @@ extern "C" {
  *
  * @param arguments
  *   The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ *   A state for providing flags and handling interrupts during long running operations.
  * @param main
  *   The main program data.
  * @param setting
@@ -474,7 +476,7 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_utf8_setting_load_
-  extern void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting);
+  extern void utf8_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, utf8_setting_t * const setting);
 #endif // _di_utf8_setting_load_
 
 /**
index 71e6c6d07dcdcac261fb64d78085e4598f7afc7f..b4a5c32ed313a4fbc7d58df4890adcb84532960e 100644 (file)
@@ -18,8 +18,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+    f_state_t state = f_state_t_initialize;
 
-    utf8_setting_load(arguments, &data, &setting);
+    utf8_setting_load(arguments, state, &data, &setting);
   }
 
   utf8_main(&data, &setting);