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).
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
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);
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);
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);
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);
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);
#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"
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.");
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]);
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_
}
}
+ 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)) {
#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"
#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"
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,
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), \
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_
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
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
* 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.
*
#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"
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.");
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]);
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_
}
}
+ 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)) {
#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"
#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"
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,
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), \
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_
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
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);
* 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.
*
#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"
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.");
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);
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_
}
}
+ 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)) {
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) {
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)) {
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
}
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;
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
}
}
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;
// 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>
#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"
#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"
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,
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), \
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_
#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;
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);
#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;
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;
content.used = 0;
state = 0x1;
+
+ range_ignore.start = 1;
+ range_ignore.stop = 0;
}
if (object.used + block.used > object.size) {
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
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
}
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;
// 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);
}
#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
* 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.
*
* 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_
/**
* 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
#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"
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.");
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]);
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_
}
}
+ 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)) {
#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"
#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"
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,
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), \
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_
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
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);
* 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.
*