From: Kevin Day Date: Fri, 4 Aug 2023 05:00:15 +0000 (-0500) Subject: Cleanup: Remove the FSS Embedded List Program. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=9654cb5ca8f46c4f05540cfc8163c8459aa459fa;p=fll Cleanup: Remove the FSS Embedded List Program. This embedded_list in fss_read should be used going forward. The embedded_list in fss_read is not working yet and is just a copy of extended_list. I will eventually get around to updating the embedded_list in fss_read to work as intended and expected. --- diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c deleted file mode 100644 index 6c6f2ed..0000000 --- a/level_3/fss_embedded_list_read/c/common.c +++ /dev/null @@ -1,174 +0,0 @@ -#include "fss_embedded_list_read.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_embedded_list_read_program_version_s_ - const f_string_static_t fss_embedded_list_read_program_version_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_program_version_s, 0, FSS_EMBEDDED_LIST_READ_program_version_s_length); -#endif // _di_fss_embedded_list_read_program_version_s_ - -#ifndef _di_fss_embedded_list_read_program_name_s_ - const f_string_static_t fss_embedded_list_read_program_name_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_program_name_s, 0, FSS_EMBEDDED_LIST_READ_program_name_s_length); - const f_string_static_t fss_embedded_list_read_program_name_long_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_program_name_long_s, 0, FSS_EMBEDDED_LIST_READ_program_name_long_s_length); -#endif // _di_fss_embedded_list_read_program_name_s_ - -#ifndef _di_fss_embedded_list_read_pipe_s_ - const f_string_static_t fss_embedded_list_read_pipe_name_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_pipe_name_s, 0, FSS_EMBEDDED_LIST_READ_pipe_name_s_length); - const f_string_static_t fss_embedded_list_read_pipe_content_end_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_pipe_content_end_s, 0, FSS_EMBEDDED_LIST_READ_pipe_content_end_s_length); - const f_string_static_t fss_embedded_list_read_pipe_content_ignore_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_pipe_content_ignore_s, 0, FSS_EMBEDDED_LIST_READ_pipe_content_ignore_s_length); - const f_string_static_t fss_embedded_list_read_pipe_content_start_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_pipe_content_start_s, 0, FSS_EMBEDDED_LIST_READ_pipe_content_start_s_length); -#endif // _di_fss_embedded_list_read_pipe_s_ - -#ifndef _di_fss_embedded_list_read_parameter_d_ - const f_string_static_t fss_embedded_list_read_short_at_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_at_s, 0, FSS_EMBEDDED_LIST_READ_short_at_s_length); - const f_string_static_t fss_embedded_list_read_short_content_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_content_s, 0, FSS_EMBEDDED_LIST_READ_short_content_s_length); - const f_string_static_t fss_embedded_list_read_short_columns_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_columns_s, 0, FSS_EMBEDDED_LIST_READ_short_columns_s_length); - const f_string_static_t fss_embedded_list_read_short_delimit_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_delimit_s, 0, FSS_EMBEDDED_LIST_READ_short_delimit_s_length); - const f_string_static_t fss_embedded_list_read_short_depth_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_depth_s, 0, FSS_EMBEDDED_LIST_READ_short_depth_s_length); - const f_string_static_t fss_embedded_list_read_short_empty_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_empty_s, 0, FSS_EMBEDDED_LIST_READ_short_empty_s_length); - const f_string_static_t fss_embedded_list_read_short_line_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_line_s, 0, FSS_EMBEDDED_LIST_READ_short_line_s_length); - const f_string_static_t fss_embedded_list_read_short_name_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_name_s, 0, FSS_EMBEDDED_LIST_READ_short_name_s_length); - const f_string_static_t fss_embedded_list_read_short_object_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_object_s, 0, FSS_EMBEDDED_LIST_READ_short_object_s_length); - const f_string_static_t fss_embedded_list_read_short_pipe_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_pipe_s, 0, FSS_EMBEDDED_LIST_READ_short_pipe_s_length); - const f_string_static_t fss_embedded_list_read_short_original_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_original_s, 0, FSS_EMBEDDED_LIST_READ_short_original_s_length); - const f_string_static_t fss_embedded_list_read_short_select_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_select_s, 0, FSS_EMBEDDED_LIST_READ_short_select_s_length); - const f_string_static_t fss_embedded_list_read_short_total_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_total_s, 0, FSS_EMBEDDED_LIST_READ_short_total_s_length); - const f_string_static_t fss_embedded_list_read_short_trim_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_short_trim_s, 0, FSS_EMBEDDED_LIST_READ_short_trim_s_length); - - const f_string_static_t fss_embedded_list_read_long_at_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_at_s, 0, FSS_EMBEDDED_LIST_READ_long_at_s_length); - const f_string_static_t fss_embedded_list_read_long_content_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_content_s, 0, FSS_EMBEDDED_LIST_READ_long_content_s_length); - const f_string_static_t fss_embedded_list_read_long_columns_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_columns_s, 0, FSS_EMBEDDED_LIST_READ_long_columns_s_length); - const f_string_static_t fss_embedded_list_read_long_delimit_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_delimit_s, 0, FSS_EMBEDDED_LIST_READ_long_delimit_s_length); - const f_string_static_t fss_embedded_list_read_long_depth_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_depth_s, 0, FSS_EMBEDDED_LIST_READ_long_depth_s_length); - const f_string_static_t fss_embedded_list_read_long_empty_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_empty_s, 0, FSS_EMBEDDED_LIST_READ_long_empty_s_length); - const f_string_static_t fss_embedded_list_read_long_line_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_line_s, 0, FSS_EMBEDDED_LIST_READ_long_line_s_length); - const f_string_static_t fss_embedded_list_read_long_name_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_name_s, 0, FSS_EMBEDDED_LIST_READ_long_name_s_length); - const f_string_static_t fss_embedded_list_read_long_object_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_object_s, 0, FSS_EMBEDDED_LIST_READ_long_object_s_length); - const f_string_static_t fss_embedded_list_read_long_pipe_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_pipe_s, 0, FSS_EMBEDDED_LIST_READ_long_pipe_s_length); - const f_string_static_t fss_embedded_list_read_long_original_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_original_s, 0, FSS_EMBEDDED_LIST_READ_long_original_s_length); - const f_string_static_t fss_embedded_list_read_long_select_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_select_s, 0, FSS_EMBEDDED_LIST_READ_long_select_s_length); - const f_string_static_t fss_embedded_list_read_long_total_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_total_s, 0, FSS_EMBEDDED_LIST_READ_long_total_s_length); - const f_string_static_t fss_embedded_list_read_long_trim_s = macro_f_string_static_t_initialize_1(FSS_EMBEDDED_LIST_READ_long_trim_s, 0, FSS_EMBEDDED_LIST_READ_long_trim_s_length); -#endif // _di_fss_embedded_list_read_parameter_d_ - -#ifndef _di_fss_embedded_list_read_delimit_mode_s_ - const f_string_static_t fss_embedded_list_read_delimit_mode_name_none_s = macro_f_string_static_t_initialize_1(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_1(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_greater_s = macro_f_string_static_t_initialize_1(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_1(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_s_ - -#ifndef _di_fss_embedded_list_read_setting_delete_ - f_status_t fss_embedded_list_read_setting_delete(fss_embedded_list_read_setting_t * const setting) { - - if (!setting) return F_status_set_error(F_parameter); - - return F_none; - } -#endif // _di_fss_embedded_list_read_setting_delete_ - -#ifndef _di_fss_embedded_list_read_setting_load_ - void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting) { - - if (!main) return; - - main->setting.state.step_small = fss_embedded_list_read_allocation_console_d; - - f_console_parameter_process(arguments, &main->program.parameters, &main->setting.state, 0); - - main->setting.state.step_small = fss_embedded_list_read_allocation_small_d; - - // Identify and process first/last parameters. - if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { - main->setting.flag -= main->setting.flag & fss_embedded_list_read_main_flag_print_first_e; - } - else { - main->setting.flag |= fss_embedded_list_read_main_flag_print_first_e; - } - - if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { - main->setting.flag -= main->setting.flag & fss_embedded_list_read_main_flag_print_last_e; - } - else { - main->setting.flag |= fss_embedded_list_read_main_flag_print_last_e; - } - - if (F_status_is_error(main->setting.state.status)) { - fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - - if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.error); - } - - return; - } - - main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_context_standard", fll_error_file_flag_fallback_e); - - if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.error); - } - - return; - } - - main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_verbosity_standard", fll_error_file_flag_fallback_e); - - if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.error); - } - - return; - } - - main->program.output.to.id = F_type_descriptor_output_d; - main->program.output.to.stream = F_type_output_d; - main->program.output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - - if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { - main->setting.flag |= fss_embedded_list_read_main_flag_help_e; - - return; - } - - if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { - main->setting.flag |= fss_embedded_list_read_main_flag_version_e; - - return; - } - - if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { - main->setting.flag |= fss_embedded_list_read_main_flag_copyright_e; - - return; - } - - f_string_static_t * const args = main->program.parameters.arguments.array; - - if (main->program.parameters.array[fss_embedded_list_read_parameter_strip_invalid_e].result & f_console_result_found_e) { - main->setting.flag |= fss_embedded_list_read_main_flag_strip_invalid_e; - } - } -#endif // _di_fss_embedded_list_read_setting_load_ - -#ifndef _di_fss_embedded_list_read_setting_unload_ - f_status_t fss_embedded_list_read_setting_unload(fss_embedded_list_read_main_t * const main) { - - if (!main) return F_status_set_error(F_parameter); - - fss_embedded_list_read_setting_delete(&main->setting); - - return F_none; - } -#endif // _di_fss_embedded_list_read_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_read/c/common.h b/level_3/fss_embedded_list_read/c/common.h deleted file mode 100644 index d50e843..0000000 --- a/level_3/fss_embedded_list_read/c/common.h +++ /dev/null @@ -1,402 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Embedded List Read - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Provides the common data structures. - * - * This is auto-included and should not need to be explicitly included. - */ -#ifndef _fss_embedded_list_read_common_h -#define _fss_embedded_list_read_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * The program version. - */ -#ifndef _di_fss_embedded_list_read_program_version_s_ - #define FSS_EMBEDDED_LIST_READ_program_version_major_s F_string_ascii_0_s - #define FSS_EMBEDDED_LIST_READ_program_version_minor_s F_string_ascii_7_s - #define FSS_EMBEDDED_LIST_READ_program_version_micro_s F_string_ascii_0_s - - #define FSS_EMBEDDED_LIST_READ_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_EMBEDDED_LIST_READ_program_version_minor_s_length F_string_ascii_7_s_length - #define FSS_EMBEDDED_LIST_READ_program_version_micro_s_length F_string_ascii_0_s_length - - #if !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length)) - #define FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s - #define FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s_length)) - #define FSS_EMBEDDED_LIST_READ_program_version_nano_s - #define FSS_EMBEDDED_LIST_READ_program_version_nano_s_length 0 - #endif // !(defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_READ_program_version_nano_s_length)) - - #define FSS_EMBEDDED_LIST_READ_program_version_s FSS_EMBEDDED_LIST_READ_program_version_major_s F_string_ascii_period_s FSS_EMBEDDED_LIST_READ_program_version_minor_s F_string_ascii_period_s FSS_EMBEDDED_LIST_READ_program_version_micro_s FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s FSS_EMBEDDED_LIST_READ_program_version_nano_s - - #define FSS_EMBEDDED_LIST_READ_program_version_s_length FSS_EMBEDDED_LIST_READ_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_READ_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_READ_program_version_micro_s_length + FSS_EMBEDDED_LIST_READ_program_version_nano_prefix_s_length + FSS_EMBEDDED_LIST_READ_program_version_nano_s_length - - extern const f_string_static_t fss_embedded_list_read_program_version_s; -#endif // _di_fss_embedded_list_read_program_version_s_ - -/** - * The program name. - */ -#ifndef _di_fss_embedded_list_read_program_name_s_ - #define FSS_EMBEDDED_LIST_READ_program_name_s "fss_embedded_list_read" - #define FSS_EMBEDDED_LIST_READ_program_name_long_s "FSS Embedded List Read" - - #define FSS_EMBEDDED_LIST_READ_program_name_s_length 22 - #define FSS_EMBEDDED_LIST_READ_program_name_long_s_length 22 - - extern const f_string_static_t fss_embedded_list_read_program_name_s; - extern const f_string_static_t fss_embedded_list_read_program_name_long_s; -#endif // _di_fss_embedded_list_read_program_name_s_ - -/** - * The program defines. - * - * fss_embedded_list_read_*_d: - * - allocation_console: An allocation step used for small buffers specifically for console parameter. - * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. - * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. - * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. - */ -#ifndef _di_fss_embedded_list_read_d_ - #define fss_embedded_list_read_allocation_console_d 4 - #define fss_embedded_list_read_allocation_large_d 256 - #define fss_embedded_list_read_allocation_small_d 16 - #define fss_embedded_list_read_signal_check_d 20000 -#endif // _di_fss_embedded_list_read_d_ - -/** - * The program defines. - * - * fss_embedded_list_read_pipe_*: - * - name: A name used to represent the pipe when printing file names. - * - content_end: A code used to represent the end of Content for use in binary formats. - * - content_ignore: A code used to represent the ignoring Content for use in binary formats. - * - content_start: A code used to represent the start of Content for use in binary formats. - */ -#ifndef _di_fss_embedded_list_read_pipe_s_ - #define FSS_EMBEDDED_LIST_READ_pipe_name_s "(pipe)" - - #define FSS_EMBEDDED_LIST_READ_pipe_content_end_s "\f" - #define FSS_EMBEDDED_LIST_READ_pipe_content_ignore_s "\v" - #define FSS_EMBEDDED_LIST_READ_pipe_content_start_s "\b" - - #define FSS_EMBEDDED_LIST_READ_pipe_name_s_length 6 - - #define FSS_EMBEDDED_LIST_READ_pipe_content_end_s_length 1 - #define FSS_EMBEDDED_LIST_READ_pipe_content_ignore_s_length 1 - #define FSS_EMBEDDED_LIST_READ_pipe_content_start_s_length 1 - - extern const f_string_static_t fss_embedded_list_read_pipe_name_s; - - extern const f_string_static_t fss_embedded_list_read_pipe_content_end_s; - extern const f_string_static_t fss_embedded_list_read_pipe_content_ignore_s; - extern const f_string_static_t fss_embedded_list_read_pipe_content_start_s; -#endif // _di_fss_embedded_list_read_pipe_s_ - -/** - * The main program parameters. - */ -#ifndef _di_fss_embedded_list_read_parameter_d_ - #define FSS_EMBEDDED_LIST_READ_short_at_s "a" - #define FSS_EMBEDDED_LIST_READ_short_content_s "c" - #define FSS_EMBEDDED_LIST_READ_short_columns_s "C" - #define FSS_EMBEDDED_LIST_READ_short_delimit_s "D" - #define FSS_EMBEDDED_LIST_READ_short_depth_s "d" - #define FSS_EMBEDDED_LIST_READ_short_empty_s "e" - #define FSS_EMBEDDED_LIST_READ_short_line_s "l" - #define FSS_EMBEDDED_LIST_READ_short_name_s "n" - #define FSS_EMBEDDED_LIST_READ_short_object_s "o" - #define FSS_EMBEDDED_LIST_READ_short_pipe_s "p" - #define FSS_EMBEDDED_LIST_READ_short_original_s "O" - #define FSS_EMBEDDED_LIST_READ_short_select_s "s" - #define FSS_EMBEDDED_LIST_READ_short_total_s "t" - #define FSS_EMBEDDED_LIST_READ_short_trim_s "T" - - #define FSS_EMBEDDED_LIST_READ_long_at_s "at" - #define FSS_EMBEDDED_LIST_READ_long_content_s "content" - #define FSS_EMBEDDED_LIST_READ_long_columns_s "columns" - #define FSS_EMBEDDED_LIST_READ_long_delimit_s "delimit" - #define FSS_EMBEDDED_LIST_READ_long_depth_s "depth" - #define FSS_EMBEDDED_LIST_READ_long_empty_s "empty" - #define FSS_EMBEDDED_LIST_READ_long_line_s "line" - #define FSS_EMBEDDED_LIST_READ_long_name_s "name" - #define FSS_EMBEDDED_LIST_READ_long_object_s "object" - #define FSS_EMBEDDED_LIST_READ_long_pipe_s "pipe" - #define FSS_EMBEDDED_LIST_READ_long_original_s "original" - #define FSS_EMBEDDED_LIST_READ_long_select_s "select" - #define FSS_EMBEDDED_LIST_READ_long_total_s "total" - #define FSS_EMBEDDED_LIST_READ_long_trim_s "trim" - - #define FSS_EMBEDDED_LIST_READ_short_at_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_content_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_columns_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_delimit_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_depth_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_empty_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_line_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_name_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_object_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_pipe_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_original_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_select_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_total_s_length 1 - #define FSS_EMBEDDED_LIST_READ_short_trim_s_length 1 - - #define FSS_EMBEDDED_LIST_READ_long_at_s_length 2 - #define FSS_EMBEDDED_LIST_READ_long_content_s_length 7 - #define FSS_EMBEDDED_LIST_READ_long_columns_s_length 7 - #define FSS_EMBEDDED_LIST_READ_long_delimit_s_length 7 - #define FSS_EMBEDDED_LIST_READ_long_depth_s_length 5 - #define FSS_EMBEDDED_LIST_READ_long_empty_s_length 5 - #define FSS_EMBEDDED_LIST_READ_long_line_s_length 4 - #define FSS_EMBEDDED_LIST_READ_long_name_s_length 4 - #define FSS_EMBEDDED_LIST_READ_long_object_s_length 6 - #define FSS_EMBEDDED_LIST_READ_long_pipe_s_length 4 - #define FSS_EMBEDDED_LIST_READ_long_original_s_length 8 - #define FSS_EMBEDDED_LIST_READ_long_select_s_length 6 - #define FSS_EMBEDDED_LIST_READ_long_total_s_length 5 - #define FSS_EMBEDDED_LIST_READ_long_trim_s_length 4 - - extern const f_string_static_t fss_embedded_list_read_short_at_s; - extern const f_string_static_t fss_embedded_list_read_short_content_s; - extern const f_string_static_t fss_embedded_list_read_short_columns_s; - extern const f_string_static_t fss_embedded_list_read_short_delimit_s; - extern const f_string_static_t fss_embedded_list_read_short_depth_s; - extern const f_string_static_t fss_embedded_list_read_short_empty_s; - extern const f_string_static_t fss_embedded_list_read_short_line_s; - extern const f_string_static_t fss_embedded_list_read_short_name_s; - extern const f_string_static_t fss_embedded_list_read_short_object_s; - extern const f_string_static_t fss_embedded_list_read_short_pipe_s; - extern const f_string_static_t fss_embedded_list_read_short_original_s; - extern const f_string_static_t fss_embedded_list_read_short_select_s; - extern const f_string_static_t fss_embedded_list_read_short_total_s; - extern const f_string_static_t fss_embedded_list_read_short_trim_s; - - extern const f_string_static_t fss_embedded_list_read_long_at_s; - extern const f_string_static_t fss_embedded_list_read_long_content_s; - extern const f_string_static_t fss_embedded_list_read_long_columns_s; - extern const f_string_static_t fss_embedded_list_read_long_delimit_s; - extern const f_string_static_t fss_embedded_list_read_long_depth_s; - extern const f_string_static_t fss_embedded_list_read_long_empty_s; - extern const f_string_static_t fss_embedded_list_read_long_line_s; - extern const f_string_static_t fss_embedded_list_read_long_name_s; - extern const f_string_static_t fss_embedded_list_read_long_object_s; - extern const f_string_static_t fss_embedded_list_read_long_pipe_s; - extern const f_string_static_t fss_embedded_list_read_long_original_s; - extern const f_string_static_t fss_embedded_list_read_long_select_s; - extern const f_string_static_t fss_embedded_list_read_long_total_s; - extern const f_string_static_t fss_embedded_list_read_long_trim_s; - - enum { - fss_embedded_list_read_parameter_at_e = f_console_standard_parameter_last_e, - fss_embedded_list_read_parameter_content_e, - fss_embedded_list_read_parameter_columns_e, - fss_embedded_list_read_parameter_delimit_e, - fss_embedded_list_read_parameter_depth_e, - fss_embedded_list_read_parameter_empty_e, - fss_embedded_list_read_parameter_line_e, - fss_embedded_list_read_parameter_name_e, - fss_embedded_list_read_parameter_object_e, - fss_embedded_list_read_parameter_pipe_e, - fss_embedded_list_read_parameter_original_e, - fss_embedded_list_read_parameter_select_e, - fss_embedded_list_read_parameter_total_e, - fss_embedded_list_read_parameter_trim_e, - }; // enum - - #define fss_embedded_list_read_console_parameter_t_initialize \ - { \ - macro_fll_program_console_parameter_standard_initialize, \ - \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_at_s.string, fss_embedded_list_read_long_at_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_content_s.string, fss_embedded_list_read_long_content_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_columns_s.string, fss_embedded_list_read_long_columns_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_delimit_s.string, fss_embedded_list_read_long_delimit_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_depth_s.string, fss_embedded_list_read_long_depth_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_empty_s.string, fss_embedded_list_read_long_empty_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_line_s.string, fss_embedded_list_read_long_line_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_name_s.string, fss_embedded_list_read_long_name_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_object_s.string, fss_embedded_list_read_long_object_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_pipe_s.string, fss_embedded_list_read_long_pipe_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_original_s.string, fss_embedded_list_read_long_original_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_select_s.string, fss_embedded_list_read_long_select_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_total_s.string, fss_embedded_list_read_long_total_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_trim_s.string, fss_embedded_list_read_long_trim_s.string, 0, 0, f_console_flag_normal_e), \ - } - - #define fss_embedded_list_read_parameter_total_d 27 -#endif // _di_fss_embedded_list_read_parameter_d_ - -/** - * Provide delimit strings. - */ -#ifndef _di_fss_embedded_list_read_delimit_mode_s_ - #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; -#endif // _di_fss_embedded_list_read_delimit_modes_ - -/** - * Provide delimit enumerations. - */ -#ifndef _di_fss_embedded_list_read_delimit_mode_e_ - enum { - fss_embedded_list_read_delimit_mode_none_e = 1, - fss_embedded_list_read_delimit_mode_all_e, - fss_embedded_list_read_delimit_mode_depth_e, - fss_embedded_list_read_delimit_mode_depth_greater_e, - fss_embedded_list_read_delimit_mode_depth_lesser_e, - }; // enum -#endif // _di_fss_embedded_list_read_delimit_mode_e_ - -/** - * Flags passed to the main function or program. - * - * fss_embedded_list_read_main_flag_*_e: - * - none: No flags set. - * - copyright: Print copyright. - * - file_from: Using a specified source file. - * - file_to: Using a specified destination file. - * - header: Enable printing of headers. - * - help: Print help. - * - print_first: When set, print new line to message output on program begin after loading settings. - * - print_last: When set, print new line to message output on program end. - * - separate: Enable printing of separators. - * - strip_invalid: Using strip invalid character mode. - * - verify: Using verify mode. - * - version: Print version. - */ -#ifndef _di_fss_embedded_list_read_main_flag_e_ - enum { - fss_embedded_list_read_main_flag_none_e = 0x0, - fss_embedded_list_read_main_flag_copyright_e = 0x1, - fss_embedded_list_read_main_flag_file_from_e = 0x2, - fss_embedded_list_read_main_flag_file_to_e = 0x4, - fss_embedded_list_read_main_flag_header_e = 0x8, - fss_embedded_list_read_main_flag_help_e = 0x10, - fss_embedded_list_read_main_flag_print_first_e = 0x20, - fss_embedded_list_read_main_flag_print_last_e = 0x40, - fss_embedded_list_read_main_flag_separate_e = 0x80, - fss_embedded_list_read_main_flag_strip_invalid_e = 0x100, - fss_embedded_list_read_main_flag_verify_e = 0x200, - fss_embedded_list_read_main_flag_version_e = 0x400, - }; // enum -#endif // _di_fss_embedded_list_read_main_flag_e_ - -/** - * The fss embedded list read main program settings. - * - * This is passed to the program-specific main entry point to designate program settings. - * These program settings are often processed from the program arguments (often called the command line arguments). - * - * flag: Flags passed to the main function. - * - * state: The state information. - */ -#ifndef _di_fss_embedded_list_read_setting_t_ - typedef struct { - uint16_t flag; - - f_state_t state; - } fss_embedded_list_read_setting_t; - - #define fss_embedded_list_read_setting_t_initialize \ - { \ - fss_embedded_list_read_main_flag_none_e, \ - f_state_t_initialize, \ - } -#endif // _di_fss_embedded_list_read_setting_t_ - -/** - * Delete the program main setting data. - * - * @param setting - * The program main setting data. - * - * This does not alter setting.state.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fss_embedded_list_read_setting_delete_ - extern f_status_t fss_embedded_list_read_setting_delete(fss_embedded_list_read_setting_t * const setting); -#endif // _di_fss_embedded_list_read_setting_delete_ - -/** - * Perform the standard program setting load process. - * - * This prints error messages as appropriate. - * - * If either main or setting is NULL, then this immediately returns without doing anything. - * - * @param arguments - * The parameters passed to the process (often referred to as command line arguments). - * @param main - * The main program data. - * @param setting - * The main program settings. - * - * This alters setting.state.status: - * F_none on success. - * - * Errors (with error bit) from: f_console_parameter_process(). - * Errors (with error bit) from: fll_program_parameter_process_context(). - * - * @see f_console_parameter_process() - * @see fll_program_parameter_process_context() - */ -#ifndef _di_fss_embedded_list_read_setting_load_ - extern void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting); -#endif // _di_fss_embedded_list_read_setting_load_ - -/** - * Perform the standard program setting unload process. - * - * @param main - * The main program and setting data. - * All buffers are deallocated. - * - * This does not alter main.setting.state.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: fss_embedded_list_read_setting_delete(). - * - * @see fss_embedded_list_read_setting_delete() - */ -#ifndef _di_fss_embedded_list_read_setting_unload_ - extern f_status_t fss_embedded_list_read_setting_unload(fss_embedded_list_read_main_t * const main); -#endif // _di_fss_embedded_list_read_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_embedded_list_read_common_h 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 deleted file mode 100644 index 9279de2..0000000 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ /dev/null @@ -1,425 +0,0 @@ -#include "fss_embedded_list_read.h" -#include "private-common.h" -#include "private-print.h" -#include "private-read.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_embedded_list_read_main_ - f_status_t fss_embedded_list_read_main(fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting) { - - f_status_t status = F_none; - - setting->state.step_small = fss_embedded_list_read_allocation_console_d; - - status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); - - setting->state.step_small = fss_embedded_list_read_allocation_small_d; - - if (F_status_is_error(status)) return; - - status = fll_program_parameter_process_context_standard(F_true, &main->program); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context_standard", fll_error_file_flag_fallback_e); - - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->error); - } - - return; - } - - status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity_standard", fll_error_file_flag_fallback_e); - - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->error); - } - - return; - } - - if (main->parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { - fss_embedded_list_read_print_help(setting, main->message); - - return F_none; - } - - if (main->parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, fss_embedded_list_read_program_version_s); - - return F_none; - } - - if (main->parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message); - - return F_none; - } - - status = F_none; - - fss_embedded_list_read_data_t data = fss_embedded_list_read_data_t_initialize; - data.main = main; - data.argv = main->parameters.arguments.array; - - if (F_status_is_error_not(status) && (main->parameters.array[fss_embedded_list_read_parameter_total_e].result & f_console_result_found_e)) { - if (main->parameters.array[fss_embedded_list_read_parameter_columns_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_embedded_list_read_long_columns_s, fss_embedded_list_read_long_total_s); - } - - status = F_status_set_error(F_parameter); - } - } - - if (main->parameters.remaining.used > 0 || (main->pipe & fll_program_data_pipe_input_e)) { - if (main->parameters.array[fss_embedded_list_read_parameter_at_e].result & f_console_result_found_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe parameter '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_at_s, main->error.notable); - fl_print_format("%[' requires a positive number.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - - status = F_status_set_error(F_parameter); - } - - if (F_status_is_error_not(status) && (main->parameters.array[fss_embedded_list_read_parameter_depth_e].result & f_console_result_found_e)) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe parameter '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_depth_s, main->error.notable); - fl_print_format("%[' requires a positive number.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - - status = F_status_set_error(F_parameter); - } - - if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_line_e].result & f_console_result_value_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe parameter '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_line_s, main->error.notable); - fl_print_format("%[' requires a positive number.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - - status = F_status_set_error(F_parameter); - } - - if (F_status_is_error_not(status) && (main->parameters.array[fss_embedded_list_read_parameter_name_e].result & f_console_result_found_e)) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe parameter '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_name_s, main->error.notable); - fl_print_format("%[' requires a string.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - - status = F_status_set_error(F_parameter); - } - - if (F_status_is_error_not(status) && (main->parameters.array[fss_embedded_list_read_parameter_select_e].result & f_console_result_found_e)) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe parameter '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_select_s, main->error.notable); - fl_print_format("%[' requires a positive number.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - - status = F_status_set_error(F_parameter); - } - - if (main->parameters.array[fss_embedded_list_read_parameter_line_e].result & f_console_result_value_e) { - if (F_status_is_error_not(status) && (main->parameters.array[fss_embedded_list_read_parameter_total_e].result & f_console_result_found_e)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_embedded_list_read_long_line_s, fss_embedded_list_read_long_total_s); - } - - status = F_status_set_error(F_parameter); - } - } - - if (main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result & f_console_result_found_e) { - if (F_status_is_error_not(status) && (main->parameters.array[fss_embedded_list_read_parameter_total_e].result & f_console_result_found_e)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_embedded_list_read_long_pipe_s, fss_embedded_list_read_long_total_s); - } - - status = F_status_set_error(F_parameter); - } - } - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_embedded_list_read_parameter_delimit_e].result & f_console_result_found_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe parameter '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_delimit_s, main->error.notable); - fl_print_format("%[' requires a value.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_embedded_list_read_parameter_delimit_e].result & f_console_result_value_e) { - const f_number_unsigned_t index = main->parameters.array[fss_embedded_list_read_parameter_delimit_e].values.array[0]; - f_number_unsigned_t length = data.argv[index].used; - - if (!length) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_delimit_s, main->error.notable); - fl_print_format("%[' must not be empty.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - - status = F_status_set_error(F_parameter); - } - else if (f_compare_dynamic_string(fss_embedded_list_read_delimit_mode_name_none_s.string, data.argv[index], fss_embedded_list_read_delimit_mode_name_none_s.used) == F_equal_to) { - data.delimit_mode = fss_embedded_list_read_delimit_mode_none_e; - } - else if (f_compare_dynamic_string(fss_embedded_list_read_delimit_mode_name_all_s.string, data.argv[index], fss_embedded_list_read_delimit_mode_name_all_s.used) == F_equal_to) { - data.delimit_mode = fss_embedded_list_read_delimit_mode_all_e; - } - else { - data.delimit_mode = fss_embedded_list_read_delimit_mode_depth_e; - - if (data.argv[index].string[length - 1] == fss_embedded_list_read_delimit_mode_name_greater_s.string[0]) { - data.delimit_mode = fss_embedded_list_read_delimit_mode_depth_greater_e; - - // Shorten the length to better convert the remainder to a number. - --length; - } - else if (data.argv[index].string[length - 1] == fss_embedded_list_read_delimit_mode_name_lesser_s.string[0]) { - data.delimit_mode = fss_embedded_list_read_delimit_mode_depth_lesser_e; - - // Shorten the length to better convert the remainder to a number. - --length; - } - - f_string_range_t range = macro_f_string_range_t_initialize_2(length); - - // Ignore leading plus sign. - if (data.argv[index].string[0] == f_string_ascii_plus_s.string[0]) { - ++range.start; - } - - status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], range, &data.delimit_depth); - - if (F_status_is_error(status)) { - fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_unsigned_detect", F_true, fss_embedded_list_read_long_delimit_s, data.argv[index]); - } - } - } - } - - fss_embedded_list_read_depths_t depths = fss_embedded_list_read_depths_t_initialize; - - f_number_unsigneds_t objects_delimits = f_number_unsigneds_t_initialize; - f_number_unsigneds_t contents_delimits = f_number_unsigneds_t_initialize; - f_string_range_t comments = f_string_range_t_initialize; - - if (F_status_is_error_not(status)) { - status = fss_embedded_list_read_main_preprocess_depth(&data, &depths); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_preprocess_depth", fll_error_file_flag_fallback_e); - } - } - - if (F_status_is_error_not(status) && (main->parameters.array[fss_embedded_list_read_parameter_select_e].result & f_console_result_found_e)) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_select_s, main->error.notable); - fl_print_format("%[' parameter requires a positive number.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - - status = F_status_set_error(F_parameter); - } - - if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) { - f_file_t file = f_file_t_initialize; - - file.id = F_type_descriptor_input_d; - - status = f_file_read(file, &data.buffer); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", fll_error_file_flag_fallback_e, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); - } - else { - status = fss_embedded_list_read_main_process_file(&data, f_string_ascii_minus_s, depths, &objects_delimits, &contents_delimits, &comments); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", fll_error_file_flag_fallback_e, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); - } - } - - // Clear buffers before continuing. - f_fss_nest_resize(0, &data.nest); - f_string_dynamic_resize(0, &data.buffer); - } - - if (F_status_is_error_not(status) && main->parameters.remaining.used > 0) { - f_file_t file = f_file_t_initialize; - off_t size_block = 0; - off_t size_file = 0; - off_t size_read = 0; - - for (f_number_unsigned_t i = 0; i < main->parameters.remaining.used; ++i) { - - if (!((++main->signal_check) % fss_embedded_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(main->warning, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - file.stream = 0; - file.id = -1; - - status = f_file_stream_open(data.argv[main->parameters.remaining.array[i]], 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", fll_error_file_flag_fallback_e, data.argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e); - - break; - } - - size_file = 0; - - 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", fll_error_file_flag_fallback_e, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); - - f_file_stream_flush(file); - f_file_stream_close(&file); - - break; - } - - // Skip past empty files. - if (!size_file) { - if (main->parameters.array[fss_embedded_list_read_parameter_total_e].result & f_console_result_found_e) { - fll_print_format("%r%r", main->output.to, f_string_ascii_0_s, f_string_eol_s); - } - - f_file_stream_flush(file); - f_file_stream_close(&file); - - continue; - } - - // Enforce a max block read size to allow for interrupts to be processed between blocks. - if (size_file > fss_embedded_list_read_block_max) { - file.size_read = fss_embedded_list_read_block_read_large; - size_block = fss_embedded_list_read_block_max; - - // Pre-allocate entire file buffer plus space for the terminating NULL. - f_string_dynamic_increase_by(size_file + (size_block - (size_file % size_block)) + 1, &data.buffer); - } - else { - file.size_read = fss_embedded_list_read_block_read_small; - size_block = size_file; - - // Pre-allocate entire file buffer plus space for the terminating NULL. - f_string_dynamic_increase_by(size_file + 1, &data.buffer); - } - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", fll_error_file_flag_fallback_e, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e); - - f_file_stream_flush(file); - f_file_stream_close(&file); - - break; - } - - for (size_read = 0; size_read < size_file; size_read += size_block) { - - // The signal check is always performed on each pass. - if (size_file > fss_embedded_list_read_block_max && fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(main->warning, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - status = f_file_stream_read_until(file, size_block, &data.buffer); - if (F_status_is_error(status)) break; - } // for - - f_file_stream_flush(file); - f_file_stream_close(&file); - - if (F_status_is_error(status)) { - if (F_status_set_fine(status) != F_interrupt) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read_until", fll_error_file_flag_fallback_e, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); - } - - break; - } - - status = fss_embedded_list_read_main_process_file(&data, data.argv[main->parameters.remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", fll_error_file_flag_fallback_e, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e); - - break; - } - - // Clear buffers before repeating the loop. - f_fss_nest_resize(0, &data.nest); - data.buffer.used = 0; - } // for - } - - f_fss_nest_resize(0, &data.nest); - f_string_dynamic_resize(0, &data.buffer); - fss_embedded_list_read_depths_resize(0, &depths); - f_number_unsigneds_resize(0, &objects_delimits); - f_number_unsigneds_resize(0, &contents_delimits); - f_string_ranges_resize(0, &comments); - } - else { - fll_print_format("%r%[%QYou failed to specify one or more files.%]%r", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); - status = F_status_set_error(F_parameter); - } - - if (main->error.verbosity > f_console_verbosity_quiet_e) { - if (F_status_set_fine(status) == F_interrupt) { - f_file_stream_flush(main->output.to); - - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } - } - - fss_embedded_list_read_data_delete(&data); - - return status; - } -#endif // _di_fss_embedded_list_read_main_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h deleted file mode 100644 index e8d2e89..0000000 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * This is the FSS Basic List Read program - * This program utilizes the Featureless Linux Library. - * This program processes files or other input in fss format and stores the results in the fss_embedded_list_read_main_t. - * - * This processes in accordance to the FSS-0008 Embedded List specification. - */ -#ifndef _fss_embedded_list_read_h -#define _fss_embedded_list_read_h - -// Libc includes. -#include -#include -#include -#include -#include - -// FLL-0 includes. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// FLL-1 includes. -#include -#include - -// FLL-2 includes. -#include -#include -#include -#include -#include - -// FSS Embedded List Read includes. -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Execute main program. - * - * If main.signal is non-zero, then this blocks and handles the following signals: - * - F_signal_abort - * - F_signal_broken_pipe - * - F_signal_hangup - * - F_signal_interrupt - * - F_signal_quit - * - F_signal_termination - * - * @param main - * The main program data. - * @param setting - * The main program settings. - * - * This alters setting.state.status: - * F_none on success. - * F_true on success when performing verification and verify passed. - * F_false on success when performing verification and verify failed. - * F_interrupt on (exit) signal received. - * - * F_parameter (with error bit) if main is NULL or setting is NULL. - */ -#ifndef _di_fss_embedded_list_read_main_ - extern f_status_t fss_embedded_list_read_main(fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting); -#endif // _di_fss_embedded_list_read_main_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_embedded_list_read_h diff --git a/level_3/fss_embedded_list_read/c/main.c b/level_3/fss_embedded_list_read/c/main.c deleted file mode 100644 index 850000c..0000000 --- a/level_3/fss_embedded_list_read/c/main.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "fss_embedded_list_read.h" - -int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - - fss_embedded_list_read_main_t data = fss_embedded_list_read_main_t_initialize; - - data.program.debug.flag |= fss_embedded_list_read_print_flag_debug_e | fss_embedded_list_read_print_flag_out_e; - data.program.error.flag |= fss_embedded_list_read_print_flag_error_e | fss_embedded_list_read_print_flag_out_e; - data.program.output.flag |= fss_embedded_list_read_print_flag_out_e; - data.program.message.flag |= fss_embedded_list_read_print_flag_message_e | fss_embedded_list_read_print_flag_out_e; - data.program.warning.flag |= fss_embedded_list_read_print_flag_warning_e | fss_embedded_list_read_print_flag_out_e; - data.program.error.custom = (void *) &data; - data.program.debug.custom = (void *) &data; - data.program.message.custom = (void *) &data; - data.program.output.custom = (void *) &data; - data.program.warning.custom = (void *) &data; - - f_console_parameter_t parameters[] = fss_embedded_list_read_console_parameter_t_initialize; - data.program.parameters.array = parameters; - data.program.parameters.used = fss_embedded_list_read_parameter_total_d; - data.program.environment = envp; - - if (f_pipe_input_exists()) { - data.program.pipe = fll_program_data_pipe_input_e; - } - - fll_program_standard_set_up(&data.program); - - { - const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize_1(argc, argv, envp); - - fss_embedded_list_read_setting_load(arguments, &data); - } - - fss_embedded_list_read_main(&data); - - fss_embedded_list_read_setting_unload(&data); - - fll_program_data_delete(&data.program); - - fll_program_standard_set_down(&data.program); - - return F_status_is_error(data.setting.state.status) ? 1 : 0; -} diff --git a/level_3/fss_embedded_list_read/c/main.h b/level_3/fss_embedded_list_read/c/main.h deleted file mode 100644 index 28543db..0000000 --- a/level_3/fss_embedded_list_read/c/main.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Embedded List - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * This file is only ever included by main/main.c and should not normally be included anywhere else. - * Anything that wants to include this should be providing the "fss_embedded_list_read" program functionality in some manner. - */ -#ifndef _fss_embedded_list_read_main_h -#define _fss_embedded_list_read_main_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Standard program entry point. - * - * @param argc - * The number of arguments. - * @param argv - * The array of arguments. - * @param envp - * The array of all environment variables on program start. - * - * @return - * 0 on success. - * 1 on error. - */ -extern int main(const int argc, const f_string_t *argv, const f_string_t *envp); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_embedded_list_read_main_h diff --git a/level_3/fss_embedded_list_read/c/print.c b/level_3/fss_embedded_list_read/c/print.c deleted file mode 100644 index 9208db9..0000000 --- a/level_3/fss_embedded_list_read/c/print.c +++ /dev/null @@ -1,115 +0,0 @@ -#include "fss_embedded_list_read.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_embedded_list_read_print_help_ - f_status_t fss_embedded_list_read_print_help(fss_embedded_list_read_setting_t * const setting, const fl_print_t print) { - - f_file_stream_lock(print.to); - - fll_program_print_help_header(print, fss_embedded_list_read_program_name_long_s, fss_embedded_list_read_program_version_s); - - fll_program_print_help_option_standard(print); - - f_print_dynamic_raw(f_string_eol_s, print.to); - - fll_program_print_help_option(print, fss_embedded_list_read_short_at_s, fss_embedded_list_read_long_at_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Select Object at this numeric index."); - fll_program_print_help_option(print, fss_embedded_list_read_short_content_s, fss_embedded_list_read_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print the Content (default)."); - fll_program_print_help_option(print, fss_embedded_list_read_short_columns_s, fss_embedded_list_read_long_columns_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print the total number of columns."); - fll_program_print_help_option(print, fss_embedded_list_read_short_delimit_s, fss_embedded_list_read_long_delimit_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Designate how to handle applying delimits."); - fll_program_print_help_option(print, fss_embedded_list_read_short_depth_s, fss_embedded_list_read_long_depth_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Select Object at this numeric depth."); - fll_program_print_help_option(print, fss_embedded_list_read_short_empty_s, fss_embedded_list_read_long_empty_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Include empty Content when processing."); - fll_program_print_help_option(print, fss_embedded_list_read_short_line_s, fss_embedded_list_read_long_line_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print only the Content at the given line."); - fll_program_print_help_option(print, fss_embedded_list_read_short_name_s, fss_embedded_list_read_long_name_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Select Object with this name."); - fll_program_print_help_option(print, fss_embedded_list_read_short_object_s, fss_embedded_list_read_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print the Object."); - fll_program_print_help_option(print, fss_embedded_list_read_short_pipe_s, fss_embedded_list_read_long_pipe_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print using the special pipe format."); - fll_program_print_help_option(print, fss_embedded_list_read_short_original_s, fss_embedded_list_read_long_original_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Print with the original quotes and escapes."); - fll_program_print_help_option(print, fss_embedded_list_read_short_select_s, fss_embedded_list_read_long_select_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Select sub-Content at this index."); - fll_program_print_help_option(print, fss_embedded_list_read_short_total_s, fss_embedded_list_read_long_total_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print the total number of lines."); - fll_program_print_help_option(print, fss_embedded_list_read_short_trim_s, fss_embedded_list_read_long_trim_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Trim Object names on select or print."); - - f_print_dynamic_raw(f_string_eol_s, print.to); - f_print_dynamic_raw(f_string_eol_s, print.to); - - fll_program_print_help_usage(print, fss_embedded_list_read_program_name_s, fll_program_parameter_filenames_s); - - fl_print_format("%r %[Notes:%]%r", print.to, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s); - - fl_print_format(" This program will print the Content associated with the given Object and Content main based on the FSS-0008 Embedded List standard.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%r", print.to, f_string_eol_s); - fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" When using the %[%r%r%] option, an order of operations is enforced on the parameters.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_depth_s, print.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", print.to, f_string_eol_s); - - fl_print_format(" %[%r%r%]: An Object index at the specified depth.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_at_s, print.set->notable, f_string_eol_s); - fl_print_format(" %[%r%r%]: A new depth within the specified depth, indexed from the root.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_depth_s, print.set->notable, f_string_eol_s); - fl_print_format(" %[%r%r%]: An Object name at the specified depth.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_name_s, print.set->notable, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The parameter %[%r%r%] must be in numeric order, but values in between may be skipped.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_depth_s, print.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", print.to, 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", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The parameter %[%r%r%] selects a Content column.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_select_s, print.set->notable, f_string_eol_s, f_string_eol_s); - - fl_print_format(" Specify both %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_object_s, print.set->notable); - fl_print_format(" and the %[%r%r%] parameters to get the total objects.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_total_s, print.set->notable, f_string_eol_s, f_string_eol_s); - - fl_print_format(" When both %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_at_s, print.set->notable); - fl_print_format(" and %[%r%r%] parameters are specified (at the same depth),", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_name_s, print.set->notable); - fl_print_format(" the %[%r%r%] parameter value will be treated as a position relative to the specified", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_at_s, print.set->notable); - fl_print_format(" %[%r%r%] parameter value.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_name_s, print.set->notable, f_string_eol_s, f_string_eol_s); - - fl_print_format(" This program may support parameters, such as %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_depth_s, print.set->notable); - fl_print_format(" or %[%r%r%], even if not supported by the standard.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_select_s, print.set->notable, f_string_eol_s); - fl_print_format(" This is done to help ensure consistency for scripting.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" For parameters like %[%r%r%],", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_depth_s, print.set->notable); - fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%r", print.to, f_string_eol_s); - - fl_print_format(" For parameters like %[%r%r%],", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_select_s, print.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", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The parameter %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_trim_s, print.set->notable); - fl_print_format(" will remove leading and trailing white spaces when selecting objects or when printing objects.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" When specifying both the %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_object_s, print.set->notable); - fl_print_format(" parameter and the %[%r%r%] parameter, the entire Object and Content are printed, including the formatting.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_content_s, print.set->notable, f_string_eol_s); - fl_print_format(" Both the Object and Content printed are already escaped.%r", print.to, f_string_eol_s); - fl_print_format(" Both the Object and Content are separated by a New Line character '\\n' (U+000A).%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The parameter %[%r%r%] accepts the following:%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_delimit_s, print.set->notable, f_string_eol_s); - fl_print_format(" - %[%r%]: Do not apply delimits.%r", print.to, print.set->notable, fss_embedded_list_read_delimit_mode_name_none_s, print.set->notable, f_string_eol_s); - fl_print_format(" - %[%r%]: (default) Apply all delimits.%r", print.to, print.set->notable, fss_embedded_list_read_delimit_mode_name_all_s, print.set->notable, f_string_eol_s); - fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%r", print.to, 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", print.to, print.set->notable, fss_embedded_list_read_delimit_mode_name_greater_s, print.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", print.to, print.set->notable, fss_embedded_list_read_delimit_mode_name_lesser_s, print.set->notable, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The %[%r%r%] parameter may be specified multiple times to customize the delimit behavior.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_delimit_s, print.set->notable, f_string_eol_s); - - fl_print_format(" The %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_delimit_s, print.set->notable); - fl_print_format(" values %[%r%]", print.to, print.set->notable, fss_embedded_list_read_delimit_mode_name_none_s, print.set->notable); - fl_print_format(" and %[%r%],", print.to, print.set->notable, fss_embedded_list_read_delimit_mode_name_all_s, print.set->notable); - fl_print_format(" overrule all other delimit values.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The parameters %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_columns_s, print.set->notable); - fl_print_format(" and %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_select_s, print.set->notable); - fl_print_format(" refer to a Content column.%r", print.to, f_string_eol_s); - fl_print_format(" The word 'column' is being loosely defined to refer to a specific Content.%r", print.to, f_string_eol_s); - fl_print_format(" This is not to be confused with a depth.%r", print.to, f_string_eol_s); - - f_file_stream_flush(print.to); - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fss_embedded_list_read_print_help_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_read/c/print.h b/level_3/fss_embedded_list_read/c/print.h deleted file mode 100644 index fae9547..0000000 --- a/level_3/fss_embedded_list_read/c/print.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Embedded List Read - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _fss_embedded_list_read_print_h -#define _fss_embedded_list_read_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print help. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * The output structure to print to. - * - * @return - * F_none on success. - */ -#ifndef _di_fss_embedded_list_read_print_help_ - extern f_status_t fss_embedded_list_read_print_help(fss_embedded_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_embedded_list_read_print_help_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_embedded_list_read_print_h diff --git a/level_3/fss_embedded_list_read/c/private-common.c b/level_3/fss_embedded_list_read/c/private-common.c deleted file mode 100644 index c47bb33..0000000 --- a/level_3/fss_embedded_list_read/c/private-common.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "fss_embedded_list_read.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_embedded_list_read_data_delete_ - f_status_t fss_embedded_list_read_data_delete(fss_embedded_list_read_data_t * const data) { - - f_fss_nest_resize(0, &data->nest); - f_string_dynamic_resize(0, &data->buffer); - - return F_none; - } -#endif // _di_fss_embedded_list_read_data_delete_ - -#ifndef _di_fss_embedded_list_read_data_delete_ - f_status_t fss_embedded_list_read_depth_delete(fss_embedded_list_read_depth_t * const depth) { - - f_string_dynamic_resize(0, &depth->value_name); - - return F_none; - } -#endif // _di_fss_embedded_list_read_data_delete_ - -#ifndef _di_fss_embedded_list_read_depths_resize_ - f_status_t fss_embedded_list_read_depths_resize(const f_number_unsigned_t length, fss_embedded_list_read_depths_t *depths) { - - if (!depths) { - return F_status_set_error(F_parameter); - } - - for (f_number_unsigned_t i = length; i < depths->size; ++i) { - fss_embedded_list_read_depth_delete(&depths->array[i]); - } // for - - const f_status_t status = f_memory_resize(depths->size, length, sizeof(fss_embedded_list_read_depth_t), (void **) & depths->array); - if (F_status_is_error(status)) return status; - - depths->size = length; - - if (depths->used > depths->size) { - depths->used = length; - } - - return F_none; - } -#endif // _di_fss_embedded_list_read_depths_resize_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_read/c/private-common.h b/level_3/fss_embedded_list_read/c/private-common.h deleted file mode 100644 index a35b5ee..0000000 --- a/level_3/fss_embedded_list_read/c/private-common.h +++ /dev/null @@ -1,216 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Embedded List Read - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_common_h -#define _PRIVATE_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Provide common/generic definitions. - * - * embedded_list_read_common_allocation_*: - * - large: An allocation step used for buffers that are anticipated to have large buffers. - * - small: An allocation step used for buffers that are anticipated to have small buffers. - * - * fss_embedded_list_read_block_*: - * - max: The max block read size before checking for interrupt. - * - read_small: The block read size for small files. - * - read_large: The block read size for large files. - */ -#ifndef _di_fss_embedded_list_read_common_ - #define fss_embedded_list_read_common_allocation_large_d 2048 - #define fss_embedded_list_read_common_allocation_small_d 128 - - #define fss_embedded_list_read_block_max 16777216 - #define fss_embedded_list_read_block_read_small 8192 - #define fss_embedded_list_read_block_read_large 65536 -#endif // _di_fss_embedded_list_read_common_ - -/** - * A structure of parameters applied at some depth. - * - * depth: the depth number in which this is to be processed at. - * - * index_at: position of the "--at" parameter value in the argv list, when 0 there is no parameter. - * index_name: position of the "--name" parameter value in the argv list, when 0 there is no parameter. - * - * value_at: the value of the "--at" parameter, already processed and ready to use, only when index_at > 0. - * value_name: the value of the "--name" parameter, already processed and ready to use, only when index_name > 0. - */ -#ifndef _di_fss_embedded_list_read_depth_t_ - typedef struct { - f_number_unsigned_t depth; - - f_number_unsigned_t index_at; - f_number_unsigned_t index_name; - - f_number_unsigned_t value_at; - f_string_dynamic_t value_name; - } fss_embedded_list_read_depth_t; - - #define fss_embedded_list_read_depth_t_initialize \ - { \ - 0, \ - 0, \ - 0, \ - 0, \ - f_string_dynamic_t_initialize, \ - } - - #define macro_fss_embedded_list_read_depth_t_clear(structure) \ - structure.depth = 0; \ - structure.index_at = 0; \ - structure.index_name = 0; \ - structure.value_at = 0; \ - macro_f_string_dynamic_t_clear(structure.value_name) - - #define macro_fss_embedded_list_read_depth_t_delete_simple(structure) macro_f_string_dynamic_t_delete_simple(structure.value_name) -#endif // _di_fss_embedded_list_read_depth_t_ - -/** - * A structure containing a statically allocated array of booleans and the array length. - * - * skip: a statically allocated array representing list items that are to be skipped. - * used: the length of the statically allocated skip array. - */ -#ifndef _di_fss_embedded_list_read_skip_t_ - typedef struct { - bool *skip; - f_number_unsigned_t used; - } fss_embedded_list_read_skip_t; - - #define fss_embedded_list_read_skip_t_initialize \ - { \ - 0, \ - 0, \ - } - - #define macro_fss_embedded_list_read_skip_t_initialize_1(skip, used) \ - { \ - skip, \ - used, \ - } -#endif // _di_fss_embedded_list_read_skip_t_ - -/** - * An array of depth parameters. - * - * array: the array of depths. - * size: total amount of allocated space. - * used: total number of allocated spaces used. - */ -#ifndef _di_fss_embedded_list_read_depths_t_ - typedef struct { - fss_embedded_list_read_depth_t *array; - - f_number_unsigned_t size; - f_number_unsigned_t used; - } fss_embedded_list_read_depths_t; - - #define fss_embedded_list_read_depths_t_initialize { 0, 0, 0 } -#endif // _di_fss_embedded_list_read_depths_t_ - -/** - * The program data. - * - * main: - * argv: - * - * buffer: - * nest: - * delimit_mode: - * delimit_depth: - */ -#ifndef _di_fss_embedded_list_read_data_t_ - typedef struct { - fll_program_data_t *main; - f_string_static_t *argv; - - f_string_dynamic_t buffer; - f_fss_nest_t nest; - - uint8_t delimit_mode; - f_number_unsigned_t delimit_depth; - } fss_embedded_list_read_data_t; - - #define fss_embedded_list_read_data_t_initialize \ - { \ - 0, \ - 0, \ - f_string_dynamic_t_initialize, \ - f_fss_nest_t_initialize, \ - fss_embedded_list_read_delimit_mode_all_e, \ - 0, \ - } -#endif // _di_fss_embedded_list_read_data_t_ - -/** - * Deallocate program data. - * - * @param data - * The program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see fss_embedded_list_read_main() - */ -#ifndef _di_fss_embedded_list_read_data_delete_ - extern f_status_t fss_embedded_list_read_data_delete(fss_embedded_list_read_data_t * const data) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_data_delete_ - -/** - * Deallocate depth data. - * - * @param depth - * The depth data to delete. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see f_string_dynamic_resize() - */ -#ifndef _di_fss_embedded_list_read_depth_delete_ - extern f_status_t fss_embedded_list_read_depth_delete(fss_embedded_list_read_depth_t * const depth) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_depth_delete_ - -/** - * Resize the depth array. - * - * @param length - * The new size to use. - * @param depths - * The depth array to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_resize(). - * - * Errors (with error bit) from: fss_embedded_list_read_depths_increase(). - * - * @see f_memory_resize() - * - * @see fss_embedded_list_read_depth_delete_simple() - * @see fss_embedded_list_read_depths_increase() - */ -#ifndef _di_fss_embedded_list_read_depths_resize_ - extern f_status_t fss_embedded_list_read_depths_resize(const f_number_unsigned_t length, fss_embedded_list_read_depths_t *depths) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_depths_resize_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_common_h diff --git a/level_3/fss_embedded_list_read/c/private-print.c b/level_3/fss_embedded_list_read/c/private-print.c deleted file mode 100644 index 40219ea..0000000 --- a/level_3/fss_embedded_list_read/c/private-print.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "fss_embedded_list_read.h" -#include "private-common.h" -#include "private-print.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_embedded_list_read_print_object_end_ - void fss_embedded_list_read_print_object_end(fss_embedded_list_read_data_t * const data) { - - if (data->main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result & f_console_result_found_e) { - f_print_dynamic_raw(fss_embedded_list_read_pipe_content_start_s, data->main->output.to); - } - else { - if (data->main->parameters.array[fss_embedded_list_read_parameter_object_e].result & f_console_result_found_e && (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result & f_console_result_found_e)) { - f_print_dynamic_raw(f_fss_embedded_list_open_s, data->main->output.to); - f_print_dynamic_raw(f_fss_embedded_list_open_end_s, data->main->output.to); - } - else { - f_print_dynamic_raw(f_fss_eol_s, data->main->output.to); - } - } - } -#endif // _di_fss_embedded_list_read_print_object_end_ - -#ifndef _di_fss_embedded_list_read_print_content_ignore_ - void fss_embedded_list_read_print_content_ignore(fss_embedded_list_read_data_t * const data) { - - if (data->main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result & f_console_result_found_e) { - f_print_dynamic_raw(fss_embedded_list_read_pipe_content_ignore_s, data->main->output.to); - } - } -#endif // _di_fss_embedded_list_read_print_content_ignore_ - -#ifndef _di_fss_embedded_list_read_print_set_end_ - void fss_embedded_list_read_print_set_end(fss_embedded_list_read_data_t * const data) { - - if (data->main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result & f_console_result_found_e) { - f_print_dynamic_raw(fss_embedded_list_read_pipe_content_end_s, data->main->output.to); - } - else { - if ((data->main->parameters.array[fss_embedded_list_read_parameter_object_e].result & f_console_result_found_e) && (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result & f_console_result_found_e)) { - f_print_dynamic_raw(f_fss_embedded_list_close_s, data->main->output.to); - f_print_dynamic_raw(f_fss_embedded_list_close_end_s, data->main->output.to); - } - else { - f_print_dynamic_raw(f_fss_eol_s, data->main->output.to); - } - } - } -#endif // _di_fss_embedded_list_read_print_set_end_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_read/c/private-print.h b/level_3/fss_embedded_list_read/c/private-print.h deleted file mode 100644 index 6f61287..0000000 --- a/level_3/fss_embedded_list_read/c/private-print.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_print_h -#define _PRIVATE_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print the ignore character for content. - * - * This is only used in pipe output mode. - * - * @param data - * The program data. - */ -#ifndef _di_fss_embedded_list_read_print_content_ignore_ - extern void fss_embedded_list_read_print_content_ignore(fss_embedded_list_read_data_t * const data) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_print_content_ignore_ - -/** - * Print the end of an object (which is essentially the start of a content). - * - * @param data - * The program data. - */ -#ifndef _di_fss_embedded_list_read_print_object_end_ - extern void fss_embedded_list_read_print_object_end(fss_embedded_list_read_data_t * const data) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_print_object_end_ - -/** - * Print the end of an object/content set. - * - * @param data - * The program data. - */ -#ifndef _di_fss_embedded_list_read_print_set_end_ - extern void fss_embedded_list_read_print_set_end(fss_embedded_list_read_data_t * const data) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_print_set_end_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_print_h diff --git a/level_3/fss_embedded_list_read/c/private-read.c b/level_3/fss_embedded_list_read/c/private-read.c deleted file mode 100644 index cd29e46..0000000 --- a/level_3/fss_embedded_list_read/c/private-read.c +++ /dev/null @@ -1,888 +0,0 @@ -#include "fss_embedded_list_read.h" -#include "private-common.h" -#include "private-print.h" -#include "private-read.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_embedded_list_read_main_preprocess_depth_ - f_status_t fss_embedded_list_read_main_preprocess_depth(fss_embedded_list_read_data_t * const data, fss_embedded_list_read_depths_t *depths) { - - f_status_t status = F_none; - - const f_number_unsigned_t values_total = data->main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.used + data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.used + data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.used; - - f_number_unsigned_t values_order[values_total]; - f_number_unsigned_t values_type[values_total]; - - f_number_unsigned_t i = 0; - f_number_unsigned_t j = 0; - - // Determine the linear order in which all of the three parameter values are to be applied. - if (values_total) { - memset(values_order, 0, sizeof(f_char_t) * values_total); - - f_number_unsigned_t k = 0; - f_number_unsigned_t l = 0; - - for (; j < data->main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.used; ++j) { - - values_order[i] = data->main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.array[j]; - values_type[i++] = fss_embedded_list_read_parameter_depth_e; - } // for - - if (i) { - for (j = 0; j < data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.used; ++j) { - - for (k = 0; k < i; ++k) { - - if (values_order[k] > data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j]) { - for (l = i; l > k; --l) { - values_order[l] = values_order[l - 1]; - values_type[l] = values_type[l - 1]; - } // for - - values_order[k] = data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j]; - values_type[k] = fss_embedded_list_read_parameter_at_e; - i++; - - break; - } - } // for - - if (k == i) { - values_order[i] = data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j]; - values_type[i++] = fss_embedded_list_read_parameter_at_e; - } - } // for - } - else { - for (; j < data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.used; ++j) { - - values_order[i] = data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j]; - values_type[i++] = fss_embedded_list_read_parameter_at_e; - } // for - } - - if (i) { - for (j = 0; j < data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.used; ++j) { - - for (k = 0; k < i; ++k) { - - if (values_order[k] > data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j]) { - for (l = i; l > k; --l) { - values_order[l] = values_order[l - 1]; - values_type[l] = values_type[l - 1]; - } // for - - values_order[k] = data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j]; - values_type[k] = fss_embedded_list_read_parameter_name_e; - i++; - - break; - } - } // for - - if (k == i) { - values_order[i] = data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j]; - values_type[i++] = fss_embedded_list_read_parameter_name_e; - } - } // for - } - else { - for (; j < data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.used; ++j) { - - values_order[i] = data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j]; - values_type[i++] = fss_embedded_list_read_parameter_name_e; - } // for - } - } - - { - i = 1; - - if (data->main->parameters.array[fss_embedded_list_read_parameter_depth_e].result & f_console_result_value_e) { - i = data->main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.used + 1; - } - - status = fss_embedded_list_read_depths_resize(i, depths); - - if (F_status_is_error(status)) { - fll_error_print(data->main->error, F_status_set_fine(status), "fss_embedded_list_read_main_preprocess_depth", fll_error_file_flag_fallback_e); - - return status; - } - } - - // Provide default level-0 depth values. - depths->array[0].depth = 0; - depths->array[0].index_at = 0; - depths->array[0].index_name = 0; - depths->array[0].value_at = 0; - - { - f_string_static_t * const argv = data->main->parameters.arguments.array; - f_number_unsigned_t number = 0; - bool first_depth = F_true; - - for (i = 0; i < values_total; ++i) { - - if (!((++data->main->signal_check) % fss_embedded_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(main->warning, main->signal_received); - - return F_status_set_error(F_interrupt); - } - - data->main->signal_check = 0; - } - - if (values_type[i] == fss_embedded_list_read_parameter_depth_e || values_type[i] == fss_embedded_list_read_parameter_at_e) { - status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, argv[values_order[i]], &number); - - if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_embedded_list_read_long_depth_s, argv[values_order[i]]); - - return status; - } - } - - if (values_type[i] == fss_embedded_list_read_parameter_depth_e) { - - if (first_depth) { - if (i && number) { - depths->array[++depths->used].index_at = 0; - depths->array[depths->used].index_name = 0; - depths->array[depths->used].value_at = 0; - } - - first_depth = F_false; - depths->array[depths->used].depth = number; - } - else { - depths->array[++depths->used].depth = number; - depths->array[depths->used].index_at = 0; - depths->array[depths->used].index_name = 0; - depths->array[depths->used].value_at = 0; - } - } - else if (values_type[i] == fss_embedded_list_read_parameter_at_e) { - depths->array[depths->used].index_at = values_order[i]; - depths->array[depths->used].value_at = number; - } - else if (values_type[i] == fss_embedded_list_read_parameter_name_e) { - depths->array[depths->used].index_name = values_order[i]; - depths->array[depths->used].value_name.used = 0; - - if (data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result & f_console_result_found_e) { - status = f_rip_dynamic(argv[values_order[i]], &depths->array[depths->used].value_name); - - if (F_status_is_error(status)) { - fll_error_print(data->main->error, F_status_set_fine(status), "f_rip_dynamic", fll_error_file_flag_fallback_e); - - return status; - } - } - else { - status = f_string_dynamic_append(argv[values_order[i]], &depths->array[depths->used].value_name); - - if (F_status_is_error(status)) { - fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_append", fll_error_file_flag_fallback_e); - - return status; - } - } - } - } // for - - depths->used++; - } - - for (i = 0; i < depths->used; ++i) { - - for (j = i + 1; j < depths->used; ++j) { - - if (depths->array[i].depth == depths->array[j].depth) { - f_file_stream_lock(data->main->error.to); - - fl_print_format("%r%[%QThe value '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); - fl_print_format("%[%ul%]", data->main->error.to, data->main->error.notable, depths->array[i].depth, data->main->error.notable); - fl_print_format("%[' may only be specified once for the parameter '%]", data->main->error.to, data->main->error.notable, data->main->error.notable); - fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_depth_s, data->main->error.notable); - fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s); - - f_file_stream_unlock(data->main->error.to); - - return F_status_set_error(F_parameter); - } - else if (depths->array[i].depth > depths->array[j].depth) { - f_file_stream_lock(data->main->error.to); - - fl_print_format("%r%[%QThe parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); - fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_read_long_depth_s, data->main->error.notable); - fl_print_format("%[' may not have the value '%]", data->main->error.to, data->main->error.notable, data->main->error.notable); - fl_print_format("%[%ul%]", data->main->error.to, data->main->error.notable, depths->array[i].depth, data->main->error.notable); - fl_print_format("%[' before the value '%]", data->main->error.to, data->main->error.notable, data->main->error.notable); - fl_print_format("%[%ul%]", data->main->error.to, data->main->error.notable, depths->array[j].depth, data->main->error.notable); - fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s); - - f_file_stream_unlock(data->main->error.to); - - return F_status_set_error(F_parameter); - } - } // for - } // for - - return F_none; - } -#endif // _di_fss_embedded_list_read_main_preprocess_depth_ - -#ifndef _di_fss_embedded_list_read_main_process_file_ - f_status_t fss_embedded_list_read_main_process_file(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits, f_string_range_t *comments) { - - f_status_t status = F_none; - - { - f_state_t state = macro_f_state_t_initialize_1(fss_embedded_list_read_common_allocation_large_d, fss_embedded_list_read_common_allocation_small_d, 0, 0, 0, &fll_program_standard_signal_handle, 0, (void *) data->main, 0); - f_string_range_t input = macro_f_string_range_t_initialize_2(data->buffer.used); - - objects_delimits->used = 0; - contents_delimits->used = 0; - comments->used = 0; - - status = fll_fss_embedded_list_read(data->buffer, state, &input, &data->nest, objects_delimits, contents_delimits, comments); - - if (F_status_is_error_not(status) && (status == F_data_not_stop || status == F_data_not_eos)) { - fss_embedded_list_read_data_delete(data); - - if (data->main->parameters.array[fss_embedded_list_read_parameter_total_e].result & f_console_result_found_e) { - fll_print_format("%r%r", data->main->output.to, f_string_ascii_0_s, f_string_eol_s); - - return F_none; - } - - return F_status_set_warning(status); - } - - if (F_status_is_error(status)) { - fss_embedded_list_read_data_delete(data); - - return status; - } - - f_number_unsigned_t i = 0; - f_number_unsigned_t j = 0; - - // Comments are not to be part of the file, so remove them. - for (; i < comments->used; ++i) { - - for (j = comments->array[i].start; j <= comments->array[i].stop; ++j) { - data->buffer.string[j] = f_fss_placeholder_s.string[0]; - } // for - } // for - } - - // Requested depths cannot be greater than contents depth. - if (depths.used > data->nest.used) { - if (data->main->parameters.array[fss_embedded_list_read_parameter_total_e].result & f_console_result_found_e) { - fll_print_format("%r%r", data->main->output.to, f_string_ascii_0_s, f_string_eol_s); - - return F_none; - } - - return F_none; - } - - { - f_number_unsigned_t select = 0; - - if (data->main->parameters.array[fss_embedded_list_read_parameter_select_e].result & f_console_result_value_e) { - const f_number_unsigned_t index = data->main->parameters.array[fss_embedded_list_read_parameter_select_e].values.array[data->main->parameters.array[fss_embedded_list_read_parameter_select_e].values.used - 1]; - - status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->main->parameters.arguments.array[index], &select); - - if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_embedded_list_read_long_select_s, data->main->parameters.arguments.array[index]); - - return status; - } - - // This standard does not support multiple content groups. - if (select) { - return F_none; - } - } - } - - f_number_unsigned_t line = 0; - - if (data->main->parameters.array[fss_embedded_list_read_parameter_line_e].result & f_console_result_value_e) { - const f_number_unsigned_t index = data->main->parameters.array[fss_embedded_list_read_parameter_line_e].values.array[data->main->parameters.array[fss_embedded_list_read_parameter_line_e].values.used - 1]; - - status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->main->parameters.arguments.array[index], &line); - - if (F_status_is_error(status)) { - fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_unsigned_detect", F_true, fss_embedded_list_read_long_line_s, data->main->parameters.arguments.array[index]); - - return status; - } - } - - fss_embedded_list_read_process_delimits(data, objects_delimits, contents_delimits); - - const fss_embedded_list_read_skip_t parents = fss_embedded_list_read_skip_t_initialize; - - - if (data->main->parameters.array[fss_embedded_list_read_parameter_original_e].result & f_console_result_found_e) { - f_number_unsigneds_t except_none = f_number_unsigneds_t_initialize; - - return fss_embedded_list_read_main_process_for_depth(data, filename, depths, 0, line, parents, &except_none, &except_none); - } - - return fss_embedded_list_read_main_process_for_depth(data, filename, depths, 0, line, parents, objects_delimits, contents_delimits); - } -#endif // _di_fss_embedded_list_read_main_process_file_ - -#ifndef _di_fss_embedded_list_read_main_process_for_depth_ - f_status_t fss_embedded_list_read_main_process_for_depth(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, const f_number_unsigned_t depths_index, const f_number_unsigned_t line, const fss_embedded_list_read_skip_t parents, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits) { - - f_fss_items_t *items = &data->nest.depth[depths.array[depths_index].depth]; - - bool skip[items->used]; - - // Setup defaults to be not skipped unless any given parent is skipped. - memset(skip, F_false, sizeof(skip) * items->used); - - if (parents.used) { - for (f_number_unsigned_t i = 0; i < items->used; ++i) { - - if (items->array[i].parent >= parents.used || parents.skip[items->array[i].parent]) { - skip[i] = F_true; - } - } // for - } - - if (depths.array[depths_index].index_name || depths.array[depths_index].index_at) { - const f_number_unsigneds_t except_none = f_number_unsigneds_t_initialize; - - f_number_unsigned_t i = 0; - f_number_unsigned_t j = 0; - - if (!depths.array[depths_index].index_name || (depths.array[depths_index].index_at && depths.array[depths_index].index_at < depths.array[depths_index].index_name)) { - - // All other non-"at" parameters must be FALSE. - for (; i < items->used; ++i) { - - if (skip[i]) continue; - - if (j != depths.array[depths_index].value_at) { - skip[i] = F_true; - } - - ++j; - } // for - - if (depths.array[depths_index].value_at < items->used && !skip[depths.array[depths_index].value_at]) { - if (depths.array[depths_index].index_name) { - - if (data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result & f_console_result_found_e) { - - if (f_compare_dynamic_partial_except_trim_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) { - skip[depths.array[depths_index].value_at] = F_true; - } - } - else { - if (f_compare_dynamic_partial_except_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) { - skip[depths.array[depths_index].value_at] = F_true; - } - } - } - } - } - else { - if (data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result & f_console_result_found_e) { - for (i = 0; i < items->used; ++i) { - - if (skip[i]) continue; - - if (f_compare_dynamic_partial_except_trim_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) { - skip[i] = F_true; - } - } // for - } - else { - for (i = 0; i < items->used; ++i) { - - if (skip[i]) continue; - - if (f_compare_dynamic_partial_except_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) { - skip[i] = F_true; - } - } // for - } - - if (depths.array[depths_index].index_at) { - - // all other non-"at" parameters must be FALSE. - for (i = 0, j = 0; i < items->used; ++i) { - - if (skip[i]) continue; - - if (j != depths.array[depths_index].value_at) { - skip[i] = F_true; - } - - ++j; - } // for - } - } - } - - // If the current depth is not the final depth, then recurse into the next depth. - if (depths_index + 1 < depths.used) { - bool skip_next[data->nest.depth[depths.array[depths_index + 1].depth - 1].used]; - - fss_embedded_list_read_skip_t parents_next = fss_embedded_list_read_skip_t_initialize; - - if (depths.array[depths_index].depth + 1 == depths.array[depths_index + 1].depth) { - parents_next.skip = skip; - parents_next.used = items->used; - } - else { - const f_number_unsigned_t parents_depth = depths.array[depths_index + 1].depth - 1; - const f_number_unsigned_t depth_next = depths.array[depths_index + 1].depth; - - parents_next.skip = skip_next; - parents_next.used = data->nest.depth[parents_depth].used; - - memset(skip_next, F_true, sizeof(skip_next) * parents_next.used); - - f_fss_items_t *items_next = &data->nest.depth[depth_next]; - f_fss_items_t *items_previous = 0; - f_fss_item_t *item_previous = 0; - - f_number_unsigned_t i = 0; - f_number_unsigned_t j = 0; - - for (; i < items_next->used; ++i) { - - j = depth_next; - - item_previous = &items_next->array[i]; - items_previous = &data->nest.depth[--j]; - - while (j > depths.array[depths_index].depth) { - - item_previous = &items_previous->array[item_previous->parent]; - items_previous = &data->nest.depth[--j]; - } // while - - if (skip[item_previous->parent]) { - skip_next[items_next->array[i].parent] = F_true; - } - else { - skip_next[items_next->array[i].parent] = F_false; - } - } // for - } - - return fss_embedded_list_read_main_process_for_depth(data, filename, depths, depths_index + 1, line, parents_next, objects_delimits, contents_delimits); - } - - // Process objects. - f_number_unsigned_t i = 0; - f_number_unsigned_t j = 0; - - if (data->main->parameters.array[fss_embedded_list_read_parameter_object_e].result & f_console_result_found_e) { - if (data->main->parameters.array[fss_embedded_list_read_parameter_total_e].result & f_console_result_found_e) { - f_number_unsigned_t total = 0; - - for (i = 0; i < items->used; ++i) { - if (skip[i]) continue; - - ++total; - } // for - - fll_print_format("%ul%r", data->main->output.to, total, f_string_eol_s); - - return F_none; - } - - f_status_t (*print_object)(const f_string_static_t, const f_string_range_t, const f_number_unsigneds_t, FILE *) = &f_print_except_dynamic_partial; - - if (data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result & f_console_result_found_e) { - print_object = &fl_print_trim_except_dynamic_partial; - } - - f_file_stream_lock(data->main->output); - - for (i = 0; i < items->used; ++i) { - - if (skip[i]) continue; - - print_object(data->buffer, items->array[i].object, *objects_delimits, data->main->output.to); - - if (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result & f_console_result_found_e) { - fss_embedded_list_read_print_object_end(data); - - if (items->array[i].content.used) { - f_print_except_dynamic_partial(data->buffer, items->array[i].content.array[0], *contents_delimits, data->main->output.to); - } - } - - fss_embedded_list_read_print_set_end(data); - } // for - - f_file_stream_unlock(data->main->output); - - return F_none; - } - - // Process contents. - bool include_empty = 0; - - if (data->main->parameters.array[fss_embedded_list_read_parameter_empty_e].result & f_console_result_found_e) { - include_empty = 1; - } - - if (data->main->parameters.array[fss_embedded_list_read_parameter_total_e].result & f_console_result_found_e) { - f_number_unsigned_t total = 0; - - for (i = 0; i < items->used; ++i) { - - if (skip[i]) continue; - - if (!((++data->main->signal_check) % fss_embedded_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(main->warning, main->signal_received); - - return F_status_set_error(F_interrupt); - } - - data->main->signal_check = 0; - } - - if (!items->array[i].content.used) { - if (include_empty) { - ++total; - } - - continue; - } - - for (j = items->array[i].content.array[0].start; j <= items->array[i].content.array[0].stop; ++j) { - - if (!data->buffer.string[j]) continue; - - if (data->buffer.string[j] == f_string_eol_s.string[0]) { - ++total; - } - } // for - } // for - - fll_print_format("%ul%r", data->main->output.to, total, f_string_eol_s); - - return F_none; - } - - if (data->main->parameters.array[fss_embedded_list_read_parameter_line_e].result & f_console_result_value_e) { - f_number_unsigned_t line_current = 0; - - f_file_stream_lock(data->main->output); - - for (; i < items->used; ++i) { - - if (skip[i]) continue; - - if (!items->array[i].content.used) { - if (include_empty) { - if (line_current == line) { - fss_embedded_list_read_print_set_end(data); - - break; - } - - ++line_current; - } - - continue; - } - - j = items->array[i].content.array[0].start; - - if (line_current != line) { - for (; j <= items->array[i].content.array[0].stop; ++j) { - - if (data->buffer.string[j] == f_string_eol_s.string[0]) { - ++line_current; - - if (line_current == line) { - ++j; - - break; - } - } - } // for - } - - if (line_current == line) { - if (j > items->array[i].content.array[0].stop) continue; - - for (; j <= items->array[i].content.array[0].stop; ++j) { - - if (!data->buffer.string[j]) continue; - - if (data->buffer.string[j] == f_string_eol_s.string[0]) { - f_print_dynamic_raw(f_string_eol_s, data->main->output.to); - - break; - } - - f_print_character(data->buffer.string[j], data->main->output.to); - } // for - - break; - } - } // for - - f_file_stream_unlock(data->main->output); - - return F_none; - } - - f_file_stream_lock(data->main->output); - - for (i = 0; i < items->used; ++i) { - - if (skip[i]) continue; - - if (!items->array[i].content.used) { - if (include_empty) { - fss_embedded_list_read_print_set_end(data); - } - - continue; - } - - f_print_except_dynamic_partial(data->buffer, items->array[i].content.array[0], *contents_delimits, data->main->output.to); - - if (data->main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result & f_console_result_found_e) { - f_print_dynamic_raw(fss_embedded_list_read_pipe_content_end_s, data->main->output.to); - } - } // for - - f_file_stream_unlock(data->main->output); - - return F_none; - } -#endif // _di_fss_embedded_list_read_main_process_for_depth_ - -#ifndef _di_fss_embedded_list_read_process_delimits_ - void fss_embedded_list_read_process_delimits(fss_embedded_list_read_data_t * const data, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits) { - - if (!data->nest.used) return; - - if ((!objects_delimits->used && !contents_delimits->used) || data->delimit_mode == fss_embedded_list_read_delimit_mode_all_e) return; - - if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser_e && data->nest.used < data->delimit_depth) return; - if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater_e && data->delimit_depth == 0) return; - - if (data->delimit_mode == fss_embedded_list_read_delimit_mode_none_e) { - objects_delimits->used = 0; - contents_delimits->used = 0; - - return; - } - - if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_e || data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater_e) { - if (data->delimit_depth >= data->nest.used) { - objects_delimits->used = 0; - contents_delimits->used = 0; - - return; - } - } - - const f_number_unsigned_t original_objects_used = objects_delimits->used; - const f_number_unsigned_t original_contents_used = contents_delimits->used; - - f_number_unsigned_t original_objects_delimits[original_objects_used]; - f_number_unsigned_t original_contents_delimits[original_contents_used]; - - memcpy(&original_objects_delimits, objects_delimits->array, original_objects_used * sizeof(f_number_unsigned_t)); - memcpy(&original_contents_delimits, contents_delimits->array, original_contents_used * sizeof(f_number_unsigned_t)); - - objects_delimits->used = 0; - contents_delimits->used = 0; - - if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_e) { - - // Only depth 0 objects are stored in objects_delimits. - if (data->delimit_depth) { - fss_embedded_list_read_process_delimits_objects(data, data->delimit_depth, original_contents_delimits, original_contents_used, contents_delimits); - } - else { - fss_embedded_list_read_process_delimits_objects(data, data->delimit_depth, original_objects_delimits, original_objects_used, objects_delimits); - } - - fss_embedded_list_read_process_delimits_contents(data, data->delimit_depth, original_contents_delimits, original_contents_used, contents_delimits); - } - else { - if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser_e) { - - // Only depth 0 objects are stored in objects_delimits. - fss_embedded_list_read_process_delimits_objects(data, 0, original_objects_delimits, original_objects_used, objects_delimits); - fss_embedded_list_read_process_delimits_contents(data, 0, original_contents_delimits, original_contents_used, contents_delimits); - - for (f_number_unsigned_t i = 1; i <= data->delimit_depth && i < data->nest.used; ++i) { - - fss_embedded_list_read_process_delimits_objects(data, i, original_contents_delimits, original_contents_used, contents_delimits); - fss_embedded_list_read_process_delimits_contents(data, i, original_contents_delimits, original_contents_used, contents_delimits); - } // for - } - else if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater_e) { - for (f_number_unsigned_t i = data->delimit_depth; i < data->nest.used; ++i) { - - fss_embedded_list_read_process_delimits_objects(data, i, original_contents_delimits, original_contents_used, contents_delimits); - fss_embedded_list_read_process_delimits_contents(data, i, original_contents_delimits, original_contents_used, contents_delimits); - } // for - } - } - } -#endif // _di_fss_embedded_list_read_process_delimits_ - -#ifndef _di_fss_embedded_list_read_process_delimits_contents_ - void fss_embedded_list_read_process_delimits_contents(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_number_unsigneds_t *delimits) { - - if (!original_used) return; - - f_fss_items_t *items = &data->nest.depth[depth]; - - if (!items->used) return; - - f_number_unsigned_t i = 0; - f_number_unsigned_t j = 0; - f_number_unsigned_t k = 0; - f_number_unsigned_t l = 0; - f_number_unsigned_t m = 0; - - for (i = 0; i < items->used; ++i) { - - for (j = 0; j < original_used; ++j) { - - for (k = 0; k < items->array[i].content.used; ++k) { - - if (original_delimits[j] >= items->array[i].content.array[k].start && original_delimits[j] <= items->array[i].content.array[k].stop) { - - // Preserve linear order when adding back delimits. - if (delimits->used) { - for (l = 0; l < delimits->used; ++l) { - - if (original_delimits[j] > delimits->array[l]) continue; - if (original_delimits[j] == delimits->array[l]) break; - - for (m = delimits->used; m > l; --m) { - delimits->array[m] = delimits->array[m - 1]; - } // for - - if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) { - delimits->array[l] = original_delimits[j]; - ++delimits->used; - } - - break; - } // for - } - else if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) { - delimits->array[0] = original_delimits[j]; - delimits->used = 1; - } - } - } - } // for - } // for - } -#endif // _di_fss_embedded_list_read_process_delimits_contents_ - -#ifndef _di_fss_embedded_list_read_process_delimits_objects_ - void fss_embedded_list_read_process_delimits_objects(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_number_unsigneds_t *delimits) { - - if (!original_used) return; - - f_fss_items_t *items = &data->nest.depth[depth]; - - if (!items->used) return; - - f_number_unsigned_t i = 0; - f_number_unsigned_t j = 0; - f_number_unsigned_t k = 0; - f_number_unsigned_t l = 0; - - for (i = 0; i < items->used; ++i) { - - for (j = 0; j < original_used; ++j) { - - if (original_delimits[j] >= items->array[i].object.start && original_delimits[j] <= items->array[i].object.stop) { - - // Preserve linear order when adding back delimits. - if (delimits->used) { - for (k = 0; k < delimits->used; ++k) { - - if (original_delimits[j] > delimits->array[k]) continue; - if (original_delimits[j] == delimits->array[k]) break; - - for (l = delimits->used; l > k; --l) { - delimits->array[l] = delimits->array[l - 1]; - } // for - - if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) { - delimits->array[k] = original_delimits[j]; - ++delimits->used; - } - - break; - } // for - } - else if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) { - delimits->array[0] = original_delimits[j]; - delimits->used = 1; - } - } - } // for - } // for - } -#endif // _di_fss_embedded_list_read_process_delimits_objects_ - -#ifndef _di_fss_embedded_list_read_process_delimits_within_greater_ - f_status_t fss_embedded_list_read_process_delimits_within_greater(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t location) { - - if (depth + 1 >= data->nest.used) return F_false; - - f_fss_items_t *items = 0; - - f_number_unsigned_t i = 0; - f_number_unsigned_t j = 0; - - for (f_number_unsigned_t d = depth + 1; d < data->nest.used; ++d) { - items = &data->nest.depth[d]; - - for (i = 0; i < items->used; ++i) { - - for (j = 0; j < items->array[i].content.used; ++j) { - - if (location >= items->array[i].content.array[j].start && location <= items->array[i].content.array[j].stop) { - return F_true; - } - } // for - } // for - } // for - - return F_false; - } -#endif // _di_fss_embedded_list_read_process_delimits_within_greater_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_read/c/private-read.h b/level_3/fss_embedded_list_read/c/private-read.h deleted file mode 100644 index e8a9354..0000000 --- a/level_3/fss_embedded_list_read/c/private-read.h +++ /dev/null @@ -1,178 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_read_h -#define _PRIVATE_read_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Pre-process the parameters, parsing out and handling the depth and depth related parameters. - * - * Will handle depth-sensitive parameter conflicts, such as --name being used with --at (which is not allowed). - * - * @param data - * The program data. - * @param depths - * This stores the pre-processed depth parameters. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - */ -#ifndef _di_fss_embedded_list_read_main_preprocess_depth_ - extern f_status_t fss_embedded_list_read_main_preprocess_depth(fss_embedded_list_read_data_t * const data, fss_embedded_list_read_depths_t *depths) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_main_preprocess_depth_ - -/** - * Process a given file. - * - * @param data - * The program data. - * @param file_name - * The name of the file being processed. - * @param depths - * The processed depth parameters. - * @param objects_delimits - * An array of delimits detected during processing, for top-level objects. - * @param contents_delimits - * An array of delimits detected during processing, for contents. - * @param comments - * An array of ranges representing where comments are found within any valid content. - * This only stores comments found within valid content only. - * - * @see fss_embedded_list_read_main_preprocess_depth() - * @see fss_embedded_list_read_main_process_for_depth() - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - */ -#ifndef _di_fss_embedded_list_read_main_process_file_ - extern f_status_t fss_embedded_list_read_main_process_file(fss_embedded_list_read_data_t * const data, const f_string_static_t file_name, const fss_embedded_list_read_depths_t depths, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits, f_string_range_t *comments) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_main_process_file_ - -/** - * Process the items for a given depth. - * - * This will recursively continue down the depth chain until the final depth is reached. - * - * @param data - * The program data. - * @param file_name - * The name of the file being processed. - * @param depths - * The array of all depth related parameter settings. - * @param depths_index - * The array location within depth being worked on. - * @param line - * The line number parameter value, used for printing a specific line number for content. - * @param parents - * The skip status of any parent lists. - * Set parents.length to 0 for depth 0. - * @param objects_delimits - * An array of delimits detected during processing, for top-level objects. - * @param contents_delimits - * An array of delimits detected during processing, for contents. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see fss_embedded_list_read_main_process_file() - */ -#ifndef _di_fss_embedded_list_read_main_process_for_depth_ - extern f_status_t fss_embedded_list_read_main_process_for_depth(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, const f_number_unsigned_t depths_index, const f_number_unsigned_t line, const fss_embedded_list_read_skip_t parents, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_main_process_for_depth_ - -/** - * Rewrite the object and content delimit ranges to be within the given depth range. - * - * @param data - * The program data. - * @param objects_delimits - * An array of delimits detected during processing, for top-level objects. - * @param contents_delimits - * An array of delimits detected during processing, for contents. - * - * @see fss_embedded_list_read_main_process_file() - */ -#ifndef _di_fss_embedded_list_read_process_delimits_ - extern void fss_embedded_list_read_process_delimits(fss_embedded_list_read_data_t * const data, f_number_unsigneds_t *objects_delimits, f_number_unsigneds_t *contents_delimits) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_process_delimits_ - -/** - * Write the given delimits at the given depth back into the new delimits array, specifically for contents. - * - * @param data - * The program data. - * @param depth - * The depth in which to process. - * @param original_delimits - * The original delimits structure. - * @param original_used - * The size of the original delimits structure. - * @param delimits - * The delimits array in which the delimits are written to. - * - * @see fss_embedded_list_read_process_delimits() - */ -#ifndef _di_fss_embedded_list_read_process_delimits_contents_ - extern void fss_embedded_list_read_process_delimits_contents(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_number_unsigneds_t *delimits) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_process_delimits_contents_ - -/** - * Write the given delimits at the given depth back into the new delimits array, specifically for objects. - * - * @param data - * The program data. - * @param depth - * The depth in which to process. - * @param original_delimits - * The original delimits structure. - * @param original_used - * The size of the original delimits structure. - * @param delimits - * The delimits array in which the delimits are written to. - * - * @see fss_embedded_list_read_process_delimits() - */ -#ifndef _di_fss_embedded_list_read_process_delimits_objects_ - extern void fss_embedded_list_read_process_delimits_objects(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t original_delimits[], const f_number_unsigned_t original_used, f_number_unsigneds_t *delimits) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_process_delimits_objects_ - -/** - * Determine if the given location is actually within another depth. - * - * @param data - * The program data. - * @param depth - * The depth in which to process. - * @param location - * The location to investigate. - * - * @return - * TRUE if location is within a greater depth. - * FALSE if location is not within a greater depth. - * - * @see fss_embedded_list_read_process_delimits_objects() - * @see fss_embedded_list_read_process_delimits_contents() - */ -#ifndef _di_fss_embedded_list_read_process_delimits_within_greater_ - extern f_status_t fss_embedded_list_read_process_delimits_within_greater(fss_embedded_list_read_data_t * const data, const f_number_unsigned_t depth, const f_number_unsigned_t location) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_read_process_delimits_within_greater_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_read_h diff --git a/level_3/fss_embedded_list_read/data/build/defines b/level_3/fss_embedded_list_read/data/build/defines deleted file mode 100644 index 490da41..0000000 --- a/level_3/fss_embedded_list_read/data/build/defines +++ /dev/null @@ -1,6 +0,0 @@ -# fss-0000 - -_di_thread_support_ Disables thread support. - -_pthread_attr_unsupported_ Disable non-portable functionality associated with pthread_attr. -_pthread_sigqueue_unsupported_ Disable GNU specific sigqueue(). diff --git a/level_3/fss_embedded_list_read/data/build/dependencies b/level_3/fss_embedded_list_read/data/build/dependencies deleted file mode 100644 index 1982441..0000000 --- a/level_3/fss_embedded_list_read/data/build/dependencies +++ /dev/null @@ -1,32 +0,0 @@ -# fss-0000 - -f_type -f_status -f_memory -f_type_array -f_string -f_utf -f_color -f_compare -f_console -f_conversion -f_directory -f_environment -f_file -f_fss -f_parse -f_pipe -f_print -f_rip -f_signal -f_thread - -fl_conversion -fl_fss -fl_print - -fll_error -fll_file -fll_fss -fll_print -fll_program diff --git a/level_3/fss_embedded_list_read/data/build/fakefile b/level_3/fss_embedded_list_read/data/build/fakefile deleted file mode 100644 index 5f7ac9a..0000000 --- a/level_3/fss_embedded_list_read/data/build/fakefile +++ /dev/null @@ -1,27 +0,0 @@ -# fss-0005 iki-0002 - -settings: - fail exit - modes individual individual_thread level monolithic clang test fanalyzer thread threadless - - environment PATH LD_LIBRARY_PATH - environment LANG LC_ALL LC_COLLATE LC_CTYPE LC_FASTMSG LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LOCPATH NLSPATH - -main: - build - -install: - shell ./install.sh parameter:'work' parameter:'verbosity' parameter:'color' - -help: - print - print context:'title'Fakefile Options for FSS Embedded List Read Software.context:'reset' - - print - print The following operations are available\: - print " - context:'notable'help:context:'reset' Perform the help operation, printing this message." - print " - context:'notable'install:context:'reset' A helper operation that simply calls the ./install.sh script with default settings." - print " - context:'notable'main:context:'reset' The default compilation using the build settings mode." - - print - print The context:'notable'install context:'reset'operation supports the context:'notable'work,context:'reset' context:'notable'verbosity,context:'reset' and context:'notable'color context:'reset'parameters. diff --git a/level_3/fss_embedded_list_read/data/build/settings b/level_3/fss_embedded_list_read/data/build/settings deleted file mode 100644 index e567a6e..0000000 --- a/level_3/fss_embedded_list_read/data/build/settings +++ /dev/null @@ -1,76 +0,0 @@ -# fss-0001 -# -# Modes: -# - individual: Compile using per project (individual) libraries, does not handle thread or threadless cases. -# - individual_thread: This is required when compiling in individual mode with "thread" mode. -# - level: Compile using per level libraries. -# - monolithic: Compile using per monolithic libraries. -# - clang: Use clang rather than the default, which is generally gcc. -# - test: Compile for a test, such as unit testing. -# - fanalyzer: Compile using GCC's -fanalyzer compile time option. -# - thread: Compile with thread support. -# - threadless: Compile without thread support. -# - -build_name fss_embedded_list_read - -version_major 0 -version_minor 7 -version_micro 0 -version_file micro -version_target minor - -modes individual individual_thread level monolithic clang test fanalyzer thread threadless -modes_default monolithic thread - -build_compiler gcc -build_compiler-clang clang -build_indexer ar -build_indexer_arguments rcs -build_language c - -build_libraries -lc -build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_print -lfll_program -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lf_color -lf_compare -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_parse -lf_path -lf_pipe -lf_print -lf_rip -lf_signal -lf_status_string -lf_string -lf_type_array -lf_utf -build_libraries-individual_thread -lf_thread -build_libraries-level -lfll_2 -lfll_1 -lfll_0 -build_libraries-monolithic -lfll - -build_sources_library fss_embedded_list_read.c common.c print.c private-common.c private-print.c private-read.c - -build_sources_program main.c - -build_sources_headers fss_embedded_list_read.h common.h print.h - -build_sources_documentation man - -build_script yes -build_shared yes -build_static no - -path_headers program/fss_embedded_list_read - -has_path_standard yes -preserve_path_headers yes - -search_exclusive yes -search_shared yes -search_static yes - -environment PATH LD_LIBRARY_PATH -environment LANG LC_ALL LC_COLLATE LC_CTYPE LC_FASTMSG LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LOCPATH NLSPATH - -#defines -D_di_libcap_ -defines -D_libcap_legacy_only_ -defines-threadless -D_di_thread_support_ -defines-thread -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_ - -flags -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-parentheses -Wno-missing-braces -flags-thread -pthread -flags-clang -Wno-logical-op-parentheses -flags-test -O0 -fstack-protector -Wall -flags-fanalyzer -fanalyzer -flags-coverage -O0 --coverage -fprofile-abs-path -fprofile-dir=build/coverage/ - -flags_library -fPIC -flags_object -fPIC -flags_program -fPIE diff --git a/level_3/fss_embedded_list_read/data/documentation/man/man1/fss_embedded_list_read.1 b/level_3/fss_embedded_list_read/data/documentation/man/man1/fss_embedded_list_read.1 deleted file mode 100644 index adae22d..0000000 --- a/level_3/fss_embedded_list_read/data/documentation/man/man1/fss_embedded_list_read.1 +++ /dev/null @@ -1,144 +0,0 @@ -.TH FSS_EMBEDDED_LIST_READ "1" "March 2023" "FLL - FSS Embedded List Read 0.7.0" "User Commands" -.SH NAME -fss_embedded_list_read \- Read data in \fBFSS-0008 (Embedded List)\fR format. -.SH SYNOPSIS -.B fss_embedded_list_read -[\fI\,OPTIONS\/\fR] [\fI\,FILENAMES\/\fR] -.SH DESCRIPTION -.PP -This program will print the Content associated with the given Object and Content main based on the \fBFSS-0008 Embedded List\fR standard. - -All numeric positions (indexes) start at 0 instead of 1. -For example, a file of 17 lines would range from 0 to 16. - -When using the \fB\-\-depth\fR option, an order of operations is enforced on the parameters. -When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter: - \fB\-\-at\fR: An Object index at the specified depth. - \fB\-\-depth\fR: A new depth within the specified depth, indexed from the root. - \fB\-\-name\fR: An Object name at the specified depth. - -The parameter \fB\-\-depth\fR must be in numeric order, but values in between may be skipped. - (\fB'\-d 0 \-a 1 \-d 2 \-a 2\fR' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.) - (\fB'\-d 2 \-a 1 \-d 0 \-a 2\fR' would be invalid because depth 2 is before depth 1.) - -The parameter \fB\-\-select\fR selects a Content column. - -Specify both \fB\-\-object\fR and the \fB\-\-total\fR parameters to get the total objects. - -When both \fB\-\-at\fR and \fB\-\-name\fR parameters are specified (at the same depth), the \fB\-\-at\fR parameter value will be treated as a position relative to the specified \fB\-\-name\fR parameter value. - -This program may support parameters, such as \fB\-\-depth\fR or \fB\-\-select\fR, even if not supported by the standard. -This is done to help ensure consistency for scripting. - -For parameters like \fB\-\-depth\fR, if the standard doesn't support nested Content, then only a depth of 0 would be valid. -For parameters like \fB\-\-select\fR, if the standard doesn't support multiple Content groups, then only a select of 0 would be valid. - -The parameter \fB\-\-trim\fR will remove leading and trailing white spaces when selecting objects or when printing objects. - -When specifying both the \fB\-\-object\fR parameter and the \fB\-\-content\fR parameter, the entire Object and Content are printed, including the formatting. -Both the Object and Content printed are already escaped. -Both the Object and Content are separated by a New Line character '\fB\\n\fR' (U+000A). - -The parameter \fB\-\-delimit\fR accepts the following: - \fBnone\fR: Do not apply delimits. - \fBall\fR: (default) Apply all delimits. - \fBA number, 0 or greater\fR: apply delimits for Content at the specified depth. - \fBA number, 0 or greater, followed by a +\fR: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically). - \fBA number, 0 or lesser, followed by a \-\fR: (such as '1\-') apply delimits for Content at the specified depth and any lesser depth (numerically). - -The \fB\-\-delimit\fR parameter may be specified multiple times to customize the delimit behavior. -The \fB\-\-delimit\fR values none and all, overrule all other delimit values. - -The parameters \fB\-\-columns\fR and \fB\-\-select\fR refer to a Content column. -The word '\fBcolumn\fR' is being loosely defined to refer to a specific Content. -This is not to be confused with a depth. -.SH OPTIONS -.TP -\fB\{\-h, \-\-help\fR -Print the help message. -.TP -\fB+C, ++copyright\fR -Print the copyright. -.TP -\fB+d, ++dark\fR -Output using colors that show up better on dark backgrounds. -.TP -\fB+l, ++light\fR -Output using colors that show up better on light backgrounds. -.TP -\fB+n, ++no_color\fR -Do not print using color. -.TP -\fB+Q, ++quiet\fR -Decrease verbosity, silencing most output. -.TP -\fB+E, ++error\fR -Decrease verbosity, using only error output. -.TP -\fB+N, ++normal\fR -Set verbosity to normal. -.TP -\fB+V, ++verbose\fR -Increase verbosity beyond normal output. -.TP -\fB+D, ++debug\fR -Enable debugging, significantly increasing verbosity beyond normal output. -.TP -\fB+v, ++version\fR -Print only the version number. -.TP -\fB+F, ++line_first_no\fR -Disable printing of first line. -.TP -\fB+L, ++line_last_no\fR -Disable printing of last line. -.TP -\fB\-a, \-\-at\fR -Select Object at this numeric index. -.TP -\fB\-c, \-\-content\fR -Print the Content (default). -.TP -\fB\-C, \-\-columns\fR -Print the total number of columns. -.TP -\fB\-D, \-\-delimit\fR -Designate how to handle applying delimits. -.TP -\fB\-d, \-\-depth\fR -Select Object at this numeric depth. -.TP -\fB\-e, \-\-empty\fR -Include empty Content when processing. -.TP -\fB\-l, \-\-line\fR -Print only the Content at the given line. -.TP -\fB\-n, \-\-name\fR -Select Object with this name. -.TP -\fB\-o, \-\-object\fR -Print the Object. -.TP -\fB\-p, \-\-pipe\fR -Print using the special pipe format. -.TP -\fB\-O, \-\-original\fR -Print with the original quotes and escapes. -.TP -\fB\-s, \-\-select\fR -Select sub-Content at this index. -.TP -\fB\-t, \-\-total\fR -Print the total number of lines. -.TP -\fB\-T, \-\-trim\fR -Trim Object names on select or print. -.SH FILENAMES -.TP -Any number of files to read. -.SH AUTHOR -Written by Kevin Day. -.SH COPYRIGHT -.PP -Copyright \(co 2007-2023 Kevin Day, GNU LGPL Version 2.1 or later.