]> Kevux Git Server - fll/commitdiff
Update: console code and some macros
authorKevin Day <thekevinday@gmail.com>
Tue, 3 Sep 2019 04:21:08 +0000 (23:21 -0500)
committerKevin Day <thekevinday@gmail.com>
Tue, 3 Sep 2019 04:21:08 +0000 (23:21 -0500)
Add explicit dark mode console option.
Add support for order of operations priority on parameters  ("+n +l +d" would result in colors for dark background because +d overrides both +n and +l due to being the right-most parameter).
Rewrite level_3 programs to utilize the new fll_program_process_parameters() helper function.
Fix some screwed up macro definitions and uses.

29 files changed:
level_0/f_console/c/console.h
level_0/f_fss/c/fss.h
level_0/f_string/c/string.h
level_0/f_type/c/type_array.h
level_0/f_utf/c/utf.h
level_1/fl_console/c/console.c
level_2/fll_program/c/program.c
level_2/fll_program/c/program.h
level_3/firewall/c/firewall.c
level_3/firewall/c/firewall.h
level_3/fss_basic_list_read/c/fss_basic_list_read.c
level_3/fss_basic_list_read/c/fss_basic_list_read.h
level_3/fss_basic_list_write/c/fss_basic_list_write.c
level_3/fss_basic_list_write/c/fss_basic_list_write.h
level_3/fss_basic_read/c/fss_basic_read.c
level_3/fss_basic_read/c/fss_basic_read.h
level_3/fss_basic_write/c/fss_basic_write.c
level_3/fss_basic_write/c/fss_basic_write.h
level_3/fss_extended_read/c/fss_extended_read.c
level_3/fss_extended_read/c/fss_extended_read.h
level_3/fss_extended_write/c/fss_extended_write.c
level_3/fss_extended_write/c/fss_extended_write.h
level_3/fss_status_code/c/fss_status_code.c
level_3/fss_status_code/c/fss_status_code.h
level_3/init/c/init.c
level_3/init/c/init.h
level_3/init/c/private-init.c
level_3/status_code/c/status_code.c
level_3/status_code/c/status_code.h

index 76fdcc9b024ea4d980c6c31d44091d731275f9b6..ed25f8b252baf9fc95282a65af0b15a30705e8ed 100644 (file)
@@ -61,12 +61,14 @@ extern "C" {
  * Create some standard command line parameter options required by the kevux/fss/fll specifications.
  */
 #ifndef _di_f_standard_console_parameters_
-  #define f_console_standard_short_debug    "d"
+  #define f_console_standard_short_dark     "d"
+  #define f_console_standard_short_debug    "D"
   #define f_console_standard_short_help     "h"
   #define f_console_standard_short_light    "l"
   #define f_console_standard_short_no_color "n"
   #define f_console_standard_short_version  "v"
 
+  #define f_console_standard_long_dark     "dark"
   #define f_console_standard_long_debug    "debug"
   #define f_console_standard_long_help     "help"
   #define f_console_standard_long_light    "light"
@@ -90,7 +92,6 @@ extern "C" {
   #define f_console_default_allocation_step 4
 #endif // _di_f_console_default_allocation_step_
 
-
 /**
  * Provide console type enumerations:
  *
@@ -133,6 +134,8 @@ extern "C" {
  * - type: One of the f_console_type_* codes, defining how this parameter is to be processed.
  * - result: A code representing that the parameter was found and how it was found ('-h' vs '--help').
  * - total: A number representing the total number of times this parameter was found ('-h -h' would result in a total of 2).
+ * - location: The last location in argv[] where this parameter was found.
+ * - location_sub: The last sub-location at location in argv (only used by short parameters, such as -h or +l).
  * - additional: An array of locations representing where in the argv[] the additional arguments are found.
  */
 #ifndef _di_f_console_parameter_
@@ -147,11 +150,12 @@ extern "C" {
     uint8_t result;
     uint8_t total;
 
+    f_string_length  location;
+    f_string_length  location_sub;
     f_string_lengths additional;
   } f_console_parameter;
 
-  #define f_console_parameter_initialize(symbol_short, symbol_long, symbol_other, has_additional, type_value) \
-    { symbol_short, symbol_long, symbol_other, has_additional, type_value, f_console_result_none, 0, f_string_lengths_initialize }
+  #define f_console_parameter_initialize(symbol_short, symbol_long, symbol_other, has_additional, type_value) { symbol_short, symbol_long, symbol_other, has_additional, type_value, f_console_result_none, 0, 0, 0, f_string_lengths_initialize }
 #endif // _di_f_console_parameter_
 
 /**
index 448d205a3e674107c2f8c40aa59b873c01bdfd73..17bee35291c8d7f85a012ac6091448b8bb43a31f 100644 (file)
@@ -133,7 +133,7 @@ enum {
 
   #define f_fss_headers_initialize { 0, 0, 0 }
 
-  #define f_clear_fss_headers(headers) f_macro_memory_structure_clear(headers)
+  #define f_macro_fss_headers_clear(headers) f_macro_memory_structure_clear(headers)
 
   #define f_macro_fss_headers_new(status, headers, length) f_macro_memory_structure_new(status, headers, f_fss_header, length)
 
index 8cf3b2d77fab5a7e5b8ef4423fdd5c32bbeb48a5..6748ef2352c6c295796309ee60efd8fef5adc3f3 100644 (file)
@@ -122,20 +122,15 @@ extern "C" {
 
   #define f_string_lengths_initialize { 0, 0, 0 }
 
-  #define f_macro_string_lengths_new(status, lengths) \
-    f_macro_memory_structure_new(status, lengths, f_string_length)
+  #define f_macro_string_lengths_clear(lengths) f_macro_memory_structure_clear(lengths)
 
-  #define f_macro_string_lengths_delete(status, lengths) \
-    f_macro_memory_structure_delete(status, lengths, f_string_length)
+  #define f_macro_string_lengths_new(status, lengths, length) f_macro_memory_structure_new(status, lengths, f_string_length, length)
 
-  #define f_macro_string_lengths_destroy(status, lengths) \
-    f_macro_memory_structure_destroy(status, lengths, f_string_length)
+  #define f_macro_string_lengths_delete(status, lengths) f_macro_memory_structure_delete(status, lengths, f_string_length)
+  #define f_macro_string_lengths_destroy(status, lengths) f_macro_memory_structure_destroy(status, lengths, f_string_length)
 
-  #define f_macro_string_lengths_resize(status, lengths, new_length) \
-    f_macro_memory_structure_resize(status, lengths, f_string_length, new_length)
-
-  #define f_macro_string_lengths_adjust(status, lengths, new_length) \
-    f_macro_memory_structure_adjust(status, lengths, f_string_length, new_length)
+  #define f_macro_string_lengths_resize(status, lengths, new_length) f_macro_memory_structure_resize(status, lengths, f_string_length, new_length)
+  #define f_macro_string_lengths_adjust(status, lengths, new_length) f_macro_memory_structure_adjust(status, lengths, f_string_length, new_length)
 #endif // _di_f_string_lengths_
 
 /**
@@ -176,23 +171,15 @@ extern "C" {
 
   #define f_string_locations_initialize {0, 0, 0}
 
-  #define f_clear_string_locations(locations) \
-    f_macro_memory_structure_clear(locations)
-
-  #define f_macro_string_locations_new(status, locations, length) \
-    f_macro_memory_structure_new(status, locations, f_string_location, length)
-
-  #define f_macro_string_locations_delete(status, locations) \
-    f_macro_memory_structure_delete(status, locations, f_string_location)
+  #define f_clear_string_locations(locations) f_macro_memory_structure_clear(locations)
 
-  #define f_macro_string_locations_destroy(status, locations) \
-    f_macro_memory_structure_destroy(status, locations, f_string_location)
+  #define f_macro_string_locations_new(status, locations, length) f_macro_memory_structure_new(status, locations, f_string_location, length)
 
-  #define f_macro_string_locations_resize(status, locations, new_length) \
-    f_macro_memory_structure_resize(status, locations, f_string_location, new_length)
+  #define f_macro_string_locations_delete(status, locations) f_macro_memory_structure_delete(status, locations, f_string_location)
+  #define f_macro_string_locations_destroy(status, locations) f_macro_memory_structure_destroy(status, locations, f_string_location)
 
-  #define f_macro_string_locations_adjust(status, locations, new_length) \
-    f_macro_memory_structure_adjust(status, locations, f_string_location, new_length)
+  #define f_macro_string_locations_resize(status, locations, new_length) f_macro_memory_structure_resize(status, locations, f_string_location, new_length)
+  #define f_macro_string_locations_adjust(status, locations, new_length) f_macro_memory_structure_adjust(status, locations, f_string_location, new_length)
 #endif // _di_f_string_locations_
 
 /**
index a1f2f3a4de69479f6c561fb870cebfd687f9398d..a7eaef254197f06366bedafc30d6a4c19134a627 100644 (file)
@@ -31,20 +31,15 @@ extern "C" {
 
   #define f_array_lengths_initialize { 0, 0, 0 }
 
-  #define f_macro_array_lengths_new(status, lengths, length) \
-    f_macro_memory_structure_new(status, lengths, f_array_length, length)
+  #define f_macro_array_lengths_clear(lengths) f_macro_memory_structure_clear(lengths)
 
-  #define f_macro_array_lengths_delete(status, lengths) \
-    f_macro_memory_structure_delete(status, lengths, f_array_length)
+  #define f_macro_array_lengths_new(status, lengths, length) f_macro_memory_structure_new(status, lengths, f_array_length, length)
 
-  #define f_macro_array_lengths_destroy(status, lengths) \
-    f_macro_memory_structure_destroy(status, lengths, f_array_length)
+  #define f_macro_array_lengths_delete(status, lengths) f_macro_memory_structure_delete(status, lengths, f_array_length)
+  #define f_macro_array_lengths_destroy(status, lengths) f_macro_memory_structure_destroy(status, lengths, f_array_length)
 
-  #define f_macro_array_lengths_resize(status, lengths, new_length) \
-    f_macro_memory_structure_resize(status, lengths, f_array_length, new_length)
-
-  #define f_macro_array_lengths_adjust(status, lengths, new_length) \
-    f_macro_memory_structure_adjust(status, lengths, f_array_length, new_length)
+  #define f_macro_array_lengths_resize(status, lengths, new_length) f_macro_memory_structure_resize(status, lengths, f_array_length, new_length)
+  #define f_macro_array_lengths_adjust(status, lengths, new_length) f_macro_memory_structure_adjust(status, lengths, f_array_length, new_length)
 #endif // _di_f_array_lengths_
 
 #ifdef __cplusplus
index be71f1b58724678c9c48835aa922fde3285a0982..897d5505b00198f57bbe3ec10be6aaedc256ad87 100644 (file)
@@ -174,14 +174,12 @@ extern "C" {
   #define f_utf_string_initialize f_utf_character_eos
 
   #define f_macro_utf_string_new(status, string, length)   status = f_memory_new((void **) & string, sizeof(f_utf_string), length)
+
   #define f_macro_utf_string_delete(status, string, size)  status = f_memory_delete((void **) & string, sizeof(f_utf_string), size)
   #define f_macro_utf_string_destroy(status, string, size) status = f_memory_destroy((void **) & string, sizeof(f_utf_string), size)
 
-  #define f_macro_utf_string_resize(status, string, old_length, new_length) \
-    status = f_memory_resize((void **) & string, sizeof(f_utf_string), old_length, new_length)
-
-  #define f_macro_utf_string_adjust(status, string, old_length, new_length) \
-    status = f_memory_adjust((void **) & string, sizeof(f_utf_string), old_length, new_length)
+  #define f_macro_utf_string_resize(status, string, old_length, new_length) status = f_memory_resize((void **) & string, sizeof(f_utf_string), old_length, new_length)
+  #define f_macro_utf_string_adjust(status, string, old_length, new_length) status = f_memory_adjust((void **) & string, sizeof(f_utf_string), old_length, new_length)
 #endif // _di_f_utf_string_
 
 /**
@@ -191,14 +189,12 @@ extern "C" {
   typedef f_s_long f_utf_string_length;
 
   #define f_macro_utf_string_length_new(status, string, length)    status = f_memory_new((void **) & string, sizeof(f_utf_string_length), length)
+
   #define f_macro_utf_string_length_delete(status, string, length) status = f_memory_delete((void **) & string, sizeof(f_utf_string_length), length)
   #define f_macro_utf_string_length_destroy(status, string, size)  status = f_memory_destroy((f_void_P *) & string, sizeof(f_utf_string_length), size)
 
-  #define f_macro_utf_string_length_resize(status, length, old_length, new_length) \
-    status = f_memory_resize((void **) & length, sizeof(f_utf_string_length), old_length, new_length)
-
-  #define f_macro_utf_string_length_adjust(status, length, old_length, new_length) \
-    status = f_memory_adjust((void **) & length, sizeof(f_utf_string_length), old_length, new_length)
+  #define f_macro_utf_string_length_resize(status, length, old_length, new_length) status = f_memory_resize((void **) & length, sizeof(f_utf_string_length), old_length, new_length)
+  #define f_macro_utf_string_length_adjust(status, length, old_length, new_length) status = f_memory_adjust((void **) & length, sizeof(f_utf_string_length), old_length, new_length)
 #endif // _di_f_utf_string_length_
 
 /**
@@ -214,20 +210,15 @@ extern "C" {
 
   #define f_utf_string_lengths_initialize { 0, 0, 0 }
 
-  #define f_macro_utf_string_length_news(status, lengths) \
-    f_macro_memory_structure_new(status, lengths, f_utf_string_length)
+  #define f_macro_utf_string_lengths_clear(lengths) f_macro_memory_structure_clear(lengths)
 
-  #define f_macro_utf_string_length_deletes(status, lengths) \
-    f_macro_memory_structure_delete(status, lengths, f_utf_string_length)
+  #define f_macro_utf_string_lengths_new(status, lengths, length) f_macro_memory_structure_new(status, lengths, f_utf_string_length, length)
 
-  #define f_macro_utf_string_length_destroys(status, lengths) \
-    f_macro_memory_structure_destroy(status, lengths, f_utf_string_length)
+  #define f_macro_utf_string_lengths_delete(status, lengths) f_macro_memory_structure_delete(status, lengths, f_utf_string_length)
+  #define f_macro_utf_string_lengths_destroy(status, lengths) f_macro_memory_structure_destroy(status, lengths, f_utf_string_length)
 
-  #define f_macro_utf_string_length_resizes(status, lengths, new_length) \
-    f_macro_memory_structure_resize(status, lengths, f_utf_string_length, new_length)
-
-  #define f_macro_utf_string_length_adjusts(status, lengths, new_length) \
-    f_macro_memory_structure_adjust(status, lengths, f_utf_string_length, new_length)
+  #define f_macro_utf_string_lengths_resize(status, lengths, new_length) f_macro_memory_structure_resize(status, lengths, f_utf_string_length, new_length)
+  #define f_macro_utf_string_lengths_adjust(status, lengths, new_length) f_macro_memory_structure_adjust(status, lengths, f_utf_string_length, new_length)
 #endif // _di_f_utf_string_lengths_
 
 /**
@@ -268,23 +259,15 @@ extern "C" {
 
   #define f_utf_string_locations_initialize {0, 0, 0}
 
-  #define f_clear_utf_string_locations(locations) \
-    f_macro_memory_structure_clear(locations)
-
-  #define f_macro_utf_string_location_news(status, locations, length) \
-    f_macro_memory_structure_new(status, locations, f_utf_string_location, length)
-
-  #define f_macro_utf_string_location_deletes(status, locations) \
-    f_macro_memory_structure_delete(status, locations, f_utf_string_location)
+  #define f_clear_utf_string_locations(locations) f_macro_memory_structure_clear(locations)
 
-  #define f_macro_utf_string_location_destroys(status, locations) \
-    f_macro_memory_structure_destroy(status, locations, f_utf_string_location)
+  #define f_macro_utf_string_location_news(status, locations, length) f_macro_memory_structure_new(status, locations, f_utf_string_location, length)
 
-  #define f_macro_utf_string_location_resizes(status, locations, new_length) \
-    f_macro_memory_structure_resize(status, locations, f_utf_string_location, new_length)
+  #define f_macro_utf_string_location_deletes(status, locations) f_macro_memory_structure_delete(status, locations, f_utf_string_location)
+  #define f_macro_utf_string_location_destroys(status, locations) f_macro_memory_structure_destroy(status, locations, f_utf_string_location)
 
-  #define f_macro_utf_string_location_adjusts(status, locations, new_length) \
-    f_macro_memory_structure_adjust(status, locations, f_utf_string_location, new_length)
+  #define f_macro_utf_string_location_resizes(status, locations, new_length) f_macro_memory_structure_resize(status, locations, f_utf_string_location, new_length)
+  #define f_macro_utf_string_location_adjusts(status, locations, new_length) f_macro_memory_structure_adjust(status, locations, f_utf_string_location, new_length)
 #endif // _di_f_utf_string_locations_
 
 /**
index 348054b678fe6cbb5e5e37ae59219369c70f5c72..5db19bd3fd91beef38e95d25e243eeac647dd74e 100644 (file)
@@ -118,8 +118,14 @@ extern "C" {
             }
 
             parameters[parameter_counter].result = f_console_result_found;
+            parameters[parameter_counter].location = location;
+            parameters[parameter_counter].location_sub = 0;
             parameters[parameter_counter].total++;
 
+            if (result == console_short) {
+              parameters[parameter_counter].location_sub = sub_location;
+            }
+
             if (parameters[parameter_counter].has_additional) {
               if (needs_additional.used + parameters[parameter_counter].has_additional > needs_additional.size) {
                 f_status allocation_status = f_none;
@@ -161,6 +167,8 @@ extern "C" {
           }
 
           parameters[parameter_counter].result = f_console_result_found;
+          parameters[parameter_counter].location = location;
+          parameters[parameter_counter].location_sub = 0;
           parameters[parameter_counter].total++;
 
           if (parameters[parameter_counter].has_additional) {
index 6209a155806c9dec3047d1390d192df18b8d2e94..2a10531fbeac021ddd5cbcb61f87d51d35baa892 100644 (file)
@@ -79,14 +79,79 @@ extern "C" {
 #endif // _di_fll_program_print_version_
 
 #ifndef _di_fll_program_process_parameters_
-  f_return_status fll_program_process_parameters(const f_array_length argc, const f_string argv[], f_console_parameter parameters[], const f_array_length total_parameters, const f_array_length parameter_no_color, const f_array_length parameter_light, f_string_lengths *remaining, fl_color_context *context) {
+  f_return_status fll_program_process_parameters(const f_array_length argc, const f_string argv[], f_console_parameter parameters[], const f_array_length total_parameters, const f_array_length parameter_no_color, const f_array_length parameter_light, const f_array_length parameter_dark, f_string_lengths *remaining, fl_color_context *context) {
     f_status status = f_none;
     f_status allocation_status = f_none;
 
     status = fl_process_parameters(argc, argv, parameters, total_parameters, remaining);
 
-    // load colors when not told to show no colors
-    if (parameters[parameter_no_color].result == f_console_result_none) {
+    f_string_length color_mode = parameter_dark;
+
+    if (parameters[parameter_no_color].result == f_console_result_found) {
+      if (parameters[parameter_light].result == f_console_result_none) {
+        if (parameters[parameter_dark].result == f_console_result_none || parameters[parameter_no_color].location > parameters[parameter_dark].location) {
+          color_mode = parameter_no_color;
+        }
+        else if (parameters[parameter_no_color].location == parameters[parameter_dark].location && parameters[parameter_no_color].location_sub > parameters[parameter_dark].location_sub) {
+          color_mode = parameter_no_color;
+        }
+      }
+      else {
+        if (parameters[parameter_dark].result == f_console_result_none) {
+          if (parameters[parameter_no_color].location > parameters[parameter_light].location) {
+            color_mode = parameter_no_color;
+          }
+          else if (parameters[parameter_no_color].location == parameters[parameter_light].location && parameters[parameter_no_color].location_sub > parameters[parameter_light].location_sub) {
+            color_mode = parameter_no_color;
+          }
+          else {
+            color_mode = parameter_light;
+          }
+        }
+        else if (parameters[parameter_no_color].location > parameters[parameter_dark].location) {
+          if (parameters[parameter_no_color].location > parameters[parameter_light].location) {
+            color_mode = parameter_no_color;
+          }
+          else if (parameters[parameter_no_color].location == parameters[parameter_light].location && parameters[parameter_no_color].location_sub > parameters[parameter_light].location_sub) {
+            color_mode = parameter_no_color;
+          }
+          else {
+            color_mode = parameter_light;
+          }
+        }
+        else if (parameters[parameter_no_color].location == parameters[parameter_dark].location && parameters[parameter_no_color].location_sub > parameters[parameter_dark].location_sub) {
+          if (parameters[parameter_no_color].location > parameters[parameter_light].location) {
+            color_mode = parameter_no_color;
+          }
+          else if (parameters[parameter_no_color].location == parameters[parameter_light].location && parameters[parameter_no_color].location_sub > parameters[parameter_light].location_sub) {
+            color_mode = parameter_no_color;
+          }
+          else {
+            color_mode = parameter_light;
+          }
+        }
+        else if (parameters[parameter_light].location > parameters[parameter_dark].location) {
+          color_mode = parameter_light;
+        }
+        else if (parameters[parameter_light].location == parameters[parameter_dark].location && parameters[parameter_light].location_sub > parameters[parameter_dark].location_sub) {
+          color_mode = parameter_light;
+        }
+      }
+    }
+    else if (parameters[parameter_light].result == f_console_result_found) {
+      if (parameters[parameter_dark].result == f_console_result_none) {
+        color_mode = parameter_light;
+      }
+      else if (parameters[parameter_light].location > parameters[parameter_dark].location) {
+        color_mode = parameter_light;
+      }
+      else if (parameters[parameter_light].location == parameters[parameter_dark].location && parameters[parameter_light].location_sub > parameters[parameter_dark].location_sub) {
+        color_mode = parameter_light;
+      }
+    }
+
+    // load colors unless told not to.
+    if (color_mode != parameter_no_color) {
       fl_macro_color_context_new(allocation_status, (*context));
 
       if (f_status_is_error(allocation_status)) {
@@ -94,7 +159,7 @@ extern "C" {
         return allocation_status;
       }
 
-      fl_color_load_context(context, parameters[parameter_light].result == f_console_result_found);
+      fl_color_load_context(context, color_mode == parameter_light);
     }
 
     if (f_status_is_error(status)) {
index 129c56d684ccdcc0bc9f5e0bc03cfcb81a42fea8..f67c8defeb57caa36d33845efce0f1e98ed6c16f 100644 (file)
@@ -126,6 +126,8 @@ extern "C" {
  *   The parameter in the parameters array representing the no-color option.
  * @param parameter_light
  *   The parameter in the parameters array representing the light-color option.
+ * @param parameter_dark
+ *   The parameter in the parameters array representing the dark-color option.
  * @param remaining
  *   A list of remaining parameters not associated with anything.
  * @param context
@@ -138,7 +140,7 @@ extern "C" {
  *   f_reallocation_error (with error bit) on memory reallocation error.
  */
 #ifndef _di_fll_program_process_parameters_
-  extern f_return_status fll_program_process_parameters(const f_array_length argc, const f_string argv[], f_console_parameter parameters[], const f_array_length total_parameters, const f_array_length parameter_no_color, const f_array_length parameter_light, f_string_lengths *remaining, fl_color_context *context);
+  extern f_return_status fll_program_process_parameters(const f_array_length argc, const f_string argv[], f_console_parameter parameters[], const f_array_length total_parameters, const f_array_length parameter_no_color, const f_array_length parameter_light, const f_array_length parameter_dark, f_string_lengths *remaining, fl_color_context *context);
 #endif // _di_fll_program_process_parameters_
 
 #ifdef __cplusplus
index b126d0018d1dede48daa5b14308a1cad1820a555..a330fa4067cc558ed6ee06475fddc3304fe7693b 100644 (file)
@@ -17,6 +17,7 @@ extern "C" {
 
     fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, "    Print this help message.");
     fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, "   Output using colors that show up better on light backgrounds.");
+    fll_program_print_help_option(data.context, f_console_standard_short_dark, f_console_standard_long_dark, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color.");
     fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number.");
 
@@ -55,48 +56,15 @@ extern "C" {
 
 #ifndef _di_firewall_main_
   f_return_status firewall_main(const f_s_int argc, const f_string argv[], firewall_data *data) {
-    f_status status = f_none;
-    f_status status2 = f_none;
-
-    status = fl_process_parameters(argc, argv, data->parameters, firewall_total_parameters, &data->remaining);
-
-    // load colors when not told to show no colors
-    if (data->parameters[firewall_parameter_no_color].result == f_console_result_none) {
-      fl_macro_color_context_new(status2, data->context);
-
-      if (status2 == f_none) {
-        fl_color_load_context(&data->context, data->parameters[firewall_parameter_light].result == f_console_result_found);
-      }
-      else {
-        fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
-        firewall_delete_data(data);
-        return status2;
-      }
-    }
+    f_status status = fll_program_process_parameters(argc, argv, data->parameters, firewall_total_parameters, firewall_parameter_no_color, firewall_parameter_light, firewall_parameter_dark, &data->remaining, &data->context);
 
     if (f_status_is_error(status)) {
-      status = f_status_set_fine(status);
-
-      if (status == f_no_data) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
-        // TODO: there is a way to identify which parameter is incorrect
-        //       to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0
-        //       nothing can be 0 as that represents the program name, unless argv[] is improperly created
-      }
-      else if (status == f_allocation_error || status == f_reallocation_error) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory");
-      }
-      else if (f_status_set_fine(status) == f_invalid_parameter) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters()");
-      }
-      else {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters()", f_status_set_error(status));
-      }
-
       firewall_delete_data(data);
       return f_status_set_error(status);
     }
 
+    status = f_none;
+
     // execute parameter results
     if (data->parameters[firewall_parameter_help].result == f_console_result_found) {
       firewall_print_help(*data);
@@ -567,6 +535,7 @@ extern "C" {
 
               status = firewall_buffer_rules(file_path.string, f_true, &local, data);
 
+              f_status status2 = f_none;
               f_macro_string_dynamic_delete(status2, file_path);
             }
 
@@ -628,6 +597,8 @@ extern "C" {
           status = firewall_create_custom_chains(&reserved, &local, data);
 
           if (f_status_is_error(status)) {
+            f_status status2 = f_none;
+
             firewall_macro_delete_fss_buffers(status2, local.buffer, local.chain_objects, local.chain_contents)
             firewall_delete_data(data);
             return status;
index e9d6cbab26196d231d251a8b73512ee7cdf39e7c..dff27085f1073b376ec9b7ab5e10c187152485ca 100644 (file)
@@ -204,6 +204,7 @@ extern "C" {
   enum {
     firewall_parameter_help,
     firewall_parameter_light,
+    firewall_parameter_dark,
     firewall_parameter_no_color,
     firewall_parameter_version,
 
@@ -240,6 +241,7 @@ extern "C" {
       { \
         f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
         f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+        f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, f_false, f_console_type_inverse), \
@@ -250,12 +252,13 @@ extern "C" {
         f_console_parameter_initialize(0, 0, firewall_command_show, f_false, f_console_type_other), \
       }
 
-    #define firewall_total_parameters 10
+    #define firewall_total_parameters 11
   #else
     #define f_console_parameter_initialize_firewall \
       { \
         f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
         f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+        f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(0, 0, firewall_command_start, f_false, f_console_type_other), \
@@ -265,7 +268,7 @@ extern "C" {
         f_console_parameter_initialize(0, 0, firewall_command_show, f_false, f_console_type_other), \
       }
 
-    #define firewall_total_parameters 9
+    #define firewall_total_parameters 10
   #endif // _en_firewall_debug_
 #endif // _di_firewall_defines_
 
index a5061bcbc369b2e8837aa4a522c0b347395958a1..143f0ec68f42cf09713dd12280c1ad23049ea992 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
 
     fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, "    Print this help message.");
     fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, "   Output using colors that show up better on light backgrounds.");
+    fll_program_print_help_option(data.context, f_console_standard_short_dark, f_console_standard_long_dark, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color.");
     fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number.");
 
@@ -32,48 +33,16 @@ extern "C" {
   f_return_status fss_basic_list_read_main_process_file(const f_array_length argc, const f_string argv[], fss_basic_list_read_data *data, const f_string filename, const f_string_length target) __attribute__((visibility ("internal")));
 
   f_return_status fss_basic_list_read_main(const f_array_length argc, const f_string argv[], fss_basic_list_read_data *data) {
-    f_status status = f_none;
-    f_status status2 = f_none;
-
-    status = fl_process_parameters(argc, argv, data->parameters, fss_basic_list_read_total_parameters, &data->remaining);
-
-    // load colors when not told to show no colors
-    if (data->parameters[fss_basic_list_read_parameter_no_color].result == f_console_result_none) {
-      fl_macro_color_context_new(status2, data->context);
-
-      if (f_status_is_error(status2)) {
-        fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
-        fss_basic_list_read_delete_data(data);
-        return status2;
-      }
-      else {
-        fl_color_load_context(&data->context, data->parameters[fss_basic_list_read_parameter_light].result == f_console_result_found);
-      }
-    }
+    f_status status = fll_program_process_parameters(argc, argv, data->parameters, fss_basic_list_read_total_parameters, fss_basic_list_read_parameter_no_color, fss_basic_list_read_parameter_light, fss_basic_list_read_parameter_dark, &data->remaining, &data->context);
 
     if (f_status_is_error(status)) {
-      status = f_status_set_fine(status);
-
-      if (status == f_no_data) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
-        // TODO: there is a way to identify which parameter is incorrect
-        //       to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0
-        //       nothing can be 0 as that represents the program name, unless argv[] is improperly created
-      }
-      else if (status == f_allocation_error || status == f_reallocation_error) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory");
-      }
-      else if (status == f_invalid_parameter) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters()");
-      }
-      else {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters()", f_status_set_error(status));
-      }
-
       fss_basic_list_read_delete_data(data);
       return f_status_set_error(status);
     }
 
+    f_status status2 = f_none;
+    status = f_none;
+
     // execute parameter results
     if (data->parameters[fss_basic_list_read_parameter_help].result == f_console_result_found) {
       fss_basic_list_read_print_help(*data);
index 85a58db6fdcb27c0d23549dbd5f63a046ca627dd..695bab14995b15721d7e54b471d2515b6a7036a2 100644 (file)
@@ -71,6 +71,7 @@ extern "C" {
   enum {
     fss_basic_list_read_parameter_help,
     fss_basic_list_read_parameter_light,
+    fss_basic_list_read_parameter_dark,
     fss_basic_list_read_parameter_no_color,
     fss_basic_list_read_parameter_version,
 
@@ -86,6 +87,7 @@ extern "C" {
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(fss_basic_list_read_short_name, fss_basic_list_read_long_name, 0, f_true, f_console_type_normal), \
@@ -96,7 +98,7 @@ extern "C" {
       f_console_parameter_initialize(fss_basic_list_read_short_line, fss_basic_list_read_long_line, 0, f_true, f_console_type_normal), \
     }
 
-  #define fss_basic_list_read_total_parameters 10
+  #define fss_basic_list_read_total_parameters 11
 #endif // _di_fss_basic_list_read_defines_
 
 #ifndef _di_fss_basic_list_read_data_
index 187d67c18255189811c2c5e352072ac7e6381ed8..dd841b7f77046f04dbbbbff0882b6f7791941ff7 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
 
     fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, "    Print this help message.");
     fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, "   Output using colors that show up better on light backgrounds.");
+    fll_program_print_help_option(data.context, f_console_standard_short_dark, f_console_standard_long_dark, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color.");
     fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number.");
 
@@ -27,48 +28,15 @@ extern "C" {
 
 #ifndef _di_fss_basic_list_write_main_
   f_return_status fss_basic_list_write_main(const f_array_length argc, const f_string argv[], fss_basic_list_write_data *data) {
-    f_status status = f_none;
-    f_status status2 = f_none;
-
-    status = fl_process_parameters(argc, argv, data->parameters, fss_basic_list_write_total_parameters, &data->remaining);
-
-    // load colors when not told to show no colors
-    if (data->parameters[fss_basic_list_write_parameter_no_color].result == f_console_result_none) {
-      fl_macro_color_context_new(status2, data->context);
-
-      if (f_status_is_error(status2)) {
-        fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
-        fss_basic_list_write_delete_data(data);
-        return status2;
-      }
-      else {
-        fl_color_load_context(&data->context, data->parameters[fss_basic_list_write_parameter_light].result == f_console_result_found);
-      }
-    }
+    f_status status = fll_program_process_parameters(argc, argv, data->parameters, fss_basic_list_write_total_parameters, fss_basic_list_write_parameter_no_color, fss_basic_list_write_parameter_light, fss_basic_list_write_parameter_dark, &data->remaining, &data->context);
 
     if (f_status_is_error(status)) {
-      status = f_status_set_fine(status);
-
-      if (status == f_no_data) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
-        // TODO: there is a way to identify which parameter is incorrect
-        //       to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0
-        //       nothing can be 0 as that represents the program name, unless argv[] is improperly created
-      }
-      else if (status == f_allocation_error || status == f_reallocation_error) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory.");
-      }
-      else if (status == f_invalid_parameter) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters().");
-      }
-      else {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters().", f_status_set_error(status));
-      }
-
       fss_basic_list_write_delete_data(data);
       return f_status_set_error(status);
     }
 
+    status = f_none;
+
     // execute parameter results
     if (data->parameters[fss_basic_list_write_parameter_help].result == f_console_result_found) {
       fss_basic_list_write_print_help(*data);
@@ -110,6 +78,8 @@ extern "C" {
             fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", f_status_set_error(status));
           }
 
+          f_status status2 = f_none;
+
           f_macro_string_dynamic_delete(status2, input);
           fss_basic_list_write_delete_data(data);
           return f_status_set_error(status);
index ea44cd1d29eda435922935d25557b54a88f295f6..472791b122ca6e12321366d2b1d4c8b5d247d777 100644 (file)
@@ -61,6 +61,7 @@ extern "C" {
   enum {
     fss_basic_list_write_parameter_help,
     fss_basic_list_write_parameter_light,
+    fss_basic_list_write_parameter_dark,
     fss_basic_list_write_parameter_no_color,
     fss_basic_list_write_parameter_version,
 
@@ -73,6 +74,7 @@ extern "C" {
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(fss_basic_list_write_short_object, fss_basic_list_write_long_object, 0, f_false, f_console_type_normal), \
@@ -80,7 +82,7 @@ extern "C" {
       f_console_parameter_initialize(fss_basic_list_write_short_string, fss_basic_list_write_long_string, 0, f_true, f_console_type_normal), \
     }
 
-  #define fss_basic_list_write_total_parameters 7
+  #define fss_basic_list_write_total_parameters 8
 #endif // _di_fss_basic_list_write_defines_
 
 #ifndef _di_fss_basic_list_write_data_
index 5c2390374eb018d6bc8a17d161469b0dfd5f4592..07236589dd3e7ad508bea488ac1ed1395d9873f6 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
 
     fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, "    Print this help message.");
     fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, "   Output using colors that show up better on light backgrounds.");
+    fll_program_print_help_option(data.context, f_console_standard_short_dark, f_console_standard_long_dark, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color.");
     fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number.");
 
@@ -30,48 +31,16 @@ extern "C" {
   f_return_status fss_basic_read_main_process_file(const f_array_length argc, const f_string argv[], fss_basic_read_data *data, const f_string filename, const f_string_length target) f_gcc_attribute_visibility_internal;
 
   f_return_status fss_basic_read_main(const f_array_length argc, const f_string argv[], fss_basic_read_data *data) {
-    f_status status = f_none;
-    f_status status2 = f_none;
-
-    status = fl_process_parameters(argc, argv, data->parameters, fss_basic_read_total_parameters, &data->remaining);
-
-    // load colors when not told to show no colors
-    if (data->parameters[fss_basic_read_parameter_no_color].result == f_console_result_none) {
-      fl_macro_color_context_new(status2, data->context);
-
-      if (f_status_is_error(status2)) {
-        fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
-        fss_basic_read_delete_data(data);
-        return status2;
-      }
-      else {
-        fl_color_load_context(&data->context, data->parameters[fss_basic_read_parameter_light].result == f_console_result_found);
-      }
-    }
+    f_status status = fll_program_process_parameters(argc, argv, data->parameters, fss_basic_read_total_parameters, fss_basic_read_parameter_no_color, fss_basic_read_parameter_light, fss_basic_read_parameter_dark, &data->remaining, &data->context);
 
     if (f_status_is_error(status)) {
-      status = f_status_set_fine(status);
-
-      if (status == f_no_data) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
-        // TODO: there is a way to identify which parameter is incorrect
-        //       to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0
-        //       nothing can be 0 as that represents the program name, unless argv[] is improperly created
-      }
-      else if (status == f_allocation_error || status == f_reallocation_error) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory");
-      }
-      else if (status == f_invalid_parameter) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters()");
-      }
-      else {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters()", f_status_set_error(status));
-      }
-
       fss_basic_read_delete_data(data);
       return f_status_set_error(status);
     }
 
+    f_status status2 = f_none;
+    status = f_none;
+
     // execute parameter results
     if (data->parameters[fss_basic_read_parameter_help].result == f_console_result_found) {
       fss_basic_read_print_help(*data);
index 6ff2da9937c55a1f0dadfbf74d3f1c2ad9db01a9..e176f1ee87cc21dbf2ebe5030e00f165bffc559d 100644 (file)
@@ -67,6 +67,7 @@ extern "C" {
   enum {
     fss_basic_read_parameter_help,
     fss_basic_read_parameter_light,
+    fss_basic_read_parameter_dark,
     fss_basic_read_parameter_no_color,
     fss_basic_read_parameter_version,
 
@@ -80,6 +81,7 @@ extern "C" {
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(fss_basic_read_short_name, fss_basic_read_long_name, 0, f_true, f_console_type_normal), \
@@ -88,7 +90,7 @@ extern "C" {
       f_console_parameter_initialize(fss_basic_read_short_object, fss_basic_read_long_object, 0, f_false, f_console_type_normal), \
     }
 
-  #define fss_basic_read_total_parameters 8
+  #define fss_basic_read_total_parameters 9
 #endif // _di_fss_basic_read_defines_
 
 #ifndef _di_fss_basic_read_data_
index 03ede7fb20b8f4359fc58efedd36ae742b91dad0..ec4510830a049b08d9b9b9cdc56ac609b7dfffd3 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
 
     fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, "    Print this help message.");
     fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, "   Output using colors that show up better on light backgrounds.");
+    fll_program_print_help_option(data.context, f_console_standard_short_dark, f_console_standard_long_dark, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color.");
     fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number.");
 
@@ -27,48 +28,15 @@ extern "C" {
 
 #ifndef _di_fss_basic_write_main_
   f_return_status fss_basic_write_main(const f_array_length argc, const f_string argv[], fss_basic_write_data *data) {
-    f_status status = f_none;
-    f_status status2 = f_none;
-
-    status = fl_process_parameters(argc, argv, data->parameters, fss_basic_write_total_parameters, &data->remaining);
-
-    // load colors when not told to show no colors
-    if (data->parameters[fss_basic_write_parameter_no_color].result == f_console_result_none) {
-      fl_macro_color_context_new(status2, data->context);
-
-      if (f_status_is_error(status2)) {
-        fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
-        fss_basic_write_delete_data(data);
-        return status2;
-      }
-      else {
-        fl_color_load_context(&data->context, data->parameters[fss_basic_write_parameter_light].result == f_console_result_found);
-      }
-    }
+    f_status status = fll_program_process_parameters(argc, argv, data->parameters, fss_basic_write_total_parameters, fss_basic_write_parameter_no_color, fss_basic_write_parameter_light, fss_basic_write_parameter_dark, &data->remaining, &data->context);
 
     if (f_status_is_error(status)) {
-      status = f_status_set_fine(status);
-
-      if (status == f_no_data) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
-        // TODO: there is a way to identify which parameter is incorrect
-        //       to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0
-        //       nothing can be 0 as that represents the program name, unless argv[] is improperly created
-      }
-      else if (status == f_allocation_error || status == f_reallocation_error) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory.");
-      }
-      else if (status == f_invalid_parameter) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters().");
-      }
-      else {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters().", f_status_set_error(status));
-      }
-
       fss_basic_write_delete_data(data);
       return f_status_set_error(status);
     }
 
+    status = f_none;
+
     // execute parameter results
     if (data->parameters[fss_basic_write_parameter_help].result == f_console_result_found) {
       fss_basic_write_print_help(*data);
@@ -110,6 +78,8 @@ extern "C" {
             fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", f_status_set_error(status));
           }
 
+          f_status status2 = f_none;
+
           f_macro_string_dynamic_delete(status2, input);
           fss_basic_write_delete_data(data);
           return f_status_set_error(status);
index 2980d519094babae49118c04f4693996fffa1bad..9a46e68b13b12fc59f50cbbd039028799c27f200 100644 (file)
@@ -60,6 +60,7 @@ extern "C" {
   enum {
     fss_basic_write_parameter_help,
     fss_basic_write_parameter_light,
+    fss_basic_write_parameter_dark,
     fss_basic_write_parameter_no_color,
     fss_basic_write_parameter_version,
 
@@ -72,6 +73,7 @@ extern "C" {
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(fss_basic_write_short_object, fss_basic_write_long_object, 0, f_false, f_console_type_normal), \
@@ -79,7 +81,7 @@ extern "C" {
       f_console_parameter_initialize(fss_basic_write_short_string, fss_basic_write_long_string, 0, f_true, f_console_type_normal), \
     }
 
-  #define fss_basic_write_total_parameters 7
+  #define fss_basic_write_total_parameters 8
 #endif // _di_fss_basic_write_defines_
 
 #ifndef _di_fss_basic_write_data_
index 9bf5b168ff139c539e0c8aa9d4f292ed677dab6d..17ca4027ae034f55d4e77977aafc013bbbf639fb 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
 
     fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, "    Print this help message.");
     fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, "   Output using colors that show up better on light backgrounds.");
+    fll_program_print_help_option(data.context, f_console_standard_short_dark, f_console_standard_long_dark, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color.");
     fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number.");
 
@@ -31,48 +32,16 @@ extern "C" {
   f_return_status fss_extended_read_main_process_file(const f_array_length argc, const f_string argv[], fss_extended_read_data *data, const f_string filename, const f_string_length target, const f_string_length select) f_gcc_attribute_visibility_internal;
 
   f_return_status fss_extended_read_main(const f_array_length argc, const f_string argv[], fss_extended_read_data *data) {
-    f_status status = f_none;
-    f_status status2 = f_none;
-
-    status = fl_process_parameters(argc, argv, data->parameters, fss_extended_read_total_parameters, &data->remaining);
-
-    // load colors when not told to show no colors
-    if (data->parameters[fss_extended_read_parameter_no_color].result == f_console_result_none) {
-      fl_macro_color_context_new(status2, data->context);
-
-      if (f_status_is_error(status2)) {
-        fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
-        fss_extended_read_delete_data(data);
-        return status2;
-      }
-      else {
-        fl_color_load_context(&data->context, data->parameters[fss_extended_read_parameter_light].result == f_console_result_found);
-      }
-    }
+    f_status status = fll_program_process_parameters(argc, argv, data->parameters, fss_extended_read_total_parameters, fss_extended_read_parameter_no_color, fss_extended_read_parameter_light, fss_extended_read_parameter_dark, &data->remaining, &data->context);
 
     if (f_status_is_error(status)) {
-      status = f_status_set_fine(status);
-
-      if (status == f_no_data) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
-        // TODO: there is a way to identify which parameter is incorrect
-        //       to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0
-        //       nothing can be 0 as that represents the program name, unless argv[] is improperly created
-      }
-      else if (status == f_allocation_error || status == f_reallocation_error) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory");
-      }
-      else if (status == f_invalid_parameter) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters()");
-      }
-      else {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters()", f_status_set_error(status));
-      }
-
       fss_extended_read_delete_data(data);
       return f_status_set_error(status);
     }
 
+    f_status status2 = f_none;
+    status = f_none;
+
     // execute parameter results
     if (data->parameters[fss_extended_read_parameter_help].result == f_console_result_found) {
       fss_extended_read_print_help(*data);
index 4ac79106d9502a9302ca9cd7c87cc17ec4a207dc..71382773a5657b8da0368f5a2295eb7b21fadcbd 100644 (file)
@@ -69,6 +69,7 @@ extern "C" {
   enum {
     fss_extended_read_parameter_help,
     fss_extended_read_parameter_light,
+    fss_extended_read_parameter_dark,
     fss_extended_read_parameter_no_color,
     fss_extended_read_parameter_version,
 
@@ -83,6 +84,7 @@ extern "C" {
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(fss_extended_read_short_name, fss_extended_read_long_name, 0, f_true, f_console_type_normal), \
@@ -92,7 +94,7 @@ extern "C" {
       f_console_parameter_initialize(fss_extended_read_short_select, fss_extended_read_long_select, 0, f_true, f_console_type_normal), \
     }
 
-  #define fss_extended_read_total_parameters 9
+  #define fss_extended_read_total_parameters 10
 #endif // _di_fss_extended_read_defines_
 
 #ifndef _di_fss_extended_read_data_
index 2b67fb6107096ac524cf987af3548671d590eb8b..db587bce0d5de1ccc02afa3685058caa10cedb90 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
 
     fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, "    Print this help message.");
     fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, "   Output using colors that show up better on light backgrounds.");
+    fll_program_print_help_option(data.context, f_console_standard_short_dark, f_console_standard_long_dark, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color.");
     fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number.");
 
@@ -28,25 +29,15 @@ extern "C" {
 
 #ifndef _di_fss_extended_write_main_
   f_return_status fss_extended_write_main(const f_array_length argc, const f_string argv[], fss_extended_write_data *data) {
-    f_status status = f_none;
-    f_status status2 = f_none;
-
-    status = fl_process_parameters(argc, argv, data->parameters, fss_extended_write_total_parameters, &data->remaining);
-
-    // load colors when not told to show no colors
-    if (data->parameters[fss_extended_write_parameter_no_color].result == f_console_result_none) {
-      fl_macro_color_context_new(status2, data->context);
+    f_status status = fll_program_process_parameters(argc, argv, data->parameters, fss_extended_write_total_parameters, fss_extended_write_parameter_no_color, fss_extended_write_parameter_light, fss_extended_write_parameter_dark, &data->remaining, &data->context);
 
-      if (f_status_is_error(status2)) {
-        fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
-        fss_extended_write_delete_data(data);
-        return status2;
-      }
-      else {
-        fl_color_load_context(&data->context, data->parameters[fss_extended_write_parameter_light].result == f_console_result_found);
-      }
+    if (f_status_is_error(status)) {
+      fss_extended_write_delete_data(data);
+      return f_status_set_error(status);
     }
 
+    status = f_none;
+
     if (f_status_is_error(status)) {
       status = f_status_set_fine(status);
 
@@ -111,6 +102,8 @@ extern "C" {
             fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", f_status_set_error(status));
           }
 
+          f_status status2 = f_none;
+
           f_macro_string_dynamic_delete(status2, input);
           fss_extended_write_delete_data(data);
           return f_status_set_error(status);
index a4867e855b7592514411b935c29afc34775a416b..2988f7d9afbd3e522ef075cb95773120a2241e46 100644 (file)
@@ -63,6 +63,7 @@ extern "C" {
   enum {
     fss_extended_write_parameter_help,
     fss_extended_write_parameter_light,
+    fss_extended_write_parameter_dark,
     fss_extended_write_parameter_no_color,
     fss_extended_write_parameter_version,
 
@@ -76,6 +77,7 @@ extern "C" {
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(fss_extended_write_short_object, fss_extended_write_long_object, 0, f_false, f_console_type_normal), \
@@ -84,7 +86,7 @@ extern "C" {
       f_console_parameter_initialize(fss_extended_write_short_partial, fss_extended_write_long_partial, 0, f_false, f_console_type_normal), \
     }
 
-  #define fss_extended_write_total_parameters 8
+  #define fss_extended_write_total_parameters 9
 #endif // _di_fss_extended_write_defines_
 
 #ifndef _di_fss_extended_write_data_
index 273fd1e51a981f8c11b5063aa41325c178dce952..2fc410ce3d7568df02a1a179597f7a57122a652b 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
 
     fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, "    Print this help message.");
     fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, "   Output using colors that show up better on light backgrounds.");
+    fll_program_print_help_option(data.context, f_console_standard_short_dark, f_console_standard_long_dark, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color.");
     fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number.");
 
@@ -28,47 +29,15 @@ extern "C" {
 
 #ifndef _di_fss_status_code_main_
   f_return_status fss_status_code_main(const f_array_length argc, const f_string argv[], fss_status_code_data *data) {
-    f_status status = f_none;
-    f_status allocation_status = f_none;
-
-    status = fl_process_parameters(argc, argv, data->parameters, fss_status_code_total_parameters, &data->remaining);
-
-    // load colors when not told to show no colors
-    if (data->parameters[fss_status_code_parameter_no_color].result == f_console_result_none) {
-      fl_macro_color_context_new(allocation_status, data->context);
-
-      if (f_status_is_error(allocation_status)) {
-        fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
-        fss_status_code_delete_data(data);
-        return allocation_status;
-      }
-
-      fl_color_load_context(&data->context, data->parameters[fss_status_code_parameter_light].result == f_console_result_found);
-    }
+    f_status status = fll_program_process_parameters(argc, argv, data->parameters, fss_status_code_total_parameters, fss_status_code_parameter_no_color, fss_status_code_parameter_light, fss_status_code_parameter_dark, &data->remaining, &data->context);
 
     if (f_status_is_error(status)) {
-      status = f_status_set_fine(status);
-
-      if (status == f_no_data) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
-        // TODO: there is a way to identify which parameter is incorrect
-        //       to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0
-        //       nothing can be 0 as that represents the program name, unless argv[] is improperly created
-      }
-      else if (status == f_allocation_error || status == f_reallocation_error) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory.");
-      }
-      else if (status == f_invalid_parameter) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters().");
-      }
-      else {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters().", status);
-      }
-
       fss_status_code_delete_data(data);
       return f_status_set_error(status);
     }
 
+    status = f_none;
+
     // execute parameter results
     if (data->parameters[fss_status_code_parameter_help].result == f_console_result_found) {
       fss_status_code_print_help(*data);
index 4f940f20e0c40030e939f131cebcc08d3d390cf1..3388f0829a8e6a4d390444aa536535864c056ca8 100644 (file)
@@ -63,6 +63,7 @@ extern "C" {
   enum {
     fss_status_code_parameter_help,
     fss_status_code_parameter_light,
+    fss_status_code_parameter_dark,
     fss_status_code_parameter_no_color,
     fss_status_code_parameter_version,
 
@@ -76,6 +77,7 @@ extern "C" {
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(fss_status_code_short_is_fine, fss_status_code_long_is_fine, 0, f_false, f_console_type_normal), \
@@ -84,7 +86,7 @@ extern "C" {
       f_console_parameter_initialize(fss_status_code_short_number, fss_status_code_long_number, 0, f_false, f_console_type_normal), \
     }
 
-  #define fss_status_code_total_parameters 8
+  #define fss_status_code_total_parameters 9
 #endif // _di_fss_status_code_defines_
 
 #ifndef _di_fss_status_code_data_
index 1779e148ed47150e73cf6c53618a0361571b1c22..c9f40025ecf1c1ec36ee6fd31593803642f3c72c 100644 (file)
@@ -26,6 +26,7 @@ extern "C" {
 
     fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, "    Print this help message.");
     fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, "   Output using colors that show up better on light backgrounds.");
+    fll_program_print_help_option(data.context, f_console_standard_short_dark, f_console_standard_long_dark, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color.");
     fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number.");
     fll_program_print_help_option(data.context, f_console_standard_short_debug, f_console_standard_long_debug, " Enable debugging.");
@@ -44,7 +45,6 @@ extern "C" {
 #ifndef _di_init_main_
   f_return_status init_main(const f_s_int argc, const f_string argv[], init_argument *argument) {
     f_status status  = f_none;
-    f_status status2 = f_none;
     f_autochar run_level[init_kernel_runlevel_buffer];
 
     memset(run_level, 0, sizeof(f_autochar) * init_kernel_runlevel_buffer);
@@ -52,41 +52,15 @@ extern "C" {
     f_u_short do_socket_file = f_true;
     f_u_short do_socket_port = f_false;
 
-    status = fl_process_parameters(argc, argv, argument->parameters, init_total_parameters, &argument->remaining);
-
-    // load colors when not told to show no colors
-    if (argument->parameters[init_parameter_no_color].result == f_console_result_none) {
-      fl_macro_color_context_new(status2, argument->context);
-
-      if (status2 == f_none) {
-        fl_color_load_context(&argument->context, argument->parameters[init_parameter_light].result == f_console_result_found);
-      } else {
-        fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
-        init_delete_argument((*argument));
-        return status2;
-      }
-    }
+    status = fll_program_process_parameters(argc, argv, data->parameters, init_total_parameters, init_parameter_no_color, init_parameter_light, init_parameter_dark, &data->remaining, &data->context);
 
     if (f_status_is_error(status)) {
-      status = f_status_set_fine(status);
-
-      if (status == f_no_data) {
-        fl_color_print_line(f_standard_error, argument->context.error, argument->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
-        // TODO: there is a way to identify which parameter is incorrect
-        //       to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0
-        //       nothing can be 0 as that represents the program name, unless argv[] is improperly created
-      } else if (status == f_allocation_error || status == f_reallocation_error) {
-        fl_color_print_line(f_standard_error, argument->context.error, argument->context.reset, "CRITICAL ERROR: unable to allocate memory");
-      } else if (f_status_set_fine(status) == f_invalid_parameter) {
-        fl_color_print_line(f_standard_error, argument->context.error, argument->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters()");
-      } else {
-        fl_color_print_line(f_standard_error, argument->context.error, argument->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters()", f_status_set_error(status));
-      }
-
-      init_delete_argument((*argument));
+      init_delete_data(data);
       return f_status_set_error(status);
     }
 
+    status = f_none;
+
 
     if (argument->parameters[init_parameter_runlevel].result == f_console_result_found) {
       const f_u_int parameter_length = strlen(argv[argument->parameters[init_parameter_runlevel].additional.array[0]]);
index 0c2d4fcfbb74791f2b1621da0fede1a0e9cc6b2e..a1365d72b2e139f7da2ce93c74cd41e2d548d42a 100644 (file)
@@ -151,9 +151,14 @@ extern "C" {
   enum {
     init_parameter_help,
     init_parameter_light,
+    init_parameter_dark,
     init_parameter_no_color,
     init_parameter_version,
-    init_parameter_debug,
+
+    #ifdef _en_init_debug_
+      init_parameter_debug,
+    #endif // _en_init_debug_
+
     init_parameter_runlevel,
     init_parameter_no_prepare,
   };
@@ -163,6 +168,7 @@ extern "C" {
       { \
         f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
         f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+        f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, f_false, f_console_type_inverse), \
@@ -170,19 +176,20 @@ extern "C" {
         f_console_parameter_initialize(init_parameter_no_prepare_short_name, init_parameter_no_prepare_long_name, 0, f_true, f_console_type_normal), \
       }
 
-    #define init_total_parameters 7
+    #define init_total_parameters 8
   #else
     #define f_console_parameter_initialize_init \
       { \
         f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
         f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+        f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
         f_console_parameter_initialize(init_parameter_runlevel_short_name, init_parameter_runlevel_long_name, 0, f_true, f_console_type_normal), \
         f_console_parameter_initialize(init_parameter_no_prepare_short_name, init_parameter_no_prepare_long_name, 0, f_true, f_console_type_normal), \
       }
 
-    #define init_total_parameters 6
+    #define init_total_parameters 7
   #endif // _en_init_debug_
 #endif // _di_init_defines_
 
index 2d49edc582eafb889bf224249edac77c122fb8aa..2a4946ab66dbdd2e3b9c6a062e597f17cd97cf8b 100644 (file)
     f_string_location location = f_string_location_initialize;
     f_fss_objects objects = f_fss_objects_initialize;
     f_fss_contents contents = f_fss_contents_initialize;
-    f_string_length position = f_string_length_initialize;
+    f_string_length position = 0;
 
     // load the main file into memory.
     status = init_rule_buffer(init_rule_core_file, &buffer, &objects, &contents);
index 9a64cb59458dc51758bec35708b6e8ae0202cdd4..5e8e5bb66066c235c36f194b6513364c0691a25a 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
 
     fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, "    Print this help message.");
     fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, "   Output using colors that show up better on light backgrounds.");
+    fll_program_print_help_option(data.context, f_console_standard_short_dark, f_console_standard_long_dark, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color.");
     fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number.");
 
@@ -28,47 +29,15 @@ extern "C" {
 
 #ifndef _di_status_code_main_
   f_return_status status_code_main(const f_array_length argc, const f_string argv[], status_code_data *data) {
-    f_status status = f_none;
-    f_status allocation_status = f_none;
-
-    status = fl_process_parameters(argc, argv, data->parameters, status_code_total_parameters, &data->remaining);
-
-    // load colors when not told to show no colors
-    if (data->parameters[status_code_parameter_no_color].result == f_console_result_none) {
-      fl_macro_color_context_new(allocation_status, data->context);
-
-      if (f_status_is_error(allocation_status)) {
-        fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
-        status_code_delete_data(data);
-        return allocation_status;
-      }
-
-      fl_color_load_context(&data->context, data->parameters[status_code_parameter_light].result == f_console_result_found);
-    }
+    f_status status = fll_program_process_parameters(argc, argv, data->parameters, status_code_total_parameters, status_code_parameter_no_color, status_code_parameter_light, status_code_parameter_dark, &data->remaining, &data->context);
 
     if (f_status_is_error(status)) {
-      status = f_status_set_fine(status);
-
-      if (status == f_no_data) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
-        // TODO: there is a way to identify which parameter is incorrect
-        //       to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0
-        //       nothing can be 0 as that represents the program name, unless argv[] is improperly created
-      }
-      else if (status == f_allocation_error || status == f_reallocation_error) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory.");
-      }
-      else if (status == f_invalid_parameter) {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters().");
-      }
-      else {
-        fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters().", status);
-      }
-
       status_code_delete_data(data);
       return f_status_set_error(status);
     }
 
+    status = f_none;
+
     // execute parameter results
     if (data->parameters[status_code_parameter_help].result == f_console_result_found) {
       status_code_print_help(*data);
index 55245445e208d39af930bec7a2b6e49ee49f45cb..2e4145a2c01f6017bdf8dae7e8073b47f2391baf 100644 (file)
@@ -60,6 +60,7 @@ extern "C" {
   enum {
     status_code_parameter_help,
     status_code_parameter_light,
+    status_code_parameter_dark,
     status_code_parameter_no_color,
     status_code_parameter_version,
 
@@ -73,6 +74,7 @@ extern "C" {
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, f_false, f_console_type_normal), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, f_false, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, f_false, f_console_type_inverse), \
       f_console_parameter_initialize(status_code_short_is_fine, status_code_long_is_fine, 0, f_false, f_console_type_normal), \
@@ -81,7 +83,7 @@ extern "C" {
       f_console_parameter_initialize(status_code_short_number, status_code_long_number, 0, f_false, f_console_type_normal), \
     }
 
-  #define status_code_total_parameters 8
+  #define status_code_total_parameters 9
 #endif // _di_status_code_defines_
 
 #ifndef _di_status_code_data_