From 6eea9534544a4955bdb5ec459824610b0c180a61 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 6 Feb 2022 21:42:46 -0600 Subject: [PATCH] Progress: Continue mass converting to f_string_static_t. This includes some performance tweaks based on the previous commit in regards to file stream read inefficiency. --- level_0/f_file/c/file.c | 5 +- level_3/fss_basic_list_read/c/common.c | 10 ++ level_3/fss_basic_list_read/c/common.h | 52 ++++++--- .../fss_basic_list_read/c/fss_basic_list_read.c | 127 +++++++++------------ level_3/fss_basic_list_read/c/main.c | 2 +- level_3/fss_basic_list_read/c/private-common.h | 13 ++- level_3/fss_basic_list_read/c/private-print.c | 16 +-- level_3/fss_basic_list_read/c/private-read.c | 99 ++++++++-------- level_3/fss_basic_list_read/c/private-read.h | 48 ++++---- .../fss_basic_list_write/c/fss_basic_list_write.c | 6 +- level_3/fss_basic_list_write/c/private-common.h | 4 +- level_3/fss_basic_read/c/common.c | 8 ++ level_3/fss_basic_read/c/common.h | 28 +++-- level_3/fss_basic_read/c/fss_basic_read.c | 70 ++++++------ level_3/fss_basic_read/c/private-common.h | 10 +- level_3/fss_basic_read/c/private-print.c | 18 +-- level_3/fss_basic_read/c/private-read.c | 6 +- level_3/fss_basic_write/c/fss_basic_write.c | 4 +- level_3/fss_basic_write/c/private-common.h | 4 +- level_3/fss_embedded_list_read/c/common.c | 8 ++ level_3/fss_embedded_list_read/c/common.h | 23 ++-- .../c/fss_embedded_list_read.c | 62 +++++----- level_3/fss_embedded_list_read/c/private-common.h | 4 +- level_3/fss_embedded_list_read/c/private-print.c | 18 +-- .../c/fss_embedded_list_write.c | 10 +- level_3/fss_embedded_list_write/c/private-common.h | 4 +- level_3/fss_extended_list_read/c/common.c | 8 ++ level_3/fss_extended_list_read/c/common.h | 28 +++-- .../c/fss_extended_list_read.c | 70 ++++++------ level_3/fss_extended_list_read/c/private-common.h | 10 +- level_3/fss_extended_list_read/c/private-print.c | 18 +-- level_3/fss_extended_list_read/c/private-read.c | 4 +- .../c/fss_extended_list_write.c | 10 +- level_3/fss_extended_list_write/c/private-common.h | 4 +- level_3/fss_extended_read/c/common.c | 8 ++ level_3/fss_extended_read/c/common.h | 28 +++-- level_3/fss_extended_read/c/fss_extended_read.c | 70 ++++++------ level_3/fss_extended_read/c/main.c | 2 +- level_3/fss_extended_read/c/private-common.h | 10 +- level_3/fss_extended_read/c/private-print.c | 32 +++--- level_3/fss_extended_read/c/private-read.c | 4 +- level_3/fss_extended_write/c/fss_extended_write.c | 4 +- level_3/fss_extended_write/c/private-common.h | 4 +- level_3/fss_identify/c/fss_identify.c | 12 +- level_3/fss_payload_read/c/common.c | 8 ++ level_3/fss_payload_read/c/common.h | 28 +++-- level_3/fss_payload_read/c/fss_payload_read.c | 75 ++++++------ level_3/fss_payload_read/c/private-common.h | 10 +- level_3/fss_payload_read/c/private-print.c | 28 ++--- level_3/fss_payload_read/c/private-read.c | 6 +- level_3/fss_payload_write/c/fss_payload_write.c | 6 +- level_3/fss_payload_write/c/private-common.h | 4 +- level_3/iki_read/c/iki_read.c | 13 ++- 53 files changed, 604 insertions(+), 559 deletions(-) diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index 50ba7fb..1e2f35f 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -1511,7 +1511,7 @@ extern "C" { f_status_t status = F_none; ssize_t size_read = 0; - for (;;) { + do { status = f_string_dynamic_increase_by(file.size_read, buffer); if (F_status_is_error(status)) return status; @@ -1532,8 +1532,7 @@ extern "C" { buffer->used += size_read; - if (size_read < file.size_read) break; - } // for + } while (size_read == file.size_read); return F_none_eof; } diff --git a/level_3/fss_basic_list_read/c/common.c b/level_3/fss_basic_list_read/c/common.c index bceee12..966d145 100644 --- a/level_3/fss_basic_list_read/c/common.c +++ b/level_3/fss_basic_list_read/c/common.c @@ -14,6 +14,8 @@ extern "C" { #endif // _di_fss_basic_list_read_program_name_ #ifndef _di_fss_basic_list_read_defines_ + const f_string_static_t fss_basic_list_read_pipe_name_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_pipe_name_s, 0, FSS_BASIC_LIST_READ_pipe_name_s_length); + const f_string_static_t fss_basic_list_read_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_pipe_content_end_s, 0, FSS_BASIC_LIST_READ_pipe_content_end_s_length); const f_string_static_t fss_basic_list_read_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_pipe_content_ignore_s, 0, FSS_BASIC_LIST_READ_pipe_content_ignore_s_length); const f_string_static_t fss_basic_list_read_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_pipe_content_start_s, 0, FSS_BASIC_LIST_READ_pipe_content_start_s_length); @@ -51,6 +53,14 @@ extern "C" { const f_string_static_t fss_basic_list_read_long_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_long_trim_s, 0, FSS_BASIC_LIST_READ_long_trim_s_length); #endif // _di_fss_basic_list_read_parameters_ +#ifndef _di_fss_basic_list_read_delimit_mode_ + const f_string_static_t fss_basic_list_read_delimit_mode_name_none_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_delimit_mode_name_none_s, 0, FSS_BASIC_LIST_READ_delimit_mode_name_none_s_length); + const f_string_static_t fss_basic_list_read_delimit_mode_name_all_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_delimit_mode_name_all_s, 0, FSS_BASIC_LIST_READ_delimit_mode_name_all_s_length); + const f_string_static_t fss_basic_list_read_delimit_mode_name_object_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_delimit_mode_name_object_s, 0, FSS_BASIC_LIST_READ_delimit_mode_name_object_s_length); + const f_string_static_t fss_basic_list_read_delimit_mode_name_greater_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_delimit_mode_name_greater_s, 0, FSS_BASIC_LIST_READ_delimit_mode_name_greater_s_length); + const f_string_static_t fss_basic_list_read_delimit_mode_name_lesser_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_READ_delimit_mode_name_lesser_s, 0, FSS_BASIC_LIST_READ_delimit_mode_name_lesser_s_length); +#endif // _di_fss_basic_list_read_delimit_mode_ + #ifndef _di_fss_basic_list_read_main_delete_ f_status_t fss_basic_list_read_main_delete(fll_program_data_t * const main) { diff --git a/level_3/fss_basic_list_read/c/common.h b/level_3/fss_basic_list_read/c/common.h index 3828405..83e71a1 100644 --- a/level_3/fss_basic_list_read/c/common.h +++ b/level_3/fss_basic_list_read/c/common.h @@ -38,11 +38,11 @@ extern "C" { #define FSS_BASIC_LIST_READ_program_version_nano_s_length 0 #endif // !(defined(FSS_BASIC_LIST_READ_program_version_nano_s) && defined(FSS_BASIC_LIST_READ_program_version_nano_s_length)) - #define FSS_BASIC_LIST_READ_program_version_s FSS_BASIC_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_BASIC_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_BASIC_LIST_READ_program_version_micro_s fss_basic_list_program_version_nano_prefix_s FSS_BASIC_LIST_READ_program_version_nano_s + #define FSS_BASIC_LIST_READ_program_version_s FSS_BASIC_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_BASIC_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_BASIC_LIST_READ_program_version_micro_s FSS_BASIC_LIST_READ_program_version_nano_prefix_s FSS_BASIC_LIST_READ_program_version_nano_s - #define FSS_BASIC_LIST_READ_program_version_s_length FSS_BASIC_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_READ_program_version_micro_s_length + fss_basic_list_program_version_nano_prefix_s_length + FSS_BASIC_LIST_READ_program_version_nano_s_length + #define FSS_BASIC_LIST_READ_program_version_s_length FSS_BASIC_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_READ_program_version_micro_s_length + FSS_BASIC_LIST_READ_program_version_nano_prefix_s_length + FSS_BASIC_LIST_READ_program_version_nano_s_length - extern const f_string_static_t fss_basic_list_program_version_s; + extern const f_string_static_t fss_basic_list_read_program_version_s; #endif // _di_fss_basic_list_read_program_version_ /** @@ -55,24 +55,36 @@ extern "C" { #define FSS_BASIC_LIST_READ_program_name_s_length 19 #define FSS_BASIC_LIST_READ_program_name_long_s_length 19 - extern const f_string_static_t fss_basic_list_program_name_s; - extern const f_string_static_t fss_basic_list_program_name_long_s; + extern const f_string_static_t fss_basic_list_read_program_name_s; + extern const f_string_static_t fss_basic_list_read_program_name_long_s; #endif // _di_fss_basic_list_read_program_name_ /** * The program defines. + * + * fss_basic_list_read_pipe_*: + * - name: A name used to represent the pipe when printing file names. + * - content_end: A code used to reprsent the end of Content for use in binary formats. + * - content_ignore: A code used to reprsent the ignoring Content for use in binary formats. + * - content_start: A code used to reprsent the start of Content for use in binary formats. */ #ifndef _di_fss_basic_list_read_defines_ #define fss_basic_list_read_signal_check_d 10000 + #define FSS_BASIC_LIST_READ_pipe_name_s "(pipe)" + #define FSS_BASIC_LIST_READ_pipe_content_end_s "\f" #define FSS_BASIC_LIST_READ_pipe_content_ignore_s "\v" #define FSS_BASIC_LIST_READ_pipe_content_start_s "\b" + #define FSS_BASIC_LIST_READ_pipe_name_s_length 6 + #define FSS_BASIC_LIST_READ_pipe_content_end_s_length 1 #define FSS_BASIC_LIST_READ_pipe_content_ignore_s_length 1 #define FSS_BASIC_LIST_READ_pipe_content_start_s_length 1 + extern const f_string_static_t fss_basic_list_read_pipe_name_s; + extern const f_string_static_t fss_basic_list_read_pipe_content_end_s; extern const f_string_static_t fss_basic_list_read_pipe_content_ignore_s; extern const f_string_static_t fss_basic_list_read_pipe_content_start_s; @@ -226,7 +238,7 @@ extern "C" { macro_f_console_parameter_t_initialize(fss_basic_list_read_short_trim_s.string, fss_basic_list_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \ } - #define fss_basic_list_total_parameters_d 23 + #define fss_basic_list_read_total_parameters_d 23 #endif // _di_fss_basic_list_read_parameters_ /** @@ -243,17 +255,23 @@ extern "C" { * - object: Objects arre to have delimits applied. */ #ifndef _di_fss_basic_list_read_delimit_mode_ - #define fss_basic_list_read_delimit_mode_name_none_s "none" - #define fss_basic_list_read_delimit_mode_name_all_s "all" - #define fss_basic_list_read_delimit_mode_name_object_s "object" - #define fss_basic_list_read_delimit_mode_name_greater_s "+" - #define fss_basic_list_read_delimit_mode_name_lesser_s "-" - - #define fss_basic_list_read_delimit_mode_name_none_s_length 4 - #define fss_basic_list_read_delimit_mode_name_all_s_length 3 - #define fss_basic_list_read_delimit_mode_name_object_s_length 6 - #define fss_basic_list_read_delimit_mode_name_greater_s_length 1 - #define fss_basic_list_read_delimit_mode_name_lesser_s_length 1 + #define FSS_BASIC_LIST_READ_delimit_mode_name_none_s "none" + #define FSS_BASIC_LIST_READ_delimit_mode_name_all_s "all" + #define FSS_BASIC_LIST_READ_delimit_mode_name_object_s "object" + #define FSS_BASIC_LIST_READ_delimit_mode_name_greater_s "+" + #define FSS_BASIC_LIST_READ_delimit_mode_name_lesser_s "-" + + #define FSS_BASIC_LIST_READ_delimit_mode_name_none_s_length 4 + #define FSS_BASIC_LIST_READ_delimit_mode_name_all_s_length 3 + #define FSS_BASIC_LIST_READ_delimit_mode_name_object_s_length 6 + #define FSS_BASIC_LIST_READ_delimit_mode_name_greater_s_length 1 + #define FSS_BASIC_LIST_READ_delimit_mode_name_lesser_s_length 1 + + extern const f_string_static_t fss_basic_list_read_delimit_mode_name_none_s; + extern const f_string_static_t fss_basic_list_read_delimit_mode_name_all_s; + extern const f_string_static_t fss_basic_list_read_delimit_mode_name_object_s; + extern const f_string_static_t fss_basic_list_read_delimit_mode_name_greater_s; + extern const f_string_static_t fss_basic_list_read_delimit_mode_name_lesser_s; enum { fss_basic_list_read_delimit_mode_none_e = 1, diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index a3ced28..91636e4 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -12,7 +12,7 @@ extern "C" { flockfile(file.stream); - fll_program_print_help_header(file, context, fss_basic_list_program_name_long_s, fss_basic_list_program_version_s); + fll_program_print_help_header(file, context, fss_basic_list_read_program_name_long_s, fss_basic_list_read_program_version_s); fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds."); @@ -41,7 +41,7 @@ extern "C" { fll_program_print_help_option(file, context, fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines."); fll_program_print_help_option(file, context, fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print."); - fll_program_print_help_usage(file, context, fss_basic_list_program_name_s, fll_program_parameter_filenames_s); + fll_program_print_help_usage(file, context, fss_basic_list_read_program_name_s, fll_program_parameter_filenames_s); fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s); @@ -50,63 +50,63 @@ extern "C" { fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%r", file.stream, f_string_eol_s); fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When using the %[%r%s%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" When using the %[%r%r%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%r", file.stream, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%r", file.stream, f_string_eol_s); fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Specify both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_object_s, context.set.notable); - fl_print_format(" and the %[%r%s%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" Specify both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_object_s, context.set.notable); + fl_print_format(" and the %[%r%r%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" When both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at_s, context.set.notable); - fl_print_format(" and %[%r%s%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name_s, context.set.notable); - fl_print_format(" the %[%r%s%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at_s, context.set.notable); - fl_print_format(" %[%s%s%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at_s, context.set.notable); + fl_print_format(" and %[%r%r%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name_s, context.set.notable); + fl_print_format(" the %[%r%r%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at_s, context.set.notable); + fl_print_format(" %[%r%r%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" This program may support parameters, such as %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable); - fl_print_format(" or %[%r%s%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable, f_string_eol_s); + fl_print_format(" This program may support parameters, such as %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable); + fl_print_format(" or %[%r%r%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable, f_string_eol_s); fl_print_format(" This is done to help ensure consistency for scripting.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable); fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%r", file.stream, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable); fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_trim_s, context.set.notable); + fl_print_format(" The parameter %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_trim_s, context.set.notable); fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When specifying both the %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_object_s, context.set.notable); - fl_print_format(" parameter and the %[%r%s%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_content_s, context.set.notable, f_string_eol_s); + fl_print_format(" When specifying both the %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_object_s, context.set.notable); + fl_print_format(" parameter and the %[%r%r%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_content_s, context.set.notable, f_string_eol_s); fl_print_format(" Both the Object and Content printed are already escaped.%r", file.stream, f_string_eol_s); fl_print_format(" Both the Object and Content are separated by an EOL.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_object_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_object_s, context.set.notable, f_string_eol_s); fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%r", file.stream, f_string_eol_s); - fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or greater, followed by a %[%r%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or lesser, followed by a %[%r%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%r%s%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" The %[%r%r%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" The %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, context.set.notable); - fl_print_format(" values %[%s%]", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_none_s, context.set.notable); - fl_print_format(" and %[%s%],", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_all_s, context.set.notable); + fl_print_format(" The %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, context.set.notable); + fl_print_format(" values %[%r%]", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_none_s, context.set.notable); + fl_print_format(" and %[%r%],", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_all_s, context.set.notable); fl_print_format(" overrule all other delimit values.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameters %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns_s, context.set.notable); - fl_print_format(" and %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable); + fl_print_format(" The parameters %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns_s, context.set.notable); + fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable); fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s); fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s); @@ -195,8 +195,6 @@ extern "C" { } } - f_string_static_t * const argv = main->parameters.arguments.array; - status = F_none; if (main->parameters.array[fss_basic_list_read_parameter_help_e].result == f_console_result_found_e) { @@ -208,7 +206,7 @@ extern "C" { } if (main->parameters.array[fss_basic_list_read_parameter_version_e].result == f_console_result_found_e) { - fll_program_print_version(main->output.to, fss_basic_list_program_version_s); + fll_program_print_version(main->output.to, fss_basic_list_read_program_version_s); fss_basic_list_read_main_delete(main); @@ -219,10 +217,11 @@ extern "C" { fss_basic_list_read_file_t files_array[main->parameters.remaining.used + 1]; fss_basic_list_read_data_t data = fss_basic_list_read_data_t_initialize; + data.argv = main->parameters.arguments.array; data.files.array = files_array; data.files.used = 1; data.files.size = main->parameters.remaining.used + 1; - data.files.array[0].name = "(pipe)"; + data.files.array[0].name = fss_basic_list_read_pipe_name_s; data.files.array[0].range.start = 1; data.files.array[0].range.stop = 0; @@ -286,7 +285,7 @@ extern "C" { fss_basic_list_read_parameter_total_e, }; - const f_string_t parameter_name[] = { + const f_string_static_t parameter_name[] = { fss_basic_list_read_long_depth_s, fss_basic_list_read_long_line_s, fss_basic_list_read_long_pipe_s, @@ -372,7 +371,7 @@ extern "C" { } index = main->parameters.array[fss_basic_list_read_parameter_delimit_e].values.array[i]; - length = argv[index].used; + length = data.argv[index].used; if (!length) { flockfile(main->error.to.stream); @@ -387,13 +386,13 @@ extern "C" { break; } - else if (fl_string_dynamic_compare_string(fss_basic_list_read_delimit_mode_name_none_s.string, argv[index], fss_basic_list_read_delimit_mode_name_none_s.used) == F_equal_to) { + else if (fl_string_dynamic_compare_string(fss_basic_list_read_delimit_mode_name_none_s.string, data.argv[index], fss_basic_list_read_delimit_mode_name_none_s.used) == F_equal_to) { data.delimit_mode = fss_basic_list_read_delimit_mode_none_e; } - else if (fl_string_dynamic_compare_string(fss_basic_list_read_delimit_mode_name_all_s.string, argv[index], fss_basic_list_read_delimit_mode_name_all_s.used) == F_equal_to) { + else if (fl_string_dynamic_compare_string(fss_basic_list_read_delimit_mode_name_all_s.string, data.argv[index], fss_basic_list_read_delimit_mode_name_all_s.used) == F_equal_to) { data.delimit_mode = fss_basic_list_read_delimit_mode_all_e; } - else if (fl_string_dynamic_compare_string(fss_basic_list_read_delimit_mode_name_object_s.string, argv[index], fss_basic_list_read_delimit_mode_name_object_s.used) == F_equal_to) { + else if (fl_string_dynamic_compare_string(fss_basic_list_read_delimit_mode_name_object_s.string, data.argv[index], fss_basic_list_read_delimit_mode_name_object_s.used) == F_equal_to) { switch (data.delimit_mode) { case 0: data.delimit_mode = fss_basic_list_read_delimit_mode_object_e; @@ -430,7 +429,7 @@ extern "C" { data.delimit_mode = fss_basic_list_read_delimit_mode_content_object_e; } - if (argv[index][length - 1] == fss_basic_list_read_delimit_mode_name_greater_s.string[0]) { + if (data.argv[index].string[length - 1] == fss_basic_list_read_delimit_mode_name_greater_s.string[0]) { if (!(data.delimit_mode == fss_basic_list_read_delimit_mode_none_e || data.delimit_mode == fss_basic_list_read_delimit_mode_all_e)) { if (data.delimit_mode == fss_basic_list_read_delimit_mode_content_object_e) { data.delimit_mode = fss_basic_list_read_delimit_mode_content_greater_object_e; @@ -443,7 +442,7 @@ extern "C" { // Shorten the length to better convert the remainder to a number. --length; } - else if (argv[index][length - 1] == fss_basic_list_read_delimit_mode_name_lesser_s.string[0]) { + else if (data.argv[index].string[length - 1] == fss_basic_list_read_delimit_mode_name_lesser_s.string[0]) { if (!(data.delimit_mode == fss_basic_list_read_delimit_mode_none_e || data.delimit_mode == fss_basic_list_read_delimit_mode_all_e)) { if (data.delimit_mode == fss_basic_list_read_delimit_mode_content_object_e) { data.delimit_mode = fss_basic_list_read_delimit_mode_content_lesser_object_e; @@ -460,14 +459,14 @@ extern "C" { f_string_range_t range = macro_f_string_range_t_initialize(length); // Ignore leading plus sign. - if (argv[index][0] == f_string_ascii_plus_s[0]) { + if (data.argv[index].string[0] == f_string_ascii_plus_s.string[0]) { ++range.start; } - status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &data.delimit_depth); + status = fl_conversion_string_to_number_unsigned(data.argv[index].string, range, &data.delimit_depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_delimit_s, argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_delimit_s, data.argv[index]); break; } @@ -493,11 +492,11 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = fss_basic_list_read_depth_process(main, arguments, &data); + status = fss_basic_list_read_depth_process(main, &data); } // This standard does not support nesting, so any depth greater than 0 can be predicted without processing the file. - if (F_status_is_error_not(status) && data.depths.array[0].depth > 0) { + if (F_status_is_error_not(status) && data.depths.array[0].depth) { if (main->parameters.array[fss_basic_list_read_parameter_total_e].result == f_console_result_found_e) { fss_basic_list_read_print_zero(main); } @@ -517,17 +516,9 @@ extern "C" { funlockfile(main->error.to.stream); - fss_basic_list_read_depths_resize(0, &data.depths); - status = F_status_set_error(F_parameter); } - if (F_status_is_error_not(status)) { - for (f_array_length_t i = 0; i < data.files.used; ++i) { - macro_f_string_range_t_clear(data.files.array[i].range); - } // for - } - if (F_status_is_error_not(status) && main->process_pipe) { f_file_t file = f_file_t_initialize; @@ -557,7 +548,7 @@ extern "C" { } } - if (F_status_is_error_not(status) && main->parameters.remaining.used > 0) { + if (F_status_is_error_not(status) && main->parameters.remaining.used) { f_file_t file = f_file_t_initialize; f_array_length_t size_file = 0; uint16_t signal_check = 0; @@ -574,14 +565,15 @@ extern "C" { signal_check = 0; } + data.files.array[data.files.used].name = data.argv[main->parameters.remaining.array[i]]; data.files.array[data.files.used].range.start = data.buffer.used; file.stream = 0; file.id = -1; - status = f_file_stream_open(argv[main->parameters.remaining.array[i]], 0, &file); + status = f_file_stream_open(data.files.array[data.files.used].name, f_string_empty_s, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); break; } @@ -590,29 +582,22 @@ extern "C" { status = f_file_size_by_id(file.id, &size_file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } if (size_file) { - status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); - - break; - } + file.size_read = size_file + 1; status = f_file_stream_read(file, &data.buffer); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); break; } else if (data.buffer.used > data.files.array[data.files.used].range.start) { - data.files.array[data.files.used].name = argv[main->parameters.remaining.array[i]]; data.files.array[data.files.used++].range.stop = data.buffer.used - 1; // This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter. @@ -635,7 +620,7 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = fss_basic_list_read_process(main, arguments, &data); + status = fss_basic_list_read_process(main, &data); } fss_basic_list_read_data_delete_simple(&data); diff --git a/level_3/fss_basic_list_read/c/main.c b/level_3/fss_basic_list_read/c/main.c index c758ed4..29831b8 100644 --- a/level_3/fss_basic_list_read/c/main.c +++ b/level_3/fss_basic_list_read/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { f_console_arguments_t arguments = { argc, argv }; - fll_program_data_t data = fss_basic_list_read_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/fss_basic_list_read/c/private-common.h b/level_3/fss_basic_list_read/c/private-common.h index be183e5..46e122b 100644 --- a/level_3/fss_basic_list_read/c/private-common.h +++ b/level_3/fss_basic_list_read/c/private-common.h @@ -20,8 +20,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_basic_list_read_common_ - #define fss_basic_list_common_allocation_large_d 256 - #define fss_basic_list_read_common_allocation_small_d 16 + #define fss_basic_list_read_common_allocation_large_d 2048 + #define fss_basic_list_read_common_allocation_small_d 128 #endif // _di_fss_basic_list_read_common_ /** @@ -86,18 +86,18 @@ extern "C" { /** * A structure for designating where within the buffer a particular file exists, using a statically allocated array. * - * name: The name of the file representing the range. Set string to NULL to represent the STDIN pipe. + * name: The name of the file representing the range. * range: A range within the buffer representing the file. */ #ifndef _di_fss_basic_list_read_file_t_ typedef struct { - f_string_t name; + f_string_static_t name; f_string_range_t range; } fss_basic_list_read_file_t; #define fss_basic_list_read_file_t_initialize \ { \ - f_string_t_initialize, \ + f_string_static_t_initialize, \ f_string_range_t_initialize, \ } #endif // _di_fss_basic_list_read_file_t_ @@ -173,6 +173,8 @@ extern "C" { f_number_unsigned_t select; f_number_unsigned_t line; + f_string_static_t *argv; + fss_basic_list_read_files_t files; fss_basic_list_read_depths_t depths; @@ -192,6 +194,7 @@ extern "C" { 0, \ 0, \ 0, \ + 0, \ fss_basic_list_read_files_t_initialize, \ fss_basic_list_read_depths_t_initialize, \ f_string_dynamic_t_initialize, \ diff --git a/level_3/fss_basic_list_read/c/private-print.c b/level_3/fss_basic_list_read/c/private-print.c index 67a7339..3145a58 100644 --- a/level_3/fss_basic_list_read/c/private-print.c +++ b/level_3/fss_basic_list_read/c/private-print.c @@ -66,7 +66,7 @@ extern "C" { void fss_basic_list_read_print_content_ignore(fll_program_data_t * const main) { if (main->parameters.array[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_basic_list_read_pipe_content_ignore_s, main->output.to.stream); + f_print_dynamic_raw(fss_basic_list_read_pipe_content_ignore_s, main->output.to.stream); } } #endif // _di_fss_basic_list_read_print_content_ignore_ @@ -75,15 +75,15 @@ extern "C" { void fss_basic_list_read_print_object_end(fll_program_data_t * const main) { if (main->parameters.array[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_basic_list_read_pipe_content_start_s, main->output.to.stream); + f_print_dynamic_raw(fss_basic_list_read_pipe_content_start_s, main->output.to.stream); } else { if (main->parameters.array[fss_basic_list_read_parameter_content_e].result == f_console_result_found_e) { - f_print_character(f_fss_basic_list_open_s.string[0], main->output.to.stream); - f_print_character(f_fss_basic_list_open_end_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_basic_list_open_s, main->output.to.stream); + f_print_dynamic_raw(f_fss_basic_list_open_end_s, main->output.to.stream); } else { - f_print_character(f_fss_eol_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_eol_s, main->output.to.stream); } } } @@ -93,7 +93,7 @@ extern "C" { void fss_basic_list_read_print_set_end(fll_program_data_t * const main) { if (main->parameters.array[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_basic_list_read_pipe_content_end_s, main->output.to.stream); + f_print_dynamic_raw(fss_basic_list_read_pipe_content_end_s, main->output.to.stream); } } #endif // _di_fss_basic_list_read_print_set_end_ @@ -101,7 +101,7 @@ extern "C" { #ifndef _di_fss_basic_list_read_print_one_ void fss_basic_list_read_print_one(fll_program_data_t * const main) { - f_print_character(f_string_ascii_1_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_string_ascii_1_s, main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); } #endif // _di_fss_basic_list_read_print_one_ @@ -109,7 +109,7 @@ extern "C" { #ifndef _di_fss_basic_list_read_print_zero_ void fss_basic_list_read_print_zero(fll_program_data_t * const main) { - f_print_character(f_string_ascii_0_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_string_ascii_0_s, main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); } #endif // _di_fss_basic_list_read_print_zero_ diff --git a/level_3/fss_basic_list_read/c/private-read.c b/level_3/fss_basic_list_read/c/private-read.c index e26fbc5..aab60ae 100644 --- a/level_3/fss_basic_list_read/c/private-read.c +++ b/level_3/fss_basic_list_read/c/private-read.c @@ -8,7 +8,7 @@ extern "C" { #endif #ifndef _di_fss_basic_list_read_delimit_content_is_ - f_status_t fss_basic_list_read_delimit_content_is(const f_array_length_t depth, fss_basic_list_read_data_t * const data) { + f_status_t fss_basic_list_read_delimit_content_is(fss_basic_list_read_data_t * const data, const f_array_length_t depth) { if (data->delimit_mode == fss_basic_list_read_delimit_mode_none_e) { return F_false; @@ -31,7 +31,7 @@ extern "C" { #endif // _di_fss_basic_list_read_delimit_content_is_ #ifndef _di_fss_basic_list_read_delimit_object_is_ - f_status_t fss_basic_list_read_delimit_object_is(const f_array_length_t depth, fss_basic_list_read_data_t * const data) { + f_status_t fss_basic_list_read_delimit_object_is(fss_basic_list_read_data_t * const data, const f_array_length_t depth) { switch (data->delimit_mode) { case fss_basic_list_read_delimit_mode_none_e: @@ -56,7 +56,7 @@ extern "C" { #endif // _di_fss_basic_list_read_delimit_object_is_ #ifndef _di_fss_basic_list_read_depth_process_ - f_status_t fss_basic_list_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) { + f_status_t fss_basic_list_read_depth_process(fll_program_data_t * const main, fss_basic_list_read_data_t * const data) { f_status_t status = F_none; @@ -108,12 +108,12 @@ extern "C" { else { position_depth = main->parameters.array[fss_basic_list_read_parameter_depth_e].values.array[i]; - const f_string_range_t range = macro_f_string_range_t_initialize(strlen(argv[position_depth])); + const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[position_depth].used); - status = fl_conversion_string_to_number_unsigned(argv[position_depth].string, range, &data->depths.array[i].depth); + status = fl_conversion_string_to_number_unsigned(data->argv[position_depth].string, range, &data->depths.array[i].depth); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_depth_s, argv[position_depth]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_depth_s, data->argv[position_depth]); return status; } @@ -132,12 +132,12 @@ extern "C" { data->depths.array[i].index_at = main->parameters.array[fss_basic_list_read_parameter_at_e].values.array[position_at]; - const f_string_range_t range = macro_f_string_range_t_initialize(argv[data->depths.array[i].index_at].used); + const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[data->depths.array[i].index_at].used); - status = fl_conversion_string_to_number_unsigned(argv[data->depths.array[i].index_at].string, range, &data->depths.array[i].value_at); + status = fl_conversion_string_to_number_unsigned(data->argv[data->depths.array[i].index_at].string, range, &data->depths.array[i].value_at); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_at_s, argv[data->depths.array[i].index_at]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_at_s, data->argv[data->depths.array[i].index_at]); return status; } @@ -158,10 +158,10 @@ extern "C" { data->depths.array[i].index_name = main->parameters.array[fss_basic_list_read_parameter_name_e].values.array[position_name]; if (main->parameters.array[fss_basic_list_read_parameter_trim_e].result == f_console_result_found_e) { - status = fl_string_dynamic_rip(argv[data->depths.array[i].index_name], &data->depths.array[i].value_name); + status = fl_string_rip(data->argv[data->depths.array[i].index_name].string, data->argv[data->depths.array[i].index_name].used, &data->depths.array[i].value_name); } else { - status = f_string_dynamic_append(argv[data->depths.array[i].index_name], &data->depths.array[i].value_name); + status = f_string_dynamic_append(data->argv[data->depths.array[i].index_name], &data->depths.array[i].value_name); } if (F_status_is_error(status)) { @@ -226,7 +226,7 @@ extern "C" { #endif // _di_fss_basic_list_read_depth_process_ #ifndef _di_fss_basic_list_read_file_identify_ - f_string_t fss_basic_list_read_file_identify(const f_array_length_t at, const fss_basic_list_read_files_t files) { + f_string_static_t fss_basic_list_read_file_identify(const f_array_length_t at, const fss_basic_list_read_files_t files) { for (f_array_length_t i = 0; i < files.used; ++i) { @@ -240,14 +240,14 @@ extern "C" { return files.array[files.used - 1].name; } - return ""; + return f_string_empty_s; } #endif // _di_fss_basic_list_read_file_identify_ #ifndef _di_fss_basic_list_read_load_ - f_status_t fss_basic_list_read_load(fll_program_data_t * const main, fss_basic_list_read_data_t *data) { + f_status_t fss_basic_list_read_load(fll_program_data_t * const main, fss_basic_list_read_data_t * const data) { - f_state_t state = macro_f_state_t_initialize(fss_basic_list_common_allocation_large_d, fss_basic_list_read_common_allocation_small_d, 0, 0, 0, 0, 0); + f_state_t state = macro_f_state_t_initialize(fss_basic_list_read_common_allocation_large_d, fss_basic_list_read_common_allocation_small_d, 0, 0, 0, 0, 0); f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used); data->delimits_object.used = 0; @@ -256,9 +256,7 @@ extern "C" { const f_status_t status = fll_fss_basic_list_read(data->buffer, state, &input, &data->objects, &data->contents, &data->delimits_object, &data->delimits_content, &data->comments); if (F_status_is_error(status)) { - const f_string_t file_name = fss_basic_list_read_file_identify(input.start, data->files); - - fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, file_name, f_file_operation_process_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, fss_basic_list_read_file_identify(input.start, data->files), f_file_operation_process_s, fll_error_file_type_file_e); return status; } @@ -282,16 +280,16 @@ extern "C" { #endif // _di_fss_basic_list_read_load_ #ifndef _di_fss_basic_list_read_load_number_ - f_status_t fss_basic_list_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) { + f_status_t fss_basic_list_read_load_number(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_number_unsigned_t *number) { if (main->parameters.array[parameter].result == f_console_result_additional_e) { const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1]; - const f_string_range_t range = macro_f_string_range_t_initialize(main->argv[index].used); + const f_string_range_t range = macro_f_string_range_t_initialize(data->argv[index].used); - const f_status_t status = fl_conversion_string_to_number_unsigned(main->argv[index].string, range, number); + const f_status_t status = fl_conversion_string_to_number_unsigned(data->argv[index].string, range, number); if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, main->argv[index]); + fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, data->argv[index]); return status; } @@ -304,9 +302,9 @@ extern "C" { #endif // _di_fss_basic_list_read_load_number_ #ifndef _di_fss_basic_list_read_process_ - f_status_t fss_basic_list_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) { + f_status_t fss_basic_list_read_process(fll_program_data_t * const main, fss_basic_list_read_data_t * const data) { - f_status_t status = fss_basic_list_read_process_option(main, arguments, data); + f_status_t status = fss_basic_list_read_process_option(main, data); if (F_status_is_error(status)) return status; // This standard does not support multiple content groups. @@ -347,8 +345,8 @@ extern "C" { } f_array_lengths_t except_none = f_array_lengths_t_initialize; - f_array_lengths_t *delimits_object = fss_basic_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none; - f_array_lengths_t *delimits_content = fss_basic_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none; + f_array_lengths_t *delimits_object = fss_basic_list_read_delimit_object_is(data, 0) ? &data->delimits_object : &except_none; + f_array_lengths_t *delimits_content = fss_basic_list_read_delimit_content_is(data, 0) ? &data->delimits_content : &except_none; uint16_t signal_check = 0; if (data->option & fss_basic_list_read_data_option_raw_d) { @@ -376,7 +374,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_ #ifndef _di_fss_basic_list_read_process_at_ - f_status_t fss_basic_list_read_process_at(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) { + f_status_t fss_basic_list_read_process_at(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, bool names[]) { if (data->depths.array[0].value_at >= data->objects.used) { if (data->option & (fss_basic_list_read_data_option_columns_d | fss_basic_list_read_data_option_total_d)) { @@ -391,8 +389,8 @@ extern "C" { } f_array_lengths_t except_none = f_array_lengths_t_initialize; - f_array_lengths_t *delimits_object = fss_basic_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none; - f_array_lengths_t *delimits_content = fss_basic_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none; + f_array_lengths_t *delimits_object = fss_basic_list_read_delimit_object_is(data, 0) ? &data->delimits_object : &except_none; + f_array_lengths_t *delimits_content = fss_basic_list_read_delimit_content_is(data, 0) ? &data->delimits_content : &except_none; if (data->option & fss_basic_list_read_data_option_raw_d) { delimits_object = &except_none; @@ -419,7 +417,7 @@ extern "C" { if (data->option & fss_basic_list_read_data_option_line_d) { f_array_length_t line = 0; - status = fss_basic_list_read_process_at_line(main, i, *delimits_object, *delimits_content, data, &line); + status = fss_basic_list_read_process_at_line(main, data, i, *delimits_object, *delimits_content, &line); if (status == F_success) return F_none; } else if (data->option & fss_basic_list_read_data_option_columns_d) { @@ -460,7 +458,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_at_ #ifndef _di_fss_basic_list_read_process_at_line_ - f_status_t fss_basic_list_read_process_at_line(fll_program_data_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_basic_list_read_data_t *data, f_array_length_t *line) { + f_status_t fss_basic_list_read_process_at_line(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, f_array_length_t *line) { if (data->option & fss_basic_list_read_data_option_object_d) { if (*line == data->line) { @@ -487,13 +485,10 @@ extern "C" { return F_none; } - f_string_range_t range = f_string_range_t_initialize; + f_string_range_t range = data->contents.array[at].array[0]; f_array_length_t i = 0; uint16_t signal_check = 0; - range.start = data->contents.array[at].array[0].start; - range.stop = data->contents.array[at].array[0].stop; - // This content has no data, do not even check "include empty" because it cannot be counted as a line. if (range.start > range.stop) { return F_none; @@ -564,7 +559,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_at_line_ #ifndef _di_fss_basic_list_read_process_columns_ - f_status_t fss_basic_list_read_process_columns(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) { + f_status_t fss_basic_list_read_process_columns(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, bool names[]) { if (!(data->option & fss_basic_list_read_data_option_content_d)) { flockfile(main->output.to.stream); @@ -579,9 +574,9 @@ extern "C" { f_array_length_t max = 0; uint16_t signal_check = 0; - for (f_array_length_t at = 0; at < data->contents.used; ++at) { + for (f_array_length_t i = 0; i < data->contents.used; ++i) { - if (!names[at]) continue; + if (!names[i]) continue; if (!((++signal_check) % fss_basic_list_read_signal_check_d)) { if (fss_basic_list_read_signal_received(main)) { @@ -591,8 +586,8 @@ extern "C" { signal_check = 0; } - if (data->contents.array[at].used > max) { - max = data->contents.array[at].used; + if (data->contents.array[i].used > max) { + max = data->contents.array[i].used; } } // for @@ -603,11 +598,11 @@ extern "C" { #endif // _di_fss_basic_list_read_process_columns_ #ifndef _di_fss_basic_list_read_process_line_ - f_status_t fss_basic_list_read_process_line(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) { + f_status_t fss_basic_list_read_process_line(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, bool names[]) { f_array_lengths_t except_none = f_array_lengths_t_initialize; - f_array_lengths_t *delimits_object = fss_basic_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none; - f_array_lengths_t *delimits_content = fss_basic_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none; + f_array_lengths_t *delimits_object = fss_basic_list_read_delimit_object_is(data, 0) ? &data->delimits_object : &except_none; + f_array_lengths_t *delimits_content = fss_basic_list_read_delimit_content_is(data, 0) ? &data->delimits_content : &except_none; if (data->option & fss_basic_list_read_data_option_raw_d) { delimits_object = &except_none; @@ -630,7 +625,7 @@ extern "C" { signal_check = 0; } - status = fss_basic_list_read_process_at_line(main, i, *delimits_object, *delimits_content, data, &line); + status = fss_basic_list_read_process_at_line(main, data, i, *delimits_object, *delimits_content, &line); if (status == F_success) break; } // for @@ -644,12 +639,10 @@ extern "C" { f_array_lengths_t except_none = f_array_lengths_t_initialize; if (data->depths.array[0].index_name) { - f_array_length_t i = 0; - memset(names, F_false, sizeof(bool) * data->objects.used); // This standard should always tread selected names as trimmed. - for (i = 0; i < data->objects.used; ++i) { + for (f_array_length_t i = 0; i < data->objects.used; ++i) { if (fl_string_dynamic_partial_compare_except_trim_dynamic(data->depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, data->delimits_object) == F_equal_to) { names[i] = F_true; @@ -665,7 +658,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_name_ #ifndef _di_fss_basic_list_read_process_option_ - f_status_t fss_basic_list_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) { + f_status_t fss_basic_list_read_process_option(fll_program_data_t * const main, fss_basic_list_read_data_t * const data) { f_status_t status = F_none; @@ -688,7 +681,7 @@ extern "C" { if (main->parameters.array[fss_basic_list_read_parameter_line_e].result == f_console_result_additional_e) { data->option |= fss_basic_list_read_data_option_line_d; - status = fss_basic_list_read_load_number(main, fss_basic_list_read_parameter_line_e, fss_basic_list_read_long_line_s, arguments, &data->line); + status = fss_basic_list_read_load_number(main, data, fss_basic_list_read_parameter_line_e, fss_basic_list_read_long_line_s, &data->line); if (F_status_is_error(status)) return status; } @@ -707,7 +700,7 @@ extern "C" { if (main->parameters.array[fss_basic_list_read_parameter_select_e].result == f_console_result_additional_e) { data->option |= fss_basic_list_read_data_option_select_d; - status = fss_basic_list_read_load_number(main, fss_basic_list_read_parameter_select_e, fss_basic_list_read_long_select_s, arguments, &data->select); + status = fss_basic_list_read_load_number(main, data, fss_basic_list_read_parameter_select_e, fss_basic_list_read_long_select_s, &data->select); if (F_status_is_error(status)) return status; } @@ -729,7 +722,7 @@ extern "C" { #endif // _di_fss_basic_list_read_process_option_ #ifndef _di_fss_basic_list_read_process_total_ - f_status_t fss_basic_list_read_process_total(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) { + f_status_t fss_basic_list_read_process_total(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, bool names[]) { f_array_length_t total = 0; f_string_range_t range = f_string_range_t_initialize; @@ -761,9 +754,7 @@ extern "C" { range.stop = data->contents.array[at].array[0].stop; // This content has no data, do not even check "include empty" because it cannot be counted as a line. - if (range.start > range.stop) { - continue; - } + if (range.start > range.stop) continue; for (i = range.start; i <= range.stop; ++i) { diff --git a/level_3/fss_basic_list_read/c/private-read.h b/level_3/fss_basic_list_read/c/private-read.h index 5711d75..3a21d7b 100644 --- a/level_3/fss_basic_list_read/c/private-read.h +++ b/level_3/fss_basic_list_read/c/private-read.h @@ -15,33 +15,33 @@ extern "C" { /** * Determine if the given depth is to be delimited or not for Content. * - * @param depth - * The depth to check. * @param data * The program data. + * @param depth + * The depth to check. * * @return * F_true if to apply delimits. * F_false if to not apply delimits. */ #ifndef _di_fss_basic_list_read_delimit_content_is_ - extern f_status_t fss_basic_list_read_delimit_content_is(const f_array_length_t depth, fss_basic_list_read_data_t * const data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_delimit_content_is(fss_basic_list_read_data_t * const data, const f_array_length_t depth) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_delimit_content_is_ /** * Determine if the given depth is to be delimited or not for an Object. * - * @param depth - * The depth to check. * @param data * The program data. + * @param depth + * The depth to check. * * @return * F_true if to apply delimits. * F_false if to not apply delimits. */ #ifndef _di_fss_basic_list_read_delimit_object_is_ - extern f_status_t fss_basic_list_read_delimit_object_is(const f_array_length_t depth, fss_basic_list_read_data_t * const data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_delimit_object_is(fss_basic_list_read_data_t * const data, const f_array_length_t depth) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_delimit_object_is_ /** @@ -51,8 +51,6 @@ extern "C" { * * @param main * The main program data. - * @param arguments - * The parameters passed to the process. * @param data * The program data. * @@ -74,7 +72,7 @@ extern "C" { * @see fss_basic_list_read_depths_resize() */ #ifndef _di_fss_basic_list_read_depth_process_ - extern f_status_t fss_basic_list_read_depth_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_depth_process(fll_program_data_t * const main, fss_basic_list_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_depth_process_ /** @@ -92,7 +90,7 @@ extern "C" { * On failure to identify, an empty string is returned. */ #ifndef _di_fss_basic_list_read_file_identify_ - extern f_string_t fss_basic_list_read_file_identify(const f_array_length_t at, const fss_basic_list_read_files_t files) F_attribute_visibility_internal_d; + extern f_string_static_t fss_basic_list_read_file_identify(const f_array_length_t at, const fss_basic_list_read_files_t files) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_file_identify_ /** @@ -118,7 +116,7 @@ extern "C" { * @see fss_basic_list_read_process_option() */ #ifndef _di_fss_basic_list_read_load_ - extern f_status_t fss_basic_list_read_load(fll_program_data_t * const main, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_load(fll_program_data_t * const main, fss_basic_list_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_load_ /** @@ -128,12 +126,12 @@ extern "C" { * * @param main * The main program data. + * @param data + * The program data. * @param parameter * An ID representing the parameter. * @param name * The parameter name to print on error. - * @param arguments - * The console arguments passed to the program. * @param number * The location to store the loaded number. * @@ -148,7 +146,7 @@ extern "C" { * @see fss_basic_list_read_depths_resize() */ #ifndef _di_fss_basic_list_read_load_number_ - extern f_status_t fss_basic_list_read_load_number(fll_program_data_t * const main, const f_array_length_t parameter, const f_string_t name, const f_console_arguments_t *arguments, f_number_unsigned_t *number) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_load_number(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_number_unsigned_t *number) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_load_number_ /** @@ -158,8 +156,6 @@ extern "C" { * * @param main * The main program data. - * @param arguments - * The parameters passed to the process. * @param data * The program data. * @@ -173,7 +169,7 @@ extern "C" { * @see fss_basic_list_read_process_option() */ #ifndef _di_fss_basic_list_read_process_ - extern f_status_t fss_basic_list_read_process(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process(fll_program_data_t * const main, fss_basic_list_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_ /** @@ -193,7 +189,7 @@ extern "C" { * @see fss_basic_list_read_process_at_line() */ #ifndef _di_fss_basic_list_read_process_at_ - extern f_status_t fss_basic_list_read_process_at(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_at(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_at_ /** @@ -201,12 +197,12 @@ extern "C" { * * @param main * The main program data. + * @param data + * The program data. * @param delimits_object * The delimits to be applied to an Object. * @param delimits_content * The delimits to be applied to Content. - * @param data - * The program data. * @param line * The current line being processed. * This will be incremented as necessary. @@ -216,7 +212,7 @@ extern "C" { * F_success on success and the line was matched (and possibly printed). */ #ifndef _di_fss_basic_list_read_process_at_line_ - extern f_status_t fss_basic_list_read_process_at_line(fll_program_data_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_basic_list_read_data_t *data, f_array_length_t *line) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_at_line(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, f_array_length_t *line) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_at_line_ /** @@ -234,7 +230,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_list_read_process_columns_ - extern f_status_t fss_basic_list_read_process_columns(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_columns(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_columns_ /** @@ -252,7 +248,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_list_read_process_line_ - extern f_status_t fss_basic_list_read_process_line(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_line(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_line_ /** @@ -278,8 +274,6 @@ extern "C" { * * @param main * The main program data. - * @param arguments - * The parameters passed to the process. * @param data * The program data. * @@ -293,7 +287,7 @@ extern "C" { * @see fss_basic_list_read_load_setting() */ #ifndef _di_fss_basic_list_read_process_option_ - extern f_status_t fss_basic_list_read_process_option(fll_program_data_t * const main, const f_console_arguments_t *arguments, fss_basic_list_read_data_t *data) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_option(fll_program_data_t * const main, fss_basic_list_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_option_ /** @@ -311,7 +305,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_list_read_process_total_ - extern f_status_t fss_basic_list_read_process_total(fll_program_data_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d; + extern f_status_t fss_basic_list_read_process_total(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, bool names[]) F_attribute_visibility_internal_d; #endif // _di_fss_basic_list_read_process_total_ #ifdef __cplusplus diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index b2dde6b..692eee9 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -44,10 +44,10 @@ extern "C" { fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s); fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The FSS-0002 (Basic List) specification does not support quoted names, therefore the parameters '%[%s%s%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_single_s, context.set.notable); - fl_print_format(" and '%[%r%s%]' do nothing.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_double_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The FSS-0002 (Basic List) specification does not support quoted names, therefore the parameters '%[%r%r%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_single_s, context.set.notable); + fl_print_format(" and '%[%r%r%]' do nothing.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_double_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" This program does not use the parameter '%[%r%s%]', which therefore does nothing.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore_s, context.set.notable, f_string_eol_s); + fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore_s, context.set.notable, f_string_eol_s); fl_print_format(" This parameter requires two values.%r%r", file.stream, f_string_eol_s, f_string_eol_s); funlockfile(file.stream); diff --git a/level_3/fss_basic_list_write/c/private-common.h b/level_3/fss_basic_list_write/c/private-common.h index ebf42c8..87aa39a 100644 --- a/level_3/fss_basic_list_write/c/private-common.h +++ b/level_3/fss_basic_list_write/c/private-common.h @@ -20,8 +20,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_basic_list_write_common_ - #define fss_basic_list_write_common_allocation_large_d 256 - #define fss_basic_list_write_common_allocation_small_d 16 + #define fss_basic_list_write_common_allocation_large_d 2048 + #define fss_basic_list_write_common_allocation_small_d 128 #endif // _di_fss_basic_list_write_common_ /** diff --git a/level_3/fss_basic_read/c/common.c b/level_3/fss_basic_read/c/common.c index bc287cd..6c0f50a 100644 --- a/level_3/fss_basic_read/c/common.c +++ b/level_3/fss_basic_read/c/common.c @@ -51,6 +51,14 @@ extern "C" { const f_string_static_t fss_basic_read_long_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_long_trim_s, 0, FSS_BASIC_READ_long_trim_s_length); #endif // _di_fss_basic_read_parameters_ +#ifndef _di_fss_basic_read_delimit_mode_ + const f_string_static_t fss_basic_read_delimit_mode_name_none_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_delimit_mode_name_none_s, 0, FSS_BASIC_READ_delimit_mode_name_none_s_length); + const f_string_static_t fss_basic_read_delimit_mode_name_all_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_delimit_mode_name_all_s, 0, FSS_BASIC_READ_delimit_mode_name_all_s_length); + const f_string_static_t fss_basic_read_delimit_mode_name_object_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_delimit_mode_name_object_s, 0, FSS_BASIC_READ_delimit_mode_name_object_s_length); + const f_string_static_t fss_basic_read_delimit_mode_name_greater_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_delimit_mode_name_greater_s, 0, FSS_BASIC_READ_delimit_mode_name_greater_s_length); + const f_string_static_t fss_basic_read_delimit_mode_name_lesser_s = macro_f_string_static_t_initialize(FSS_BASIC_READ_delimit_mode_name_lesser_s, 0, FSS_BASIC_READ_delimit_mode_name_lesser_s_length); +#endif // _di_fss_basic_read_delimit_mode_ + #ifndef _di_fss_basic_read_main_delete_ f_status_t fss_basic_read_main_delete(fll_program_data_t * const main) { diff --git a/level_3/fss_basic_read/c/common.h b/level_3/fss_basic_read/c/common.h index be67b79..1ab5079 100644 --- a/level_3/fss_basic_read/c/common.h +++ b/level_3/fss_basic_read/c/common.h @@ -243,17 +243,23 @@ extern "C" { * - object: Objects arre to have delimits applied. */ #ifndef _di_fss_basic_read_delimit_mode_ - #define fss_basic_read_delimit_mode_name_none_s "none" - #define fss_basic_read_delimit_mode_name_all_s "all" - #define fss_basic_read_delimit_mode_name_object_s "object" - #define fss_basic_read_delimit_mode_name_greater_s "+" - #define fss_basic_read_delimit_mode_name_lesser_s "-" - - #define fss_basic_read_delimit_mode_name_none_s_length 4 - #define fss_basic_read_delimit_mode_name_all_s_length 3 - #define fss_basic_read_delimit_mode_name_object_s_length 6 - #define fss_basic_read_delimit_mode_name_greater_s_length 1 - #define fss_basic_read_delimit_mode_name_lesser_s_length 1 + #define FSS_BASIC_READ_delimit_mode_name_none_s "none" + #define FSS_BASIC_READ_delimit_mode_name_all_s "all" + #define FSS_BASIC_READ_delimit_mode_name_object_s "object" + #define FSS_BASIC_READ_delimit_mode_name_greater_s "+" + #define FSS_BASIC_READ_delimit_mode_name_lesser_s "-" + + #define FSS_BASIC_READ_delimit_mode_name_none_s_length 4 + #define FSS_BASIC_READ_delimit_mode_name_all_s_length 3 + #define FSS_BASIC_READ_delimit_mode_name_object_s_length 6 + #define FSS_BASIC_READ_delimit_mode_name_greater_s_length 1 + #define FSS_BASIC_READ_delimit_mode_name_lesser_s_length 1 + + extern const f_string_static_t fss_basic_read_delimit_mode_name_none_s; + extern const f_string_static_t fss_basic_read_delimit_mode_name_all_s; + extern const f_string_static_t fss_basic_read_delimit_mode_name_object_s; + extern const f_string_static_t fss_basic_read_delimit_mode_name_greater_s; + extern const f_string_static_t fss_basic_read_delimit_mode_name_lesser_s; enum { fss_basic_read_delimit_mode_none_e = 1, diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index 5febba1..73a5009 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -50,63 +50,63 @@ extern "C" { fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%r", file.stream, f_string_eol_s); fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When using the %[%r%s%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" When using the %[%r%r%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%r", file.stream, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_at_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_at_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%r", file.stream, f_string_eol_s); fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Specify both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_object_s, context.set.notable); - fl_print_format(" and the %[%r%s%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" Specify both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_object_s, context.set.notable); + fl_print_format(" and the %[%r%r%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" When both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_at_s, context.set.notable); - fl_print_format(" and %[%r%s%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_name_s, context.set.notable); - fl_print_format(" the %[%r%s%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_at_s, context.set.notable); - fl_print_format(" %[%r%s%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_at_s, context.set.notable); + fl_print_format(" and %[%r%r%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_name_s, context.set.notable); + fl_print_format(" the %[%r%r%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_at_s, context.set.notable); + fl_print_format(" %[%r%r%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" This program may support parameters, such as %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, context.set.notable); - fl_print_format(" or %[%r%s%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, context.set.notable, f_string_eol_s); + fl_print_format(" This program may support parameters, such as %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, context.set.notable); + fl_print_format(" or %[%r%r%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, context.set.notable, f_string_eol_s); fl_print_format(" This is done to help ensure consistency for scripting.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, context.set.notable); fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%r", file.stream, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, context.set.notable); fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_trim_s, context.set.notable); + fl_print_format(" The parameter %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_trim_s, context.set.notable); fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When specifying both the %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_object_s, context.set.notable); - fl_print_format(" parameter and the %[%r%s%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_content_s, context.set.notable, f_string_eol_s); + fl_print_format(" When specifying both the %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_object_s, context.set.notable); + fl_print_format(" parameter and the %[%r%r%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_content_s, context.set.notable, f_string_eol_s); fl_print_format(" Both the Object and Content printed are already escaped.%r", file.stream, f_string_eol_s); fl_print_format(" Both the Object and Content are separated by a space.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_object_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_object_s, context.set.notable, f_string_eol_s); fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%r", file.stream, f_string_eol_s); - fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or greater, followed by a %[%r%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or lesser, followed by a %[%r%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%r%s%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" The %[%r%r%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" The %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit_s, context.set.notable); - fl_print_format(" values %[%s%]", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_none_s, context.set.notable); - fl_print_format(" and %[%s%],", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_all_s, context.set.notable); + fl_print_format(" The %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit_s, context.set.notable); + fl_print_format(" values %[%r%]", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_none_s, context.set.notable); + fl_print_format(" and %[%r%],", file.stream, context.set.notable, fss_basic_read_delimit_mode_name_all_s, context.set.notable); fl_print_format(" overrule all other delimit values.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameters %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_columns_s, context.set.notable); - fl_print_format(" and %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, context.set.notable); + fl_print_format(" The parameters %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_columns_s, context.set.notable); + fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, context.set.notable); fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s); fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s); @@ -586,13 +586,7 @@ extern "C" { } if (size_file) { - status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); - - break; - } + file.size_read = size_file + 1; status = f_file_stream_read(file, &data.buffer); diff --git a/level_3/fss_basic_read/c/private-common.h b/level_3/fss_basic_read/c/private-common.h index 8cc0c37..99955fe 100644 --- a/level_3/fss_basic_read/c/private-common.h +++ b/level_3/fss_basic_read/c/private-common.h @@ -20,8 +20,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_basic_read_common_ - #define fss_basic_read_common_allocation_large_d 256 - #define fss_basic_read_delimit_common_allocation_small_d 16 + #define fss_basic_read_common_allocation_large_d 2048 + #define fss_basic_read_common_allocation_small_d 128 #endif // _di_fss_basic_read_common_ /** @@ -86,18 +86,18 @@ extern "C" { /** * A structure for designating where within the buffer a particular file exists, using a statically allocated array. * - * name: The name of the file representing the range. Set string to NULL to represent the STDIN pipe. + * name: The name of the file representing the range. * range: A range within the buffer representing the file. */ #ifndef _di_fss_basic_read_file_t_ typedef struct { - f_string_t name; + f_string_static_t name; f_string_range_t range; } fss_basic_read_file_t; #define fss_basic_read_file_t_initialize \ { \ - f_string_t_initialize, \ + f_string_static_t_initialize, \ f_string_range_t_initialize, \ } #endif // _di_fss_basic_read_file_t_ diff --git a/level_3/fss_basic_read/c/private-print.c b/level_3/fss_basic_read/c/private-print.c index 7b406c9..c0ab8d8 100644 --- a/level_3/fss_basic_read/c/private-print.c +++ b/level_3/fss_basic_read/c/private-print.c @@ -20,13 +20,13 @@ extern "C" { if (data->option & fss_basic_read_data_option_trim_d) { if (data->option & fss_basic_read_data_option_raw_d) { if (data->quotes.array[at]) { - f_print_character_safely(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } fl_print_trim_dynamic_partial(data->buffer, data->objects.array[at], main->output.to.stream); if (data->quotes.array[at]) { - f_print_character_safely(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } } else { @@ -36,13 +36,13 @@ extern "C" { else { if (data->option & fss_basic_read_data_option_raw_d) { if (data->quotes.array[at]) { - f_print_character_safely(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } f_print_dynamic_partial(data->buffer, data->objects.array[at], main->output.to.stream); if (data->quotes.array[at]) { - f_print_character_safely(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } } else { @@ -75,10 +75,10 @@ extern "C" { void fss_basic_read_print_object_end(fll_program_data_t * const main) { if (main->parameters.array[fss_basic_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_basic_read_pipe_content_start_s, main->output.to.stream); + f_print_dynamic_raw(fss_basic_read_pipe_content_start_s, main->output.to.stream); } else { - f_print_character(f_fss_space_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_space_s, main->output.to.stream); } } #endif // _di_fss_basic_read_print_object_end_ @@ -86,7 +86,7 @@ extern "C" { #ifndef _di_fss_basic_read_print_one_ void fss_basic_read_print_one(fll_program_data_t * const main) { - f_print_character(f_string_ascii_1_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_string_ascii_1_s, main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); } #endif // _di_fss_basic_read_print_one_ @@ -95,7 +95,7 @@ extern "C" { void fss_basic_read_print_set_end(fll_program_data_t * const main) { if (main->parameters.array[fss_basic_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_basic_read_pipe_content_end_s, main->output.to.stream); + f_print_dynamic_raw(fss_basic_read_pipe_content_end_s, main->output.to.stream); } else { f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); @@ -106,7 +106,7 @@ extern "C" { #ifndef _di_fss_basic_read_print_zero_ void fss_basic_read_print_zero(fll_program_data_t * const main) { - f_print_character(f_string_ascii_0_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_string_ascii_0_s, main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); } #endif // _di_fss_basic_read_print_zero_ diff --git a/level_3/fss_basic_read/c/private-read.c b/level_3/fss_basic_read/c/private-read.c index 7643acc..a0681d9 100644 --- a/level_3/fss_basic_read/c/private-read.c +++ b/level_3/fss_basic_read/c/private-read.c @@ -194,7 +194,7 @@ extern "C" { #endif // _di_fss_basic_read_depth_process_ #ifndef _di_fss_basic_read_file_identify_ - f_string_t fss_basic_read_file_identify(const f_array_length_t at, const fss_basic_read_files_t files) { + f_string_static_t fss_basic_read_file_identify(const f_array_length_t at, const fss_basic_read_files_t files) { for (f_array_length_t i = 0; i < files.used; ++i) { @@ -208,14 +208,14 @@ extern "C" { return files.array[files.used - 1].name; } - return ""; + return f_string_empty_s; } #endif // _di_fss_basic_read_file_identify_ #ifndef _di_fss_basic_read_load_ f_status_t fss_basic_read_load(fll_program_data_t * const main, fss_basic_read_data_t *data) { - f_state_t state = macro_f_state_t_initialize(fss_basic_read_common_allocation_large_d, fss_basic_read_delimit_common_allocation_small_d, 0, 0, 0, 0, 0); + f_state_t state = macro_f_state_t_initialize(fss_basic_read_common_allocation_large_d, fss_basic_read_common_allocation_small_d, 0, 0, 0, 0, 0); f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used); data->delimits.used = 0; diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index 5f2ae69..c867b3e 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -44,10 +44,10 @@ extern "C" { fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s); fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The FSS-0000 (Basic) specification does not support multi-line Content, therefore the parameter '%[%r%s%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, context.set.notable); + fl_print_format(" The FSS-0000 (Basic) specification does not support multi-line Content, therefore the parameter '%[%r%r%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, context.set.notable); fl_print_format(" does nothing.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" This program does not use the parameter '%[%r%s%]', which therefore does nothing.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_write_long_ignore_s, context.set.notable, f_string_eol_s); + fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_write_long_ignore_s, context.set.notable, f_string_eol_s); fl_print_format(" This parameter requires two values.%r%r", file.stream, f_string_eol_s, f_string_eol_s); funlockfile(file.stream); diff --git a/level_3/fss_basic_write/c/private-common.h b/level_3/fss_basic_write/c/private-common.h index 2eb6cd7..3eeac9c 100644 --- a/level_3/fss_basic_write/c/private-common.h +++ b/level_3/fss_basic_write/c/private-common.h @@ -20,8 +20,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_basic_write_common_ - #define fss_basic_write_common_allocation_large_d 256 - #define fss_basic_write_common_allocation_small_d 16 + #define fss_basic_write_common_allocation_large_d 2048 + #define fss_basic_write_common_allocation_small_d 128 #endif // _di_fss_basic_write_common_ /** diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c index 0d2ff7b..c0c599f 100644 --- a/level_3/fss_embedded_list_read/c/common.c +++ b/level_3/fss_embedded_list_read/c/common.c @@ -45,6 +45,14 @@ extern "C" { const f_string_static_t fss_embedded_list_read_long_trim_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_long_trim_s, 0, FSS_EMBEDDED_LIST_READ_long_trim_s_length); #endif // _di_fss_embedded_list_read_parameters_ +#ifndef _di_fss_embedded_list_read_delimit_mode_ + const f_string_static_t fss_embedded_list_read_delimit_mode_name_none_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_delimit_mode_name_none_s, 0, FSS_EMBEDDED_LIST_READ_delimit_mode_name_none_s_length); + const f_string_static_t fss_embedded_list_read_delimit_mode_name_all_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_delimit_mode_name_all_s, 0, FSS_EMBEDDED_LIST_READ_delimit_mode_name_all_s_length); + const f_string_static_t fss_embedded_list_read_delimit_mode_name_object_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_delimit_mode_name_object_s, 0, FSS_EMBEDDED_LIST_READ_delimit_mode_name_object_s_length); + const f_string_static_t fss_embedded_list_read_delimit_mode_name_greater_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_delimit_mode_name_greater_s, 0, FSS_EMBEDDED_LIST_READ_delimit_mode_name_greater_s_length); + const f_string_static_t fss_embedded_list_read_delimit_mode_name_lesser_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_READ_delimit_mode_name_lesser_s, 0, FSS_EMBEDDED_LIST_READ_delimit_mode_name_lesser_s_length); +#endif // _di_fss_embedded_list_read_delimit_mode_ + #ifndef _di_fss_embedded_list_read_main_delete_ f_status_t fss_embedded_list_read_main_delete(fss_embedded_list_read_main_t * const main) { diff --git a/level_3/fss_embedded_list_read/c/common.h b/level_3/fss_embedded_list_read/c/common.h index c6ceb65..e504479 100644 --- a/level_3/fss_embedded_list_read/c/common.h +++ b/level_3/fss_embedded_list_read/c/common.h @@ -233,15 +233,20 @@ extern "C" { * Provide delimit management. */ #ifndef _di_fss_embedded_list_read_delimit_mode_ - #define fss_embedded_list_read_delimit_mode_name_none_s "none" - #define fss_embedded_list_read_delimit_mode_name_all_s "all" - #define fss_embedded_list_read_delimit_mode_name_greater_s "+" - #define fss_embedded_list_read_delimit_mode_name_lesser_s "-" - - #define fss_embedded_list_read_delimit_mode_name_none_s_length 4 - #define fss_embedded_list_read_delimit_mode_name_all_s_length 3 - #define fss_embedded_list_read_delimit_mode_name_greater_s_length 1 - #define fss_embedded_list_read_delimit_mode_name_lesser_s_length 1 + #define FSS_EMBEDDED_LIST_READ_delimit_mode_name_none_s "none" + #define FSS_EMBEDDED_LIST_READ_delimit_mode_name_all_s "all" + #define FSS_EMBEDDED_LIST_READ_delimit_mode_name_greater_s "+" + #define FSS_EMBEDDED_LIST_READ_delimit_mode_name_lesser_s "-" + + #define FSS_EMBEDDED_LIST_READ_delimit_mode_name_none_s_length 4 + #define FSS_EMBEDDED_LIST_READ_delimit_mode_name_all_s_length 3 + #define FSS_EMBEDDED_LIST_READ_delimit_mode_name_greater_s_length 1 + #define FSS_EMBEDDED_LIST_READ_delimit_mode_name_lesser_s_length 1 + + extern const f_string_static_t fss_embedded_list_read_delimit_mode_name_none_s; + extern const f_string_static_t fss_embedded_list_read_delimit_mode_name_all_s; + extern const f_string_static_t fss_embedded_list_read_delimit_mode_name_greater_s; + extern const f_string_static_t fss_embedded_list_read_delimit_mode_name_lesser_s; enum { fss_embedded_list_read_delimit_mode_none_e = 1, diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index dce5909..d37aa47 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -50,64 +50,64 @@ extern "C" { fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%r", file.stream, f_string_eol_s); fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When using the %[%r%s%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" When using the %[%r%r%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%r", file.stream, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%r", file.stream, f_string_eol_s); fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Specify both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_object_s, context.set.notable); - fl_print_format(" and the %[%r%s%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" Specify both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_object_s, context.set.notable); + fl_print_format(" and the %[%r%r%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" When both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at_s, context.set.notable); - fl_print_format(" and %[%r%s%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name_s, context.set.notable); - fl_print_format(" the %[%r%s%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at_s, context.set.notable); - fl_print_format(" %[%r%s%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at_s, context.set.notable); + fl_print_format(" and %[%r%r%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name_s, context.set.notable); + fl_print_format(" the %[%r%r%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at_s, context.set.notable); + fl_print_format(" %[%r%r%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" This program may support parameters, such as %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, context.set.notable); - fl_print_format(" or %[%r%s%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, context.set.notable, f_string_eol_s); + fl_print_format(" This program may support parameters, such as %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, context.set.notable); + fl_print_format(" or %[%r%r%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, context.set.notable, f_string_eol_s); fl_print_format(" This is done to help ensure consistency for scripting.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, context.set.notable); fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%r", file.stream, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, context.set.notable); fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_trim_s, context.set.notable); + fl_print_format(" The parameter %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_trim_s, context.set.notable); fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When specifying both the %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_object_s, context.set.notable); - fl_print_format(" parameter and the %[%r%s%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_content_s, context.set.notable, f_string_eol_s); + fl_print_format(" When specifying both the %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_object_s, context.set.notable); + fl_print_format(" parameter and the %[%r%r%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_content_s, context.set.notable, f_string_eol_s); fl_print_format(" Both the Object and Content printed are already escaped.%r", file.stream, f_string_eol_s); fl_print_format(" Both the Object and Content are separated by an EOL.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s); // @todo - //fl_print_format(" - %[%s%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_object, context.set.notable, f_string_eol_s); + //fl_print_format(" - %[%r%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_object, context.set.notable, f_string_eol_s); fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%r", file.stream, f_string_eol_s); - fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or greater, followed by a %[%r%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or lesser, followed by a %[%r%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%r%s%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" The %[%r%r%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" The %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, context.set.notable); - fl_print_format(" values %[%s%]", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_none_s, context.set.notable); - fl_print_format(" and %[%s%],", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_all_s, context.set.notable); + fl_print_format(" The %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, context.set.notable); + fl_print_format(" values %[%r%]", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_none_s, context.set.notable); + fl_print_format(" and %[%r%],", file.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_all_s, context.set.notable); fl_print_format(" overrule all other delimit values.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameters %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns_s, context.set.notable); - fl_print_format(" and %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, context.set.notable); + fl_print_format(" The parameters %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns_s, context.set.notable); + fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, context.set.notable); fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s); fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s); diff --git a/level_3/fss_embedded_list_read/c/private-common.h b/level_3/fss_embedded_list_read/c/private-common.h index 819a97a..32a705a 100644 --- a/level_3/fss_embedded_list_read/c/private-common.h +++ b/level_3/fss_embedded_list_read/c/private-common.h @@ -20,8 +20,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_embedded_list_read_common_ - #define fss_embedded_list_read_common_allocation_large_d 256 - #define fss_embedded_list_read_common_allocation_small_d 16 + #define fss_embedded_list_read_common_allocation_large_d 2048 + #define fss_embedded_list_read_common_allocation_small_d 128 #endif // _di_fss_embedded_list_read_common_ /** diff --git a/level_3/fss_embedded_list_read/c/private-print.c b/level_3/fss_embedded_list_read/c/private-print.c index 2dec272..cfe3dd3 100644 --- a/level_3/fss_embedded_list_read/c/private-print.c +++ b/level_3/fss_embedded_list_read/c/private-print.c @@ -10,15 +10,15 @@ extern "C" { void fss_embedded_list_read_print_object_end(fss_embedded_list_read_main_t * const main) { if (main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_embedded_list_read_pipe_content_start_s, main->output.to.stream); + f_print_dynamic_raw(fss_embedded_list_read_pipe_content_start_s, main->output.to.stream); } else { if (main->parameters.array[fss_embedded_list_read_parameter_object_e].result == f_console_result_found_e && main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) { - f_print_character(f_fss_embedded_list_open_s.string[0], main->output.to.stream); - f_print_character(f_fss_embedded_list_open_end_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_embedded_list_open_s, main->output.to.stream); + f_print_dynamic_raw(f_fss_embedded_list_open_end_s, main->output.to.stream); } else { - f_print_character(f_fss_eol_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_eol_s, main->output.to.stream); } } } @@ -28,7 +28,7 @@ extern "C" { void fss_embedded_list_read_print_content_ignore(fss_embedded_list_read_main_t * const main) { if (main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_embedded_list_read_pipe_content_ignore_s, main->output.to.stream); + f_print_dynamic_raw(fss_embedded_list_read_pipe_content_ignore_s, main->output.to.stream); } } #endif // _di_fss_embedded_list_read_print_content_ignore_ @@ -37,15 +37,15 @@ extern "C" { void fss_embedded_list_read_print_set_end(fss_embedded_list_read_main_t * const main) { if (main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_embedded_list_read_pipe_content_end_s, main->output.to.stream); + f_print_dynamic_raw(fss_embedded_list_read_pipe_content_end_s, main->output.to.stream); } else { if (main->parameters.array[fss_embedded_list_read_parameter_object_e].result == f_console_result_found_e && main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) { - f_print_character(f_fss_embedded_list_close_s.string[0], main->output.to.stream); - f_print_character(f_fss_embedded_list_close_end_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_embedded_list_close_s, main->output.to.stream); + f_print_dynamic_raw(f_fss_embedded_list_close_end_s, main->output.to.stream); } else { - f_print_character(f_fss_eol_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_eol_s, main->output.to.stream); } } } diff --git a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c index 0e50f93..d7fdc8a 100644 --- a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c +++ b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c @@ -44,14 +44,14 @@ extern "C" { fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s); fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The FSS-0008 (Embedded List) specification does not support quoted names, therefore the parameters '%[%r%s%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_single_s, context.set.notable); - fl_print_format(" and '%[%r%s%]' do nothing.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_double_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The FSS-0008 (Embedded List) specification does not support quoted names, therefore the parameters '%[%r%r%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_single_s, context.set.notable); + fl_print_format(" and '%[%r%r%]' do nothing.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_double_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter '%[%r%s%]' designates to not escape any valid nested Object or Content within some Content.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter '%[%r%r%]' designates to not escape any valid nested Object or Content within some Content.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore_s, context.set.notable, f_string_eol_s); fl_print_format(" This parameter requires two values.%r", file.stream, f_string_eol_s); fl_print_format(" This parameter is not used for ignoring anything from the input pipe.%r", file.stream, f_string_eol_s); - fl_print_format(" This parameter must be specified after a '%[%r%s%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, context.set.notable); - fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%s%]' parameter.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" This parameter must be specified after a '%[%r%r%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, context.set.notable); + fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s); funlockfile(file.stream); diff --git a/level_3/fss_embedded_list_write/c/private-common.h b/level_3/fss_embedded_list_write/c/private-common.h index 4ff4b1c..60f996f 100644 --- a/level_3/fss_embedded_list_write/c/private-common.h +++ b/level_3/fss_embedded_list_write/c/private-common.h @@ -21,8 +21,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_embedded_list_write_common_ - #define fss_embedded_list_write_common_allocation_large_d 256 - #define fss_embedded_list_write_common_allocation_small_d 16 + #define fss_embedded_list_write_common_allocation_large_d 2048 + #define fss_embedded_list_write_common_allocation_small_d 128 #endif // _di_fss_embedded_list_write_common_ /** diff --git a/level_3/fss_extended_list_read/c/common.c b/level_3/fss_extended_list_read/c/common.c index 9bbe35e..6c95bd6 100644 --- a/level_3/fss_extended_list_read/c/common.c +++ b/level_3/fss_extended_list_read/c/common.c @@ -51,6 +51,14 @@ extern "C" { const f_string_static_t fss_extended_list_read_long_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_long_trim_s, 0, FSS_EXTENDED_LIST_READ_long_trim_s_length); #endif // _di_fss_extended_list_read_parameters_ +#ifndef _di_fss_extended_list_read_delimit_mode_ + const f_string_static_t fss_extended_list_read_delimit_mode_name_none_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_delimit_mode_name_none_s, 0, FSS_EXTENDED_LIST_READ_delimit_mode_name_none_s_length); + const f_string_static_t fss_extended_list_read_delimit_mode_name_all_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_delimit_mode_name_all_s, 0, FSS_EXTENDED_LIST_READ_delimit_mode_name_all_s_length); + const f_string_static_t fss_extended_list_read_delimit_mode_name_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_delimit_mode_name_object_s, 0, FSS_EXTENDED_LIST_READ_delimit_mode_name_object_s_length); + const f_string_static_t fss_extended_list_read_delimit_mode_name_greater_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_delimit_mode_name_greater_s, 0, FSS_EXTENDED_LIST_READ_delimit_mode_name_greater_s_length); + const f_string_static_t fss_extended_list_read_delimit_mode_name_lesser_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_READ_delimit_mode_name_lesser_s, 0, FSS_EXTENDED_LIST_READ_delimit_mode_name_lesser_s_length); +#endif // _di_fss_extended_list_read_delimit_mode_ + #ifndef _di_fss_extended_list_read_main_delete_ f_status_t fss_extended_list_read_main_delete(fll_program_data_t *main) { diff --git a/level_3/fss_extended_list_read/c/common.h b/level_3/fss_extended_list_read/c/common.h index 0369ea7..3e23909 100644 --- a/level_3/fss_extended_list_read/c/common.h +++ b/level_3/fss_extended_list_read/c/common.h @@ -243,17 +243,23 @@ extern "C" { * - object: Objects arre to have delimits applied. */ #ifndef _di_fss_extended_list_read_delimit_mode_ - #define fss_extended_list_read_delimit_mode_name_none_s "none" - #define fss_extended_list_read_delimit_mode_name_all_s "all" - #define fss_extended_list_read_delimit_mode_name_object_s "object" - #define fss_extended_list_read_delimit_mode_name_greater_s "+" - #define fss_extended_list_read_delimit_mode_name_lesser_s "-" - - #define fss_extended_list_read_delimit_mode_name_none_s_length 4 - #define fss_extended_list_read_delimit_mode_name_all_s_length 3 - #define fss_extended_list_read_delimit_mode_name_object_s_length 6 - #define fss_extended_list_read_delimit_mode_name_greater_s_length 1 - #define fss_extended_list_read_delimit_mode_name_lesser_s_length 1 + #define FSS_EXTENDED_LIST_READ_delimit_mode_name_none_s "none" + #define FSS_EXTENDED_LIST_READ_delimit_mode_name_all_s "all" + #define FSS_EXTENDED_LIST_READ_delimit_mode_name_object_s "object" + #define FSS_EXTENDED_LIST_READ_delimit_mode_name_greater_s "+" + #define FSS_EXTENDED_LIST_READ_delimit_mode_name_lesser_s "-" + + #define FSS_EXTENDED_LIST_READ_delimit_mode_name_none_s_length 4 + #define FSS_EXTENDED_LIST_READ_delimit_mode_name_all_s_length 3 + #define FSS_EXTENDED_LIST_READ_delimit_mode_name_object_s_length 6 + #define FSS_EXTENDED_LIST_READ_delimit_mode_name_greater_s_length 1 + #define FSS_EXTENDED_LIST_READ_delimit_mode_name_lesser_s_length 1 + + extern const f_string_static_t fss_extended_list_read_delimit_mode_name_none_s; + extern const f_string_static_t fss_extended_list_read_delimit_mode_name_all_s; + extern const f_string_static_t fss_extended_list_read_delimit_mode_name_object_s; + extern const f_string_static_t fss_extended_list_read_delimit_mode_name_greater_s; + extern const f_string_static_t fss_extended_list_read_delimit_mode_name_lesser_s; enum { fss_extended_list_read_delimit_mode_none_e = 1, diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index 9dcb748..070e494 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -50,63 +50,63 @@ extern "C" { fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%r", file.stream, f_string_eol_s); fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When using the %[%r%s%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" When using the %[%r%r%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%r", file.stream, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_at_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_at_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%r", file.stream, f_string_eol_s); fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Specify both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_object_s, context.set.notable); - fl_print_format(" and the %[%r%s%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" Specify both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_object_s, context.set.notable); + fl_print_format(" and the %[%r%r%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" When both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_at_s, context.set.notable); - fl_print_format(" and %[%r%s%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_name_s, context.set.notable); - fl_print_format(" the %[%r%s%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_at_s, context.set.notable); - fl_print_format(" %[%r%s%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_at_s, context.set.notable); + fl_print_format(" and %[%r%r%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_name_s, context.set.notable); + fl_print_format(" the %[%r%r%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_at_s, context.set.notable); + fl_print_format(" %[%r%r%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" This program may support parameters, such as %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, context.set.notable); - fl_print_format(" or %[%r%s%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, context.set.notable, f_string_eol_s); + fl_print_format(" This program may support parameters, such as %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, context.set.notable); + fl_print_format(" or %[%r%r%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, context.set.notable, f_string_eol_s); fl_print_format(" This is done to help ensure consistency for scripting.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" For parameters like %[%s%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, context.set.notable); fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%r", file.stream, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, context.set.notable); fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_trim_s, context.set.notable); + fl_print_format(" The parameter %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_trim_s, context.set.notable); fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When specifying both the %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_object_s, context.set.notable); - fl_print_format(" parameter and the %[%r%s%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_content_s, context.set.notable, f_string_eol_s); + fl_print_format(" When specifying both the %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_object_s, context.set.notable); + fl_print_format(" parameter and the %[%r%r%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_content_s, context.set.notable, f_string_eol_s); fl_print_format(" Both the Object and Content printed are already escaped.%r", file.stream, f_string_eol_s); fl_print_format(" Both the Object and Content are separated by an EOL.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_object_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_object_s, context.set.notable, f_string_eol_s); fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%r", file.stream, f_string_eol_s); - fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or greater, followed by a %[%r%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or lesser, followed by a %[%r%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%s%s%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" The %[%r%r%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" The %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit_s, context.set.notable); - fl_print_format(" values %[%s%]", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_none_s, context.set.notable); - fl_print_format(" and %[%s%],", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_all_s, context.set.notable); + fl_print_format(" The %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit_s, context.set.notable); + fl_print_format(" values %[%r%]", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_none_s, context.set.notable); + fl_print_format(" and %[%r%],", file.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_all_s, context.set.notable); fl_print_format(" overrule all other delimit values.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameters %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_columns_s, context.set.notable); - fl_print_format(" and %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, context.set.notable); + fl_print_format(" The parameters %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_columns_s, context.set.notable); + fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, context.set.notable); fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s); fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s); @@ -586,13 +586,7 @@ extern "C" { } if (size_file) { - status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); - - break; - } + file.size_read = size_file + 1; status = f_file_stream_read(file, &data.buffer); diff --git a/level_3/fss_extended_list_read/c/private-common.h b/level_3/fss_extended_list_read/c/private-common.h index 3a77365..4d4679f 100644 --- a/level_3/fss_extended_list_read/c/private-common.h +++ b/level_3/fss_extended_list_read/c/private-common.h @@ -21,8 +21,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_extended_list_read_common_ - #define fss_extended_list_read_common_allocation_large_d 256 - #define fss_extended_list_read_common_allocation_small_d 16 + #define fss_extended_list_read_common_allocation_large_d 2048 + #define fss_extended_list_read_common_allocation_small_d 128 #endif // _di_fss_extended_list_read_common_ /** @@ -87,18 +87,18 @@ extern "C" { /** * A structure for designating where within the buffer a particular file exists, using a statically allocated array. * - * name: The name of the file representing the range. Set string to NULL to represent the STDIN pipe. + * name: The name of the file representing the range. * range: A range within the buffer representing the file. */ #ifndef _di_fss_extended_list_read_file_t_ typedef struct { - f_string_t name; + f_string_static_t name; f_string_range_t range; } fss_extended_list_read_file_t; #define fss_extended_list_read_file_t_initialize \ { \ - f_string_t_initialize, \ + f_string_static_t_initialize, \ f_string_range_t_initialize, \ } #endif // _di_fss_extended_list_read_file_t_ diff --git a/level_3/fss_extended_list_read/c/private-print.c b/level_3/fss_extended_list_read/c/private-print.c index d8380dc..48e524d 100644 --- a/level_3/fss_extended_list_read/c/private-print.c +++ b/level_3/fss_extended_list_read/c/private-print.c @@ -68,7 +68,7 @@ extern "C" { void fss_extended_list_read_print_content_ignore(fll_program_data_t * const main) { if (main->parameters.array[fss_extended_list_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_extended_list_read_pipe_content_ignore, main->output.to.stream); + f_print_dynamic_raw(fss_extended_list_read_pipe_content_ignore, main->output.to.stream); } } #endif // _di_fss_extended_list_read_print_content_ignore_ @@ -77,12 +77,12 @@ extern "C" { void fss_extended_list_read_print_object_end(fll_program_data_t * const main, fss_extended_list_read_data_t * const data) { if (main->parameters.array[fss_extended_list_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_extended_list_read_pipe_content_start, main->output.to.stream); + f_print_dynamic_raw(fss_extended_list_read_pipe_content_start, main->output.to.stream); } else { if ((data->option & fss_extended_list_read_data_option_object_d) && (data->option & fss_extended_list_read_data_option_content_d)) { - f_print_character(f_fss_extended_list_open_s.string[0], main->output.to.stream); - f_print_character(f_fss_extended_list_open_end_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_extended_list_open_s, main->output.to.stream); + f_print_dynamic_raw(f_fss_extended_list_open_end_s, main->output.to.stream); } } } @@ -97,11 +97,11 @@ extern "C" { else { if (data->option & fss_extended_list_read_data_option_object_d) { if (data->option & fss_extended_list_read_data_option_content_d) { - f_print_character(f_fss_extended_list_close_s.string[0], main->output.to.stream); - f_print_character(f_fss_extended_list_close_end_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_extended_list_close_s, main->output.to.stream); + f_print_dynamic_raw(f_fss_extended_list_close_end_s, main->output.to.stream); } else if (!(data->option & fss_extended_list_read_data_option_content_d)) { - f_print_character(f_fss_eol_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_eol_s, main->output.to.stream); } } } @@ -111,7 +111,7 @@ extern "C" { #ifndef _di_fss_extended_list_read_print_one_ void fss_extended_list_read_print_one(fll_program_data_t * const main) { - f_print_character(f_string_ascii_1_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_string_ascii_1_s, main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); } #endif // _di_fss_extended_list_read_print_one_ @@ -119,7 +119,7 @@ extern "C" { #ifndef _di_fss_extended_list_read_print_zero_ void fss_extended_list_read_print_zero(fll_program_data_t * const main) { - f_print_character(f_string_ascii_0_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_string_ascii_0_s, main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); } #endif // _di_fss_extended_list_read_print_zero_ diff --git a/level_3/fss_extended_list_read/c/private-read.c b/level_3/fss_extended_list_read/c/private-read.c index b8f813b..7f7972a 100644 --- a/level_3/fss_extended_list_read/c/private-read.c +++ b/level_3/fss_extended_list_read/c/private-read.c @@ -216,7 +216,7 @@ extern "C" { #endif // _di_fss_extended_list_read_depth_process_ #ifndef _di_fss_extended_list_read_file_identify_ - f_string_t fss_extended_list_read_file_identify(const f_array_length_t at, const fss_extended_list_read_files_t files) { + f_string_static_t fss_extended_list_read_file_identify(const f_array_length_t at, const fss_extended_list_read_files_t files) { for (f_array_length_t i = 0; i < files.used; ++i) { @@ -230,7 +230,7 @@ extern "C" { return files.array[files.used - 1].name; } - return ""; + return f_string_empty_s; } #endif // _di_fss_extended_list_read_file_identify_ diff --git a/level_3/fss_extended_list_write/c/fss_extended_list_write.c b/level_3/fss_extended_list_write/c/fss_extended_list_write.c index 77b60ea..b301d3f 100644 --- a/level_3/fss_extended_list_write/c/fss_extended_list_write.c +++ b/level_3/fss_extended_list_write/c/fss_extended_list_write.c @@ -44,14 +44,14 @@ extern "C" { fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s); fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The FSS-0003 (Extended List) specification does not support quoted names, therefore the parameters '%[%r%s%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_single_s, context.set.notable); - fl_print_format(" and '%[%r%s%]' do nothing.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_double_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The FSS-0003 (Extended List) specification does not support quoted names, therefore the parameters '%[%r%r%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_single_s, context.set.notable); + fl_print_format(" and '%[%r%r%]' do nothing.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_double_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter '%[%r%s%]' designates to not escape any valid nested Object or Content within some Content.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter '%[%r%r%]' designates to not escape any valid nested Object or Content within some Content.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore_s, context.set.notable, f_string_eol_s); fl_print_format(" This parameter requires two values.%r", file.stream, f_string_eol_s); fl_print_format(" This parameter is not used for ignoring anything from the input pipe.%r", file.stream, f_string_eol_s); - fl_print_format(" This parameter must be specified after a '%[%r%s%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, context.set.notable); - fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%s%]' parameter.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" This parameter must be specified after a '%[%r%r%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, context.set.notable); + fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s); funlockfile(file.stream); diff --git a/level_3/fss_extended_list_write/c/private-common.h b/level_3/fss_extended_list_write/c/private-common.h index ad7c928..f9ffa03 100644 --- a/level_3/fss_extended_list_write/c/private-common.h +++ b/level_3/fss_extended_list_write/c/private-common.h @@ -20,8 +20,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_extended_list_write_common_ - #define fss_extended_list_write_common_allocation_large_d 256 - #define fss_extended_list_write_common_allocation_small_d 16 + #define fss_extended_list_write_common_allocation_large_d 2048 + #define fss_extended_list_write_common_allocation_small_d 128 #endif // _di_fss_extended_list_write_common_ /** diff --git a/level_3/fss_extended_read/c/common.c b/level_3/fss_extended_read/c/common.c index b92e376..ddf08cc 100644 --- a/level_3/fss_extended_read/c/common.c +++ b/level_3/fss_extended_read/c/common.c @@ -51,6 +51,14 @@ extern "C" { const f_string_static_t fss_extended_read_long_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_long_trim_s, 0, FSS_EXTENDED_READ_long_trim_s_length); #endif // _di_fss_extended_read_parameters_ +#ifndef _di_fss_extended_read_delimit_mode_ + const f_string_static_t fss_extended_read_delimit_mode_name_none_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_delimit_mode_name_none_s, 0, FSS_EXTENDED_READ_delimit_mode_name_none_s_length); + const f_string_static_t fss_extended_read_delimit_mode_name_all_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_delimit_mode_name_all_s, 0, FSS_EXTENDED_READ_delimit_mode_name_all_s_length); + const f_string_static_t fss_extended_read_delimit_mode_name_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_delimit_mode_name_object_s, 0, FSS_EXTENDED_READ_delimit_mode_name_object_s_length); + const f_string_static_t fss_extended_read_delimit_mode_name_greater_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_delimit_mode_name_greater_s, 0, FSS_EXTENDED_READ_delimit_mode_name_greater_s_length); + const f_string_static_t fss_extended_read_delimit_mode_name_lesser_s = macro_f_string_static_t_initialize(FSS_EXTENDED_READ_delimit_mode_name_lesser_s, 0, FSS_EXTENDED_READ_delimit_mode_name_lesser_s_length); +#endif // _di_fss_extended_read_delimit_mode_ + #ifndef _di_fss_extended_read_main_delete_ f_status_t fss_extended_read_main_delete(fll_program_data_t * const main) { diff --git a/level_3/fss_extended_read/c/common.h b/level_3/fss_extended_read/c/common.h index f73ee23..dd66d09 100644 --- a/level_3/fss_extended_read/c/common.h +++ b/level_3/fss_extended_read/c/common.h @@ -243,17 +243,23 @@ extern "C" { * - object: Objects arre to have delimits applied. */ #ifndef _di_fss_extended_read_delimit_mode_ - #define fss_extended_read_delimit_mode_name_none "none" - #define fss_extended_read_delimit_mode_name_all "all" - #define fss_extended_read_delimit_mode_name_object "object" - #define fss_extended_read_delimit_mode_name_greater "+" - #define fss_extended_read_delimit_mode_name_lesser "-" - - #define fss_extended_read_delimit_mode_name_none_length 4 - #define fss_extended_read_delimit_mode_name_all_length 3 - #define fss_extended_read_delimit_mode_name_object_length 6 - #define fss_extended_read_delimit_mode_name_greater_length 1 - #define fss_extended_read_delimit_mode_name_lesser_length 1 + #define FSS_EXTENDED_READ_delimit_mode_name_none "none" + #define FSS_EXTENDED_READ_delimit_mode_name_all "all" + #define FSS_EXTENDED_READ_delimit_mode_name_object "object" + #define FSS_EXTENDED_READ_delimit_mode_name_greater "+" + #define FSS_EXTENDED_READ_delimit_mode_name_lesser "-" + + #define FSS_EXTENDED_READ_delimit_mode_name_none_length 4 + #define FSS_EXTENDED_READ_delimit_mode_name_all_length 3 + #define FSS_EXTENDED_READ_delimit_mode_name_object_length 6 + #define FSS_EXTENDED_READ_delimit_mode_name_greater_length 1 + #define FSS_EXTENDED_READ_delimit_mode_name_lesser_length 1 + + extern const f_string_static_t fss_extended_read_delimit_mode_name_none_s; + extern const f_string_static_t fss_extended_read_delimit_mode_name_all_s; + extern const f_string_static_t fss_extended_read_delimit_mode_name_object_s; + extern const f_string_static_t fss_extended_read_delimit_mode_name_greater_s; + extern const f_string_static_t fss_extended_read_delimit_mode_name_lesser_s; enum { fss_extended_read_delimit_mode_none_e = 1, diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index c303b3d..d3f24b5 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -50,63 +50,63 @@ extern "C" { fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%r", file.stream, f_string_eol_s); fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When using the %[%r%s%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" When using the %[%r%r%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%r", file.stream, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_at_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_at_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%r", file.stream, f_string_eol_s); fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Specify both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_object_s, context.set.notable); - fl_print_format(" and the %[%r%s%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" Specify both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_object_s, context.set.notable); + fl_print_format(" and the %[%r%r%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" When both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_at_s, context.set.notable); - fl_print_format(" and %[%r%s%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_name_s, context.set.notable); - fl_print_format(" the %[%r%s%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_at_s, context.set.notable); - fl_print_format(" %[%r%s%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_at_s, context.set.notable); + fl_print_format(" and %[%r%r%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_name_s, context.set.notable); + fl_print_format(" the %[%r%r%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_at_s, context.set.notable); + fl_print_format(" %[%r%r%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" This program may support parameters, such as %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, context.set.notable); - fl_print_format(" or %[%r%s%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, context.set.notable, f_string_eol_s); + fl_print_format(" This program may support parameters, such as %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, context.set.notable); + fl_print_format(" or %[%r%r%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, context.set.notable, f_string_eol_s); fl_print_format(" This is done to help ensure consistency for scripting.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, context.set.notable); fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%r", file.stream, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, context.set.notable); fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_trim_s, context.set.notable); + fl_print_format(" The parameter %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_trim_s, context.set.notable); fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When specifying both the %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_object_s, context.set.notable); - fl_print_format(" parameter and the %[%r%s%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_content_s, context.set.notable, f_string_eol_s); + fl_print_format(" When specifying both the %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_object_s, context.set.notable); + fl_print_format(" parameter and the %[%r%r%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_content_s, context.set.notable, f_string_eol_s); fl_print_format(" Both the Object and Content printed are already escaped.%r", file.stream, f_string_eol_s); fl_print_format(" Both the Object and Content are separated by a space.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_none, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_all, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_object, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_none, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_all, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_object, context.set.notable, f_string_eol_s); fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%r", file.stream, f_string_eol_s); - fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_greater, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_lesser, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or greater, followed by a %[%r%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_greater, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or lesser, followed by a %[%r%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_lesser, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%r%s%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" The %[%r%r%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" The %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit_s, context.set.notable); - fl_print_format(" values %[%s%]", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_none, context.set.notable); - fl_print_format(" and %[%s%],", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_all, context.set.notable); + fl_print_format(" The %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit_s, context.set.notable); + fl_print_format(" values %[%r%]", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_none, context.set.notable); + fl_print_format(" and %[%r%],", file.stream, context.set.notable, fss_extended_read_delimit_mode_name_all, context.set.notable); fl_print_format(" overrule all other delimit values.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameters %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_columns_s, context.set.notable); - fl_print_format(" and %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, context.set.notable); + fl_print_format(" The parameters %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_columns_s, context.set.notable); + fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, context.set.notable); fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s); fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s); @@ -592,13 +592,7 @@ extern "C" { } if (size_file) { - status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); - - break; - } + file.size_read = size_file + 1; status = f_file_stream_read(file, &data.buffer); diff --git a/level_3/fss_extended_read/c/main.c b/level_3/fss_extended_read/c/main.c index 492c3bc..e6ba9bd 100644 --- a/level_3/fss_extended_read/c/main.c +++ b/level_3/fss_extended_read/c/main.c @@ -3,7 +3,7 @@ int main(const int argc, const f_string_t *argv) { f_console_arguments_t arguments = { argc, argv }; - fll_program_data_t data = fss_extended_read_main_t_initialize; + fll_program_data_t data = fll_program_data_t_initialize; if (f_pipe_input_exists()) { data.process_pipe = F_true; diff --git a/level_3/fss_extended_read/c/private-common.h b/level_3/fss_extended_read/c/private-common.h index 0094e54..b9211a0 100644 --- a/level_3/fss_extended_read/c/private-common.h +++ b/level_3/fss_extended_read/c/private-common.h @@ -20,8 +20,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_extended_read_common_ - #define fss_extended_read_common_allocation_large_d 256 - #define fss_extended_read_common_allocation_small_d 16 + #define fss_extended_read_common_allocation_large_d 2048 + #define fss_extended_read_common_allocation_small_d 128 #endif // _di_fss_extended_read_common_ /** @@ -86,18 +86,18 @@ extern "C" { /** * A structure for designating where within the buffer a particular file exists, using a statically allocated array. * - * name: The name of the file representing the range. Set string to NULL to represent the STDIN pipe. + * name: The name of the file representing the range. * range: A range within the buffer representing the file. */ #ifndef _di_fss_extended_read_file_t_ typedef struct { - f_string_t name; + f_string_static_t name; f_string_range_t range; } fss_extended_read_file_t; #define fss_extended_read_file_t_initialize \ { \ - f_string_t_initialize, \ + f_string_static_t_initialize, \ f_string_range_t_initialize, \ } #endif // _di_fss_extended_read_file_t_ diff --git a/level_3/fss_extended_read/c/private-print.c b/level_3/fss_extended_read/c/private-print.c index 9b1edb7..788974b 100644 --- a/level_3/fss_extended_read/c/private-print.c +++ b/level_3/fss_extended_read/c/private-print.c @@ -20,24 +20,24 @@ extern "C" { if (data->option & fss_extended_read_data_option_object_d) { if (data->option & fss_extended_read_data_option_trim_d) { if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_object.array[at]) { - f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream); if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_object.array[at]) { - f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } } else { if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_object.array[at]) { - f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream); if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_object.array[at]) { - f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } } @@ -54,13 +54,13 @@ extern "C" { content_printed = F_true; if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_content.array[at].array[data->select]) { - f_print_character_safely(data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[data->select], delimits_content, main->output.to.stream); if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_content.array[at].array[data->select]) { - f_print_character_safely(data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } } } @@ -74,13 +74,13 @@ extern "C" { content_printed = F_true; if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_content.array[at].array[i]) { - f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[i], delimits_content, main->output.to.stream); if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_content.array[at].array[i]) { - f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } if (i + 1 < data->contents.array[at].used && data->contents.array[at].array[i + 1].start <= data->contents.array[at].array[i + 1].stop) { @@ -157,10 +157,10 @@ extern "C" { void fss_extended_read_print_content_end(fll_program_data_t * const main) { if (main->parameters.array[fss_extended_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_extended_read_pipe_content_start_s, main->output.to.stream); + f_print_dynamic_raw(fss_extended_read_pipe_content_start_s, main->output.to.stream); } else { - f_print_character(f_fss_space_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_space_s, main->output.to.stream); } } #endif // _di_fss_extended_read_print_content_end_ @@ -169,10 +169,10 @@ extern "C" { void fss_extended_read_print_object_end(fll_program_data_t * const main) { if (main->parameters.array[fss_extended_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_extended_read_pipe_content_end_s, main->output.to.stream); + f_print_dynamic_raw(fss_extended_read_pipe_content_end_s, main->output.to.stream); } else { - f_print_character(f_fss_space_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_space_s, main->output.to.stream); } } #endif // _di_fss_extended_read_print_object_end_ @@ -180,7 +180,7 @@ extern "C" { #ifndef _di_fss_extended_read_print_one_ void fss_extended_read_print_one(fll_program_data_t * const main) { - f_print_character(f_string_ascii_1_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_string_ascii_1_s, main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); } #endif // _di_fss_extended_read_print_one_ @@ -189,10 +189,10 @@ extern "C" { void fss_extended_read_print_set_end(fll_program_data_t * const main) { if (main->parameters.array[fss_extended_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_extended_read_pipe_content_end_s, main->output.to.stream); + f_print_dynamic_raw(fss_extended_read_pipe_content_end_s, main->output.to.stream); } else { - f_print_character(f_fss_eol_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_fss_eol_s, main->output.to.stream); } } #endif // _di_fss_extended_read_print_set_end_ @@ -200,7 +200,7 @@ extern "C" { #ifndef _di_fss_extended_read_print_zero_ void fss_extended_read_print_zero(fll_program_data_t * const main) { - f_print_character(f_string_ascii_0_s.string[0], main->output.to.stream); + f_print_dynamic_raw(f_string_ascii_0_s, main->output.to.stream); f_print_dynamic_raw(f_string_eol_s, main->output.to.stream); } #endif // _di_fss_extended_read_print_zero_ diff --git a/level_3/fss_extended_read/c/private-read.c b/level_3/fss_extended_read/c/private-read.c index 7dced40..eb35b51 100644 --- a/level_3/fss_extended_read/c/private-read.c +++ b/level_3/fss_extended_read/c/private-read.c @@ -229,7 +229,7 @@ extern "C" { #endif // _di_fss_extended_read_depth_process_ #ifndef _di_fss_extended_read_file_identify_ - f_string_t fss_extended_read_file_identify(const f_array_length_t at, const fss_extended_read_files_t files) { + f_string_static_t fss_extended_read_file_identify(const f_array_length_t at, const fss_extended_read_files_t files) { for (f_array_length_t i = 0; i < files.used; ++i) { @@ -243,7 +243,7 @@ extern "C" { return files.array[files.used - 1].name; } - return ""; + return f_string_empty_s; } #endif // _di_fss_extended_read_file_identify_ diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index 0cb75cf..72aad1b 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -44,10 +44,10 @@ extern "C" { fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s); fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The FSS-0001 (Extended) specification does not support multi-line Content, therefore the parameter '%[%r%s%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, context.set.notable); + fl_print_format(" The FSS-0001 (Extended) specification does not support multi-line Content, therefore the parameter '%[%r%r%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, context.set.notable); fl_print_format(" does nothing.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" This program does not use the parameter '%[%r%s%]', which therefore does nothing.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_write_long_ignore_s, context.set.notable, f_string_eol_s); + fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_write_long_ignore_s, context.set.notable, f_string_eol_s); fl_print_format(" This parameter requires two values.%r%r", file.stream, f_string_eol_s, f_string_eol_s); funlockfile(file.stream); diff --git a/level_3/fss_extended_write/c/private-common.h b/level_3/fss_extended_write/c/private-common.h index 4b439d9..2020ded 100644 --- a/level_3/fss_extended_write/c/private-common.h +++ b/level_3/fss_extended_write/c/private-common.h @@ -20,8 +20,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_extended_write_common_ - #define fss_extended_write_common_allocation_large_d 256 - #define fss_extended_write_common_allocation_small_d 16 + #define fss_extended_write_common_allocation_large_d 2048 + #define fss_extended_write_common_allocation_small_d 128 #endif // _di_fss_extended_write_common_ /** diff --git a/level_3/fss_identify/c/fss_identify.c b/level_3/fss_identify/c/fss_identify.c index 4a118fe..5cf85f8 100644 --- a/level_3/fss_identify/c/fss_identify.c +++ b/level_3/fss_identify/c/fss_identify.c @@ -36,14 +36,14 @@ extern "C" { fll_program_print_help_usage(file, context, fss_identify_program_name_s, fll_program_parameter_filenames_s); - fl_print_format(" The %[%r%s%] parameter refers to the file lines and not the lines in a given file.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_line_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The %[%r%r%] parameter refers to the file lines and not the lines in a given file.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_line_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" If neither the %[%r%s%] nor", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_object_s, context.set.notable); - fl_print_format(" %[%r%s%] are specified, then the default behavior is to print both.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" If neither the %[%r%r%] nor", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_object_s, context.set.notable); + fl_print_format(" %[%r%r%] are specified, then the default behavior is to print both.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" When specifying the %[%r%s%] parameter, neither the", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_total_s, context.set.notable); - fl_print_format(" %[%r%s%] nor the", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_object_s, context.set.notable); - fl_print_format(" %[%r%s%] parameter may be specified.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When specifying the %[%r%r%] parameter, neither the", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_total_s, context.set.notable); + fl_print_format(" %[%r%r%] nor the", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_object_s, context.set.notable); + fl_print_format(" %[%r%r%] parameter may be specified.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s); fl_print_format(" An FSS file is identified by the following format: '%[# Object-Content%]'", file.stream, context.set.notable, context.set.notable); fl_print_format(" where the Object, is a machine-name representing the name and may only consist of \"word\" characters and the Content is a 4-digit hexidecimal number representing a particular variant of the Object.%r", file.stream, f_string_eol_s); diff --git a/level_3/fss_payload_read/c/common.c b/level_3/fss_payload_read/c/common.c index 5ed0865..61f353e 100644 --- a/level_3/fss_payload_read/c/common.c +++ b/level_3/fss_payload_read/c/common.c @@ -42,6 +42,14 @@ extern "C" { const f_string_static_t fss_payload_read_long_trim_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_long_trim_s, 0, FSS_PAYLOAD_READ_long_trim_s_length); #endif // _di_fss_payload_read_parameters_ +#ifndef _di_fss_payload_read_delimit_mode_ + const f_string_static_t fss_payload_read_delimit_mode_name_none_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_delimit_mode_name_none_s, 0, FSS_PAYLOAD_READ_delimit_mode_name_none_s_length); + const f_string_static_t fss_payload_read_delimit_mode_name_all_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_delimit_mode_name_all_s, 0, FSS_PAYLOAD_READ_delimit_mode_name_all_s_length); + const f_string_static_t fss_payload_read_delimit_mode_name_object_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_delimit_mode_name_object_s, 0, FSS_PAYLOAD_READ_delimit_mode_name_object_s_length); + const f_string_static_t fss_payload_read_delimit_mode_name_greater_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_delimit_mode_name_greater_s, 0, FSS_PAYLOAD_READ_delimit_mode_name_greater_s_length); + const f_string_static_t fss_payload_read_delimit_mode_name_lesser_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_READ_delimit_mode_name_lesser_s, 0, FSS_PAYLOAD_READ_delimit_mode_name_lesser_s_length); +#endif // _di_fss_payload_read_delimit_mode_ + #ifndef _di_fss_payload_read_main_delete_ f_status_t fss_payload_read_main_delete(fll_program_data_t * const main) { diff --git a/level_3/fss_payload_read/c/common.h b/level_3/fss_payload_read/c/common.h index bbab7ee..9ffe698 100644 --- a/level_3/fss_payload_read/c/common.h +++ b/level_3/fss_payload_read/c/common.h @@ -243,17 +243,23 @@ extern "C" { * - object: Objects arre to have delimits applied. */ #ifndef _di_fss_payload_read_delimit_mode_ - #define fss_payload_read_delimit_mode_name_none_s "none" - #define fss_payload_read_delimit_mode_name_all_s "all" - #define fss_payload_read_delimit_mode_name_object_s "object" - #define fss_payload_read_delimit_mode_name_greater_s "+" - #define fss_payload_read_delimit_mode_name_lesser_s "-" - - #define fss_payload_read_delimit_mode_name_none_s_length 4 - #define fss_payload_read_delimit_mode_name_all_s_length 3 - #define fss_payload_read_delimit_mode_name_object_s_length 6 - #define fss_payload_read_delimit_mode_name_greater_s_length 1 - #define fss_payload_read_delimit_mode_name_lesser_s_length 1 + #define FSS_PAYLOAD_READ_delimit_mode_name_none_s "none" + #define FSS_PAYLOAD_READ_delimit_mode_name_all_s "all" + #define FSS_PAYLOAD_READ_delimit_mode_name_object_s "object" + #define FSS_PAYLOAD_READ_delimit_mode_name_greater_s "+" + #define FSS_PAYLOAD_READ_delimit_mode_name_lesser_s "-" + + #define FSS_PAYLOAD_READ_delimit_mode_name_none_s_length 4 + #define FSS_PAYLOAD_READ_delimit_mode_name_all_s_length 3 + #define FSS_PAYLOAD_READ_delimit_mode_name_object_s_length 6 + #define FSS_PAYLOAD_READ_delimit_mode_name_greater_s_length 1 + #define FSS_PAYLOAD_READ_delimit_mode_name_lesser_s_length 1 + + extern const f_string_static_t fss_payload_read_delimit_mode_name_none_s; + extern const f_string_static_t fss_payload_read_delimit_mode_name_all_s; + extern const f_string_static_t fss_payload_read_delimit_mode_name_object_s; + extern const f_string_static_t fss_payload_read_delimit_mode_name_greater_s; + extern const f_string_static_t fss_payload_read_delimit_mode_name_lesser_s; enum { fss_payload_read_delimit_mode_none_e = 1, diff --git a/level_3/fss_payload_read/c/fss_payload_read.c b/level_3/fss_payload_read/c/fss_payload_read.c index f976226..6c8c4d5 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -59,68 +59,68 @@ extern "C" { fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%r", file.stream, f_string_eol_s); fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When using the %[%r%s%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" When using the %[%r%r%] option, an order of operations is enforced on the parameters.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%r", file.stream, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_at_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable, f_string_eol_s); - fl_print_format(" %[%r%s%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object index at the specified depth.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_at_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: A new depth within the specified depth, indexed from the root.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" %[%r%r%]: An Object name at the specified depth.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] must be in numeric order, but values in between may be skipped.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable, f_string_eol_s); fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%r", file.stream, f_string_eol_s); fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] selects a Content column.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Specify both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_object_s, context.set.notable); - fl_print_format(" and the %[%r%s%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" Specify both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_object_s, context.set.notable); + fl_print_format(" and the %[%r%r%] parameters to get the total objects.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_total_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" When both %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_at_s, context.set.notable); - fl_print_format(" and %[%r%s%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_name_s, context.set.notable); - fl_print_format(" the %[%r%s%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_at_s, context.set.notable); - fl_print_format(" %[%r%s%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" When both %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_at_s, context.set.notable); + fl_print_format(" and %[%r%r%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_name_s, context.set.notable); + fl_print_format(" the %[%r%r%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_at_s, context.set.notable); + fl_print_format(" %[%r%r%] parameter value.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_name_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" This program may support parameters, such as %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable); - fl_print_format(" or %[%r%s%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, context.set.notable, f_string_eol_s); + fl_print_format(" This program may support parameters, such as %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable); + fl_print_format(" or %[%r%r%], even if not supported by the standard.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, context.set.notable, f_string_eol_s); fl_print_format(" This is done to help ensure consistency for scripting.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable); fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%r", file.stream, f_string_eol_s); - fl_print_format(" For parameters like %[%r%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, context.set.notable); + fl_print_format(" For parameters like %[%r%r%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, context.set.notable); fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_trim_s, context.set.notable); + fl_print_format(" The parameter %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_trim_s, context.set.notable); fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" When specifying both the %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_object_s, context.set.notable); - fl_print_format(" parameter and the %[%r%s%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_content_s, context.set.notable, f_string_eol_s); + fl_print_format(" When specifying both the %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_object_s, context.set.notable); + fl_print_format(" parameter and the %[%r%r%] parameter, the entire Object and Content are printed, including the formatting.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_content_s, context.set.notable, f_string_eol_s); fl_print_format(" Both the Object and Content printed are already escaped.%r", file.stream, f_string_eol_s); fl_print_format(" Both the Object and Content are separated by an EOL.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameter %[%r%s%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s); - fl_print_format(" - %[%s%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_object_s, context.set.notable, f_string_eol_s); + fl_print_format(" The parameter %[%r%r%] accepts the following:%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Do not apply delimits.%r", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: (default) Apply all delimits.%r", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s); + fl_print_format(" - %[%r%]: Apply delimits for Objects.%r", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_object_s, context.set.notable, f_string_eol_s); fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%r", file.stream, f_string_eol_s); - fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or greater, followed by a %[%r%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%r", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" - A number, 0 or lesser, followed by a %[%r%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%r%r", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%r%s%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_delimit_s, context.set.notable, f_string_eol_s); + fl_print_format(" The %[%r%r%] parameter may be specified multiple times to customize the delimit behavior.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_delimit_s, context.set.notable, f_string_eol_s); - fl_print_format(" The %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_delimit_s, context.set.notable); - fl_print_format(" values %[%s%]", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_none_s, context.set.notable); - fl_print_format(" and %[%s%],", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_all_s, context.set.notable); + fl_print_format(" The %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_delimit_s, context.set.notable); + fl_print_format(" values %[%r%]", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_none_s, context.set.notable); + fl_print_format(" and %[%r%],", file.stream, context.set.notable, fss_payload_read_delimit_mode_name_all_s, context.set.notable); fl_print_format(" overrule all other delimit values.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The parameters %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_columns_s, context.set.notable); - fl_print_format(" and %[%r%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, context.set.notable); + fl_print_format(" The parameters %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_columns_s, context.set.notable); + fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, context.set.notable); fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s); fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" As an exceptional case, a %[%r%s%] of", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable); + fl_print_format(" As an exceptional case, a %[%r%r%] of", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, context.set.notable); fl_print_format(" %[1%] applies only to the explicit Object of", file.stream, context.set.notable, context.set.notable); fl_print_format(" '%[%r%]'.%r", file.stream, context.set.notable, f_fss_string_header_s, context.set.notable, f_string_eol_s); fl_print_format(" Content at this depth is processed as FSS-0001 Extended.%r%r", file.stream, f_string_eol_s, f_string_eol_s); @@ -128,7 +128,7 @@ extern "C" { fl_print_format(" The Content of the explicit Object of", file.stream); fl_print_format(" '%[%r%]'", file.stream, context.set.notable, f_fss_string_payload_s, context.set.notable, f_string_eol_s); fl_print_format(" will not contain any Content close pipe control codes when using", file.stream); - fl_print_format(" %[%r%s%].%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%r%].%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, context.set.notable, f_string_eol_s, f_string_eol_s); funlockfile(file.stream); @@ -623,14 +623,7 @@ extern "C" { } if (size_file) { - status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); - - break; - } - + file.size_read = size_file + 1; // This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter. // Guarantee that a newline exists at the end of the buffer. diff --git a/level_3/fss_payload_read/c/private-common.h b/level_3/fss_payload_read/c/private-common.h index badfb20..8e3ea3e 100644 --- a/level_3/fss_payload_read/c/private-common.h +++ b/level_3/fss_payload_read/c/private-common.h @@ -20,8 +20,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_payload_read_common_ - #define fss_payload_common_allocation_large_d 256 - #define fss_payload_read_common_allocation_small_d 16 + #define fss_payload_read_common_allocation_large_d 2048 + #define fss_payload_read_common_allocation_small_d 128 #endif // _di_fss_payload_read_common_ /** @@ -86,18 +86,18 @@ extern "C" { /** * A structure for designating where within the buffer a particular file exists, using a statically allocated array. * - * name: The name of the file representing the range. Set string to NULL to represent the STDIN pipe. + * name: The name of the file representing the range. * range: A range within the buffer representing the file. */ #ifndef _di_fss_payload_read_file_t_ typedef struct { - f_string_t name; + f_string_static_t name; f_string_range_t range; } fss_payload_read_file_t; #define fss_payload_read_file_t_initialize \ { \ - f_string_t_initialize, \ + f_string_static_t_initialize, \ f_string_range_t_initialize, \ } #endif // _di_fss_payload_read_file_t_ diff --git a/level_3/fss_payload_read/c/private-print.c b/level_3/fss_payload_read/c/private-print.c index 66b5af0..5e1ee2a 100644 --- a/level_3/fss_payload_read/c/private-print.c +++ b/level_3/fss_payload_read/c/private-print.c @@ -68,24 +68,24 @@ extern "C" { if (data->option & fss_payload_read_data_option_object_d) { if (data->option & fss_payload_read_data_option_trim_d) { if ((data->option & fss_payload_read_data_option_raw_d) && data->quotes_object_header.array[at]) { - f_print_character_safely(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } fl_print_trim_except_dynamic_partial(data->buffer, data->objects_header.array[at], delimits_object, main->output.to.stream); if ((data->option & fss_payload_read_data_option_raw_d) && data->quotes_object_header.array[at]) { - f_print_character_safely(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } } else { if ((data->option & fss_payload_read_data_option_raw_d) && data->quotes_object_header.array[at]) { - f_print_character_safely(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } f_print_except_dynamic_partial(data->buffer, data->objects_header.array[at], delimits_object, main->output.to.stream); if ((data->option & fss_payload_read_data_option_raw_d) && data->quotes_object_header.array[at]) { - f_print_character_safely(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } } @@ -102,13 +102,13 @@ extern "C" { content_printed = F_true; if ((data->option & fss_payload_read_data_option_raw_d) && data->quotes_content_header.array[at].array[data->select]) { - f_print_character_safely(data->quotes_content_header.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_content_header.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } f_print_except_dynamic_partial(data->buffer, data->contents_header.array[at].array[data->select], delimits_content, main->output.to.stream); if ((data->option & fss_payload_read_data_option_raw_d) && data->quotes_content_header.array[at].array[data->select]) { - f_print_character_safely(data->quotes_content_header.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_content_header.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } } } @@ -122,13 +122,13 @@ extern "C" { content_printed = F_true; if ((data->option & fss_payload_read_data_option_raw_d) && data->quotes_content_header.array[at].array[i]) { - f_print_character_safely(data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } f_print_except_dynamic_partial(data->buffer, data->contents_header.array[at].array[i], delimits_content, main->output.to.stream); if ((data->option & fss_payload_read_data_option_raw_d) && data->quotes_content_header.array[at].array[i]) { - f_print_character_safely(data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_dynamic_raw(data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); } if (i + 1 < data->contents_header.array[at].used && data->contents_header.array[at].array[i + 1].start <= data->contents_header.array[at].array[i + 1].stop) { @@ -223,7 +223,7 @@ extern "C" { void fss_payload_read_print_content_end_extended(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_payload_read_pipe_content_start_s, main->output.to.stream); + f_print_dynamic_raw(fss_payload_read_pipe_content_start_s, main->output.to.stream); } else { f_print_dynamic_raw(f_fss_space_s, main->output.to.stream); @@ -235,7 +235,7 @@ extern "C" { void fss_payload_read_print_content_ignore(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_payload_read_pipe_content_ignore_s, main->output.to.stream); + f_print_dynamic_raw(fss_payload_read_pipe_content_ignore_s, main->output.to.stream); } } #endif // _di_fss_payload_read_print_content_ignore_ @@ -244,7 +244,7 @@ extern "C" { void fss_payload_read_print_object_end(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_payload_read_pipe_content_start_s, main->output.to.stream); + f_print_dynamic_raw(fss_payload_read_pipe_content_start_s, main->output.to.stream); } else { if (main->parameters.array[fss_payload_read_parameter_content_e].result == f_console_result_found_e) { @@ -262,7 +262,7 @@ extern "C" { void fss_payload_read_print_object_end_extended(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_payload_read_pipe_content_end_s, main->output.to.stream); + f_print_dynamic_raw(fss_payload_read_pipe_content_end_s, main->output.to.stream); } else { f_print_dynamic_raw(f_fss_space_s, main->output.to.stream); @@ -274,7 +274,7 @@ extern "C" { void fss_payload_read_print_set_end(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_payload_read_pipe_content_end_s, main->output.to.stream); + f_print_dynamic_raw(fss_payload_read_pipe_content_end_s, main->output.to.stream); } } #endif // _di_fss_payload_read_print_set_end_ @@ -283,7 +283,7 @@ extern "C" { void fss_payload_read_print_set_end_extended(fll_program_data_t * const main) { if (main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) { - f_print_character(fss_payload_read_pipe_content_end_s, main->output.to.stream); + f_print_dynamic_raw(fss_payload_read_pipe_content_end_s, main->output.to.stream); } else { f_print_dynamic_raw(f_fss_eol_s, main->output.to.stream); diff --git a/level_3/fss_payload_read/c/private-read.c b/level_3/fss_payload_read/c/private-read.c index af307ae..2506fd7 100644 --- a/level_3/fss_payload_read/c/private-read.c +++ b/level_3/fss_payload_read/c/private-read.c @@ -225,7 +225,7 @@ extern "C" { #endif // _di_fss_payload_read_depth_process_ #ifndef _di_fss_payload_read_file_identify_ - f_string_t fss_payload_read_file_identify(const f_array_length_t at, const fss_payload_read_files_t files) { + f_string_static_t fss_payload_read_file_identify(const f_array_length_t at, const fss_payload_read_files_t files) { for (f_array_length_t i = 0; i < files.used; ++i) { @@ -239,14 +239,14 @@ extern "C" { return files.array[files.used - 1].name; } - return ""; + return f_string_empty_s; } #endif // _di_fss_payload_read_file_identify_ #ifndef _di_fss_payload_read_load_ f_status_t fss_payload_read_load(fll_program_data_t * const main, fss_payload_read_data_t *data) { - f_state_t state = macro_f_state_t_initialize(fss_payload_common_allocation_large_d, fss_payload_read_common_allocation_small_d, 0, 0, 0, 0, 0); + f_state_t state = macro_f_state_t_initialize(fss_payload_read_common_allocation_large_d, fss_payload_read_common_allocation_small_d, 0, 0, 0, 0, 0); f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used); data->delimits_object.used = 0; diff --git a/level_3/fss_payload_write/c/fss_payload_write.c b/level_3/fss_payload_write/c/fss_payload_write.c index 302bc1e..8b88fa6 100644 --- a/level_3/fss_payload_write/c/fss_payload_write.c +++ b/level_3/fss_payload_write/c/fss_payload_write.c @@ -53,10 +53,10 @@ extern "C" { fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s); fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", file.stream, f_string_eol_s, f_string_eol_s); - fl_print_format(" The FSS-000E (Payload) specification does not support quoted names, therefore the parameters '%[%r%s%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_write_long_single_s, context.set.notable); - fl_print_format(" and '%[%r%s%]' do nothing.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_write_long_double_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The FSS-000E (Payload) specification does not support quoted names, therefore the parameters '%[%r%r%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_write_long_single_s, context.set.notable); + fl_print_format(" and '%[%r%r%]' do nothing.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_write_long_double_s, context.set.notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" This program does not use the parameter '%[%r%s%]', which therefore does nothing.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_write_long_ignore_s, context.set.notable, f_string_eol_s); + fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_write_long_ignore_s, context.set.notable, f_string_eol_s); fl_print_format(" This parameter requires two values.%r%r", file.stream, f_string_eol_s, f_string_eol_s); funlockfile(file.stream); diff --git a/level_3/fss_payload_write/c/private-common.h b/level_3/fss_payload_write/c/private-common.h index a612a40..b5cfa64 100644 --- a/level_3/fss_payload_write/c/private-common.h +++ b/level_3/fss_payload_write/c/private-common.h @@ -20,8 +20,8 @@ extern "C" { * - small: An allocation step used for buffers that are anticipated to have small buffers. */ #ifndef _di_fss_payload_write_common_ - #define fss_payload_write_common_allocation_large_d 256 - #define fss_payload_write_common_allocation_small_d 16 + #define fss_payload_write_common_allocation_large_d 2048 + #define fss_payload_write_common_allocation_small_d 128 #endif // _di_fss_payload_write_common_ /** diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index 39ba5a2..6b86132 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -437,7 +437,6 @@ extern "C" { if (F_status_is_fine(status) && main->parameters.remaining.used > 0) { uint16_t signal_check = 0; - f_array_length_t total = 0; f_file_t file = f_file_t_initialize; for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { @@ -453,7 +452,7 @@ extern "C" { } macro_f_file_t_reset(file); - total = 0; + file.size_read = 0; status = f_file_open(argv[main->parameters.remaining.array[i]], 0, &file); @@ -463,7 +462,7 @@ extern "C" { break; } - status = f_file_size_by_id(file.id, &total); + status = f_file_size_by_id(file.id, &file.size_read); if (F_status_is_error(status)) { fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e); @@ -474,18 +473,20 @@ extern "C" { } // Skip past empty files. - if (!total) { + if (!file.size_read) { f_file_stream_close(F_true, &file); continue; } - status = f_file_read_until(file, total, &main->buffer); + ++file.size_read; + + status = f_file_read(file, &main->buffer); f_file_stream_close(F_true, &file); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e); break; } -- 1.8.3.1