]> Kevux Git Server - fll/commitdiff
Progress: FSS read and write programs.
authorKevin Day <thekevinday@gmail.com>
Thu, 15 Oct 2020 02:44:20 +0000 (21:44 -0500)
committerKevin Day <thekevinday@gmail.com>
Thu, 15 Oct 2020 04:16:45 +0000 (23:16 -0500)
Use \b (backspace character) instead of \0 (NULL character).
- The bash programs and functions like "echo" automatically strip NULL characters.
- This defeats the purpose of providing these functions for manipulating FSS files using these programs.

Add an ignore range list.
- The pipes represent the start and stop of an ignore range using the \v (vertical tab character).
- Only the FSS-0003 (Extended List) utilize the ignore range.
- This ignore range list provides a simple way to manage nested lists without having to write complex recursive parsers.
- For consistency, all FSS write programs utilize the -I/--ignore parameter, but for the standards that do not support ignore range lists then that parameter is essentially ignored.
- The ignore lists only applies to Content.

Fix bug in the fll_error where the wrong variable is being used (should be printing a newline).

22 files changed:
level_1/fl_fss/c/fss_extended_list.c
level_2/fll_error/c/error.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_list_write/c/private-fss_basic_list_write.c
level_3/fss_basic_list_write/c/private-fss_basic_list_write.h
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_basic_write/c/private-fss_basic_write.c
level_3/fss_basic_write/c/private-fss_basic_write.h
level_3/fss_extended_list_read/c/fss_extended_list_read.h
level_3/fss_extended_list_write/c/fss_extended_list_write.c
level_3/fss_extended_list_write/c/fss_extended_list_write.h
level_3/fss_extended_list_write/c/private-fss_extended_list_write.c
level_3/fss_extended_list_write/c/private-fss_extended_list_write.h
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_extended_write/c/private-fss_extended_write.c
level_3/fss_extended_write/c/private-fss_extended_write.h

index b8cfeadef529f39669065e0624af03a8f0c95a66..a2d079889078f4d1dc5e3cfbba84765fb67772f4 100644 (file)
@@ -1133,11 +1133,13 @@ extern "C" {
         if (F_status_is_error(status)) break;
 
         if (content.string[range->start] == f_fss_eol || range->start >= content.used || range->start > range->stop) {
+
           if (content.string[range->start] == f_fss_eol) {
             do_prepend = F_true;
           }
 
           if (ignore && ignore->used) {
+
             for (r = 0; r < ignore->used; r++) {
               if (start >= ignore->array[r].start && start <= ignore->array[r].stop) break;
             } // for
index 0580bef32cf31c8783c8325f4d74e4db4cf1b1b6..fd426fd5d8ca37072ec891abfbf07666d209503f 100644 (file)
@@ -261,7 +261,7 @@ extern "C" {
 
     if (status == F_number) {
       if (error.verbosity != f_console_verbosity_quiet) {
-        fprintf(error.to.stream, "%c", argument[0]);
+        fprintf(error.to.stream, "%c", f_string_eol[0]);
         fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? error.prefix : "");
         fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string);
         fprintf(error.to.stream, "%s' is not a valid number for the parameter '", error.context.before->string);
@@ -274,7 +274,7 @@ extern "C" {
 
     if (status == F_number_negative) {
       if (error.verbosity != f_console_verbosity_quiet) {
-        fprintf(error.to.stream, "%c", argument[0]);
+        fprintf(error.to.stream, "%c", f_string_eol[0]);
         fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? error.prefix : "");
         fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string);
         fprintf(error.to.stream, "%s' is negative, which is not allowed for the parameter '", error.context.before->string);
@@ -287,7 +287,7 @@ extern "C" {
 
     if (status == F_number_overflow) {
       if (error.verbosity != f_console_verbosity_quiet) {
-        fprintf(error.to.stream, "%c", argument[0]);
+        fprintf(error.to.stream, "%c", f_string_eol[0]);
         fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? error.prefix : "");
         fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string);
         fprintf(error.to.stream, "%s' is too large for the parameter '", error.context.before->string);
@@ -300,7 +300,7 @@ extern "C" {
 
     if (status == F_number_positive) {
       if (error.verbosity != f_console_verbosity_quiet) {
-        fprintf(error.to.stream, "%c", argument[0]);
+        fprintf(error.to.stream, "%c", f_string_eol[0]);
         fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? error.prefix : "");
         fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string);
         fprintf(error.to.stream, "%s' is positive, which is not allowed for the parameter '", error.context.before->string);
@@ -313,7 +313,7 @@ extern "C" {
 
     if (status == F_number_underflow) {
       if (error.verbosity != f_console_verbosity_quiet) {
-        fprintf(error.to.stream, "%c", argument[0]);
+        fprintf(error.to.stream, "%c", f_string_eol[0]);
         fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? error.prefix : "");
         fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string);
         fprintf(error.to.stream, "%s' is too small for the parameter '", error.context.before->string);
index c284d4d8dd080d8e524fc957a8a46d1fb63983a8..1c6028d94a8eeacd28dccd01c0a3903df3b6271b 100644 (file)
@@ -62,8 +62,9 @@ extern "C" {
 #endif // _di_fss_basic_list_read_name_
 
 #ifndef _di_fss_basic_list_read_defines_
-  #define fss_basic_list_read_pipe_content_start '\0'
-  #define fss_basic_list_read_pipe_content_end   '\f'
+  #define fss_basic_list_read_pipe_content_end    '\f'
+  #define fss_basic_list_read_pipe_content_ignore '\v'
+  #define fss_basic_list_read_pipe_content_start  '\b'
 
   #define fss_basic_list_read_short_at      "a"
   #define fss_basic_list_read_short_content "c"
index e407450d9b615099c46b30e0c6cef535a921de8a..df8c058c83fe90bee4d945680685d571a31cc1f9 100644 (file)
@@ -25,6 +25,7 @@ extern "C" {
     fll_program_print_help_option(file, context, fss_basic_list_write_short_file, fss_basic_list_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, "   Specify a file to send output to.");
     fll_program_print_help_option(file, context, fss_basic_list_write_short_content, fss_basic_list_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, "The Content to output.");
     fll_program_print_help_option(file, context, fss_basic_list_write_short_double, fss_basic_list_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default).");
+    fll_program_print_help_option(file, context, fss_basic_list_write_short_ignore, fss_basic_list_write_long_ignore, f_console_symbol_short_enable, f_console_symbol_long_enable, " Ignore a given range within a content.");
     fll_program_print_help_option(file, context, fss_basic_list_write_short_object, fss_basic_list_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The Object to output.");
     fll_program_print_help_option(file, context, fss_basic_list_write_short_partial, fss_basic_list_write_long_partial, f_console_symbol_short_enable, f_console_symbol_long_enable, "Do not output end of Object/Content character.");
     fll_program_print_help_option(file, context, fss_basic_list_write_short_prepend, fss_basic_list_write_long_prepend, f_console_symbol_short_enable, f_console_symbol_long_enable, "Prepend the given whitespace characters to the start of each multi-line Content.");
@@ -33,24 +34,34 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_basic_list_write_name, "");
 
-    printf("  The pipe uses the NULL character '");
-    fl_color_print(f_type_output, context.set.notable, "\\0");
+    printf("  The pipe uses the Backspace character '");
+    fl_color_print(f_type_output, context.set.notable, "\\b");
     printf("' (");
-    fl_color_print(f_type_output, context.set.notable, "U+0000");
-    printf(") to designate the start of a Content and uses the Form Feed character '");
+    fl_color_print(f_type_output, context.set.notable, "U+0008");
+    printf(") to designate the start of a Content.%c", f_string_eol[0]);
+
+    printf("  The pipe uses the Form Feed character '");
     fl_color_print(f_type_output, context.set.notable, "\\f");
     printf("' (");
     fl_color_print(f_type_output, context.set.notable, "U+000C");
     printf(") to designate the end of the last Content.%c", f_string_eol[0]);
-    printf("  For the pipe, an Object is terminated by either a NULL character '");
-    fl_color_print(f_type_output, context.set.notable, "\\0");
+
+    printf("  The pipe uses the Vertical Line character '");
+    fl_color_print(f_type_output, context.set.notable, "\\v");
+    printf("' (");
+    fl_color_print(f_type_output, context.set.notable, "U+000B");
+    printf(") is used to ignore a content range, which does nothing in this program.%c", f_string_eol[0]);
+
+    printf("  For the pipe, an Object is terminated by either a Backspace character '");
+    fl_color_print(f_type_output, context.set.notable, "\\b");
     printf("' (");
-    fl_color_print(f_type_output, context.set.notable, "U+0000");
+    fl_color_print(f_type_output, context.set.notable, "U+0008");
     printf(") or a Form Feed character '");
     fl_color_print(f_type_output, context.set.notable, "\\f");
     printf("' (");
     fl_color_print(f_type_output, context.set.notable, "U+000C");
     printf(").%c", f_string_eol[0]);
+
     printf("  The end of the pipe represents the end of any Object or Content.%c", f_string_eol[0]);
 
     printf("%c", f_string_eol[0]);
@@ -63,6 +74,13 @@ extern "C" {
 
     printf("%c", f_string_eol[0]);
 
+    printf("  This program does not use the parameter '");
+    fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_write_long_ignore);
+    printf("', which therefore does nothing.%c", f_string_eol[0]);
+    printf("  This parameter requires two values.%c", f_string_eol[0]);
+
+    printf("%c", f_string_eol[0]);
+
     return F_none;
   }
 #endif // _di_fss_basic_list_write_print_help_
@@ -322,6 +340,32 @@ extern "C" {
       }
     }
 
+    if (F_status_is_error_not(status)) {
+      if (data->parameters[fss_basic_list_write_parameter_ignore].result == f_console_result_found) {
+        if (data->error.verbosity != f_console_verbosity_quiet) {
+          fprintf(data->error.to.stream, "%c", f_string_eol[0]);
+          fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
+          fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_write_long_ignore);
+          fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no values were given.%c", f_string_eol[0]);
+        }
+
+        status = F_status_set_error(F_parameter);
+      }
+      else if (data->parameters[fss_basic_list_write_parameter_ignore].result == f_console_result_additional) {
+        const f_array_length_t total_locations = data->parameters[fss_basic_list_write_parameter_ignore].locations.used;
+        const f_array_length_t total_arguments = data->parameters[fss_basic_list_write_parameter_ignore].additional.used;
+
+        if (total_locations * 2 > total_arguments) {
+          fprintf(data->error.to.stream, "%c", f_string_eol[0]);
+          fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
+          fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_write_long_ignore);
+          fl_color_print(data->error.to.stream, data->context.set.error, "' requires two values.%c", f_string_eol[0]);
+
+          status = F_status_set_error(F_parameter);
+        }
+      }
+    }
+
     f_fss_quote_t quote = f_fss_delimit_quote_double;
 
     if (F_status_is_error_not(status)) {
index 7b719db9e776fa67bebd2c6dc91330fc106ad2e2..052ca19f2535e3f26b0e6272c9e0f784fcd703b2 100644 (file)
@@ -54,12 +54,14 @@ extern "C" {
 #endif // _di_fss_basic_list_write_name_
 
 #ifndef _di_fss_basic_list_write_defines_
-  #define fss_basic_list_write_pipe_content_start '\0'
-  #define fss_basic_list_write_pipe_content_end   '\f'
+  #define fss_basic_list_write_pipe_content_end    '\f'
+  #define fss_basic_list_write_pipe_content_ignore '\v'
+  #define fss_basic_list_write_pipe_content_start  '\b'
 
   #define fss_basic_list_write_short_file    "f"
   #define fss_basic_list_write_short_content "c"
   #define fss_basic_list_write_short_double  "d"
+  #define fss_basic_list_write_short_ignore  "I"
   #define fss_basic_list_write_short_object  "o"
   #define fss_basic_list_write_short_partial "p"
   #define fss_basic_list_write_short_prepend "P"
@@ -69,6 +71,7 @@ extern "C" {
   #define fss_basic_list_write_long_file    "file"
   #define fss_basic_list_write_long_content "content"
   #define fss_basic_list_write_long_double  "double"
+  #define fss_basic_list_write_long_ignore  "ignore"
   #define fss_basic_list_write_long_object  "object"
   #define fss_basic_list_write_long_partial "partial"
   #define fss_basic_list_write_long_prepend "prepend"
@@ -89,6 +92,7 @@ extern "C" {
     fss_basic_list_write_parameter_file,
     fss_basic_list_write_parameter_content,
     fss_basic_list_write_parameter_double,
+    fss_basic_list_write_parameter_ignore,
     fss_basic_list_write_parameter_object,
     fss_basic_list_write_parameter_partial,
     fss_basic_list_write_parameter_prepend,
@@ -110,6 +114,7 @@ extern "C" {
       f_console_parameter_t_initialize(fss_basic_list_write_short_file, fss_basic_list_write_long_file, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_basic_list_write_short_content, fss_basic_list_write_long_content, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_basic_list_write_short_double, fss_basic_list_write_long_double, 0, 0, f_console_type_normal), \
+      f_console_parameter_t_initialize(fss_basic_list_write_short_ignore, fss_basic_list_write_long_ignore, 0, 2, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_basic_list_write_short_object, fss_basic_list_write_long_object, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_basic_list_write_short_partial, fss_basic_list_write_long_partial, 0, 0, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_basic_list_write_short_prepend, fss_basic_list_write_long_prepend, 0, 1, f_console_type_normal), \
@@ -117,7 +122,7 @@ extern "C" {
       f_console_parameter_t_initialize(fss_basic_list_write_short_trim, fss_basic_list_write_long_trim, 0, 0, f_console_type_normal), \
     }
 
-  #define fss_basic_list_write_total_parameters 17
+  #define fss_basic_list_write_total_parameters 18
 #endif // _di_fss_basic_list_write_defines_
 
 #ifndef _di_fss_basic_list_write_data_t_
index 71b8bc9e66d90af1fcd4bec8f835600341313537..2f50280d9569e095f747c7c0ef523f4954e0a05b 100644 (file)
@@ -194,6 +194,11 @@ extern "C" {
             break;
           }
 
+          if (block.string[range.start] == fss_basic_list_write_pipe_content_ignore) {
+            // this is not used by objects.
+            continue;
+          }
+
           object.string[object.used++] = block.string[range.start];
         } // for
 
@@ -242,6 +247,11 @@ extern "C" {
               break;
             }
 
+            if (block.string[range.start] == fss_basic_list_write_pipe_content_ignore) {
+              // this is not used by this program.
+              continue;
+            }
+
             content.string[content.used++] = block.string[range.start];
           } // for
 
index 9a9a7eba5f35fb6fe68509a0ff5f93d96f228c0f..8a3a5cbff5745f69c61a307526194c430f556581 100644 (file)
@@ -70,8 +70,10 @@ extern "C" {
  *   This is either single our double quote.
  * @param object
  *   The object to validate and print.
+ *   Set pointer address to 0 to not use.
  * @param content
  *   The content to escape and print.
+ *   Set pointer address to 0 to not use.
  * @param buffer
  *   The buffer array used as a cache to construct the output before printing.
  *
index ea35952769f3623c1b0e4a7e58681a54752f98ea..ae4a818ef782a55b70c366a5dcc70d7b6d17d4ff 100644 (file)
@@ -62,8 +62,9 @@ extern "C" {
 #endif // _di_fss_basic_read_name_
 
 #ifndef _di_fss_basic_read_defines_
-  #define fss_basic_read_pipe_content_start '\0'
-  #define fss_basic_read_pipe_content_end   '\f'
+  #define fss_basic_read_pipe_content_end    '\f'
+  #define fss_basic_read_pipe_content_ignore '\v'
+  #define fss_basic_read_pipe_content_start  '\b'
 
   #define fss_basic_read_short_at      "a"
   #define fss_basic_read_short_content "c"
index 172dfaa6cadd3a148d3b26b7e177ff066b5a7110..88c4b9b0d3ed801103c0a8816032351ec89b95e8 100644 (file)
@@ -25,6 +25,7 @@ extern "C" {
     fll_program_print_help_option(file, context, fss_basic_write_short_file, fss_basic_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, "   Specify a file to send output to.");
     fll_program_print_help_option(file, context, fss_basic_write_short_content, fss_basic_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, "The Content to output.");
     fll_program_print_help_option(file, context, fss_basic_write_short_double, fss_basic_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default).");
+    fll_program_print_help_option(file, context, fss_basic_write_short_ignore, fss_basic_write_long_ignore, f_console_symbol_short_enable, f_console_symbol_long_enable, " Ignore a given range within a content.");
     fll_program_print_help_option(file, context, fss_basic_write_short_object, fss_basic_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The Object to output.");
     fll_program_print_help_option(file, context, fss_basic_write_short_partial, fss_basic_write_long_partial, f_console_symbol_short_enable, f_console_symbol_long_enable, "Do not output end of Object/Content character.");
     fll_program_print_help_option(file, context, fss_basic_write_short_prepend, fss_basic_write_long_prepend, f_console_symbol_short_enable, f_console_symbol_long_enable, "Prepend the given whitespace characters to the start of each multi-line Content.");
@@ -33,24 +34,34 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_basic_write_name, "");
 
-    printf("  The pipe uses the NULL character '");
-    fl_color_print(f_type_output, context.set.notable, "\\0");
+    printf("  The pipe uses the Backspace character '");
+    fl_color_print(f_type_output, context.set.notable, "\\b");
     printf("' (");
-    fl_color_print(f_type_output, context.set.notable, "U+0000");
-    printf(") to designate the start of a Content and uses the Form Feed character '");
+    fl_color_print(f_type_output, context.set.notable, "U+0008");
+    printf(") to designate the start of a Content.%c", f_string_eol[0]);
+
+    printf("  The pipe uses the Form Feed character '");
     fl_color_print(f_type_output, context.set.notable, "\\f");
     printf("' (");
     fl_color_print(f_type_output, context.set.notable, "U+000C");
     printf(") to designate the end of the last Content.%c", f_string_eol[0]);
-    printf("  For the pipe, an Object is terminated by either a NULL character '");
-    fl_color_print(f_type_output, context.set.notable, "\\0");
+
+    printf("  The pipe uses the Vertical Line character '");
+    fl_color_print(f_type_output, context.set.notable, "\\v");
+    printf("' (");
+    fl_color_print(f_type_output, context.set.notable, "U+000B");
+    printf(") is used to ignore a content range, which does nothing in this program.%c", f_string_eol[0]);
+
+    printf("  For the pipe, an Object is terminated by either a Backspace character '");
+    fl_color_print(f_type_output, context.set.notable, "\\b");
     printf("' (");
-    fl_color_print(f_type_output, context.set.notable, "U+0000");
+    fl_color_print(f_type_output, context.set.notable, "U+0008");
     printf(") or a Form Feed character '");
     fl_color_print(f_type_output, context.set.notable, "\\f");
     printf("' (");
     fl_color_print(f_type_output, context.set.notable, "U+000C");
     printf(").%c", f_string_eol[0]);
+
     printf("  The end of the pipe represents the end of any Object or Content.%c", f_string_eol[0]);
 
     printf("%c", f_string_eol[0]);
@@ -61,6 +72,13 @@ extern "C" {
 
     printf("%c", f_string_eol[0]);
 
+    printf("  This program does not use the parameter '");
+    fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_write_long_ignore);
+    printf("', which therefore does nothing.%c", f_string_eol[0]);
+    printf("  This parameter requires two values.%c", f_string_eol[0]);
+
+    printf("%c", f_string_eol[0]);
+
     return F_none;
   }
 #endif // _di_fss_basic_write_print_help_
@@ -318,6 +336,32 @@ extern "C" {
       }
     }
 
+    if (F_status_is_error_not(status)) {
+      if (data->parameters[fss_basic_write_parameter_ignore].result == f_console_result_found) {
+        if (data->error.verbosity != f_console_verbosity_quiet) {
+          fprintf(data->error.to.stream, "%c", f_string_eol[0]);
+          fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
+          fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_write_long_ignore);
+          fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no values were given.%c", f_string_eol[0]);
+        }
+
+        status = F_status_set_error(F_parameter);
+      }
+      else if (data->parameters[fss_basic_write_parameter_ignore].result == f_console_result_additional) {
+        const f_array_length_t total_locations = data->parameters[fss_basic_write_parameter_ignore].locations.used;
+        const f_array_length_t total_arguments = data->parameters[fss_basic_write_parameter_ignore].additional.used;
+
+        if (total_locations * 2 > total_arguments) {
+          fprintf(data->error.to.stream, "%c", f_string_eol[0]);
+          fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
+          fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_write_long_ignore);
+          fl_color_print(data->error.to.stream, data->context.set.error, "' requires two values.%c", f_string_eol[0]);
+
+          status = F_status_set_error(F_parameter);
+        }
+      }
+    }
+
     f_fss_quote_t quote = f_fss_delimit_quote_double;
 
     if (F_status_is_error_not(status)) {
index a8f0664fa3f314f851a1484da5ea8536ed038ebe..697db519fd18046b045ed92aab051f4626c0632f 100644 (file)
@@ -55,12 +55,14 @@ extern "C" {
 #endif // _di_fss_basic_write_name_
 
 #ifndef _di_fss_basic_write_defines_
-  #define fss_basic_write_pipe_content_start '\0'
-  #define fss_basic_write_pipe_content_end   '\f'
+  #define fss_basic_write_pipe_content_end    '\f'
+  #define fss_basic_write_pipe_content_ignore '\v'
+  #define fss_basic_write_pipe_content_start  '\b'
 
   #define fss_basic_write_short_file    "f"
   #define fss_basic_write_short_content "c"
   #define fss_basic_write_short_double  "d"
+  #define fss_basic_write_short_ignore  "I"
   #define fss_basic_write_short_object  "o"
   #define fss_basic_write_short_partial "p"
   #define fss_basic_write_short_prepend "P"
@@ -70,6 +72,7 @@ extern "C" {
   #define fss_basic_write_long_file    "file"
   #define fss_basic_write_long_content "content"
   #define fss_basic_write_long_double  "double"
+  #define fss_basic_write_long_ignore  "ignore"
   #define fss_basic_write_long_object  "object"
   #define fss_basic_write_long_partial "partial"
   #define fss_basic_write_long_prepend "prepend"
@@ -90,6 +93,7 @@ extern "C" {
     fss_basic_write_parameter_file,
     fss_basic_write_parameter_content,
     fss_basic_write_parameter_double,
+    fss_basic_write_parameter_ignore,
     fss_basic_write_parameter_object,
     fss_basic_write_parameter_partial,
     fss_basic_write_parameter_prepend,
@@ -111,6 +115,7 @@ extern "C" {
       f_console_parameter_t_initialize(fss_basic_write_short_file, fss_basic_write_long_file, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_basic_write_short_content, fss_basic_write_long_content, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_basic_write_short_double, fss_basic_write_long_double, 0, 0, f_console_type_normal), \
+      f_console_parameter_t_initialize(fss_basic_write_short_ignore, fss_basic_write_long_ignore, 0, 2, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_basic_write_short_object, fss_basic_write_long_object, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_basic_write_short_partial, fss_basic_write_long_partial, 0, 0, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_basic_write_short_prepend, fss_basic_write_long_prepend, 0, 1, f_console_type_normal), \
@@ -118,7 +123,7 @@ extern "C" {
       f_console_parameter_t_initialize(fss_basic_write_short_trim, fss_basic_write_long_trim, 0, 0, f_console_type_normal), \
     }
 
-  #define fss_basic_write_total_parameters 17
+  #define fss_basic_write_total_parameters 18
 #endif // _di_fss_basic_write_defines_
 
 #ifndef _di_fss_basic_write_data_
index ba3379905d8d3b47c88601d7d62c807ff64db2d2..46b6989f6695c285aa42c3dfe34358e6552851a5 100644 (file)
@@ -206,6 +206,11 @@ extern "C" {
             break;
           }
 
+          if (block.string[range.start] == fss_basic_write_pipe_content_ignore) {
+            // this is not used by objects.
+            continue;
+          }
+
           object.string[object.used++] = block.string[range.start];
         } // for
 
@@ -247,12 +252,19 @@ extern "C" {
               status = F_status_set_error(F_unsupported);
               break;
             }
-            else if (block.string[range.start] == fss_basic_write_pipe_content_end) {
+
+            if (block.string[range.start] == fss_basic_write_pipe_content_end) {
               state = 0x3;
               range.start++;
               break;
             }
-            else if (F_status_set_fine(status) == F_none_eol) {
+
+            if (block.string[range.start] == fss_basic_write_pipe_content_ignore) {
+              // this is not used by this program.
+              continue;
+            }
+
+            if (F_status_set_fine(status) == F_none_eol) {
               fss_basic_write_error_parameter_unsupported_eol_print(data);
 
               status = F_status_set_error(F_unsupported);
index 768479b157c008070b3ff63d394ee1cd9636f258..7e4ebca761f7dbd658d0d513a7f91cdf3e04257f 100644 (file)
@@ -70,10 +70,10 @@ extern "C" {
  *   This is either single our double quote.
  * @param object
  *   A pointer to the object to validate and print.
- *   Set to 0 to disable.
+ *   Set pointer address to 0 to not use.
  * @param content
  *   A pointer to the  content to escape and print.
- *   Set to 0 to disable.
+ *   Set pointer address to 0 to not use.
  * @param buffer
  *   The buffer array used as a cache to construct the output before printing.
  *
index 57942c361d32ae6adf6739fecc8d8feb2a657b13..c2840b1b42abc900f31d55bf382b7afbfde43c3e 100644 (file)
@@ -62,8 +62,9 @@ extern "C" {
 #endif // _di_fss_extended_list_read_name_
 
 #ifndef _di_fss_extended_list_read_defines_
-  #define fss_extended_list_read_pipe_content_start '\0'
-  #define fss_extended_list_read_pipe_content_end   '\f'
+  #define fss_extended_list_read_pipe_content_end    '\f'
+  #define fss_extended_list_read_pipe_content_ignore '\v'
+  #define fss_extended_list_read_pipe_content_start  '\b'
 
   #define fss_extended_list_read_short_at      "a"
   #define fss_extended_list_read_short_content "c"
index 5225de3730c85deb49cf6c78c02ec316da613f7d..2ff60895a05521aac65b9a9dcf882510eb3721dd 100644 (file)
@@ -25,6 +25,7 @@ extern "C" {
     fll_program_print_help_option(file, context, fss_extended_list_write_short_file, fss_extended_list_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, "   Specify a file to send output to.");
     fll_program_print_help_option(file, context, fss_extended_list_write_short_content, fss_extended_list_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, "The Content to output.");
     fll_program_print_help_option(file, context, fss_extended_list_write_short_double, fss_extended_list_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default).");
+    fll_program_print_help_option(file, context, fss_extended_list_write_short_ignore, fss_extended_list_write_long_ignore, f_console_symbol_short_enable, f_console_symbol_long_enable, " Ignore a given range within a content.");
     fll_program_print_help_option(file, context, fss_extended_list_write_short_object, fss_extended_list_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The Object to output.");
     fll_program_print_help_option(file, context, fss_extended_list_write_short_partial, fss_extended_list_write_long_partial, f_console_symbol_short_enable, f_console_symbol_long_enable, "Do not output end of Object/Content character.");
     fll_program_print_help_option(file, context, fss_extended_list_write_short_prepend, fss_extended_list_write_long_prepend, f_console_symbol_short_enable, f_console_symbol_long_enable, "Prepend the given whitespace characters to the start of each multi-line Content.");
@@ -33,29 +34,39 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_extended_list_write_name, "");
 
-    printf("  The pipe uses the NULL character '");
-    fl_color_print(f_type_output, context.set.notable, "\\0");
+    printf("  The pipe uses the Backspace character '");
+    fl_color_print(f_type_output, context.set.notable, "\\b");
     printf("' (");
-    fl_color_print(f_type_output, context.set.notable, "U+0000");
-    printf(") to designate the start of a Content and uses the Form Feed character '");
+    fl_color_print(f_type_output, context.set.notable, "U+0008");
+    printf(") to designate the start of a Content.%c", f_string_eol[0]);
+
+    printf("  The pipe uses the Form Feed character '");
     fl_color_print(f_type_output, context.set.notable, "\\f");
     printf("' (");
     fl_color_print(f_type_output, context.set.notable, "U+000C");
     printf(") to designate the end of the last Content.%c", f_string_eol[0]);
-    printf("  For the pipe, an Object is terminated by either a NULL character '");
-    fl_color_print(f_type_output, context.set.notable, "\\0");
+
+    printf("  The pipe uses the Vertical Line character '");
+    fl_color_print(f_type_output, context.set.notable, "\\v");
+    printf("' (");
+    fl_color_print(f_type_output, context.set.notable, "U+000B");
+    printf(") is used to ignore a content range (use this both before and after the range).%c", f_string_eol[0]);
+
+    printf("  For the pipe, an Object is terminated by either a Backspace character '");
+    fl_color_print(f_type_output, context.set.notable, "\\b");
     printf("' (");
-    fl_color_print(f_type_output, context.set.notable, "U+0000");
+    fl_color_print(f_type_output, context.set.notable, "U+0008");
     printf(") or a Form Feed character '");
     fl_color_print(f_type_output, context.set.notable, "\\f");
     printf("' (");
     fl_color_print(f_type_output, context.set.notable, "U+000C");
     printf(").%c", f_string_eol[0]);
+
     printf("  The end of the pipe represents the end of any Object or Content.%c", f_string_eol[0]);
 
     printf("%c", f_string_eol[0]);
 
-    printf("  The FSS-0002 (Basic List) specification does not support quoted names, therefore the parameters '");
+    printf("  The FSS-0003 (Extended List) specification does not support quoted names, therefore the parameters '");
     fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_write_long_single);
     printf("' and '");
     fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_write_long_double);
@@ -63,6 +74,19 @@ extern "C" {
 
     printf("%c", f_string_eol[0]);
 
+    printf("  The parameter '");
+    fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_write_long_ignore);
+    printf("' designates to not escape any valid nested Object or Content within some Content.%c", f_string_eol[0]);
+    printf("  This parameter requires two values.%c", f_string_eol[0]);
+    printf("  This is not used for ignoring anything within the input pipe.%c", f_string_eol[0]);
+    printf("  This parameter must be specified after a '");
+    fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_write_long_content);
+    printf("' parameter and this applies only to the Content represented by that specific '");
+    fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_write_long_content);
+    printf("' parameter.%c", f_string_eol[0]);
+
+    printf("%c", f_string_eol[0]);
+
     return F_none;
   }
 #endif // _di_fss_extended_list_write_print_help_
@@ -322,6 +346,32 @@ extern "C" {
       }
     }
 
+    if (F_status_is_error_not(status)) {
+      if (data->parameters[fss_extended_list_write_parameter_ignore].result == f_console_result_found) {
+        if (data->error.verbosity != f_console_verbosity_quiet) {
+          fprintf(data->error.to.stream, "%c", f_string_eol[0]);
+          fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
+          fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_write_long_ignore);
+          fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no values were given.%c", f_string_eol[0]);
+        }
+
+        status = F_status_set_error(F_parameter);
+      }
+      else if (data->parameters[fss_extended_list_write_parameter_ignore].result == f_console_result_additional) {
+        const f_array_length_t total_locations = data->parameters[fss_extended_list_write_parameter_ignore].locations.used;
+        const f_array_length_t total_arguments = data->parameters[fss_extended_list_write_parameter_ignore].additional.used;
+
+        if (total_locations * 2 > total_arguments) {
+          fprintf(data->error.to.stream, "%c", f_string_eol[0]);
+          fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
+          fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_write_long_ignore);
+          fl_color_print(data->error.to.stream, data->context.set.error, "' requires two values.%c", f_string_eol[0]);
+
+          status = F_status_set_error(F_parameter);
+        }
+      }
+    }
+
     f_fss_quote_t quote = f_fss_delimit_quote_double;
 
     if (F_status_is_error_not(status)) {
@@ -343,9 +393,10 @@ extern "C" {
 
     if (F_status_is_error_not(status)) {
       f_string_dynamic_t escaped = f_string_dynamic_t_initialize;
+      f_string_ranges_t ignore = f_string_ranges_t_initialize;
 
       if (data->process_pipe) {
-        status = fss_extended_list_write_process_pipe(*data, output, quote, &buffer);
+        status = fss_extended_list_write_process_pipe(*data, output, quote, &buffer, &ignore);
 
         if (F_status_is_error(status)) {
           if (data->error.verbosity != f_console_verbosity_quiet) {
@@ -355,6 +406,8 @@ extern "C" {
             fl_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol[0]);
           }
         }
+
+        ignore.used = 0;
       }
 
       if (F_status_is_error_not(status)) {
@@ -367,18 +420,21 @@ extern "C" {
               object.used = strnlen(object.string, f_console_length_size);
               object.size = object.used;
 
-              status = fss_extended_list_write_process(*data, output, quote, &object, 0, &buffer);
+              status = fss_extended_list_write_process(*data, output, quote, &object, 0, 0, &buffer);
               if (F_status_is_error(status)) break;
             } // for
           }
           else {
             for (f_array_length_t i = 0; i < data->parameters[fss_extended_list_write_parameter_content].additional.used; i++) {
 
+              status = fss_extended_list_write_process_parameter_ignore(arguments, *data, data->parameters[fss_extended_list_write_parameter_content].locations, i, &ignore);
+              if (F_status_is_error(status)) break;
+
               content.string = arguments.argv[data->parameters[fss_extended_list_write_parameter_content].additional.array[i]];
               content.used = strnlen(content.string, f_console_length_size);
               content.size = content.used;
 
-              status = fss_extended_list_write_process(*data, output, quote, 0, &content, &buffer);
+              status = fss_extended_list_write_process(*data, output, quote, 0, &content, &ignore, &buffer);
               if (F_status_is_error(status)) break;
             } // for
           }
@@ -386,6 +442,9 @@ extern "C" {
         else {
           for (f_array_length_t i = 0; i < data->parameters[fss_extended_list_write_parameter_object].additional.used; i++) {
 
+            status = fss_extended_list_write_process_parameter_ignore(arguments, *data, data->parameters[fss_extended_list_write_parameter_content].locations, i, &ignore);
+            if (F_status_is_error(status)) break;
+
             object.string = arguments.argv[data->parameters[fss_extended_list_write_parameter_object].additional.array[i]];
             object.used = strnlen(object.string, f_console_length_size);
             object.size = object.used;
@@ -394,7 +453,7 @@ extern "C" {
             content.used = strnlen(content.string, f_console_length_size);
             content.size = content.used;
 
-            status = fss_extended_list_write_process(*data, output, quote, &object, &content, &buffer);
+            status = fss_extended_list_write_process(*data, output, quote, &object, &content, &ignore, &buffer);
             if (F_status_is_error(status)) break;
           } // for
         }
@@ -414,6 +473,7 @@ extern "C" {
       }
 
       f_macro_string_dynamic_t_delete_simple(escaped);
+      f_macro_string_ranges_t_delete_simple(ignore);
 
       // object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
       object.string = 0;
index f705074b27d961d7cb7799d32a8fb6af83721fd1..29469203df6f97e332461f964c48d0f62bae7bdf 100644 (file)
@@ -28,6 +28,7 @@
 // fll-1 includes
 #include <level_1/color.h>
 #include <level_1/console.h>
+#include <level_1/conversion.h>
 #include <level_1/fss_extended_list.h>
 #include <level_1/status.h>
 #include <level_1/string.h>
@@ -54,12 +55,14 @@ extern "C" {
 #endif // _di_fss_extended_list_write_name_
 
 #ifndef _di_fss_extended_list_write_defines_
-  #define fss_extended_list_write_pipe_content_start '\0'
-  #define fss_extended_list_write_pipe_content_end   '\f'
+  #define fss_extended_list_write_pipe_content_end    '\f'
+  #define fss_extended_list_write_pipe_content_ignore '\v'
+  #define fss_extended_list_write_pipe_content_start  '\b'
 
   #define fss_extended_list_write_short_file    "f"
   #define fss_extended_list_write_short_content "c"
   #define fss_extended_list_write_short_double  "d"
+  #define fss_extended_list_write_short_ignore  "I"
   #define fss_extended_list_write_short_object  "o"
   #define fss_extended_list_write_short_partial "p"
   #define fss_extended_list_write_short_prepend "P"
@@ -69,6 +72,7 @@ extern "C" {
   #define fss_extended_list_write_long_file    "file"
   #define fss_extended_list_write_long_content "content"
   #define fss_extended_list_write_long_double  "double"
+  #define fss_extended_list_write_long_ignore  "ignore"
   #define fss_extended_list_write_long_object  "object"
   #define fss_extended_list_write_long_partial "partial"
   #define fss_extended_list_write_long_prepend "prepend"
@@ -89,6 +93,7 @@ extern "C" {
     fss_extended_list_write_parameter_file,
     fss_extended_list_write_parameter_content,
     fss_extended_list_write_parameter_double,
+    fss_extended_list_write_parameter_ignore,
     fss_extended_list_write_parameter_object,
     fss_extended_list_write_parameter_partial,
     fss_extended_list_write_parameter_prepend,
@@ -110,6 +115,7 @@ extern "C" {
       f_console_parameter_t_initialize(fss_extended_list_write_short_file, fss_extended_list_write_long_file, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_extended_list_write_short_content, fss_extended_list_write_long_content, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_extended_list_write_short_double, fss_extended_list_write_long_double, 0, 0, f_console_type_normal), \
+      f_console_parameter_t_initialize(fss_extended_list_write_short_ignore, fss_extended_list_write_long_ignore, 0, 2, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_extended_list_write_short_object, fss_extended_list_write_long_object, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_extended_list_write_short_partial, fss_extended_list_write_long_partial, 0, 0, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_extended_list_write_short_prepend, fss_extended_list_write_long_prepend, 0, 1, f_console_type_normal), \
@@ -117,7 +123,7 @@ extern "C" {
       f_console_parameter_t_initialize(fss_extended_list_write_short_trim, fss_extended_list_write_long_trim, 0, 0, f_console_type_normal), \
     }
 
-  #define fss_extended_list_write_total_parameters 17
+  #define fss_extended_list_write_total_parameters 18
 #endif // _di_fss_extended_list_write_defines_
 
 #ifndef _di_fss_extended_list_write_data_t_
index c6bc35b84b5c1f69bbbe650837c086092dc98019..171f8481546f6587341232dbe2a44793e770bf4c 100644 (file)
@@ -52,7 +52,7 @@ extern "C" {
 #endif // _di_fss_extended_list_write_error_parameter_value_missing_print_
 
 #ifndef _di_fss_extended_list_write_process_
-  f_return_status fss_extended_list_write_process(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) {
+  f_return_status fss_extended_list_write_process(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) {
     f_status_t status = F_none;
 
     f_string_range_t range = f_string_range_t_initialize;
@@ -96,8 +96,7 @@ extern "C" {
       range.start = 0;
       range.stop = content->used - 1;
 
-      // @todo: add const f_string_ranges_t *ignore parameter.
-      status = fl_fss_extended_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &data.prepend, 0, &range, buffer);
+      status = fl_fss_extended_list_content_write_string(*content, object ? f_fss_complete_full : f_fss_complete_none, &data.prepend, ignore, &range, buffer);
 
       if (F_status_is_error(status)) {
         fll_error_print(data.error, F_status_set_fine(status), "fl_fss_extended_list_content_write_string", F_true);
@@ -122,7 +121,7 @@ extern "C" {
 #endif // _di_fss_extended_list_write_process_
 
 #ifndef _di_fss_extended_list_write_process_pipe_
-  f_return_status fss_extended_list_write_process_pipe(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) {
+  f_return_status fss_extended_list_write_process_pipe(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) {
     f_status_t status = F_none;
     f_status_t status_pipe = F_none;
 
@@ -133,7 +132,9 @@ extern "C" {
 
     f_string_length_t total = 0;
     f_string_length_t previous = 0;
+
     f_string_range_t range = f_string_range_t_initialize;
+    f_string_range_t range_ignore = f_string_range_t_initialize;
 
     f_string_dynamic_t block = f_string_dynamic_t_initialize;
     f_string_dynamic_t object = f_string_dynamic_t_initialize;
@@ -170,6 +171,9 @@ extern "C" {
           content.used = 0;
 
           state = 0x1;
+
+          range_ignore.start = 1;
+          range_ignore.stop = 0;
         }
 
         if (object.used + block.used > object.size) {
@@ -195,6 +199,11 @@ extern "C" {
             break;
           }
 
+          if (block.string[range.start] == fss_extended_list_write_pipe_content_ignore) {
+            // this is not used by objects.
+            continue;
+          }
+
           object.string[object.used++] = block.string[range.start];
         } // for
 
@@ -243,6 +252,45 @@ extern "C" {
               break;
             }
 
+            if (block.string[range.start] == fss_extended_list_write_pipe_content_ignore) {
+              if (ignore) {
+                if (range_ignore.start > range_ignore.stop) {
+                  range_ignore.start = content.used;
+                  range_ignore.stop = content.used;
+                }
+                else {
+                  if (ignore->used + 1 > ignore->size) {
+                    if (ignore->size + f_fss_default_allocation_step > f_array_length_t_size) {
+                      if (ignore->size + 1 > f_array_length_t_size) {
+                        fll_error_print(data.error, F_string_too_large, "fss_extended_list_write_process_pipe", F_true);
+
+                        status = F_status_set_error(F_string_too_large);
+                        break;
+                      }
+
+                      f_macro_string_ranges_t_resize(status, (*ignore), ignore->size + 1);
+                    }
+                    else {
+                      f_macro_string_ranges_t_resize(status, (*ignore), ignore->size + f_fss_default_allocation_step);
+                    }
+
+                    if (F_status_is_error(status)) {
+                      fll_error_print(data.error, F_string_too_large, "fss_extended_list_write_process_pipe", F_true);
+                      break;
+                    }
+                  }
+
+                  ignore->array[ignore->used].start = range_ignore.start;
+                  ignore->array[ignore->used++].stop = content.used - 1;
+
+                  range_ignore.start = 1;
+                  range_ignore.stop = 0;
+                }
+              }
+
+              continue;
+            }
+
             content.string[content.used++] = block.string[range.start];
           } // for
 
@@ -254,7 +302,7 @@ extern "C" {
       }
 
       if (state == 0x3) {
-        status = fss_extended_list_write_process(data, output, quote, &object, &content, buffer);
+        status = fss_extended_list_write_process(data, output, quote, &object, &content, ignore, buffer);
         if (F_status_is_error(status)) break;
 
         state = 0;
@@ -263,7 +311,7 @@ extern "C" {
 
     // if the pipe ended before finishing, then attempt to wrap up.
     if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) {
-      status = fss_extended_list_write_process(data, output, quote, &object, &content, buffer);
+      status = fss_extended_list_write_process(data, output, quote, &object, &content, ignore, buffer);
     }
 
     f_macro_string_dynamic_t_delete_simple(block);
@@ -273,6 +321,89 @@ extern "C" {
   }
 #endif // _di_fss_extended_list_write_process_pipe_
 
+#ifndef _di_fss_extended_list_write_process_parameter_ignore_
+  f_return_status fss_extended_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_extended_list_write_data_t data, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) {
+    f_status_t status = F_none;
+
+    f_array_length_t i = 0;
+    f_array_length_t l = 0;
+    f_array_length_t index = 0;
+
+    f_string_range_t range = f_string_range_t_initialize;
+
+    f_number_unsigned_t number = 0;
+
+    range.start = 0;
+
+    for (; i < data.parameters[fss_extended_list_write_parameter_ignore].locations.used; i++) {
+
+      l = data.parameters[fss_extended_list_write_parameter_ignore].locations.array[i];
+
+      if (l < contents.array[location]) continue;
+      if (location + 1 < contents.used && l > contents.array[location + 1]) continue;
+
+      if (ignore->used + 1 > ignore->size) {
+        if (ignore->size + f_fss_default_allocation_step > f_array_length_t_size) {
+          if (ignore->size + 1 > f_array_length_t_size) {
+            fll_error_print(data.error, F_string_too_large, "fss_extended_list_write_process_parameter_ignore", F_true);
+            return F_status_set_error(F_string_too_large);
+          }
+
+          f_macro_string_ranges_t_resize(status, (*ignore), ignore->size + 1);
+        }
+        else {
+          f_macro_string_ranges_t_resize(status, (*ignore), ignore->size + f_fss_default_allocation_step);
+        }
+
+        if (F_status_is_error(status)) {
+          fll_error_print(data.error, F_status_set_fine(status), "fss_extended_list_write_process_parameter_ignore", F_true);
+          return status;
+        }
+      }
+
+      index = data.parameters[fss_extended_list_write_parameter_ignore].additional.array[i * 2];
+
+      range.start = 0;
+      range.stop = strnlen(arguments.argv[index], f_console_length_size);
+
+      // allow and ignore the positive sign.
+      if (range.stop > 0 && arguments.argv[index][0] == '+') {
+        range.start = 1;
+      }
+
+      status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range);
+
+      if (F_status_is_error(status)) {
+        fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore, arguments.argv[index]);
+        return status;
+      }
+
+      ignore->array[ignore->used].start = number;
+
+      index = data.parameters[fss_extended_list_write_parameter_ignore].additional.array[(i * 2) + 1];
+
+      range.start = 0;
+      range.stop = strnlen(arguments.argv[index], f_console_length_size);
+
+      // allow and ignore the positive sign.
+      if (range.stop > 0 && arguments.argv[index][0] == '+') {
+        range.start = 1;
+      }
+
+      status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range);
+
+      if (F_status_is_error(status)) {
+        fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore, arguments.argv[index]);
+        return status;
+      }
+
+      ignore->array[ignore->used++].stop = number;
+    } // for
+
+    return F_none;
+  }
+#endif // _di_fss_extended_list_write_process_parameter_ignore_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index ed984b701ddb745a218668454122e0ad227d3ebc..5f567732e7d83538869e9fb3cd1082e32a039893 100644 (file)
@@ -70,8 +70,13 @@ extern "C" {
  *   This is either single our double quote.
  * @param object
  *   The object to validate and print.
+ *   Set pointer address to 0 to not use.
  * @param content
  *   The content to escape and print.
+ *   Set pointer address to 0 to not use.
+ * @param ignore
+ *   An array of ranges within the Content to ignore.
+ *   Set pointer address to 0 to not use.
  * @param buffer
  *   The buffer array used as a cache to construct the output before printing.
  *
@@ -80,7 +85,7 @@ extern "C" {
  *   F_failure (with error bit) for any othe failure.
  */
 #ifndef _di_fss_extended_list_write_process_
-  extern f_return_status fss_extended_list_write_process(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) f_gcc_attribute_visibility_internal;
+  extern f_return_status fss_extended_list_write_process(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) f_gcc_attribute_visibility_internal;
 #endif // _di_fss_extended_list_write_process_
 
 /**
@@ -95,15 +100,40 @@ extern "C" {
  *   This is either single our double quote.
  * @param buffer
  *   The buffer array used as a cache to construct the output before printing.
+ * @param ignore
+ *   An array of ranges within the Content to ignore.
+ *   Set pointer address to 0 to not use.
  *
  * @return
  *   F_none on success.
  *   F_failure (with error bit) for any othe failure.
  */
 #ifndef _di_fss_extended_list_write_process_pipe_
-  extern f_return_status fss_extended_list_write_process_pipe(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer) f_gcc_attribute_visibility_internal;
+  extern f_return_status fss_extended_list_write_process_pipe(const fss_extended_list_write_data_t data, const f_file_t output, const f_fss_quote_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) f_gcc_attribute_visibility_internal;
 #endif // _di_fss_extended_list_write_process_pipe_
 
+/**
+ * Process the ignore parameter associated with a specific content parameter.
+ *
+ * @param arguments
+ *   The parameters passed to the process.
+ * @param data
+ *   The program data.
+ * @param contents
+ *   The console parameter locations array for the content parameter.
+ * @param location
+ *   The specific location within the contents locations array.
+ * @param ignore
+ *   An array of ranges within the Content to ignore.
+ *
+ * @return
+ *   F_none on success.
+ *   F_failure (with error bit) for any othe failure.
+ */
+#ifndef _di_fss_extended_list_write_process_parameter_ignore_
+  extern f_return_status fss_extended_list_write_process_parameter_ignore(const f_console_arguments_t arguments, const fss_extended_list_write_data_t data, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) f_gcc_attribute_visibility_internal;
+#endif // _di_fss_extended_list_write_process_parameter_ignore_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 71d4ae03143717621b28168d76c09f80e90ff83f..7c3d1dbb34d117c634fe0f9f222d7cb683cf360c 100644 (file)
@@ -62,8 +62,9 @@ extern "C" {
 #endif // _di_fss_extended_read_name_
 
 #ifndef _di_fss_extended_read_defines_
-  #define fss_extended_read_pipe_content_start '\0'
-  #define fss_extended_read_pipe_content_end   '\f'
+  #define fss_extended_read_pipe_content_end    '\f'
+  #define fss_extended_read_pipe_content_ignore '\v'
+  #define fss_extended_read_pipe_content_start  '\b'
 
   #define fss_extended_read_short_at      "a"
   #define fss_extended_read_short_content "c"
index 6cb945344d3dd95c2fcf8d2ed8eb5f77836d86b3..cbed51db79d4f14dc1b4ddd451c687ba88c179ad 100644 (file)
@@ -25,6 +25,7 @@ extern "C" {
     fll_program_print_help_option(file, context, fss_extended_write_short_file, fss_extended_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, "   Specify a file to send output to.");
     fll_program_print_help_option(file, context, fss_extended_write_short_content, fss_extended_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, "The Content to output.");
     fll_program_print_help_option(file, context, fss_extended_write_short_double, fss_extended_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default).");
+    fll_program_print_help_option(file, context, fss_extended_write_short_ignore, fss_extended_write_long_ignore, f_console_symbol_short_enable, f_console_symbol_long_enable, " Ignore a given range within a content.");
     fll_program_print_help_option(file, context, fss_extended_write_short_object, fss_extended_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The Object to output.");
     fll_program_print_help_option(file, context, fss_extended_write_short_partial, fss_extended_write_long_partial, f_console_symbol_short_enable, f_console_symbol_long_enable, "Do not output end of Object/Content character.");
     fll_program_print_help_option(file, context, fss_extended_write_short_prepend, fss_extended_write_long_prepend, f_console_symbol_short_enable, f_console_symbol_long_enable, "Prepend the given whitespace characters to the start of each multi-line Content.");
@@ -33,24 +34,34 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_extended_write_name, "");
 
-    printf("  The pipe uses the NULL character '");
-    fl_color_print(f_type_output, context.set.notable, "\\0");
+    printf("  The pipe uses the Backspace character '");
+    fl_color_print(f_type_output, context.set.notable, "\\b");
     printf("' (");
-    fl_color_print(f_type_output, context.set.notable, "U+0000");
-    printf(") to designate the start of a Content and uses the Form Feed character '");
+    fl_color_print(f_type_output, context.set.notable, "U+0008");
+    printf(") to designate the start of a Content.%c", f_string_eol[0]);
+
+    printf("  The pipe uses the Form Feed character '");
     fl_color_print(f_type_output, context.set.notable, "\\f");
     printf("' (");
     fl_color_print(f_type_output, context.set.notable, "U+000C");
     printf(") to designate the end of the last Content.%c", f_string_eol[0]);
-    printf("  For the pipe, an Object is terminated by either a NULL character '");
-    fl_color_print(f_type_output, context.set.notable, "\\0");
+
+    printf("  The pipe uses the Vertical Line character '");
+    fl_color_print(f_type_output, context.set.notable, "\\v");
+    printf("' (");
+    fl_color_print(f_type_output, context.set.notable, "U+000B");
+    printf(") is used to ignore a content range, which does nothing in this program.%c", f_string_eol[0]);
+
+    printf("  For the pipe, an Object is terminated by either a Backspace character '");
+    fl_color_print(f_type_output, context.set.notable, "\\b");
     printf("' (");
-    fl_color_print(f_type_output, context.set.notable, "U+0000");
+    fl_color_print(f_type_output, context.set.notable, "U+0008");
     printf(") or a Form Feed character '");
     fl_color_print(f_type_output, context.set.notable, "\\f");
     printf("' (");
     fl_color_print(f_type_output, context.set.notable, "U+000C");
     printf(").%c", f_string_eol[0]);
+
     printf("  The end of the pipe represents the end of any Object or Content.%c", f_string_eol[0]);
 
     printf("%c", f_string_eol[0]);
@@ -61,6 +72,13 @@ extern "C" {
 
     printf("%c", f_string_eol[0]);
 
+    printf("  This program does not use the parameter '");
+    fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_write_long_ignore);
+    printf("', which therefore does nothing.%c", f_string_eol[0]);
+    printf("  This parameter requires two values.%c", f_string_eol[0]);
+
+    printf("%c", f_string_eol[0]);
+
     return F_none;
   }
 #endif // _di_fss_extended_write_print_help_
@@ -329,6 +347,32 @@ extern "C" {
       }
     }
 
+    if (F_status_is_error_not(status)) {
+      if (data->parameters[fss_extended_write_parameter_ignore].result == f_console_result_found) {
+        if (data->error.verbosity != f_console_verbosity_quiet) {
+          fprintf(data->error.to.stream, "%c", f_string_eol[0]);
+          fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
+          fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_write_long_ignore);
+          fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no values were given.%c", f_string_eol[0]);
+        }
+
+        status = F_status_set_error(F_parameter);
+      }
+      else if (data->parameters[fss_extended_write_parameter_ignore].result == f_console_result_additional) {
+        const f_array_length_t total_locations = data->parameters[fss_extended_write_parameter_ignore].locations.used;
+        const f_array_length_t total_arguments = data->parameters[fss_extended_write_parameter_ignore].additional.used;
+
+        if (total_locations * 2 > total_arguments) {
+          fprintf(data->error.to.stream, "%c", f_string_eol[0]);
+          fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
+          fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_write_long_ignore);
+          fl_color_print(data->error.to.stream, data->context.set.error, "' requires two values.%c", f_string_eol[0]);
+
+          status = F_status_set_error(F_parameter);
+        }
+      }
+    }
+
     f_fss_quote_t quote = f_fss_delimit_quote_double;
 
     if (F_status_is_error_not(status)) {
index 0e9b2356d5cccd130eac69f66c1532a802f1fe4f..d32667fa23128dd49312989e7bb66cbb2c18258f 100644 (file)
@@ -54,12 +54,14 @@ extern "C" {
 #endif // _di_fss_extended_write_name_
 
 #ifndef _di_fss_extended_write_defines_
-  #define fss_extended_write_pipe_content_start '\0'
-  #define fss_extended_write_pipe_content_end   '\f'
+  #define fss_extended_write_pipe_content_end    '\f'
+  #define fss_extended_write_pipe_content_ignore '\v'
+  #define fss_extended_write_pipe_content_start  '\b'
 
   #define fss_extended_write_short_file     "f"
   #define fss_extended_write_short_content  "c"
   #define fss_extended_write_short_double   "d"
+  #define fss_extended_write_short_ignore   "I"
   #define fss_extended_write_short_object   "o"
   #define fss_extended_write_short_partial  "p"
   #define fss_extended_write_short_prepend  "P"
@@ -69,6 +71,7 @@ extern "C" {
   #define fss_extended_write_long_file    "file"
   #define fss_extended_write_long_content "content"
   #define fss_extended_write_long_double  "double"
+  #define fss_extended_write_long_ignore  "ignore"
   #define fss_extended_write_long_object  "object"
   #define fss_extended_write_long_partial "partial"
   #define fss_extended_write_long_prepend "prepend"
@@ -89,6 +92,7 @@ extern "C" {
     fss_extended_write_parameter_file,
     fss_extended_write_parameter_content,
     fss_extended_write_parameter_double,
+    fss_extended_write_parameter_ignore,
     fss_extended_write_parameter_object,
     fss_extended_write_parameter_partial,
     fss_extended_write_parameter_prepend,
@@ -110,6 +114,7 @@ extern "C" {
       f_console_parameter_t_initialize(fss_extended_write_short_file, fss_extended_write_long_file, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_extended_write_short_content, fss_extended_write_long_content, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_extended_write_short_double, fss_extended_write_long_double, 0, 0, f_console_type_normal), \
+      f_console_parameter_t_initialize(fss_extended_write_short_ignore, fss_extended_write_long_ignore, 0, 2, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_extended_write_short_object, fss_extended_write_long_object, 0, 1, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_extended_write_short_partial, fss_extended_write_long_partial, 0, 0, f_console_type_normal), \
       f_console_parameter_t_initialize(fss_extended_write_short_prepend, fss_extended_write_long_prepend, 0, 1, f_console_type_normal), \
@@ -117,7 +122,7 @@ extern "C" {
       f_console_parameter_t_initialize(fss_extended_write_short_trim, fss_extended_write_long_trim, 0, 0, f_console_type_normal), \
     }
 
-  #define fss_extended_write_total_parameters 17
+  #define fss_extended_write_total_parameters 18
 #endif // _di_fss_extended_write_defines_
 
 #ifndef _di_fss_extended_write_data_t_
index b95a86bab36ee32e07bc49d00c812bc3191c800f..7e8dc4d3b6c29a773c10f10196508630a2a91362 100644 (file)
@@ -218,6 +218,11 @@ extern "C" {
             break;
           }
 
+          if (block.string[range.start] == fss_extended_write_pipe_content_ignore) {
+            // this is not used by objects.
+            continue;
+          }
+
           object.string[object.used++] = block.string[range.start];
         } // for
 
@@ -268,12 +273,19 @@ extern "C" {
               contents.used++;
               continue;
             }
-            else if (block.string[range.start] == fss_extended_write_pipe_content_end) {
+
+            if (block.string[range.start] == fss_extended_write_pipe_content_end) {
               state = 0x4;
               range.start++;
               break;
             }
-            else if (F_status_set_fine(status) == F_none_eol) {
+
+            if (block.string[range.start] == fss_extended_write_pipe_content_ignore) {
+              // this is not used by this program.
+              continue;
+            }
+
+            if (F_status_set_fine(status) == F_none_eol) {
               fss_extended_write_error_parameter_unsupported_eol_print(data);
 
               status = F_status_set_error(F_unsupported);
index 49522b455072cd1c3768d12bfaefd87c70128707..d12b25cc708830c003a8a20c4654bff156cd1c32 100644 (file)
@@ -70,10 +70,10 @@ extern "C" {
  *   This is either single our double quote.
  * @param object
  *   A pointer to the object to validate and print.
- *   Set to 0 to disable.
+ *   Set pointer address to 0 to not use.
  * @param content
  *   A pointer to the  content to escape and print.
- *   Set to 0 to disable.
+ *   Set pointer address to 0 to not use.
  * @param buffer
  *   The buffer array used as a cache to construct the output before printing.
  *