From: Kevin Day Date: Sat, 10 Dec 2022 17:34:01 +0000 (-0600) Subject: Cleanup: Remove remaining fss_*_write programs. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=ee176bb5a0a9c81635224de8878a8c2fee9aafab;p=fll Cleanup: Remove remaining fss_*_write programs. These are now part of fss_write. --- diff --git a/level_3/fss_basic_list_write/c/common.c b/level_3/fss_basic_list_write/c/common.c deleted file mode 100644 index 184e098..0000000 --- a/level_3/fss_basic_list_write/c/common.c +++ /dev/null @@ -1,166 +0,0 @@ -#include "fss_basic_list_write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_basic_list_write_program_version_s_ - const f_string_static_t fss_basic_list_write_program_version_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_program_version_s, 0, FSS_BASIC_LIST_WRITE_program_version_s_length); -#endif // _di_fss_basic_list_write_program_version_s_ - -#ifndef _di_fss_basic_list_write_program_name_s_ - const f_string_static_t fss_basic_list_write_program_name_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_program_name_s, 0, FSS_BASIC_LIST_WRITE_program_name_s_length); - const f_string_static_t fss_basic_list_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_program_name_long_s, 0, FSS_BASIC_LIST_WRITE_program_name_long_s_length); -#endif // _di_fss_basic_list_write_program_name_s_ - -#ifndef _di_fss_basic_list_write_pipe_s_ - const f_string_static_t fss_basic_list_write_pipe_name_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_pipe_name_s, 0, FSS_BASIC_LIST_WRITE_pipe_name_s_length); - const f_string_static_t fss_basic_list_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_pipe_content_end_s, 0, FSS_BASIC_LIST_WRITE_pipe_content_end_s_length); - const f_string_static_t fss_basic_list_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_pipe_content_ignore_s, 0, FSS_BASIC_LIST_WRITE_pipe_content_ignore_s_length); - const f_string_static_t fss_basic_list_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_pipe_content_start_s, 0, FSS_BASIC_LIST_WRITE_pipe_content_start_s_length); -#endif // _di_fss_basic_list_write_pipe_s_ - -#ifndef _di_fss_basic_list_write_parameter_d_ - const f_string_static_t fss_basic_list_write_short_file_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_file_s, 0, FSS_BASIC_LIST_WRITE_short_file_s_length); - const f_string_static_t fss_basic_list_write_short_content_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_content_s, 0, FSS_BASIC_LIST_WRITE_short_content_s_length); - const f_string_static_t fss_basic_list_write_short_double_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_double_s, 0, FSS_BASIC_LIST_WRITE_short_double_s_length); - const f_string_static_t fss_basic_list_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_ignore_s, 0, FSS_BASIC_LIST_WRITE_short_ignore_s_length); - const f_string_static_t fss_basic_list_write_short_object_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_object_s, 0, FSS_BASIC_LIST_WRITE_short_object_s_length); - const f_string_static_t fss_basic_list_write_short_partial_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_partial_s, 0, FSS_BASIC_LIST_WRITE_short_partial_s_length); - const f_string_static_t fss_basic_list_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_prepend_s, 0, FSS_BASIC_LIST_WRITE_short_prepend_s_length); - const f_string_static_t fss_basic_list_write_short_single_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_single_s, 0, FSS_BASIC_LIST_WRITE_short_single_s_length); - const f_string_static_t fss_basic_list_write_short_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_short_trim_s, 0, FSS_BASIC_LIST_WRITE_short_trim_s_length); - - const f_string_static_t fss_basic_list_write_long_file_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_file_s, 0, FSS_BASIC_LIST_WRITE_long_file_s_length); - const f_string_static_t fss_basic_list_write_long_content_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_content_s, 0, FSS_BASIC_LIST_WRITE_long_content_s_length); - const f_string_static_t fss_basic_list_write_long_double_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_double_s, 0, FSS_BASIC_LIST_WRITE_long_double_s_length); - const f_string_static_t fss_basic_list_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_ignore_s, 0, FSS_BASIC_LIST_WRITE_long_ignore_s_length); - const f_string_static_t fss_basic_list_write_long_object_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_object_s, 0, FSS_BASIC_LIST_WRITE_long_object_s_length); - const f_string_static_t fss_basic_list_write_long_partial_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_partial_s, 0, FSS_BASIC_LIST_WRITE_long_partial_s_length); - const f_string_static_t fss_basic_list_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_prepend_s, 0, FSS_BASIC_LIST_WRITE_long_prepend_s_length); - const f_string_static_t fss_basic_list_write_long_single_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_single_s, 0, FSS_BASIC_LIST_WRITE_long_single_s_length); - const f_string_static_t fss_basic_list_write_long_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_LIST_WRITE_long_trim_s, 0, FSS_BASIC_LIST_WRITE_long_trim_s_length); -#endif // _di_fss_basic_list_write_parameter_d_ - -#ifndef _di_fss_basic_list_write_setting_delete_ - f_status_t fss_basic_list_write_setting_delete(fss_basic_list_write_setting_t * const setting) { - - if (!setting) return F_status_set_error(F_parameter); - - return F_none; - } -#endif // _di_fss_basic_list_write_setting_delete_ - -#ifndef _di_fss_basic_list_write_setting_load_ - void fss_basic_list_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_list_write_setting_t * const setting) { - - if (!main || !setting) return; - - setting->flag = 0; - - // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); - - if (F_status_is_error(setting->status)) { - fss_basic_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true); - fss_basic_list_write_print_line_last_locked(setting, main->error); - - return; - } - - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_basic_list_write_parameter_no_color_e, fss_basic_list_write_parameter_light_e, fss_basic_list_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(setting->status)) { - fss_basic_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true); - fss_basic_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - - if (main->parameters.array[fss_basic_list_write_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_basic_list_write_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_basic_list_write_parameter_verbosity_quiet_e, fss_basic_list_write_parameter_verbosity_error_e, fss_basic_list_write_parameter_verbosity_verbose_e, fss_basic_list_write_parameter_verbosity_debug_e, fss_basic_list_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); - - if (F_status_is_error(setting->status)) { - fss_basic_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true); - fss_basic_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - } - - main->output.to.id = F_type_descriptor_output_d; - main->output.to.stream = F_type_output_d; - main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - - if (main->parameters.array[fss_basic_list_write_parameter_help_e].result & f_console_result_found_e) { - setting->flag |= fss_basic_list_write_main_flag_help_e; - - return; - } - - if (main->parameters.array[fss_basic_list_write_parameter_version_e].result & f_console_result_found_e) { - setting->flag |= fss_basic_list_write_main_flag_version_e; - - return; - } - - f_string_static_t * const args = main->parameters.arguments.array; - - if (main->parameters.array[fss_basic_list_write_parameter_strip_invalid_e].result & f_console_result_found_e) { - setting->flag |= fss_basic_list_write_main_flag_strip_invalid_e; - } - } -#endif // _di_fss_basic_list_write_setting_load_ - -#ifndef _di_fss_basic_list_write_setting_unload_ - f_status_t fss_basic_list_write_setting_unload(fll_program_data_t * const main, fss_basic_list_write_setting_t * const setting) { - - if (!main || !setting) return F_status_set_error(F_parameter); - - fss_basic_list_write_setting_delete(setting); - - return F_none; - } -#endif // _di_fss_basic_list_write_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_basic_list_write/c/common.h b/level_3/fss_basic_list_write/c/common.h deleted file mode 100644 index da2986d..0000000 --- a/level_3/fss_basic_list_write/c/common.h +++ /dev/null @@ -1,350 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Basic List Write - * 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_basic_list_write_common_h -#define _fss_basic_list_write_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * The program version. - */ -#ifndef _di_fss_basic_list_write_program_version_s_ - #define FSS_BASIC_LIST_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_BASIC_LIST_WRITE_program_version_minor_s F_string_ascii_7_s - #define FSS_BASIC_LIST_WRITE_program_version_micro_s F_string_ascii_0_s - - #define FSS_BASIC_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_BASIC_LIST_WRITE_program_version_minor_s_length F_string_ascii_7_s_length - #define FSS_BASIC_LIST_WRITE_program_version_micro_s_length F_string_ascii_0_s_length - - #if !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length)) - #define FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s - #define FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_s_length)) - #define FSS_BASIC_LIST_WRITE_program_version_nano_s - #define FSS_BASIC_LIST_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_BASIC_LIST_WRITE_program_version_nano_s) && defined(FSS_BASIC_LIST_WRITE_program_version_nano_s_length)) - - #define FSS_BASIC_LIST_WRITE_program_version_s FSS_BASIC_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_BASIC_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_BASIC_LIST_WRITE_program_version_micro_s FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s FSS_BASIC_LIST_WRITE_program_version_nano_s - - #define FSS_BASIC_LIST_WRITE_program_version_s_length FSS_BASIC_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_LIST_WRITE_program_version_micro_s_length + FSS_BASIC_LIST_WRITE_program_version_nano_prefix_s_length + FSS_BASIC_LIST_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_basic_list_write_program_version_s; -#endif // _di_fss_basic_list_write_program_version_s_ - -/** - * The program name. - */ -#ifndef _di_fss_basic_list_write_program_name_s_ - #define FSS_BASIC_LIST_WRITE_program_name_s "fss_basic_list_write" - #define FSS_BASIC_LIST_WRITE_program_name_long_s "FSS Basic List Write" - - #define FSS_BASIC_LIST_WRITE_program_name_s_length 20 - #define FSS_BASIC_LIST_WRITE_program_name_long_s_length 20 - - extern const f_string_static_t fss_basic_list_write_program_name_s; - extern const f_string_static_t fss_basic_list_write_program_name_long_s; -#endif // _di_fss_basic_list_write_program_name_s_ - -/** - * The program define. - */ -#ifndef _di_fss_basic_list_write_d_ - #define fss_basic_list_write_signal_check_d 20000 -#endif // _di_fss_basic_list_write_d_ - -/** - * The program pipe strings. - * - * fss_basic_list_write_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_basic_list_write_pipe_s_ - #define fss_basic_list_write_signal_check_d 20000 - - #define FSS_BASIC_LIST_WRITE_pipe_name_s "(pipe)" - - #define FSS_BASIC_LIST_WRITE_pipe_content_end_s "\f" - #define FSS_BASIC_LIST_WRITE_pipe_content_ignore_s "\v" - #define FSS_BASIC_LIST_WRITE_pipe_content_start_s "\b" - - #define FSS_BASIC_LIST_WRITE_pipe_name_s_length 6 - - #define FSS_BASIC_LIST_WRITE_pipe_content_end_s_length 1 - #define FSS_BASIC_LIST_WRITE_pipe_content_ignore_s_length 1 - #define FSS_BASIC_LIST_WRITE_pipe_content_start_s_length 1 - - extern const f_string_static_t fss_basic_list_write_pipe_name_s; - - extern const f_string_static_t fss_basic_list_write_pipe_content_end_s; - extern const f_string_static_t fss_basic_list_write_pipe_content_ignore_s; - extern const f_string_static_t fss_basic_list_write_pipe_content_start_s; -#endif // _di_fss_basic_list_write_pipe_s_ - -/** - * The main program parameters. - */ -#ifndef _di_fss_basic_list_write_parameter_d_ - #define FSS_BASIC_LIST_WRITE_short_file_s "f" - #define FSS_BASIC_LIST_WRITE_short_content_s "c" - #define FSS_BASIC_LIST_WRITE_short_double_s "d" - #define FSS_BASIC_LIST_WRITE_short_ignore_s "I" - #define FSS_BASIC_LIST_WRITE_short_object_s "o" - #define FSS_BASIC_LIST_WRITE_short_partial_s "p" - #define FSS_BASIC_LIST_WRITE_short_prepend_s "P" - #define FSS_BASIC_LIST_WRITE_short_single_s "s" - #define FSS_BASIC_LIST_WRITE_short_trim_s "T" - - #define FSS_BASIC_LIST_WRITE_long_file_s "file" - #define FSS_BASIC_LIST_WRITE_long_content_s "content" - #define FSS_BASIC_LIST_WRITE_long_double_s "double" - #define FSS_BASIC_LIST_WRITE_long_ignore_s "ignore" - #define FSS_BASIC_LIST_WRITE_long_object_s "object" - #define FSS_BASIC_LIST_WRITE_long_partial_s "partial" - #define FSS_BASIC_LIST_WRITE_long_prepend_s "prepend" - #define FSS_BASIC_LIST_WRITE_long_single_s "single" - #define FSS_BASIC_LIST_WRITE_long_trim_s "trim" - - #define FSS_BASIC_LIST_WRITE_short_file_s_length 1 - #define FSS_BASIC_LIST_WRITE_short_content_s_length 1 - #define FSS_BASIC_LIST_WRITE_short_double_s_length 1 - #define FSS_BASIC_LIST_WRITE_short_ignore_s_length 1 - #define FSS_BASIC_LIST_WRITE_short_object_s_length 1 - #define FSS_BASIC_LIST_WRITE_short_partial_s_length 1 - #define FSS_BASIC_LIST_WRITE_short_prepend_s_length 1 - #define FSS_BASIC_LIST_WRITE_short_single_s_length 1 - #define FSS_BASIC_LIST_WRITE_short_trim_s_length 1 - - #define FSS_BASIC_LIST_WRITE_long_file_s_length 4 - #define FSS_BASIC_LIST_WRITE_long_content_s_length 7 - #define FSS_BASIC_LIST_WRITE_long_double_s_length 6 - #define FSS_BASIC_LIST_WRITE_long_ignore_s_length 6 - #define FSS_BASIC_LIST_WRITE_long_object_s_length 6 - #define FSS_BASIC_LIST_WRITE_long_partial_s_length 7 - #define FSS_BASIC_LIST_WRITE_long_prepend_s_length 7 - #define FSS_BASIC_LIST_WRITE_long_single_s_length 6 - #define FSS_BASIC_LIST_WRITE_long_trim_s_length 4 - - extern const f_string_static_t fss_basic_list_write_short_file_s; - extern const f_string_static_t fss_basic_list_write_short_content_s; - extern const f_string_static_t fss_basic_list_write_short_double_s; - extern const f_string_static_t fss_basic_list_write_short_ignore_s; - extern const f_string_static_t fss_basic_list_write_short_object_s; - extern const f_string_static_t fss_basic_list_write_short_partial_s; - extern const f_string_static_t fss_basic_list_write_short_prepend_s; - extern const f_string_static_t fss_basic_list_write_short_single_s; - extern const f_string_static_t fss_basic_list_write_short_trim_s; - - extern const f_string_static_t fss_basic_list_write_long_file_s; - extern const f_string_static_t fss_basic_list_write_long_content_s; - extern const f_string_static_t fss_basic_list_write_long_double_s; - extern const f_string_static_t fss_basic_list_write_long_ignore_s; - extern const f_string_static_t fss_basic_list_write_long_object_s; - extern const f_string_static_t fss_basic_list_write_long_partial_s; - extern const f_string_static_t fss_basic_list_write_long_prepend_s; - extern const f_string_static_t fss_basic_list_write_long_single_s; - extern const f_string_static_t fss_basic_list_write_long_trim_s; - - enum { - fss_basic_list_write_parameter_help_e, - fss_basic_list_write_parameter_light_e, - fss_basic_list_write_parameter_dark_e, - fss_basic_list_write_parameter_no_color_e, - fss_basic_list_write_parameter_verbosity_quiet_e, - fss_basic_list_write_parameter_verbosity_error_e, - fss_basic_list_write_parameter_verbosity_normal_e, - fss_basic_list_write_parameter_verbosity_verbose_e, - fss_basic_list_write_parameter_verbosity_debug_e, - fss_basic_list_write_parameter_version_e, - fss_basic_list_write_parameter_line_first_no_e, - fss_basic_list_write_parameter_line_last_no_e, - - fss_basic_list_write_parameter_file_e, - fss_basic_list_write_parameter_content_e, - fss_basic_list_write_parameter_double_e, - fss_basic_list_write_parameter_ignore_e, - fss_basic_list_write_parameter_object_e, - fss_basic_list_write_parameter_partial_e, - fss_basic_list_write_parameter_prepend_e, - fss_basic_list_write_parameter_single_e, - fss_basic_list_write_parameter_trim_e, - }; // enum - - #define fss_basic_list_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ - \ - macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_file_s.string, fss_basic_list_write_long_file_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_content_s.string, fss_basic_list_write_long_content_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_double_s.string, fss_basic_list_write_long_double_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_ignore_s.string, fss_basic_list_write_long_ignore_s.string, 0, 2, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_object_s.string, fss_basic_list_write_long_object_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_partial_s.string, fss_basic_list_write_long_partial_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_prepend_s.string, fss_basic_list_write_long_prepend_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_single_s.string, fss_basic_list_write_long_single_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_trim_s.string, fss_basic_list_write_long_trim_s.string, 0, 0, f_console_flag_normal_e), \ - } - - #define fss_basic_list_write_total_parameters_d 21 -#endif // _di_fss_basic_list_write_parameter_d_ - -/** - * Flags used to represent flags passed to the main function. - * - * fss_basic_list_write_main_flag_*_e: - * - none: No modes in use. - * - file_from: Using a specified source file. - * - file_to: Using a specified destination file. - * - help: Print help. - * - header: Enable printing of headers. - * - separate: Enable printing of separators. - * - strip_invalid: Using strip invalid character mode. - * - verify: Using verify mode. - * - version: Print version. - */ -#ifndef _di_fss_basic_list_write_main_flag_e_ - enum { - fss_basic_list_write_main_flag_none_e = 0x0, - fss_basic_list_write_main_flag_file_from_e = 0x1, - fss_basic_list_write_main_flag_file_to_e = 0x2, - fss_basic_list_write_main_flag_header_e = 0x4, - fss_basic_list_write_main_flag_help_e = 0x8, - fss_basic_list_write_main_flag_separate_e = 0x10, - fss_basic_list_write_main_flag_strip_invalid_e = 0x20, - fss_basic_list_write_main_flag_verify_e = 0x40, - fss_basic_list_write_main_flag_version_e = 0x80, - }; // enum -#endif // _di_fss_basic_list_write_main_flag_e_ - -/** - * The fss basic list write 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. - * - * status: The main status code, generally used by the load settings and main functions. - * - * line_first: A string expected to represent either "\n" or NULL to allow for easy handling of when to print first new line or not. - * line_last: A string expected to represent either "\n" or NULL to allow for easy handling of when to print last new line or not. - */ -#ifndef _di_fss_basic_list_write_setting_t_ - typedef struct { - uint16_t flag; - - f_status_t status; - - f_string_static_t line_first; - f_string_static_t line_last; - } fss_basic_list_write_setting_t; - - #define fss_basic_list_write_setting_t_initialize \ - { \ - fss_basic_list_write_main_flag_none_e, \ - F_none, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ - } -#endif // _di_fss_basic_list_write_setting_t_ - -/** - * Delete the program main setting data. - * - * @param setting - * The program main setting data. - * - * This does not alter setting.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fss_basic_list_write_setting_delete_ - extern f_status_t fss_basic_list_write_setting_delete(fss_basic_list_write_setting_t * const setting); -#endif // _di_fss_basic_list_write_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 retuns 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.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_basic_list_write_setting_load_ - extern void fss_basic_list_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_list_write_setting_t * const setting); -#endif // _di_fss_basic_list_write_setting_load_ - -/** - * Perform the standard program setting unload process. - * - * @param main - * The main program data. - * @param setting - * The main program settings. - * All buffers are deallocated. - * - * This does not alter setting.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: utf8_setting_delete(). - * - * @see utf8_setting_delete() - */ -#ifndef _di_fss_basic_list_write_setting_unload_ - extern f_status_t fss_basic_list_write_setting_unload(fll_program_data_t * const main, fss_basic_list_write_setting_t * const setting); -#endif // _di_fss_basic_list_write_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_basic_list_write_common_h diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c deleted file mode 100644 index 39f1c99..0000000 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ /dev/null @@ -1,462 +0,0 @@ -#include "fss_basic_list_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_basic_list_write_main_ - f_status_t fss_basic_list_write_main(fll_program_data_t * const main, fss_basic_list_write_setting_t * const setting) { - - f_status_t status = F_none; - - // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); - if (F_status_is_error(status)) return; - - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_basic_list_write_parameter_no_color_e, fss_basic_list_write_parameter_light_e, fss_basic_list_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(status)) { - fss_basic_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true); - fss_basic_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_basic_list_write_parameter_verbosity_quiet_e, fss_basic_list_write_parameter_verbosity_error_e, fss_basic_list_write_parameter_verbosity_verbose_e, fss_basic_list_write_parameter_verbosity_debug_e, fss_basic_list_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); - - if (F_status_is_error(status)) { - fss_basic_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true); - fss_basic_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - } - - f_string_static_t * const argv = main->parameters.arguments.array; - - status = F_none; - - if (main->parameters.array[fss_basic_list_write_parameter_help_e].result & f_console_result_found_e) { - fss_basic_list_write_print_help(setting, main->message); - - return status; - } - - if (main->parameters.array[fss_basic_list_write_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, fss_basic_list_write_program_version_s); - - return status; - } - - f_file_t output = f_file_t_initialize; - - output.id = F_type_descriptor_output_d; - output.stream = main->output.to; - output.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - output.size_read = main->output.to.size_read; - output.size_write = main->output.to.size_write; - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_basic_list_write_parameter_file_e].result & f_console_result_value_e) { - if (main->parameters.array[fss_basic_list_write_parameter_file_e].values.used > 1) { - if (main->error.verbosity > f_console_verbosity_quiet_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_basic_list_write_long_file_s, main->error.notable); - fl_print_format("%[' may only be specified once.%]%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 { - const f_array_length_t index = main->parameters.array[fss_basic_list_write_parameter_file_e].values.array[0]; - - output.id = -1; - output.stream = 0; - status = f_file_stream_open(argv[index], f_string_empty_s, &output); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e); - } - } - } - else if (main->parameters.array[fss_basic_list_write_parameter_file_e].result & f_console_result_found_e) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_basic_list_write_long_file_s); - status = F_status_set_error(F_parameter); - } - } - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_basic_list_write_parameter_object_e].locations.used || main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_basic_list_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_basic_list_write_parameter_object_e].locations.used != main->parameters.array[fss_basic_list_write_parameter_object_e].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_basic_list_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used != main->parameters.array[fss_basic_list_write_parameter_content_e].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_basic_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_basic_list_write_parameter_object_e].locations.used != main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used && !(main->parameters.array[fss_basic_list_write_parameter_partial_e].result & f_console_result_found_e)) { - fss_basic_list_write_error_parameter_same_times_print(main); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used && main->parameters.array[fss_basic_list_write_parameter_partial_e].locations.used) { - if (main->parameters.array[fss_basic_list_write_parameter_content_e].result & f_console_result_value_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_basic_list_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter only allows either the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter or the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter, but not both.%]%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)) { - if (main->parameters.array[fss_basic_list_write_parameter_content_e].result & f_console_result_value_e) { - f_array_length_t location_object = 0; - f_array_length_t location_content = 0; - f_array_length_t location_sub_object = 0; - f_array_length_t location_sub_content = 0; - - for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_list_write_parameter_object_e].locations.used; ++i) { - location_object = main->parameters.array[fss_basic_list_write_parameter_object_e].locations.array[i]; - location_content = main->parameters.array[fss_basic_list_write_parameter_content_e].locations.array[i]; - location_sub_object = main->parameters.array[fss_basic_list_write_parameter_object_e].locations_sub.array[i]; - location_sub_content = main->parameters.array[fss_basic_list_write_parameter_content_e].locations_sub.array[i]; - - if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QEach '%]", 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_basic_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter must be specified before a '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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); - - break; - } - } // for - } - } - } - else if (main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used != main->parameters.array[fss_basic_list_write_parameter_content_e].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_basic_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_basic_list_write_parameter_partial_e].locations.used) { - fss_basic_list_write_error_parameter_same_times_print(main); - status = F_status_set_error(F_parameter); - } - } - } - else if (!(main->pipe & fll_program_data_pipe_input_e)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", 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_basic_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter with the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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)) { - if (main->parameters.array[fss_basic_list_write_parameter_partial_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThis '%]", 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_basic_list_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter cannot be used when processing a pipe.%]%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)) { - if (main->parameters.array[fss_basic_list_write_parameter_prepend_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_basic_list_write_long_prepend_s, main->error.notable); - fl_print_format("%[' is specified, but no value is given.%]%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_basic_list_write_parameter_prepend_e].result & f_console_result_value_e) { - const f_array_length_t index = main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.used - 1]; - - if (argv[index].used) { - f_state_t state = f_state_t_initialize; - f_string_range_t range = macro_f_string_range_t_initialize2(argv[index].used); - - for (; range.start < argv[index].used; ++range.start) { - - status = f_fss_is_space(state, argv[index], range); - if (F_status_is_error(status)) break; - - if (status == F_false) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - 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_basic_list_write_long_prepend_s, main->error.notable); - fl_print_format("%[' must only contain white space.%]%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); - - break; - } - } // for - } - else { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - 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_basic_list_write_long_prepend_s, main->error.notable); - fl_print_format("%[' must not be an empty 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)) { - if (main->parameters.array[fss_basic_list_write_parameter_ignore_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_basic_list_write_long_ignore_s, main->error.notable); - fl_print_format("%[' was specified, but no values were given.%]%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_basic_list_write_parameter_ignore_e].result & f_console_result_value_e) { - const f_array_length_t total_locations = main->parameters.array[fss_basic_list_write_parameter_ignore_e].locations.used; - const f_array_length_t total_arguments = main->parameters.array[fss_basic_list_write_parameter_ignore_e].values.used; - - if (total_locations * 2 > total_arguments) { - 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_basic_list_write_long_ignore_s, main->error.notable); - fl_print_format("%[' requires two values.%]%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); - } - } - } - - uint8_t quote = f_fss_quote_double_s; - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_basic_list_write_parameter_double_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_basic_list_write_parameter_single_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_basic_list_write_parameter_double_e].location < main->parameters.array[fss_basic_list_write_parameter_single_e].location) { - quote = f_fss_quote_single_s; - } - } - } - else if (main->parameters.array[fss_basic_list_write_parameter_single_e].result & f_console_result_found_e) { - quote = f_fss_quote_single_s; - } - } - - f_string_dynamic_t buffer = f_string_dynamic_t_initialize; - - if (F_status_is_error_not(status)) { - if (main->pipe & fll_program_data_pipe_input_e) { - status = fss_basic_list_write_process_pipe(main, output, quote, &buffer); - - if (F_status_is_error(status)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); - fl_print_format("%['.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } - } - } - - if (F_status_is_error_not(status)) { - f_array_length_t index = 0; - - if (main->parameters.array[fss_basic_list_write_parameter_partial_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_basic_list_write_parameter_object_e].result & f_console_result_value_e) { - for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_list_write_parameter_object_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_basic_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - index = main->parameters.array[fss_basic_list_write_parameter_object_e].values.array[i]; - - status = fss_basic_list_write_process(main, output, quote, &argv[index], 0, &buffer); - if (F_status_is_error(status)) break; - } // for - } - else { - for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_list_write_parameter_content_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_basic_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - index = main->parameters.array[fss_basic_list_write_parameter_content_e].values.array[i]; - - status = fss_basic_list_write_process(main, output, quote, 0, &argv[index], &buffer); - if (F_status_is_error(status)) break; - } // for - } - } - else { - for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_list_write_parameter_object_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_basic_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - index = main->parameters.array[fss_basic_list_write_parameter_object_e].values.array[i]; - - status = fss_basic_list_write_process(main, output, quote, &argv[index], &argv[main->parameters.array[fss_basic_list_write_parameter_content_e].values.array[i]], &buffer); - if (F_status_is_error(status)) break; - } // for - } - - if (F_status_is_error(status)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); - fl_print_format("%['.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } - } - else if (!(main->error.verbosity > f_console_verbosity_quiet_e && (main->parameters.array[fss_basic_list_write_parameter_file_e].result & f_console_result_found_e))) { - - // Ensure there is always a newline at the end, unless in quiet mode. - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } - } - } - - if (main->parameters.array[fss_basic_list_write_parameter_file_e].result & f_console_result_value_e) { - f_file_stream_flush(output); - f_file_stream_close(&output); - } - - // Ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (main->error.verbosity > f_console_verbosity_quiet_e) { - if (F_status_is_error(status)) { - fll_print_dynamic_raw(f_string_eol_s, main->error.to); - } - } - - f_string_dynamic_resize(0, &buffer); - - return status; - } -#endif // _di_fss_basic_list_write_main_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.h b/level_3/fss_basic_list_write/c/fss_basic_list_write.h deleted file mode 100644 index 1c6a804..0000000 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.h +++ /dev/null @@ -1,82 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * This program provides fss basic list write functionality. - */ -#ifndef _fss_basic_list_write_h -#define _fss_basic_list_write_h - -// Libc includes. -#include -#include -#include -#include - -// FLL-0 includes. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// FLL-1 includes. -#include -#include -#include - -// FLL-2 includes. -#include -#include -#include - -// FSS Basic List Write 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.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_basic_list_write_main_ - extern f_status_t fss_basic_list_write_main(fll_program_data_t * const main, fss_basic_list_write_setting_t * const setting); -#endif // _di_fss_basic_list_write_main_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_basic_list_write_h diff --git a/level_3/fss_basic_list_write/c/main.c b/level_3/fss_basic_list_write/c/main.c deleted file mode 100644 index fd6a53b..0000000 --- a/level_3/fss_basic_list_write/c/main.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "fss_basic_list_write.h" - -int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - - fll_program_data_t data = fll_program_data_t_initialize; - fss_basic_list_write_setting_t setting = fss_basic_list_write_setting_t_initialize; - - f_console_parameter_t parameters[] = fss_basic_list_write_console_parameter_t_initialize; - data.parameters.array = parameters; - data.parameters.used = fss_basic_list_write_total_parameters_d; - data.environment = envp; - - if (f_pipe_input_exists()) { - data.pipe = fll_program_data_pipe_input_e; - } - - fll_program_standard_set_up(&data); - - { - const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - - fss_basic_list_write_setting_load(arguments, &data, &setting); - } - - const f_status_t status = fss_basic_list_write_main(&data, arguments); - - fss_basic_list_write_main(&data, &setting); - - fss_basic_list_write_setting_unload(&data, &setting); - - fll_program_data_delete(&data); - - fll_program_standard_set_down(&data); - - return F_status_is_error(status) ? 1 : 0; -} diff --git a/level_3/fss_basic_list_write/c/print.c b/level_3/fss_basic_list_write/c/print.c deleted file mode 100644 index 32b2420..0000000 --- a/level_3/fss_basic_list_write/c/print.c +++ /dev/null @@ -1,120 +0,0 @@ -#include "fss_basic_list_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_basic_list_write_print_help_ - f_status_t fss_basic_list_write_print_help(fss_basic_list_write_setting_t * const setting, const fl_print_t print) { - - f_file_stream_lock(print.to); - - f_print_dynamic_raw(setting->line_first, print.to); - - fll_program_print_help_header(print, fss_basic_list_write_program_name_long_s, fss_basic_list_write_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_basic_list_write_short_file_s, fss_basic_list_write_long_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a file to send data to."); - fll_program_print_help_option(print, fss_basic_list_write_short_content_s, fss_basic_list_write_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The Content to write."); - fll_program_print_help_option(print, fss_basic_list_write_short_double_s, fss_basic_list_write_long_double_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use double quotes (default)."); - fll_program_print_help_option(print, fss_basic_list_write_short_ignore_s, fss_basic_list_write_long_ignore_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Ignore a given range within a Content."); - fll_program_print_help_option(print, fss_basic_list_write_short_object_s, fss_basic_list_write_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The Object to write."); - fll_program_print_help_option(print, fss_basic_list_write_short_partial_s, fss_basic_list_write_long_partial_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Do not write end of Object/Content character."); - fll_program_print_help_option(print, fss_basic_list_write_short_prepend_s, fss_basic_list_write_long_prepend_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Prepend the given white space characters to the start of each multi-line Content."); - fll_program_print_help_option(print, fss_basic_list_write_short_single_s, fss_basic_list_write_long_single_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use single quotes."); - fll_program_print_help_option(print, fss_basic_list_write_short_trim_s, fss_basic_list_write_long_trim_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Trim Object names."); - - 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_basic_list_write_program_name_s, f_string_empty_s); - - fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The pipe uses the Form Feed character '%[\\f%]' (%[U+000C%]) to designate the end of the last Content.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The pipe uses the Vertical Line character '%[\\v%]' (%[U+000B%]) is used to ignore a Content range, which does nothing in this program.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable); - fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The FSS-0002 (Basic List) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_basic_list_write_long_single_s, print.set->notable); - fl_print_format(" and '%[%r%r%]' do nothing.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_basic_list_write_long_double_s, print.set->notable, f_string_eol_s, f_string_eol_s); - - fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_basic_list_write_long_ignore_s, print.set->notable, f_string_eol_s); - fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s); - - f_print_dynamic_raw(setting->line_last, print.to); - - f_file_stream_flush(print.to); - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fss_basic_list_write_print_help_ - -#ifndef _di_fss_basic_list_write_print_line_first_locked_ - f_status_t fss_basic_list_write_print_line_first_locked(fss_basic_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_basic_list_write_print_line_first_locked_ - -#ifndef _di_fss_basic_list_write_print_line_first_unlocked_ - f_status_t fss_basic_list_write_print_line_first_unlocked(fss_basic_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_basic_list_write_print_line_first_unlocked_ - -#ifndef _di_fss_basic_list_write_print_line_last_locked_ - f_status_t fss_basic_list_write_print_line_last_locked(fss_basic_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_basic_list_write_print_line_last_locked_ - -#ifndef _di_fss_basic_list_write_print_line_last_unlocked_ - f_status_t fss_basic_list_write_print_line_last_unlocked(fss_basic_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_basic_list_write_print_line_last_unlocked_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_basic_list_write/c/print.h b/level_3/fss_basic_list_write/c/print.h deleted file mode 100644 index c222def..0000000 --- a/level_3/fss_basic_list_write/c/print.h +++ /dev/null @@ -1,124 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: UTF-8 - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _fss_basic_list_write_print_h -#define _fss_basic_list_write_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print help. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * - * @return - * F_none on success. - */ -#ifndef _di_fss_basic_list_write_print_help_ - extern f_status_t fss_basic_list_write_print_help(fss_basic_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_list_write_print_help_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_list_write_print_line_first_locked_ - extern f_status_t fss_basic_list_write_print_line_first_locked(fss_basic_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_list_write_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_list_write_print_line_first_unlocked_ - extern f_status_t fss_basic_list_write_print_line_first_unlocked(fss_basic_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_list_write_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_list_write_print_line_last_locked_ - extern f_status_t fss_basic_list_write_print_line_last_locked(fss_basic_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_list_write_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_list_write_print_line_last_unlocked_ - extern f_status_t fss_basic_list_write_print_line_last_unlocked(fss_basic_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_list_write_print_line_last_unlocked_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_basic_list_write_print_h diff --git a/level_3/fss_basic_list_write/c/private-common.c b/level_3/fss_basic_list_write/c/private-common.c deleted file mode 100644 index 1975491..0000000 --- a/level_3/fss_basic_list_write/c/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_basic_list_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_basic_list_write/c/private-common.h b/level_3/fss_basic_list_write/c/private-common.h deleted file mode 100644 index 13524a4..0000000 --- a/level_3/fss_basic_list_write/c/private-common.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Basic List Write - * 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. - * - * basic_list_write_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. - */ -#ifndef _di_fss_basic_list_write_common_ - #define fss_basic_list_write_common_allocation_large_d 2048 - #define fss_basic_list_write_common_allocation_small_d 128 -#endif // _di_fss_basic_list_write_common_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_common_h diff --git a/level_3/fss_basic_list_write/c/private-write.c b/level_3/fss_basic_list_write/c/private-write.c deleted file mode 100644 index c644739..0000000 --- a/level_3/fss_basic_list_write/c/private-write.c +++ /dev/null @@ -1,325 +0,0 @@ -#include "fss_basic_list_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_basic_list_write_error_parameter_same_times_print_ - void fss_basic_list_write_error_parameter_same_times_print(fll_program_data_t * const main) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return; - - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QMust specify the '%]", 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_basic_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_list_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_basic_list_write_error_parameter_same_times_print_ - -#ifndef _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ - void fss_basic_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return; - - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe FSS-0002 (Basic List) standard does not support end of line character '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[\\n%]", main->error.to, main->error.notable, main->error.notable); - fl_print_format("%[' (%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[U+000A%]", main->error.to, main->error.notable, main->error.notable); - fl_print_format("%[) in objects.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ - -#ifndef _di_fss_basic_list_write_error_parameter_value_missing_print_ - void fss_basic_list_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return; - - 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, symbol, parameter, main->error.notable); - fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_basic_list_write_error_parameter_value_missing_print_ - -#ifndef _di_fss_basic_list_write_process_ - f_status_t fss_basic_list_write_process(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t * const buffer) { - - f_status_t status = F_none; - f_state_t state = macro_f_state_t_initialize(fss_basic_list_write_common_allocation_large_d, fss_basic_list_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); - f_string_range_t range = f_string_range_t_initialize; - - if (object) { - uint8_t complete = f_fss_complete_none_e; - - if (object->used) { - range.start = 0; - range.stop = object->used - 1; - } - else { - range.start = 1; - range.stop = 0; - } - - if (content) { - if (main->parameters.array[fss_basic_list_write_parameter_trim_e].result & f_console_result_found_e) { - complete = f_fss_complete_full_trim_e; - } - else { - complete = f_fss_complete_full_e; - } - } - - status = fl_fss_basic_list_object_write(*object, complete, state, &range, buffer); - - if (F_status_set_fine(status) == F_none_eol) { - fss_basic_list_write_error_parameter_unsupported_eol_print(main); - - return F_status_set_error(F_support_not); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fl_fss_basic_list_object_write", F_true); - - return status; - } - } - - if (content && content->used) { - range.start = 0; - range.stop = content->used - 1; - - f_string_static_t *prepend = 0; - - if (main->parameters.array[fss_basic_list_write_parameter_prepend_e].result & f_console_result_value_e) { - const f_array_length_t index = main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.used - 1]; - - prepend = &main->parameters.arguments.array[index]; - } - - status = fl_fss_basic_list_content_write(*content, object ? f_fss_complete_full_e : f_fss_complete_none_e, prepend, state, &range, buffer); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fl_fss_basic_list_content_write", F_true); - - return status; - } - } - - if (!object || !content) { - status = f_string_dynamic_append(f_string_eol_s, buffer); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); - - return status; - } - } - - fll_print_dynamic(*buffer, output); - - buffer->used = 0; - - return status; - } -#endif // _di_fss_basic_list_write_process_ - -#ifndef _di_fss_basic_list_write_process_pipe_ - f_status_t fss_basic_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, f_string_dynamic_t * const buffer) { - - f_status_t status = F_none; - f_status_t status_pipe = F_none; - - f_file_t input = f_file_t_initialize; - - input.id = F_type_descriptor_input_d; - input.size_read = 2048; - - f_array_length_t total = 0; - f_string_range_t range = f_string_range_t_initialize; - - f_string_dynamic_t block = f_string_dynamic_t_initialize; - f_string_dynamic_t object = f_string_dynamic_t_initialize; - f_string_dynamic_t content = f_string_dynamic_t_initialize; - - // 0x0 = start new object/content set, 0x1 = processing object, 0x2 = processing content, 0x3 = end object/content set. - uint8_t state = 0; - - for (;;) { - - if (!((++main->signal_check) % fss_basic_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - if (range.start > range.stop) { - if (status_pipe == F_none_eof) break; - - block.used = 0; - - status_pipe = f_file_read_block(input, &block); - - if (F_status_is_error(status_pipe)) { - fll_error_print(main->error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); - - status_pipe = F_status_set_error(F_pipe); - - break; - } - - if (!block.used) break; - - range.start = 0; - range.stop = block.used - 1; - } - - if (!state || state == 0x1) { - if (!state) { - object.used = 0; - content.used = 0; - - state = 0x1; - } - - if (object.used + block.used > object.size) { - status = f_string_dynamic_increase_by(block.used, &object); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); - - break; - } - } - - for (; range.start <= range.stop; ++range.start) { - - if (block.string[range.start] == fss_basic_list_write_pipe_content_start_s.string[0]) { - state = 0x2; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_basic_list_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_basic_list_write_pipe_content_ignore_s.string[0]) { - - // This is not used by objects. - continue; - } - - object.string[object.used++] = block.string[range.start]; - } // for - - if (F_status_is_error(status)) break; - - // If the start of content was not found, then fetch the next block. - if (state == 0x1) continue; - - // If the end of the current block is reached, fetch the next block. - if (range.start > range.stop) continue; - } - - if (state == 0x2) { - if (range.start <= range.stop) { - total = (range.stop - range.start) + 1; - } - else { - total = 0; - } - - if (total) { - status = f_string_dynamic_increase_by(total, &content); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); - - break; - } - - for (; range.start <= range.stop; ++range.start) { - - if (block.string[range.start] == fss_basic_list_write_pipe_content_start_s.string[0]) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_format("%r%[%QThe FSS-0002 (Basic List) standard only supports one content per object.%]%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_support_not); - - break; - } - - if (block.string[range.start] == fss_basic_list_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_basic_list_write_pipe_content_ignore_s.string[0]) { - - // This is not used by this program. - continue; - } - - content.string[content.used++] = block.string[range.start]; - } // for - - if (F_status_is_error(status)) break; - } - else { - state = 0x3; - } - } - - if (state == 0x3) { - status = fss_basic_list_write_process(main, output, quote, &object, &content, buffer); - if (F_status_is_error(status)) break; - - state = 0; - } - } // for - - // If the pipe ended before finishing, then attempt to wrap up. - if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) { - status = fss_basic_list_write_process(main, output, quote, &object, &content, buffer); - } - - f_string_dynamic_resize(0, &block); - f_string_dynamic_resize(0, &object); - f_string_dynamic_resize(0, &content); - - return status; - } -#endif // _di_fss_basic_list_write_process_pipe_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_basic_list_write/c/private-write.h b/level_3/fss_basic_list_write/c/private-write.h deleted file mode 100644 index 3d55a87..0000000 --- a/level_3/fss_basic_list_write/c/private-write.h +++ /dev/null @@ -1,101 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_write_h -#define _PRIVATE_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print an message about the object and content parameters not being specified the same number of times. - * - * @param main - * The main program data. - */ -#ifndef _di_fss_basic_list_write_error_parameter_same_times_print_ - void fss_basic_list_write_error_parameter_same_times_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_basic_list_write_error_parameter_same_times_print_ - -/** - * Print an error message about a parameter a New Line character '\n' (U+000A) being unsupported. - * - * @param main - * The main program data. - */ -#ifndef _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ - void fss_basic_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_basic_list_write_error_parameter_unsupported_eol_print_ - -/** - * Print an error message about a parameter missing a value. - * - * @param main - * The main program data. - * @param symbol - * The console symbol, such as "--" in "--help". - * @param parameter - * The parameter name, such as "help" in "--help". - */ -#ifndef _di_fss_basic_list_write_error_parameter_value_missing_print_ - void fss_basic_list_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; -#endif // _di_fss_basic_list_write_error_parameter_value_missing_print_ - -/** - * Process a given object and content, printing the FSS if valid or an error if invalid. - * - * @param main - * The main program data. - * @param output - * The file to output to. - * @param quote - * The quote character to use. - * This is either single our double quote. - * @param object - * The object to validate and print. - * Set pointer address to 0 to not use. - * @param content - * The content to escape and print. - * Set pointer address to 0 to not use. - * @param buffer - * The buffer array used as a cache to construct the output before printing. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_basic_list_write_process_ - extern f_status_t fss_basic_list_write_process(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t * const buffer) F_attribute_visibility_internal_d; -#endif // _di_fss_basic_list_write_process_ - -/** - * Process the pipe, reading from the pipe and writing to the output. - * - * @param main - * The main program data. - * @param output - * The file to output to. - * @param quote - * The quote character to use. - * This is either single our double quote. - * @param buffer - * The buffer array used as a cache to construct the output before printing. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_basic_list_write_process_pipe_ - extern f_status_t fss_basic_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, f_string_dynamic_t * const buffer) F_attribute_visibility_internal_d; -#endif // _di_fss_basic_list_write_process_pipe_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_write_h diff --git a/level_3/fss_basic_list_write/data/build/defines b/level_3/fss_basic_list_write/data/build/defines deleted file mode 100644 index c665317..0000000 --- a/level_3/fss_basic_list_write/data/build/defines +++ /dev/null @@ -1,2 +0,0 @@ -# fss-0000 - diff --git a/level_3/fss_basic_list_write/data/build/dependencies b/level_3/fss_basic_list_write/data/build/dependencies deleted file mode 100644 index aa10ae3..0000000 --- a/level_3/fss_basic_list_write/data/build/dependencies +++ /dev/null @@ -1,27 +0,0 @@ -# fss-0000 - -f_type -f_status -f_memory -f_type_array -f_string -f_utf -f_color -f_console -f_conversion -f_directory -f_environment -f_file -f_fss -f_pipe -f_print -f_signal -fl_conversion -fl_fss -fl_print -fl_string -fll_error -fll_file -fll_fss -fll_print -fll_program diff --git a/level_3/fss_basic_list_write/data/build/fakefile b/level_3/fss_basic_list_write/data/build/fakefile deleted file mode 100644 index 5328059..0000000 --- a/level_3/fss_basic_list_write/data/build/fakefile +++ /dev/null @@ -1,11 +0,0 @@ -# fss-0005 iki-0002 - -settings: - fail exit - modes individual level monolithic clang test - - environment PATH LD_LIBRARY_PATH - -main: - - build diff --git a/level_3/fss_basic_list_write/data/build/settings b/level_3/fss_basic_list_write/data/build/settings deleted file mode 100644 index f92a448..0000000 --- a/level_3/fss_basic_list_write/data/build/settings +++ /dev/null @@ -1,65 +0,0 @@ -# fss-0001 - -build_name fss_basic_list_write - -version_major 0 -version_minor 7 -version_micro 0 -version_file micro -version_target minor - -modes individual level monolithic clang test -modes_default monolithic - -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 -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_status_string -lf_string -lf_type_array -lf_utf -build_libraries-level -lfll_2 -lfll_1 -lfll_0 -build_libraries-monolithic -lfll - -build_sources_library fss_basic_list_write.c common.c print.c private-common.c private-write.c - -build_sources_program main.c - -build_sources_headers fss_basic_list_write.h common.h print.h - -build_script yes -build_shared yes -build_static no - -path_headers program/fss_basic_list_write -path_library_script script -path_library_shared shared -path_library_static static -path_object_script script -path_object_shared shared -path_object_static static -path_program_script script -path_program_shared shared -path_program_static static - -has_path_standard yes -preserve_path_headers yes - -search_exclusive yes -search_shared yes -search_static yes - -environment PATH LD_LIBRARY_PATH - -#defines -D_di_libcap_ -D_di_thread_support_ -defines -D_libcap_legacy_only_ -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-clang -Wno-logical-op-parentheses -flags-test -O0 -fstack-protector -Wall -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_basic_write/c/common.c b/level_3/fss_basic_write/c/common.c deleted file mode 100644 index 4565f03..0000000 --- a/level_3/fss_basic_write/c/common.c +++ /dev/null @@ -1,166 +0,0 @@ -#include "fss_basic_write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_basic_write_program_version_s_ - const f_string_static_t fss_basic_write_program_version_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_program_version_s, 0, FSS_BASIC_WRITE_program_version_s_length); -#endif // _di_fss_basic_write_program_version_s_ - -#ifndef _di_fss_basic_write_program_name_s_ - const f_string_static_t fss_basic_write_program_name_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_program_name_s, 0, FSS_BASIC_WRITE_program_name_s_length); - const f_string_static_t fss_basic_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_program_name_long_s, 0, FSS_BASIC_WRITE_program_name_long_s_length); -#endif // _di_fss_basic_write_program_name_s_ - -#ifndef _di_fss_basic_write_pipe_s_ - const f_string_static_t fss_basic_write_pipe_name_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_pipe_name_s, 0, FSS_BASIC_WRITE_pipe_name_s_length); - const f_string_static_t fss_basic_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_pipe_content_end_s, 0, FSS_BASIC_WRITE_pipe_content_end_s_length); - const f_string_static_t fss_basic_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_pipe_content_ignore_s, 0, FSS_BASIC_WRITE_pipe_content_ignore_s_length); - const f_string_static_t fss_basic_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_pipe_content_start_s, 0, FSS_BASIC_WRITE_pipe_content_start_s_length); -#endif // _di_fss_basic_write_defines. - -#ifndef _di_fss_basic_write_program_parameters_ - const f_string_static_t fss_basic_write_short_file_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_file_s, 0, FSS_BASIC_WRITE_short_file_s_length); - const f_string_static_t fss_basic_write_short_content_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_content_s, 0, FSS_BASIC_WRITE_short_content_s_length); - const f_string_static_t fss_basic_write_short_double_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_double_s, 0, FSS_BASIC_WRITE_short_double_s_length); - const f_string_static_t fss_basic_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_ignore_s, 0, FSS_BASIC_WRITE_short_ignore_s_length); - const f_string_static_t fss_basic_write_short_object_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_object_s, 0, FSS_BASIC_WRITE_short_object_s_length); - const f_string_static_t fss_basic_write_short_partial_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_partial_s, 0, FSS_BASIC_WRITE_short_partial_s_length); - const f_string_static_t fss_basic_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_prepend_s, 0, FSS_BASIC_WRITE_short_prepend_s_length); - const f_string_static_t fss_basic_write_short_single_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_single_s, 0, FSS_BASIC_WRITE_short_single_s_length); - const f_string_static_t fss_basic_write_short_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_short_trim_s, 0, FSS_BASIC_WRITE_short_trim_s_length); - - const f_string_static_t fss_basic_write_long_file_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_file_s, 0, FSS_BASIC_WRITE_long_file_s_length); - const f_string_static_t fss_basic_write_long_content_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_content_s, 0, FSS_BASIC_WRITE_long_content_s_length); - const f_string_static_t fss_basic_write_long_double_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_double_s, 0, FSS_BASIC_WRITE_long_double_s_length); - const f_string_static_t fss_basic_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_ignore_s, 0, FSS_BASIC_WRITE_long_ignore_s_length); - const f_string_static_t fss_basic_write_long_object_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_object_s, 0, FSS_BASIC_WRITE_long_object_s_length); - const f_string_static_t fss_basic_write_long_partial_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_partial_s, 0, FSS_BASIC_WRITE_long_partial_s_length); - const f_string_static_t fss_basic_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_prepend_s, 0, FSS_BASIC_WRITE_long_prepend_s_length); - const f_string_static_t fss_basic_write_long_single_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_single_s, 0, FSS_BASIC_WRITE_long_single_s_length); - const f_string_static_t fss_basic_write_long_trim_s = macro_f_string_static_t_initialize(FSS_BASIC_WRITE_long_trim_s, 0, FSS_BASIC_WRITE_long_trim_s_length); -#endif // _di_fss_basic_write_program_parameters_ - -#ifndef _di_fss_basic_write_setting_delete_ - f_status_t fss_basic_write_setting_delete(fss_basic_write_setting_t * const setting) { - - if (!setting) return F_status_set_error(F_parameter); - - return F_none; - } -#endif // _di_fss_basic_write_setting_delete_ - -#ifndef _di_fss_basic_write_setting_load_ - void fss_basic_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_write_setting_t * const setting) { - - if (!main || !setting) return; - - setting->flag = 0; - - // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); - - if (F_status_is_error(setting->status)) { - fss_basic_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true); - fss_basic_write_print_line_last_locked(setting, main->error); - - return; - } - - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_basic_write_parameter_no_color_e, fss_basic_write_parameter_light_e, fss_basic_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(setting->status)) { - fss_basic_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true); - fss_basic_write_print_line_last_locked(setting, main->error); - - return; - } - } - - if (main->parameters.array[fss_basic_write_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_basic_write_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_basic_write_parameter_verbosity_quiet_e, fss_basic_write_parameter_verbosity_error_e, fss_basic_write_parameter_verbosity_verbose_e, fss_basic_write_parameter_verbosity_debug_e, fss_basic_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); - - if (F_status_is_error(setting->status)) { - fss_basic_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true); - fss_basic_write_print_line_last_locked(setting, main->error); - - return; - } - } - } - - main->output.to.id = F_type_descriptor_output_d; - main->output.to.stream = F_type_output_d; - main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - - if (main->parameters.array[fss_basic_write_parameter_help_e].result & f_console_result_found_e) { - setting->flag |= fss_basic_write_main_flag_help_e; - - return; - } - - if (main->parameters.array[fss_basic_write_parameter_version_e].result & f_console_result_found_e) { - setting->flag |= fss_basic_write_main_flag_version_e; - - return; - } - - f_string_static_t * const args = main->parameters.arguments.array; - - if (main->parameters.array[fss_basic_write_parameter_strip_invalid_e].result & f_console_result_found_e) { - setting->flag |= fss_basic_write_main_flag_strip_invalid_e; - } - } -#endif // _di_fss_basic_write_setting_load_ - -#ifndef _di_fss_basic_write_setting_unload_ - f_status_t fss_basic_write_setting_unload(fll_program_data_t * const main, fss_basic_write_setting_t * const setting) { - - if (!main || !setting) return F_status_set_error(F_parameter); - - fss_basic_write_setting_delete(setting); - - return F_none; - } -#endif // _di_fss_basic_write_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_basic_write/c/common.h b/level_3/fss_basic_write/c/common.h deleted file mode 100644 index bc3f269..0000000 --- a/level_3/fss_basic_write/c/common.h +++ /dev/null @@ -1,348 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Basic Write - * 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_basic_write_common_h -#define _fss_basic_write_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * The program version. - */ -#ifndef _di_fss_basic_write_program_version_s_ - #define FSS_BASIC_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_BASIC_WRITE_program_version_minor_s F_string_ascii_7_s - #define FSS_BASIC_WRITE_program_version_micro_s F_string_ascii_0_s - - #define FSS_BASIC_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_BASIC_WRITE_program_version_minor_s_length F_string_ascii_7_s_length - #define FSS_BASIC_WRITE_program_version_micro_s_length F_string_ascii_0_s_length - - #if !(defined(FSS_BASIC_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_WRITE_program_version_nano_prefix_s_length)) - #define FSS_BASIC_WRITE_program_version_nano_prefix_s - #define FSS_BASIC_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_BASIC_WRITE_program_version_nano_prefix_s) && defined(FSS_BASIC_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_BASIC_WRITE_program_version_nano_s) && defined(FSS_BASIC_WRITE_program_version_nano_s_length)) - #define FSS_BASIC_WRITE_program_version_nano_s - #define FSS_BASIC_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_BASIC_WRITE_program_version_nano_s) && defined(FSS_BASIC_WRITE_program_version_nano_s_length)) - - #define FSS_BASIC_WRITE_program_version_s FSS_BASIC_WRITE_program_version_major_s F_string_ascii_period_s FSS_BASIC_WRITE_program_version_minor_s F_string_ascii_period_s FSS_BASIC_WRITE_program_version_micro_s FSS_BASIC_WRITE_program_version_nano_prefix_s FSS_BASIC_WRITE_program_version_nano_s - - #define FSS_BASIC_WRITE_program_version_s_length FSS_BASIC_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_BASIC_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_BASIC_WRITE_program_version_micro_s_length + FSS_BASIC_WRITE_program_version_nano_prefix_s_length + FSS_BASIC_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_basic_write_program_version_s; -#endif // _di_fss_basic_write_program_version_s_ - -/** - * The main program name. - */ -#ifndef _di_fss_basic_write_program_name_s_ - #define FSS_BASIC_WRITE_program_name_s "fss_basic_write" - #define FSS_BASIC_WRITE_program_name_long_s "FSS Basic Write" - - #define FSS_BASIC_WRITE_program_name_s_length 15 - #define FSS_BASIC_WRITE_program_name_long_s_length 15 - - extern const f_string_static_t fss_basic_write_program_name_s; - extern const f_string_static_t fss_basic_write_program_name_long_s; -#endif // _di_fss_basic_write_program_name_s_ - -/** - * The program signal defines. - */ -#ifndef _di_fss_basic_write_d_ - #define fss_basic_write_signal_check_d 20000 -#endif // _di_fss_basic_write_d_. - -/** - * The program pipe strings. - * - * fss_basic_write_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_basic_write_pipe_s_ - #define FSS_BASIC_WRITE_pipe_name_s "(pipe)" - - #define FSS_BASIC_WRITE_pipe_content_end_s "\f" - #define FSS_BASIC_WRITE_pipe_content_ignore_s "\v" - #define FSS_BASIC_WRITE_pipe_content_start_s "\b" - - #define FSS_BASIC_WRITE_pipe_name_s_length 6 - - #define FSS_BASIC_WRITE_pipe_content_end_s_length 1 - #define FSS_BASIC_WRITE_pipe_content_ignore_s_length 1 - #define FSS_BASIC_WRITE_pipe_content_start_s_length 1 - - extern const f_string_static_t fss_basic_write_pipe_name_s; - - extern const f_string_static_t fss_basic_write_pipe_content_end_s; - extern const f_string_static_t fss_basic_write_pipe_content_ignore_s; - extern const f_string_static_t fss_basic_write_pipe_content_start_s; -#endif // _di_fss_basic_write_pipe_s_. - -/** - * The main program parameters. - */ -#ifndef _di_fss_basic_write_parameter_d_ - #define FSS_BASIC_WRITE_short_file_s "f" - #define FSS_BASIC_WRITE_short_content_s "c" - #define FSS_BASIC_WRITE_short_double_s "d" - #define FSS_BASIC_WRITE_short_ignore_s "I" - #define FSS_BASIC_WRITE_short_object_s "o" - #define FSS_BASIC_WRITE_short_partial_s "p" - #define FSS_BASIC_WRITE_short_prepend_s "P" - #define FSS_BASIC_WRITE_short_single_s "s" - #define FSS_BASIC_WRITE_short_trim_s "T" - - #define FSS_BASIC_WRITE_long_file_s "file" - #define FSS_BASIC_WRITE_long_content_s "content" - #define FSS_BASIC_WRITE_long_double_s "double" - #define FSS_BASIC_WRITE_long_ignore_s "ignore" - #define FSS_BASIC_WRITE_long_object_s "object" - #define FSS_BASIC_WRITE_long_partial_s "partial" - #define FSS_BASIC_WRITE_long_prepend_s "prepend" - #define FSS_BASIC_WRITE_long_single_s "single" - #define FSS_BASIC_WRITE_long_trim_s "trim" - - #define FSS_BASIC_WRITE_short_file_s_length 1 - #define FSS_BASIC_WRITE_short_content_s_length 1 - #define FSS_BASIC_WRITE_short_double_s_length 1 - #define FSS_BASIC_WRITE_short_ignore_s_length 1 - #define FSS_BASIC_WRITE_short_object_s_length 1 - #define FSS_BASIC_WRITE_short_partial_s_length 1 - #define FSS_BASIC_WRITE_short_prepend_s_length 1 - #define FSS_BASIC_WRITE_short_single_s_length 1 - #define FSS_BASIC_WRITE_short_trim_s_length 1 - - #define FSS_BASIC_WRITE_long_file_s_length 4 - #define FSS_BASIC_WRITE_long_content_s_length 7 - #define FSS_BASIC_WRITE_long_double_s_length 6 - #define FSS_BASIC_WRITE_long_ignore_s_length 6 - #define FSS_BASIC_WRITE_long_object_s_length 6 - #define FSS_BASIC_WRITE_long_partial_s_length 7 - #define FSS_BASIC_WRITE_long_prepend_s_length 7 - #define FSS_BASIC_WRITE_long_single_s_length 6 - #define FSS_BASIC_WRITE_long_trim_s_length 4 - - extern const f_string_static_t fss_basic_write_short_file_s; - extern const f_string_static_t fss_basic_write_short_content_s; - extern const f_string_static_t fss_basic_write_short_double_s; - extern const f_string_static_t fss_basic_write_short_ignore_s; - extern const f_string_static_t fss_basic_write_short_object_s; - extern const f_string_static_t fss_basic_write_short_partial_s; - extern const f_string_static_t fss_basic_write_short_prepend_s; - extern const f_string_static_t fss_basic_write_short_single_s; - extern const f_string_static_t fss_basic_write_short_trim_s; - - extern const f_string_static_t fss_basic_write_long_file_s; - extern const f_string_static_t fss_basic_write_long_content_s; - extern const f_string_static_t fss_basic_write_long_double_s; - extern const f_string_static_t fss_basic_write_long_ignore_s; - extern const f_string_static_t fss_basic_write_long_object_s; - extern const f_string_static_t fss_basic_write_long_partial_s; - extern const f_string_static_t fss_basic_write_long_prepend_s; - extern const f_string_static_t fss_basic_write_long_single_s; - extern const f_string_static_t fss_basic_write_long_trim_s; - - enum { - fss_basic_write_parameter_help_e, - fss_basic_write_parameter_light_e, - fss_basic_write_parameter_dark_e, - fss_basic_write_parameter_no_color_e, - fss_basic_write_parameter_verbosity_quiet_e, - fss_basic_write_parameter_verbosity_error_e, - fss_basic_write_parameter_verbosity_normal_e, - fss_basic_write_parameter_verbosity_verbose_e, - fss_basic_write_parameter_verbosity_debug_e, - fss_basic_write_parameter_version_e, - fss_basic_write_parameter_line_first_no_e, - fss_basic_write_parameter_line_last_no_e, - - fss_basic_write_parameter_file_e, - fss_basic_write_parameter_content_e, - fss_basic_write_parameter_double_e, - fss_basic_write_parameter_ignore_e, - fss_basic_write_parameter_object_e, - fss_basic_write_parameter_partial_e, - fss_basic_write_parameter_prepend_e, - fss_basic_write_parameter_single_e, - fss_basic_write_parameter_trim_e, - }; // enum - - #define fss_basic_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ - \ - macro_f_console_parameter_t_initialize2(fss_basic_write_short_file_s.string, fss_basic_write_long_file_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_write_short_content_s.string, fss_basic_write_long_content_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_write_short_double_s.string, fss_basic_write_long_double_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_write_short_ignore_s.string, fss_basic_write_long_ignore_s.string, 0, 2, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_write_short_object_s.string, fss_basic_write_long_object_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_write_short_partial_s.string, fss_basic_write_long_partial_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_write_short_prepend_s.string, fss_basic_write_long_prepend_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_write_short_single_s.string, fss_basic_write_long_single_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_basic_write_short_trim_s.string, fss_basic_write_long_trim_s.string, 0, 0, f_console_flag_normal_e), \ - } - - #define fss_basic_write_total_parameters_d 20 -#endif // _di_fss_basic_write_parameter_d_ - -/** - * Flags used to represent flags passed to the main function. - * - * fss_basic_write_main_flag_*_e: - * - none: No modes in use. - * - file_from: Using a specified source file. - * - file_to: Using a specified destination file. - * - help: Print help. - * - header: Enable printing of headers. - * - separate: Enable printing of separators. - * - strip_invalid: Using strip invalid character mode. - * - verify: Using verify mode. - * - version: Print version. - */ -#ifndef _di_fss_basic_write_main_flag_e_ - enum { - fss_basic_write_main_flag_none_e = 0x0, - fss_basic_write_main_flag_file_from_e = 0x1, - fss_basic_write_main_flag_file_to_e = 0x2, - fss_basic_write_main_flag_header_e = 0x4, - fss_basic_write_main_flag_help_e = 0x8, - fss_basic_write_main_flag_separate_e = 0x10, - fss_basic_write_main_flag_strip_invalid_e = 0x20, - fss_basic_write_main_flag_verify_e = 0x40, - fss_basic_write_main_flag_version_e = 0x80, - }; // enum -#endif // _di_fss_basic_write_main_flag_e_ - -/** - * The fss basic write 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. - * - * status: The main status code, generally used by the load settings and main functions. - * - * line_first: A string expected to represent either "\n" or NULL to allow for easy handling of when to print first new line or not. - * line_last: A string expected to represent either "\n" or NULL to allow for easy handling of when to print last new line or not. - */ -#ifndef _di_fss_basic_write_setting_t_ - typedef struct { - uint16_t flag; - - f_status_t status; - - f_string_static_t line_first; - f_string_static_t line_last; - } fss_basic_write_setting_t; - - #define fss_basic_write_setting_t_initialize \ - { \ - fss_basic_write_main_flag_none_e, \ - F_none, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ - } -#endif // _di_fss_basic_write_setting_t_ - -/** - * Delete the program main setting data. - * - * @param setting - * The program main setting data. - * - * This does not alter setting.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fss_basic_write_setting_delete_ - extern f_status_t fss_basic_write_setting_delete(fss_basic_write_setting_t * const setting); -#endif // _di_fss_basic_write_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 retuns 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.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_basic_write_setting_load_ - extern void fss_basic_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_write_setting_t * const setting); -#endif // _di_fss_basic_write_setting_load_ - -/** - * Perform the standard program setting unload process. - * - * @param main - * The main program data. - * @param setting - * The main program settings. - * All buffers are deallocated. - * - * This does not alter setting.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: utf8_setting_delete(). - * - * @see utf8_setting_delete() - */ -#ifndef _di_fss_basic_write_setting_unload_ - extern f_status_t fss_basic_write_setting_unload(fll_program_data_t * const main, fss_basic_write_setting_t * const setting); -#endif // _di_fss_basic_write_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_basic_write_common_h diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c deleted file mode 100644 index b112b3f..0000000 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ /dev/null @@ -1,453 +0,0 @@ -#include "fss_basic_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_basic_write_main_ - f_status_t fss_basic_write_main(fll_program_data_t * const main, fss_basic_write_setting_t * const setting) { - - f_status_t status = F_none; - - // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); - if (F_status_is_error(status)) return; - - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_basic_write_parameter_no_color_e, fss_basic_write_parameter_light_e, fss_basic_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(status)) { - fss_basic_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true); - fss_basic_write_print_line_last_locked(setting, main->error); - - return; - } - } - - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_basic_write_parameter_verbosity_quiet_e, fss_basic_write_parameter_verbosity_error_e, fss_basic_write_parameter_verbosity_verbose_e, fss_basic_write_parameter_verbosity_debug_e, fss_basic_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); - - if (F_status_is_error(status)) { - fss_basic_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true); - fss_basic_write_print_line_last_locked(setting, main->error); - - return; - } - } - } - - f_string_static_t * const argv = main->parameters.arguments.array; - - status = F_none; - - if (main->parameters.array[fss_basic_write_parameter_help_e].result & f_console_result_found_e) { - fss_basic_write_print_help(setting, main->message); - - return status; - } - - if (main->parameters.array[fss_basic_write_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, fss_basic_write_program_version_s); - - return status; - } - - f_file_t output = f_file_t_initialize; - - output.id = F_type_descriptor_output_d; - output.stream = F_type_output_d; - output.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_basic_write_parameter_file_e].result & f_console_result_value_e) { - if (main->parameters.array[fss_basic_write_parameter_file_e].values.used > 1) { - if (main->error.verbosity > f_console_verbosity_quiet_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_basic_write_long_file_s, main->error.notable); - fl_print_format("%[' may only be specified once.%]%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 { - const f_array_length_t index = main->parameters.array[fss_basic_write_parameter_file_e].values.array[0]; - - output.id = -1; - output.stream = 0; - status = f_file_stream_open(argv[index], f_string_empty_s, &output); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e); - } - } - } - else if (main->parameters.array[fss_basic_write_parameter_file_e].result & f_console_result_found_e) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_basic_write_long_file_s); - status = F_status_set_error(F_parameter); - } - } - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_basic_write_parameter_object_e].locations.used || main->parameters.array[fss_basic_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_basic_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_basic_write_parameter_object_e].locations.used != main->parameters.array[fss_basic_write_parameter_object_e].values.used) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_basic_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_basic_write_parameter_content_e].locations.used != main->parameters.array[fss_basic_write_parameter_content_e].values.used) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_basic_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_basic_write_parameter_object_e].locations.used != main->parameters.array[fss_basic_write_parameter_content_e].locations.used && !(main->parameters.array[fss_basic_write_parameter_partial_e].result & f_console_result_found_e)) { - fss_basic_write_error_parameter_same_times_print(main); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_basic_write_parameter_content_e].locations.used && main->parameters.array[fss_basic_write_parameter_partial_e].locations.used) { - if (main->parameters.array[fss_basic_write_parameter_content_e].result & f_console_result_value_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_basic_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter only allows either the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter or the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter, but not both.%]%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)) { - if (main->parameters.array[fss_basic_write_parameter_content_e].result & f_console_result_value_e) { - f_array_length_t location_object = 0; - f_array_length_t location_content = 0; - f_array_length_t location_sub_object = 0; - f_array_length_t location_sub_content = 0; - - for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_write_parameter_object_e].locations.used; ++i) { - location_object = main->parameters.array[fss_basic_write_parameter_object_e].locations.array[i]; - location_content = main->parameters.array[fss_basic_write_parameter_content_e].locations.array[i]; - location_sub_object = main->parameters.array[fss_basic_write_parameter_object_e].locations_sub.array[i]; - location_sub_content = main->parameters.array[fss_basic_write_parameter_content_e].locations_sub.array[i]; - - if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QEach '%]", 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_basic_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter must be specified before a '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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); - - break; - } - } // for - } - } - } - else if (main->parameters.array[fss_basic_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_basic_write_parameter_content_e].locations.used != main->parameters.array[fss_basic_write_parameter_content_e].values.used) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_basic_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_basic_write_parameter_partial_e].locations.used) { - fss_basic_write_error_parameter_same_times_print(main); - status = F_status_set_error(F_parameter); - } - } - } - else if (!(main->pipe & fll_program_data_pipe_input_e)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", 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_basic_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter with the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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)) { - if (main->parameters.array[fss_basic_write_parameter_partial_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThis '%]", 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_basic_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter cannot be used when processing a pipe.%]%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)) { - if (main->parameters.array[fss_basic_write_parameter_prepend_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_basic_write_long_prepend_s, main->error.notable); - fl_print_format("%[' is specified, but no value is given.%]%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_basic_write_parameter_prepend_e].result & f_console_result_value_e) { - const f_array_length_t index = main->parameters.array[fss_basic_write_parameter_prepend_e].values.array[main->parameters.array[fss_basic_write_parameter_prepend_e].values.used - 1]; - - // Even though this standard does not utilize this parameter, provide the validation for consistency. - if (argv[index].used) { - f_string_range_t range = macro_f_string_range_t_initialize2(argv[index].used); - f_state_t state = f_state_t_initialize; - - for (; range.start < argv[index].used; ++range.start) { - - status = f_fss_is_space(state, argv[index], range); - if (F_status_is_error(status)) break; - - if (status == F_false) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - 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_basic_write_long_prepend_s, main->error.notable); - fl_print_format("%[' must only contain white space.%]%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); - - break; - } - } // for - } - else { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - 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_basic_write_long_prepend_s, main->error.notable); - fl_print_format("%[' must not be an empty 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)) { - if (main->parameters.array[fss_basic_write_parameter_ignore_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_basic_write_long_ignore_s, main->error.notable); - fl_print_format("%[' was specified, but no values were given.%]%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_basic_write_parameter_ignore_e].result & f_console_result_value_e) { - const f_array_length_t total_locations = main->parameters.array[fss_basic_write_parameter_ignore_e].locations.used; - const f_array_length_t total_arguments = main->parameters.array[fss_basic_write_parameter_ignore_e].values.used; - - if (total_locations * 2 > total_arguments) { - 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_basic_write_long_ignore_s, main->error.notable); - fl_print_format("%[' requires two values.%]%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); - } - } - } - - uint8_t quote = f_fss_quote_double_s; - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_basic_write_parameter_double_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_basic_write_parameter_single_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_basic_write_parameter_double_e].location < main->parameters.array[fss_basic_write_parameter_single_e].location) { - quote = f_fss_quote_single_s; - } - } - } - else if (main->parameters.array[fss_basic_write_parameter_single_e].result & f_console_result_found_e) { - quote = f_fss_quote_single_s; - } - } - - f_string_dynamic_t buffer = f_string_dynamic_t_initialize; - - if (F_status_is_error_not(status)) { - if (main->pipe & fll_program_data_pipe_input_e) { - status = fss_basic_write_process_pipe(main, output, quote, &buffer); - - if (F_status_is_error(status)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); - fl_print_format("%['.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } - } - } - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_basic_write_parameter_partial_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_basic_write_parameter_object_e].result & f_console_result_value_e) { - for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_write_parameter_object_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_basic_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - status = fss_basic_write_process(main, output, quote, &argv[main->parameters.array[fss_basic_write_parameter_object_e].values.array[i]], 0, &buffer); - if (F_status_is_error(status)) break; - } // for - } - else { - for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_write_parameter_content_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_basic_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - status = fss_basic_write_process(main, output, quote, 0, &argv[main->parameters.array[fss_basic_write_parameter_content_e].values.array[i]], &buffer); - if (F_status_is_error(status)) break; - } // for - } - } - else { - for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_write_parameter_object_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_basic_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - status = fss_basic_write_process(main, output, quote, &argv[main->parameters.array[fss_basic_write_parameter_object_e].values.array[i]], &argv[main->parameters.array[fss_basic_write_parameter_content_e].values.array[i]], &buffer); - if (F_status_is_error(status)) break; - } // for - } - - if (F_status_is_error(status)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); - fl_print_format("%['.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } - } - else if (main->error.verbosity > f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && !(main->parameters.array[fss_basic_write_parameter_file_e].result & f_console_result_found_e)) { - - // Ensure there is always a newline at the end, unless in quiet mode. - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } - } - } - - if (main->parameters.array[fss_basic_write_parameter_file_e].result & f_console_result_value_e) { - f_file_stream_flush(output); - f_file_stream_close(&output); - } - - // Ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (main->error.verbosity > f_console_verbosity_quiet_e) { - if (F_status_is_error(status)) { - fll_print_dynamic_raw(f_string_eol_s, main->error.to); - } - } - - f_string_dynamic_resize(0, &buffer); - - return status; - } -#endif // _di_fss_basic_write_main_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_basic_write/c/fss_basic_write.h b/level_3/fss_basic_write/c/fss_basic_write.h deleted file mode 100644 index c39d88a..0000000 --- a/level_3/fss_basic_write/c/fss_basic_write.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * This program provides fss basic write functionality. - */ -#ifndef _fss_basic_write_h -#define _fss_basic_write_h - -// Libc includes. -#include -#include -#include -#include - -// FLL-0 includes. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// FLL-1 includes. -#include -#include -#include - -// FLL-2 includes. -#include -#include -#include -#include - -// FSS Basic Write 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 arguments - * The parameters passed to the process. - * - * @return - * F_none on success. - * Status codes (with error bit) are returned on any problem. - */ -#ifndef _di_fss_basic_write_main_ - extern f_status_t fss_basic_write_main(fll_program_data_t * const main, fss_basic_write_setting_t * const setting); -#endif // _di_fss_basic_write_main_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_basic_write_h diff --git a/level_3/fss_basic_write/c/main.c b/level_3/fss_basic_write/c/main.c deleted file mode 100644 index c953bc5..0000000 --- a/level_3/fss_basic_write/c/main.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "fss_basic_write.h" - -int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - - fll_program_data_t data = fll_program_data_t_initialize; - fss_basic_write_setting_t setting = fss_basic_write_setting_t_initialize; - - f_console_parameter_t parameters[] = fss_basic_write_console_parameter_t_initialize; - data.parameters.array = parameters; - data.parameters.used = fss_basic_write_total_parameters_d; - data.environment = envp; - - if (f_pipe_input_exists()) { - data.pipe = fll_program_data_pipe_input_e; - } - - fll_program_standard_set_up(&data); - - { - const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - - fss_basic_write_setting_load(arguments, &data, &setting); - } - - fss_basic_write_main(&data, &setting); - - fss_basic_write_setting_unload(&data, &setting); - - fll_program_data_delete(&data); - - fll_program_standard_set_down(&data); - - return F_status_is_error(status) ? 1 : 0; -} diff --git a/level_3/fss_basic_write/c/print.c b/level_3/fss_basic_write/c/print.c deleted file mode 100644 index 424abf6..0000000 --- a/level_3/fss_basic_write/c/print.c +++ /dev/null @@ -1,120 +0,0 @@ -#include "fss_basic_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_basic_write_print_help_ - f_status_t fss_basic_write_print_help(fss_basic_write_setting_t * const setting, const fl_print_t print) { - - f_file_stream_lock(print.to); - - f_print_dynamic_raw(setting->line_first, print.to); - - fll_program_print_help_header(print, fss_basic_write_program_name_long_s, fss_basic_write_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_basic_write_short_file_s, fss_basic_write_long_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a file to send data to."); - fll_program_print_help_option(print, fss_basic_write_short_content_s, fss_basic_write_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The Content to write."); - fll_program_print_help_option(print, fss_basic_write_short_double_s, fss_basic_write_long_double_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use double quotes (default)."); - fll_program_print_help_option(print, fss_basic_write_short_ignore_s, fss_basic_write_long_ignore_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Ignore a given range within a Content."); - fll_program_print_help_option(print, fss_basic_write_short_object_s, fss_basic_write_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The Object to write."); - fll_program_print_help_option(print, fss_basic_write_short_partial_s, fss_basic_write_long_partial_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Do not write end of Object/Content character."); - fll_program_print_help_option(print, fss_basic_write_short_prepend_s, fss_basic_write_long_prepend_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Prepend the given white space characters to the start of each multi-line Content."); - fll_program_print_help_option(print, fss_basic_write_short_single_s, fss_basic_write_long_single_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use single quotes."); - fll_program_print_help_option(print, fss_basic_write_short_trim_s, fss_basic_write_long_trim_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Trim Object names."); - - 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_basic_write_program_name_s, f_string_empty_s); - - fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The pipe uses the Form Feed character '%[\\f%]' (%[U+000C%]) to designate the end of the last Content.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The pipe uses the Vertical Line character '%[\\v%]' (%[U+000B%]) is used to ignore a Content range, which does nothing in this program.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable); - fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The FSS-0000 (Basic) specification does not support multi-line Content, therefore the parameter '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_basic_write_long_prepend_s, print.set->notable); - fl_print_format(" does nothing.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_basic_write_long_ignore_s, print.set->notable, f_string_eol_s); - fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s); - - f_print_dynamic_raw(setting->line_last, print.to); - - f_file_stream_flush(print.to); - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fss_basic_write_print_help_ - -#ifndef _di_fss_basic_write_print_line_first_locked_ - f_status_t fss_basic_write_print_line_first_locked(fss_basic_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_basic_write_print_line_first_locked_ - -#ifndef _di_fss_basic_write_print_line_first_unlocked_ - f_status_t fss_basic_write_print_line_first_unlocked(fss_basic_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_basic_write_print_line_first_unlocked_ - -#ifndef _di_fss_basic_write_print_line_last_locked_ - f_status_t fss_basic_write_print_line_last_locked(fss_basic_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_basic_write_print_line_last_locked_ - -#ifndef _di_fss_basic_write_print_line_last_unlocked_ - f_status_t fss_basic_write_print_line_last_unlocked(fss_basic_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_basic_write_print_line_last_unlocked_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_basic_write/c/print.h b/level_3/fss_basic_write/c/print.h deleted file mode 100644 index 8a016ac..0000000 --- a/level_3/fss_basic_write/c/print.h +++ /dev/null @@ -1,124 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: UTF-8 - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _fss_basic_write_print_h -#define _fss_basic_write_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print help. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * - * @return - * F_none on success. - */ -#ifndef _di_fss_basic_write_print_help_ - extern f_status_t fss_basic_write_print_help(fss_basic_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_write_print_help_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_write_print_line_first_locked_ - extern f_status_t fss_basic_write_print_line_first_locked(fss_basic_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_write_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_write_print_line_first_unlocked_ - extern f_status_t fss_basic_write_print_line_first_unlocked(fss_basic_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_write_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_write_print_line_last_locked_ - extern f_status_t fss_basic_write_print_line_last_locked(fss_basic_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_write_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_write_print_line_last_unlocked_ - extern f_status_t fss_basic_write_print_line_last_unlocked(fss_basic_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_write_print_line_last_unlocked_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_basic_write_print_h diff --git a/level_3/fss_basic_write/c/private-common.c b/level_3/fss_basic_write/c/private-common.c deleted file mode 100644 index d1c0ac4..0000000 --- a/level_3/fss_basic_write/c/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_basic_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_basic_write/c/private-common.h b/level_3/fss_basic_write/c/private-common.h deleted file mode 100644 index c9af824..0000000 --- a/level_3/fss_basic_write/c/private-common.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Basic Write - * 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. - * - * basic_write_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. - */ -#ifndef _di_fss_basic_write_common_ - #define fss_basic_write_common_allocation_large_d 2048 - #define fss_basic_write_common_allocation_small_d 128 -#endif // _di_fss_basic_write_common_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_common_h diff --git a/level_3/fss_basic_write/c/private-write.c b/level_3/fss_basic_write/c/private-write.c deleted file mode 100644 index 254617f..0000000 --- a/level_3/fss_basic_write/c/private-write.c +++ /dev/null @@ -1,335 +0,0 @@ -#include "fss_basic_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_basic_write_error_parameter_same_times_print_ - void fss_basic_write_error_parameter_same_times_print(fll_program_data_t * const main) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return; - - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QMust specify the '%]", 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_basic_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_basic_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_basic_write_error_parameter_same_times_print_ - -#ifndef _di_fss_basic_write_error_parameter_value_missing_print_ - void fss_basic_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return; - - 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, symbol, parameter, main->error.notable); - fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_basic_write_error_parameter_value_missing_print_ - -#ifndef _di_fss_basic_write_error_parameter_unsupported_eol_print_ - void fss_basic_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return; - - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe FSS-0000 (Basic) standard does not support end of line character '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[\\n%]", main->error.to, main->error.notable, main->error.notable); - fl_print_format("%[' (%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[U+000A%]", main->error.to, main->error.notable, main->error.notable); - fl_print_format("%[) in objects.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_basic_write_error_parameter_unsupported_eol_print_ - -#ifndef _di_fss_basic_write_process_ - f_status_t fss_basic_write_process(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) { - - f_status_t status = F_none; - f_state_t state = macro_f_state_t_initialize(fss_basic_write_common_allocation_large_d, fss_basic_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); - f_string_range_t range = f_string_range_t_initialize; - - if (object) { - uint8_t complete = f_fss_complete_none_e; - - if (object->used) { - range.start = 0; - range.stop = object->used - 1; - } - else { - range.start = 1; - range.stop = 0; - } - - if (content) { - if (main->parameters.array[fss_basic_write_parameter_trim_e].result & f_console_result_found_e) { - complete = f_fss_complete_full_trim_e; - } - else { - complete = f_fss_complete_full_e; - } - } - - status = fl_fss_basic_object_write(*object, quote, complete, state, &range, buffer); - - if (F_status_set_fine(status) == F_none_eol) { - fss_basic_write_error_parameter_unsupported_eol_print(main); - - return F_status_set_error(F_support_not); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fl_fss_basic_object_write", F_true); - - return status; - } - } - - if (content) { - if (content->used) { - range.start = 0; - range.stop = content->used - 1; - } - else { - range.start = 1; - range.stop = 0; - } - - status = fl_fss_basic_content_write(*content, object ? f_fss_complete_full_e : f_fss_complete_none_e, state, &range, buffer); - - if (F_status_set_fine(status) == F_none_eol) { - fss_basic_write_error_parameter_unsupported_eol_print(main); - - return F_status_set_error(F_support_not); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fl_fss_basic_content_write", F_true); - - return status; - } - } - - if (!object || !content) { - status = f_string_dynamic_append(f_string_eol_s, buffer); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); - - return status; - } - } - - fll_print_dynamic(*buffer, output); - - buffer->used = 0; - - return status; - } -#endif // _di_fss_basic_write_process_ - -#ifndef _di_fss_basic_write_process_pipe_ - f_status_t fss_basic_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, f_string_dynamic_t *buffer) { - - f_status_t status = F_none; - f_status_t status_pipe = F_none; - - f_file_t input = f_file_t_initialize; - - input.id = F_type_descriptor_input_d; - input.size_read = 2048; - - f_array_length_t total = 0; - f_string_range_t range = f_string_range_t_initialize; - - f_string_dynamic_t block = f_string_dynamic_t_initialize; - f_string_dynamic_t object = f_string_dynamic_t_initialize; - f_string_dynamic_t content = f_string_dynamic_t_initialize; - - // 0x0 = start new object/content set, 0x1 = processing object, 0x2 = processing content, 0x3 = end object/content set. - uint8_t state = 0; - - for (;;) { - - if (!((++main->signal_check) % fss_basic_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - return F_status_set_error(F_interrupt); - } - - main->signal_check = 0; - } - - if (range.start > range.stop) { - if (status_pipe == F_none_eof) break; - - block.used = 0; - - status_pipe = f_file_read_block(input, &block); - - if (F_status_is_error(status_pipe)) { - fll_error_print(main->error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); - - status_pipe = F_status_set_error(F_pipe); - - break; - } - - if (!block.used) break; - - range.start = 0; - range.stop = block.used - 1; - } - - if (!state || state == 0x1) { - if (!state) { - object.used = 0; - content.used = 0; - - state = 0x1; - } - - if (object.used + block.used > object.size) { - status = f_string_dynamic_increase_by(block.used, &object); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); - - break; - } - } - - for (; range.start <= range.stop; range.start++) { - - if (block.string[range.start] == fss_basic_write_pipe_content_start_s.string[0]) { - state = 0x2; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_basic_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_basic_write_pipe_content_ignore_s.string[0]) { - - // This is not used by objects. - continue; - } - - object.string[object.used++] = block.string[range.start]; - } // for - - if (F_status_is_error(status)) break; - - // If the start of content was not found, then fetch the next block. - if (state == 0x1) continue; - - // If the end of the current block is reached, fetch the next block. - if (range.start > range.stop) continue; - } - - if (state == 0x2) { - if (range.start <= range.stop) { - total = (range.stop - range.start) + 1; - } - else { - total = 0; - } - - if (total) { - status = f_string_dynamic_increase_by(total, &content); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); - - break; - } - - for (; range.start <= range.stop; ++range.start) { - - if (block.string[range.start] == fss_basic_write_pipe_content_start_s.string[0]) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_format("%r%[%QThe FSS-0000 (Basic) standard only supports one content per object.%]%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_support_not); - - break; - } - - if (block.string[range.start] == fss_basic_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_basic_write_pipe_content_ignore_s.string[0]) { - - // This is not used by this program. - continue; - } - - if (F_status_set_fine(status) == F_none_eol) { - fss_basic_write_error_parameter_unsupported_eol_print(main); - - status = F_status_set_error(F_support_not); - - break; - } - - content.string[content.used++] = block.string[range.start]; - } // for - - if (F_status_is_error(status)) break; - } - else { - state = 0x3; - } - } - - if (state == 0x3) { - status = fss_basic_write_process(main, output, quote, &object, &content, buffer); - if (F_status_is_error(status)) break; - - state = 0; - } - } // for - - // If the pipe ended before finishing, then attempt to wrap up. - if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) { - status = fss_basic_write_process(main, output, quote, &object, &content, buffer); - } - - f_string_dynamic_resize(0, &block); - f_string_dynamic_resize(0, &object); - f_string_dynamic_resize(0, &content); - - return status; - } -#endif // _di_fss_basic_write_process_pipe_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_basic_write/c/private-write.h b/level_3/fss_basic_write/c/private-write.h deleted file mode 100644 index 899344b..0000000 --- a/level_3/fss_basic_write/c/private-write.h +++ /dev/null @@ -1,101 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_write_h -#define _PRIVATE_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print an message about the object and content parameters not being specified the same number of times. - * - * @param main - * The main program data. - */ -#ifndef _di_fss_basic_write_error_parameter_same_times_print_ - void fss_basic_write_error_parameter_same_times_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_basic_write_error_parameter_same_times_print_ - -/** - * Print an error message about a parameter missing a value. - * - * @param main - * The main program data. - * @param symbol - * The console symbol, such as "--" in "--help". - * @param parameter - * The parameter name, such as "help" in "--help". - */ -#ifndef _di_fss_basic_write_error_parameter_value_missing_print_ - void fss_basic_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; -#endif // _di_fss_basic_write_error_parameter_value_missing_print_ - -/** - * Print an error message about a parameter a New Line character '\n' (U+000A) being unsupported. - * - * @param main - * The main program data. - */ -#ifndef _di_fss_basic_write_error_parameter_unsupported_eol_print_ - void fss_basic_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_basic_write_error_parameter_unsupported_eol_print_ - -/** - * Process a given object and content, printing the FSS if valid or an error if invalid. - * - * @param main - * The main program data. - * @param output - * The file to output to. - * @param quote - * The quote character to use. - * This is either single our double quote. - * @param object - * A pointer to the object to validate and print. - * Set pointer address to 0 to not use. - * @param content - * A pointer to the content to escape and print. - * Set pointer address to 0 to not use. - * @param buffer - * The buffer array used as a cache to construct the output before printing. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_basic_write_process_ - extern f_status_t fss_basic_write_process(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, const f_string_static_t *object, const f_string_static_t *content, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; -#endif // _di_fss_basic_write_process_ - -/** - * Process the pipe, reading from the pipe and writing to the output. - * - * @param main - * The main program data. - * @param output - * The file to output to. - * @param quote - * The quote character to use. - * This is either single our double quote. - * @param buffer - * The buffer array used as a cache to construct the output before printing. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_basic_write_process_pipe_ - extern f_status_t fss_basic_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; -#endif // _di_fss_basic_write_process_pipe_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_write_h diff --git a/level_3/fss_basic_write/data/build/defines b/level_3/fss_basic_write/data/build/defines deleted file mode 100644 index c665317..0000000 --- a/level_3/fss_basic_write/data/build/defines +++ /dev/null @@ -1,2 +0,0 @@ -# fss-0000 - diff --git a/level_3/fss_basic_write/data/build/dependencies b/level_3/fss_basic_write/data/build/dependencies deleted file mode 100644 index aa10ae3..0000000 --- a/level_3/fss_basic_write/data/build/dependencies +++ /dev/null @@ -1,27 +0,0 @@ -# fss-0000 - -f_type -f_status -f_memory -f_type_array -f_string -f_utf -f_color -f_console -f_conversion -f_directory -f_environment -f_file -f_fss -f_pipe -f_print -f_signal -fl_conversion -fl_fss -fl_print -fl_string -fll_error -fll_file -fll_fss -fll_print -fll_program diff --git a/level_3/fss_basic_write/data/build/fakefile b/level_3/fss_basic_write/data/build/fakefile deleted file mode 100644 index 5328059..0000000 --- a/level_3/fss_basic_write/data/build/fakefile +++ /dev/null @@ -1,11 +0,0 @@ -# fss-0005 iki-0002 - -settings: - fail exit - modes individual level monolithic clang test - - environment PATH LD_LIBRARY_PATH - -main: - - build diff --git a/level_3/fss_basic_write/data/build/settings b/level_3/fss_basic_write/data/build/settings deleted file mode 100644 index 292c290..0000000 --- a/level_3/fss_basic_write/data/build/settings +++ /dev/null @@ -1,65 +0,0 @@ -# fss-0001 - -build_name fss_basic_write - -version_major 0 -version_minor 7 -version_micro 0 -version_file micro -version_target minor - -modes individual level monolithic clang test -modes_default monolithic - -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 -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_status_string -lf_string -lf_type_array -lf_utf -build_libraries-level -lfll_2 -lfll_1 -lfll_0 -build_libraries-monolithic -lfll - -build_sources_library fss_basic_write.c common.c print.c private-common.c private-write.c - -build_sources_program main.c - -build_sources_headers fss_basic_write.h common.h print.h - -build_script yes -build_shared yes -build_static no - -path_headers program/fss_basic_write -path_library_script script -path_library_shared shared -path_library_static static -path_object_script script -path_object_shared shared -path_object_static static -path_program_script script -path_program_shared shared -path_program_static static - -has_path_standard yes -preserve_path_headers yes - -search_exclusive yes -search_shared yes -search_static yes - -environment PATH LD_LIBRARY_PATH - -#defines -D_di_libcap_ -D_di_thread_support_ -defines -D_libcap_legacy_only_ -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-clang -Wno-logical-op-parentheses -flags-test -O0 -fstack-protector -Wall -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_write/c/common.c b/level_3/fss_embedded_list_write/c/common.c deleted file mode 100644 index 4a6b399..0000000 --- a/level_3/fss_embedded_list_write/c/common.c +++ /dev/null @@ -1,166 +0,0 @@ -#include "fss_embedded_list_write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_embedded_list_write_program_version_s_ - const f_string_static_t fss_embedded_list_write_program_version_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_program_version_s, 0, FSS_EMBEDDED_LIST_WRITE_program_version_s_length); -#endif // _di_fss_embedded_list_write_program_version_s_ - -#ifndef _di_fss_embedded_list_write_program_name_s_ - const f_string_static_t fss_embedded_list_write_program_name_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_program_name_s, 0, FSS_EMBEDDED_LIST_WRITE_program_name_s_length); - const f_string_static_t fss_embedded_list_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_program_name_long_s, 0, FSS_EMBEDDED_LIST_WRITE_program_name_long_s_length); -#endif // _di_fss_embedded_list_write_program_name_s_ - -#ifndef _di_fss_embedded_list_write_pipe_s_ - const f_string_static_t fss_embedded_list_write_pipe_name_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_pipe_name_s, 0, FSS_EMBEDDED_LIST_WRITE_pipe_name_s_length); - const f_string_static_t fss_embedded_list_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_pipe_content_end_s, 0, FSS_EMBEDDED_LIST_WRITE_pipe_content_end_s_length); - const f_string_static_t fss_embedded_list_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_pipe_content_ignore_s, 0, FSS_EMBEDDED_LIST_WRITE_pipe_content_ignore_s_length); - const f_string_static_t fss_embedded_list_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_pipe_content_start_s, 0, FSS_EMBEDDED_LIST_WRITE_pipe_content_start_s_length); -#endif // _di_fss_embedded_list_write_pipe_s_ - -#ifndef _di_fss_embedded_list_write_parameter_d_ - const f_string_static_t fss_embedded_list_write_short_file_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_file_s, 0, FSS_EMBEDDED_LIST_WRITE_short_file_s_length); - const f_string_static_t fss_embedded_list_write_short_content_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_content_s, 0, FSS_EMBEDDED_LIST_WRITE_short_content_s_length); - const f_string_static_t fss_embedded_list_write_short_double_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_double_s, 0, FSS_EMBEDDED_LIST_WRITE_short_double_s_length); - const f_string_static_t fss_embedded_list_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_ignore_s, 0, FSS_EMBEDDED_LIST_WRITE_short_ignore_s_length); - const f_string_static_t fss_embedded_list_write_short_object_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_object_s, 0, FSS_EMBEDDED_LIST_WRITE_short_object_s_length); - const f_string_static_t fss_embedded_list_write_short_partial_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_partial_s, 0, FSS_EMBEDDED_LIST_WRITE_short_partial_s_length); - const f_string_static_t fss_embedded_list_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_prepend_s, 0, FSS_EMBEDDED_LIST_WRITE_short_prepend_s_length); - const f_string_static_t fss_embedded_list_write_short_single_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_single_s, 0, FSS_EMBEDDED_LIST_WRITE_short_single_s_length); - const f_string_static_t fss_embedded_list_write_short_trim_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_short_trim_s, 0, FSS_EMBEDDED_LIST_WRITE_short_trim_s_length); - - const f_string_static_t fss_embedded_list_write_long_file_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_file_s, 0, FSS_EMBEDDED_LIST_WRITE_long_file_s_length); - const f_string_static_t fss_embedded_list_write_long_content_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_content_s, 0, FSS_EMBEDDED_LIST_WRITE_long_content_s_length); - const f_string_static_t fss_embedded_list_write_long_double_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_double_s, 0, FSS_EMBEDDED_LIST_WRITE_long_double_s_length); - const f_string_static_t fss_embedded_list_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_ignore_s, 0, FSS_EMBEDDED_LIST_WRITE_long_ignore_s_length); - const f_string_static_t fss_embedded_list_write_long_object_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_object_s, 0, FSS_EMBEDDED_LIST_WRITE_long_object_s_length); - const f_string_static_t fss_embedded_list_write_long_partial_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_partial_s, 0, FSS_EMBEDDED_LIST_WRITE_long_partial_s_length); - const f_string_static_t fss_embedded_list_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_prepend_s, 0, FSS_EMBEDDED_LIST_WRITE_long_prepend_s_length); - const f_string_static_t fss_embedded_list_write_long_single_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_single_s, 0, FSS_EMBEDDED_LIST_WRITE_long_single_s_length); - const f_string_static_t fss_embedded_list_write_long_trim_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_trim_s, 0, FSS_EMBEDDED_LIST_WRITE_long_trim_s_length); -#endif // _di_fss_embedded_list_write_parameter_d_ - -#ifndef _di_fss_embedded_list_write_setting_delete_ - f_status_t fss_embedded_list_write_setting_delete(fss_embedded_list_write_setting_t * const setting) { - - if (!setting) return F_status_set_error(F_parameter); - - return F_none; - } -#endif // _di_fss_embedded_list_write_setting_delete_ - -#ifndef _di_fss_embedded_list_write_setting_load_ - void fss_embedded_list_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_write_setting_t * const setting) { - - if (!main || !setting) return; - - setting->flag = 0; - - // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); - - if (F_status_is_error(setting->status)) { - fss_embedded_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true); - fss_embedded_list_write_print_line_last_locked(setting, main->error); - - return; - } - - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_embedded_list_write_parameter_no_color_e, fss_embedded_list_write_parameter_light_e, fss_embedded_list_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(setting->status)) { - fss_embedded_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true); - fss_embedded_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - - if (main->parameters.array[fss_embedded_list_write_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_embedded_list_write_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_embedded_list_write_parameter_verbosity_quiet_e, fss_embedded_list_write_parameter_verbosity_error_e, fss_embedded_list_write_parameter_verbosity_verbose_e, fss_embedded_list_write_parameter_verbosity_debug_e, fss_embedded_list_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); - - if (F_status_is_error(setting->status)) { - fss_embedded_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true); - fss_embedded_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - } - - main->output.to.id = F_type_descriptor_output_d; - main->output.to.stream = F_type_output_d; - main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - - if (main->parameters.array[fss_embedded_list_write_parameter_help_e].result & f_console_result_found_e) { - setting->flag |= fss_embedded_list_write_main_flag_help_e; - - return; - } - - if (main->parameters.array[fss_embedded_list_write_parameter_version_e].result & f_console_result_found_e) { - setting->flag |= fss_embedded_list_write_main_flag_version_e; - - return; - } - - f_string_static_t * const args = main->parameters.arguments.array; - - if (main->parameters.array[fss_embedded_list_write_parameter_strip_invalid_e].result & f_console_result_found_e) { - setting->flag |= fss_embedded_list_write_main_flag_strip_invalid_e; - } - } -#endif // _di_fss_embedded_list_write_setting_load_ - -#ifndef _di_fss_embedded_list_write_setting_unload_ - f_status_t fss_embedded_list_write_setting_unload(fll_program_data_t * const main, fss_embedded_list_write_setting_t * const setting) { - - if (!main || !setting) return F_status_set_error(F_parameter); - - fss_embedded_list_write_setting_delete(setting); - - return F_none; - } -#endif // _di_fss_embedded_list_write_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_write/c/common.h b/level_3/fss_embedded_list_write/c/common.h deleted file mode 100644 index c744f98..0000000 --- a/level_3/fss_embedded_list_write/c/common.h +++ /dev/null @@ -1,348 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Embedded List Write - * 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_write_common_h -#define _fss_embedded_list_write_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * The program version. - */ -#ifndef _di_fss_embedded_list_write_program_version_s_ - #define FSS_EMBEDDED_LIST_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_EMBEDDED_LIST_WRITE_program_version_minor_s F_string_ascii_7_s - #define FSS_EMBEDDED_LIST_WRITE_program_version_micro_s F_string_ascii_0_s - - #define FSS_EMBEDDED_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_EMBEDDED_LIST_WRITE_program_version_minor_s_length F_string_ascii_7_s_length - #define FSS_EMBEDDED_LIST_WRITE_program_version_micro_s_length F_string_ascii_0_s_length - - #if !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length)) - #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s - #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length)) - #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_s - #define FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length)) - - #define FSS_EMBEDDED_LIST_WRITE_program_version_s FSS_EMBEDDED_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_EMBEDDED_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EMBEDDED_LIST_WRITE_program_version_micro_s FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s FSS_EMBEDDED_LIST_WRITE_program_version_nano_s - - #define FSS_EMBEDDED_LIST_WRITE_program_version_s_length FSS_EMBEDDED_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_micro_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_nano_prefix_s_length + FSS_EMBEDDED_LIST_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_embedded_list_write_program_version_s; -#endif // _di_fss_embedded_list_write_program_version_s_ - -/** - * The program name. - */ -#ifndef _di_fss_embedded_list_write_program_name_s_ - #define FSS_EMBEDDED_LIST_WRITE_program_name_s "fss_embedded_list_write" - #define FSS_EMBEDDED_LIST_WRITE_program_name_long_s "FSS Embedded List Write" - - #define FSS_EMBEDDED_LIST_WRITE_program_name_s_length 23 - #define FSS_EMBEDDED_LIST_WRITE_program_name_long_s_length 23 - - extern const f_string_static_t fss_embedded_list_write_program_name_s; - extern const f_string_static_t fss_embedded_list_write_program_name_long_s; -#endif // _di_fss_embedded_list_write_program_name_s_ - -/** - * The program defines. - */ -#ifndef _di_fss_embedded_list_write_d_ - #define fss_embedded_list_write_signal_check_d 20000 -#endif // _di_fss_embedded_list_write_d_ - -/** - * The program pipe strings. - * - * fss_embedded_list_write_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_write_pipe_s_ - #define FSS_EMBEDDED_LIST_WRITE_pipe_name_s "(pipe)" - - #define FSS_EMBEDDED_LIST_WRITE_pipe_content_end_s "\f" - #define FSS_EMBEDDED_LIST_WRITE_pipe_content_ignore_s "\v" - #define FSS_EMBEDDED_LIST_WRITE_pipe_content_start_s "\b" - - #define FSS_EMBEDDED_LIST_WRITE_pipe_name_s_length 6 - - #define FSS_EMBEDDED_LIST_WRITE_pipe_content_end_s_length 1 - #define FSS_EMBEDDED_LIST_WRITE_pipe_content_ignore_s_length 1 - #define FSS_EMBEDDED_LIST_WRITE_pipe_content_start_s_length 1 - - extern const f_string_static_t fss_embedded_list_write_pipe_name_s; - - extern const f_string_static_t fss_embedded_list_write_pipe_content_end_s; - extern const f_string_static_t fss_embedded_list_write_pipe_content_ignore_s; - extern const f_string_static_t fss_embedded_list_write_pipe_content_start_s; -#endif // _di_fss_embedded_list_write_pipe_s_ - -/** - * The main program parameters. - */ -#ifndef _di_fss_embedded_list_write_parameter_d_ - #define FSS_EMBEDDED_LIST_WRITE_short_file_s "f" - #define FSS_EMBEDDED_LIST_WRITE_short_content_s "c" - #define FSS_EMBEDDED_LIST_WRITE_short_double_s "d" - #define FSS_EMBEDDED_LIST_WRITE_short_ignore_s "I" - #define FSS_EMBEDDED_LIST_WRITE_short_object_s "o" - #define FSS_EMBEDDED_LIST_WRITE_short_partial_s "p" - #define FSS_EMBEDDED_LIST_WRITE_short_prepend_s "P" - #define FSS_EMBEDDED_LIST_WRITE_short_single_s "s" - #define FSS_EMBEDDED_LIST_WRITE_short_trim_s "T" - - #define FSS_EMBEDDED_LIST_WRITE_long_file_s "file" - #define FSS_EMBEDDED_LIST_WRITE_long_content_s "content" - #define FSS_EMBEDDED_LIST_WRITE_long_double_s "double" - #define FSS_EMBEDDED_LIST_WRITE_long_ignore_s "ignore" - #define FSS_EMBEDDED_LIST_WRITE_long_object_s "object" - #define FSS_EMBEDDED_LIST_WRITE_long_partial_s "partial" - #define FSS_EMBEDDED_LIST_WRITE_long_prepend_s "prepend" - #define FSS_EMBEDDED_LIST_WRITE_long_single_s "single" - #define FSS_EMBEDDED_LIST_WRITE_long_trim_s "trim" - - #define FSS_EMBEDDED_LIST_WRITE_short_file_s_length 1 - #define FSS_EMBEDDED_LIST_WRITE_short_content_s_length 1 - #define FSS_EMBEDDED_LIST_WRITE_short_double_s_length 1 - #define FSS_EMBEDDED_LIST_WRITE_short_ignore_s_length 1 - #define FSS_EMBEDDED_LIST_WRITE_short_object_s_length 1 - #define FSS_EMBEDDED_LIST_WRITE_short_partial_s_length 1 - #define FSS_EMBEDDED_LIST_WRITE_short_prepend_s_length 1 - #define FSS_EMBEDDED_LIST_WRITE_short_single_s_length 1 - #define FSS_EMBEDDED_LIST_WRITE_short_trim_s_length 1 - - #define FSS_EMBEDDED_LIST_WRITE_long_file_s_length 4 - #define FSS_EMBEDDED_LIST_WRITE_long_content_s_length 7 - #define FSS_EMBEDDED_LIST_WRITE_long_double_s_length 6 - #define FSS_EMBEDDED_LIST_WRITE_long_ignore_s_length 6 - #define FSS_EMBEDDED_LIST_WRITE_long_object_s_length 6 - #define FSS_EMBEDDED_LIST_WRITE_long_partial_s_length 7 - #define FSS_EMBEDDED_LIST_WRITE_long_prepend_s_length 7 - #define FSS_EMBEDDED_LIST_WRITE_long_single_s_length 6 - #define FSS_EMBEDDED_LIST_WRITE_long_trim_s_length 4 - - extern const f_string_static_t fss_embedded_list_write_short_file_s; - extern const f_string_static_t fss_embedded_list_write_short_content_s; - extern const f_string_static_t fss_embedded_list_write_short_double_s; - extern const f_string_static_t fss_embedded_list_write_short_ignore_s; - extern const f_string_static_t fss_embedded_list_write_short_object_s; - extern const f_string_static_t fss_embedded_list_write_short_partial_s; - extern const f_string_static_t fss_embedded_list_write_short_prepend_s; - extern const f_string_static_t fss_embedded_list_write_short_single_s; - extern const f_string_static_t fss_embedded_list_write_short_trim_s; - - extern const f_string_static_t fss_embedded_list_write_long_file_s; - extern const f_string_static_t fss_embedded_list_write_long_content_s; - extern const f_string_static_t fss_embedded_list_write_long_double_s; - extern const f_string_static_t fss_embedded_list_write_long_ignore_s; - extern const f_string_static_t fss_embedded_list_write_long_object_s; - extern const f_string_static_t fss_embedded_list_write_long_partial_s; - extern const f_string_static_t fss_embedded_list_write_long_prepend_s; - extern const f_string_static_t fss_embedded_list_write_long_single_s; - extern const f_string_static_t fss_embedded_list_write_long_trim_s; - - enum { - fss_embedded_list_write_parameter_help_e, - fss_embedded_list_write_parameter_light_e, - fss_embedded_list_write_parameter_dark_e, - fss_embedded_list_write_parameter_no_color_e, - fss_embedded_list_write_parameter_verbosity_quiet_e, - fss_embedded_list_write_parameter_verbosity_error_e, - fss_embedded_list_write_parameter_verbosity_normal_e, - fss_embedded_list_write_parameter_verbosity_verbose_e, - fss_embedded_list_write_parameter_verbosity_debug_e, - fss_embedded_list_write_parameter_version_e, - fss_embedded_list_write_parameter_line_first_no_e, - fss_embedded_list_write_parameter_line_last_no_e, - - fss_embedded_list_write_parameter_file_e, - fss_embedded_list_write_parameter_content_e, - fss_embedded_list_write_parameter_double_e, - fss_embedded_list_write_parameter_ignore_e, - fss_embedded_list_write_parameter_object_e, - fss_embedded_list_write_parameter_partial_e, - fss_embedded_list_write_parameter_prepend_e, - fss_embedded_list_write_parameter_single_e, - fss_embedded_list_write_parameter_trim_e, - }; // enum - - #define fss_embedded_list_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ - \ - macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_file_s.string, fss_embedded_list_write_long_file_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_content_s.string, fss_embedded_list_write_long_content_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_double_s.string, fss_embedded_list_write_long_double_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_ignore_s.string, fss_embedded_list_write_long_ignore_s.string, 0, 2, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_object_s.string, fss_embedded_list_write_long_object_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_partial_s.string, fss_embedded_list_write_long_partial_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_prepend_s.string, fss_embedded_list_write_long_prepend_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_single_s.string, fss_embedded_list_write_long_single_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_trim_s.string, fss_embedded_list_write_long_trim_s.string, 0, 0, f_console_flag_normal_e), \ - } - - #define fss_embedded_list_write_total_parameters_d 21 -#endif // _di_fss_embedded_list_write_parameter_d_ - -/** - * Flags used to represent flags passed to the main function. - * - * fss_embedded_list_write_main_flag_*_e: - * - none: No modes in use. - * - file_from: Using a specified source file. - * - file_to: Using a specified destination file. - * - help: Print help. - * - header: Enable printing of headers. - * - separate: Enable printing of separators. - * - strip_invalid: Using strip invalid character mode. - * - verify: Using verify mode. - * - version: Print version. - */ -#ifndef _di_fss_embedded_list_write_main_flag_e_ - enum { - fss_embedded_list_write_main_flag_none_e = 0x0, - fss_embedded_list_write_main_flag_file_from_e = 0x1, - fss_embedded_list_write_main_flag_file_to_e = 0x2, - fss_embedded_list_write_main_flag_header_e = 0x4, - fss_embedded_list_write_main_flag_help_e = 0x8, - fss_embedded_list_write_main_flag_separate_e = 0x10, - fss_embedded_list_write_main_flag_strip_invalid_e = 0x20, - fss_embedded_list_write_main_flag_verify_e = 0x40, - fss_embedded_list_write_main_flag_version_e = 0x80, - }; // enum -#endif // _di_fss_embedded_list_write_main_flag_e_ - -/** - * The fss embedded list write 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. - * - * status: The main status code, generally used by the load settings and main functions. - * - * line_first: A string expected to represent either "\n" or NULL to allow for easy handling of when to print first new line or not. - * line_last: A string expected to represent either "\n" or NULL to allow for easy handling of when to print last new line or not. - */ -#ifndef _di_fss_embedded_list_write_setting_t_ - typedef struct { - uint16_t flag; - - f_status_t status; - - f_string_static_t line_first; - f_string_static_t line_last; - } fss_embedded_list_write_setting_t; - - #define fss_embedded_list_write_setting_t_initialize \ - { \ - fss_embedded_list_write_main_flag_none_e, \ - F_none, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ - } -#endif // _di_fss_embedded_list_write_setting_t_ - -/** - * Delete the program main setting data. - * - * @param setting - * The program main setting data. - * - * This does not alter setting.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fss_embedded_list_write_setting_delete_ - extern f_status_t fss_embedded_list_write_setting_delete(fss_embedded_list_write_setting_t * const setting); -#endif // _di_fss_embedded_list_write_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 retuns 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.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_write_setting_load_ - extern void fss_embedded_list_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_write_setting_t * const setting); -#endif // _di_fss_embedded_list_write_setting_load_ - -/** - * Perform the standard program setting unload process. - * - * @param main - * The main program data. - * @param setting - * The main program settings. - * All buffers are deallocated. - * - * This does not alter setting.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: utf8_setting_delete(). - * - * @see utf8_setting_delete() - */ -#ifndef _di_fss_embedded_list_write_setting_unload_ - extern f_status_t fss_embedded_list_write_setting_unload(fll_program_data_t * const main, fss_embedded_list_write_setting_t * const setting); -#endif // _di_fss_embedded_list_write_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_embedded_list_write_common_h diff --git a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c deleted file mode 100644 index 942d2e4..0000000 --- a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c +++ /dev/null @@ -1,467 +0,0 @@ -#include "fss_embedded_list_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_embedded_list_write_main_ - f_status_t fss_embedded_list_write_main(fll_program_data_t * const main, fss_embedded_list_write_setting_t * const setting) { - - f_status_t status = F_none; - - setting->flag = 0; - - // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); - if (F_status_is_error(setting->status)) return; - - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_embedded_list_write_parameter_no_color_e, fss_embedded_list_write_parameter_light_e, fss_embedded_list_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(status)) { - fss_embedded_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true); - fss_embedded_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_embedded_list_write_parameter_verbosity_quiet_e, fss_embedded_list_write_parameter_verbosity_error_e, fss_embedded_list_write_parameter_verbosity_verbose_e, fss_embedded_list_write_parameter_verbosity_debug_e, fss_embedded_list_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); - - if (F_status_is_error(status)) { - fss_embedded_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true); - fss_embedded_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - } - - f_string_static_t * const argv = main->parameters.arguments.array; - - status = F_none; - - if (main->parameters.array[fss_embedded_list_write_parameter_help_e].result & f_console_result_found_e) { - fss_embedded_list_write_print_help(setting, main->message); - - return status; - } - - if (main->parameters.array[fss_embedded_list_write_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, fss_embedded_list_write_program_version_s); - - return status; - } - - f_file_t output = f_file_t_initialize; - - output.id = F_type_descriptor_output_d; - output.stream = F_type_output_d; - output.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_embedded_list_write_parameter_file_e].result & f_console_result_value_e) { - if (main->parameters.array[fss_embedded_list_write_parameter_file_e].values.used > 1) { - if (main->error.verbosity > f_console_verbosity_quiet_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_write_long_file_s, main->error.notable); - fl_print_format("%[' may only be specified once.%]%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 { - const f_array_length_t index = main->parameters.array[fss_embedded_list_write_parameter_file_e].values.array[0]; - - output.id = -1; - output.stream = 0; - status = f_file_stream_open(argv[index], f_string_empty_s, &output); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e); - } - } - } - else if (main->parameters.array[fss_embedded_list_write_parameter_file_e].result & f_console_result_found_e) { - fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_embedded_list_write_long_file_s); - status = F_status_set_error(F_parameter); - } - } - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_embedded_list_write_parameter_object_e].locations.used || main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_embedded_list_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_embedded_list_write_parameter_object_e].locations.used != main->parameters.array[fss_embedded_list_write_parameter_object_e].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_embedded_list_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used != main->parameters.array[fss_embedded_list_write_parameter_content_e].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_embedded_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_embedded_list_write_parameter_object_e].locations.used != main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used && !(main->parameters.array[fss_embedded_list_write_parameter_partial_e].result & f_console_result_found_e)) { - fss_embedded_list_write_error_parameter_same_times_print(main); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used && main->parameters.array[fss_embedded_list_write_parameter_partial_e].locations.used) { - if (main->parameters.array[fss_embedded_list_write_parameter_content_e].result & f_console_result_value_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter only allows either the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter or the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter, but not both.%]%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)) { - if (main->parameters.array[fss_embedded_list_write_parameter_content_e].result & f_console_result_value_e) { - f_array_length_t location_object = 0; - f_array_length_t location_content = 0; - f_array_length_t location_sub_object = 0; - f_array_length_t location_sub_content = 0; - - for (f_array_length_t i = 0; i < main->parameters.array[fss_embedded_list_write_parameter_object_e].locations.used; ++i) { - location_object = main->parameters.array[fss_embedded_list_write_parameter_object_e].locations.array[i]; - location_content = main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.array[i]; - location_sub_object = main->parameters.array[fss_embedded_list_write_parameter_object_e].locations_sub.array[i]; - location_sub_content = main->parameters.array[fss_embedded_list_write_parameter_content_e].locations_sub.array[i]; - - if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QEach '%]", 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_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter must be specified before a '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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); - - break; - } - } // for - } - } - } - else if (main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used != main->parameters.array[fss_embedded_list_write_parameter_content_e].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_embedded_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_embedded_list_write_parameter_partial_e].locations.used) { - fss_embedded_list_write_error_parameter_same_times_print(main); - status = F_status_set_error(F_parameter); - } - } - } - else if (!(main->pipe & fll_program_data_pipe_input_e)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", 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_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter with the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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)) { - if (main->parameters.array[fss_embedded_list_write_parameter_partial_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThis '%]", 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_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter cannot be used when processing a pipe.%]%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)) { - if (main->parameters.array[fss_embedded_list_write_parameter_prepend_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_write_long_prepend_s, main->error.notable); - fl_print_format("%[' is specified, but no value is given.%]%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_write_parameter_prepend_e].result & f_console_result_value_e) { - const f_array_length_t index = main->parameters.array[fss_embedded_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_embedded_list_write_parameter_prepend_e].values.used - 1]; - - if (argv[index].used) { - f_string_range_t range = macro_f_string_range_t_initialize2(argv[index].used); - f_state_t state = f_state_t_initialize; - - for (; range.start < argv[index].used; ++range.start) { - - status = f_fss_is_space(state, argv[index], range); - if (F_status_is_error(status)) break; - - if (status == F_false) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - 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_write_long_prepend_s, main->error.notable); - fl_print_format("%[' must only contain white space.%]%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); - - break; - } - } // for - } - else { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - 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_write_long_prepend_s, main->error.notable); - fl_print_format("%[' must not be an empty 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)) { - if (main->parameters.array[fss_embedded_list_write_parameter_ignore_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_write_long_ignore_s, main->error.notable); - fl_print_format("%[' was specified, but no values were given.%]%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_write_parameter_ignore_e].result & f_console_result_value_e) { - const f_array_length_t total_locations = main->parameters.array[fss_embedded_list_write_parameter_ignore_e].locations.used; - const f_array_length_t total_arguments = main->parameters.array[fss_embedded_list_write_parameter_ignore_e].values.used; - - if (total_locations * 2 > total_arguments) { - 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_write_long_ignore_s, main->error.notable); - fl_print_format("%[' requires two values.%]%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); - } - } - } - - uint8_t quote = f_fss_quote_double_s; - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_embedded_list_write_parameter_double_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_embedded_list_write_parameter_single_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_embedded_list_write_parameter_double_e].location < main->parameters.array[fss_embedded_list_write_parameter_single_e].location) { - quote = f_fss_quote_single_s; - } - } - } - else if (main->parameters.array[fss_embedded_list_write_parameter_single_e].result & f_console_result_found_e) { - quote = f_fss_quote_single_s; - } - } - - f_string_dynamic_t buffer = f_string_dynamic_t_initialize; - - if (F_status_is_error_not(status)) { - f_string_ranges_t ignore = f_string_ranges_t_initialize; - - if (main->pipe & fll_program_data_pipe_input_e) { - status = fss_embedded_list_write_process_pipe(main, output, quote, &buffer, &ignore); - - if (F_status_is_error(status) && F_status_set_fine(status) != F_interrupt) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); - fl_print_format("%['.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } - } - - ignore.used = 0; - } - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_embedded_list_write_parameter_partial_e].result & f_console_result_found_e) { - - if (main->parameters.array[fss_embedded_list_write_parameter_object_e].result & f_console_result_value_e) { - for (f_array_length_t i = 0; i < main->parameters.array[fss_embedded_list_write_parameter_object_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_embedded_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - status = fss_embedded_list_write_process(main, output, quote, &argv[main->parameters.array[fss_embedded_list_write_parameter_object_e].values.array[i]], 0, 0, &buffer); - if (F_status_is_error(status)) break; - } // for - } - else { - for (f_array_length_t i = 0; i < main->parameters.array[fss_embedded_list_write_parameter_content_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_embedded_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - status = fss_embedded_list_write_process_parameter_ignore(main, main->parameters.array[fss_embedded_list_write_parameter_content_e].locations, i, &ignore); - if (F_status_is_error(status)) break; - - status = fss_embedded_list_write_process(main, output, quote, 0, &argv[main->parameters.array[fss_embedded_list_write_parameter_content_e].values.array[i]], &ignore, &buffer); - if (F_status_is_error(status)) break; - } // for - } - } - else { - for (f_array_length_t i = 0; i < main->parameters.array[fss_embedded_list_write_parameter_object_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_embedded_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - status = fss_embedded_list_write_process_parameter_ignore(main, main->parameters.array[fss_embedded_list_write_parameter_content_e].locations, i, &ignore); - if (F_status_is_error(status)) break; - - status = fss_embedded_list_write_process(main, output, quote, &argv[main->parameters.array[fss_embedded_list_write_parameter_object_e].values.array[i]], &argv[main->parameters.array[fss_embedded_list_write_parameter_content_e].values.array[i]], &ignore, &buffer); - if (F_status_is_error(status)) break; - } // for - } - - if (F_status_is_error(status)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); - fl_print_format("%['.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } - } - else if (main->error.verbosity > f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && !(main->parameters.array[fss_embedded_list_write_parameter_file_e].result & f_console_result_found_e)) { - - // Ensure there is always a newline at the end, unless in quiet mode. - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } - } - - macro_f_string_ranges_t_delete_simple(ignore); - } - - if (main->parameters.array[fss_embedded_list_write_parameter_file_e].result & f_console_result_value_e) { - f_file_stream_flush(output); - f_file_stream_close(&output); - } - - // Ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (main->error.verbosity > f_console_verbosity_quiet_e) { - if (F_status_is_error(status)) { - fll_print_dynamic_raw(f_string_eol_s, main->error.to); - } - } - - f_string_dynamic_resize(0, &buffer); - - return status; - } -#endif // _di_fss_embedded_list_write_main_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h deleted file mode 100644 index 8f10b92..0000000 --- a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.h +++ /dev/null @@ -1,82 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * This program provides FSS-0008 Embedded List write functionality. - */ -#ifndef _fss_embedded_list_write_h -#define _fss_embedded_list_write_h - -// Libc includes. -#include -#include -#include -#include - -// FLL-0 includes. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// FLL-1 includes. -#include -#include -#include -#include - -// FLL-2 includes. -#include -#include -#include - -// FSS Embedded List Write includes. -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Execute main program. - * - * Be sure to call fss_embedded_list_write_main_delete() after executing this. - * - * 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 arguments - * The parameters passed to the process. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - */ -#ifndef _di_fss_embedded_list_write_main_ - extern f_status_t fss_embedded_list_write_main(fll_program_data_t * const main, fss_embedded_list_write_setting_t * const setting); -#endif // _di_fss_embedded_list_write_main_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_embedded_list_write_h diff --git a/level_3/fss_embedded_list_write/c/main.c b/level_3/fss_embedded_list_write/c/main.c deleted file mode 100644 index 501e052..0000000 --- a/level_3/fss_embedded_list_write/c/main.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "fss_embedded_list_write.h" - -int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - - fll_program_data_t data = fll_program_data_t_initialize; - fss_extended_list_write_setting_t setting = fss_extended_list_write_setting_t_initialize; - - f_console_parameter_t parameters[] = fss_embedded_list_write_console_parameter_t_initialize; - data.parameters.array = parameters; - data.parameters.used = fss_embedded_list_write_total_parameters_d; - data.environment = envp; - - if (f_pipe_input_exists()) { - data.pipe = fll_program_data_pipe_input_e; - } - - fll_program_standard_set_up(&data); - - { - const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - - fss_embedded_list_write_setting_load(arguments, &data, &setting); - } - - fss_embedded_list_write_main(&data, &setting); - - fss_embedded_list_write_setting_unload(&data, &setting); - - fll_program_data_delete(&data); - - fll_program_standard_set_down(&data); - - return F_status_is_error(status) ? 1 : 0; -} diff --git a/level_3/fss_embedded_list_write/c/print.c b/level_3/fss_embedded_list_write/c/print.c deleted file mode 100644 index 5cdcd1e..0000000 --- a/level_3/fss_embedded_list_write/c/print.c +++ /dev/null @@ -1,125 +0,0 @@ -#include "fss_embedded_list_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_embedded_list_write_print_help_ - f_status_t fss_embedded_list_write_print_help(fss_embedded_list_write_setting_t * const setting, const fl_print_t print) { - - f_file_stream_lock(print.to); - - f_print_dynamic_raw(setting->line_first, print.to); - - fll_program_print_help_header(print, fss_embedded_list_write_program_name_long_s, fss_embedded_list_write_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_write_short_file_s, fss_embedded_list_write_long_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a file to send data to."); - fll_program_print_help_option(print, fss_embedded_list_write_short_content_s, fss_embedded_list_write_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The Content to write."); - fll_program_print_help_option(print, fss_embedded_list_write_short_double_s, fss_embedded_list_write_long_double_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use double quotes (default)."); - fll_program_print_help_option(print, fss_embedded_list_write_short_ignore_s, fss_embedded_list_write_long_ignore_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Ignore a given range within a Content."); - fll_program_print_help_option(print, fss_embedded_list_write_short_object_s, fss_embedded_list_write_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The Object to write."); - fll_program_print_help_option(print, fss_embedded_list_write_short_partial_s, fss_embedded_list_write_long_partial_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Do not write end of Object/Content character."); - fll_program_print_help_option(print, fss_embedded_list_write_short_prepend_s, fss_embedded_list_write_long_prepend_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Prepend the given white space characters to the start of each multi-line Content."); - fll_program_print_help_option(print, fss_embedded_list_write_short_single_s, fss_embedded_list_write_long_single_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use single quotes."); - fll_program_print_help_option(print, fss_embedded_list_write_short_trim_s, fss_embedded_list_write_long_trim_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Trim Object names."); - - 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_write_program_name_s, f_string_empty_s); - - fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The pipe uses the Form Feed character '%[\\f%]' (%[U+000C%]) to designate the end of the last Content.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The pipe uses the Vertical Line character '%[\\v%]' (%[U+000B%]) is used to ignore a Content range (use this both before and after the range).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable); - fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The FSS-0008 (Embedded List) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_single_s, print.set->notable); - fl_print_format(" and '%[%r%r%]' do nothing.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_double_s, print.set->notable, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The parameter '%[%r%r%]' designates to not escape any valid nested Object or Content within some Content.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_ignore_s, print.set->notable, f_string_eol_s); - fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s); - fl_print_format(" This parameter is not used for ignoring anything from the input pipe.%r", print.to, f_string_eol_s); - fl_print_format(" This parameter must be specified after a '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_content_s, print.set->notable); - fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_content_s, print.set->notable, f_string_eol_s); - - f_print_dynamic_raw(setting->line_last, print.to); - - f_file_stream_flush(print.to); - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fss_embedded_list_write_print_help_ - -#ifndef _di_fss_embedded_list_write_print_line_first_locked_ - f_status_t fss_embedded_list_write_print_line_first_locked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_embedded_list_write_print_line_first_locked_ - -#ifndef _di_fss_embedded_list_write_print_line_first_unlocked_ - f_status_t fss_embedded_list_write_print_line_first_unlocked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_embedded_list_write_print_line_first_unlocked_ - -#ifndef _di_fss_embedded_list_write_print_line_last_locked_ - f_status_t fss_embedded_list_write_print_line_last_locked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - if (setting->flag & (fss_embedded_list_write_main_flag_verify_e | fss_embedded_list_write_main_flag_file_to_e)) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_embedded_list_write_print_line_last_locked_ - -#ifndef _di_fss_embedded_list_write_print_line_last_unlocked_ - f_status_t fss_embedded_list_write_print_line_last_unlocked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - if (setting->flag & (fss_embedded_list_write_main_flag_verify_e | fss_embedded_list_write_main_flag_file_to_e)) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_embedded_list_write_print_line_last_unlocked_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_write/c/print.h b/level_3/fss_embedded_list_write/c/print.h deleted file mode 100644 index 0e0e1cd..0000000 --- a/level_3/fss_embedded_list_write/c/print.h +++ /dev/null @@ -1,124 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: UTF-8 - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _fss_embedded_list_write_print_h -#define _fss_embedded_list_write_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print help. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * - * @return - * F_none on success. - */ -#ifndef _di_fss_embedded_list_write_print_help_ - extern f_status_t fss_embedded_list_write_print_help(fss_embedded_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_embedded_list_write_print_help_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_embedded_list_write_print_line_first_locked_ - extern f_status_t fss_embedded_list_write_print_line_first_locked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_embedded_list_write_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_embedded_list_write_print_line_first_unlocked_ - extern f_status_t fss_embedded_list_write_print_line_first_unlocked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_embedded_list_write_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_embedded_list_write_print_line_last_locked_ - extern f_status_t fss_embedded_list_write_print_line_last_locked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_embedded_list_write_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_embedded_list_write_print_line_last_unlocked_ - extern f_status_t fss_embedded_list_write_print_line_last_unlocked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_embedded_list_write_print_line_last_unlocked_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_embedded_list_write_print_h diff --git a/level_3/fss_embedded_list_write/c/private-common.c b/level_3/fss_embedded_list_write/c/private-common.c deleted file mode 100644 index 16c4cbb..0000000 --- a/level_3/fss_embedded_list_write/c/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_embedded_list_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_write/c/private-common.h b/level_3/fss_embedded_list_write/c/private-common.h deleted file mode 100644 index 85df5d0..0000000 --- a/level_3/fss_embedded_list_write/c/private-common.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Embedded List Write - * 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_write_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. - */ -#ifndef _di_fss_embedded_list_write_common_ - #define fss_embedded_list_write_common_allocation_large_d 2048 - #define fss_embedded_list_write_common_allocation_small_d 128 -#endif // _di_fss_embedded_list_write_common_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_common_h diff --git a/level_3/fss_embedded_list_write/c/private-write.c b/level_3/fss_embedded_list_write/c/private-write.c deleted file mode 100644 index 77f40b7..0000000 --- a/level_3/fss_embedded_list_write/c/private-write.c +++ /dev/null @@ -1,472 +0,0 @@ -#include "fss_embedded_list_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_embedded_list_write_error_parameter_same_times_print_ - void fss_embedded_list_write_error_parameter_same_times_print(fll_program_data_t * const main) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) { - return; - } - - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QMust specify the '%]", 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_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_embedded_list_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_embedded_list_write_error_parameter_same_times_print_ - -#ifndef _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ - void fss_embedded_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) { - return; - } - - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe FSS-0008 (Embedded List) standard does not support end of line character '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[\\n%]", main->error.to, main->error.notable, main->error.notable); - fl_print_format("%[' (%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[U+000A%]", main->error.to, main->error.notable, main->error.notable); - fl_print_format("%[) in objects.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ - -#ifndef _di_fss_embedded_list_write_error_parameter_value_missing_print_ - void fss_embedded_list_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) { - return; - } - - 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, symbol, parameter, main->error.notable); - fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_embedded_list_write_error_parameter_value_missing_print_ - -#ifndef _di_fss_embedded_list_write_process_ - f_status_t fss_embedded_list_write_process(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) { - - f_status_t status = F_none; - f_state_t state = macro_f_state_t_initialize(fss_embedded_list_write_common_allocation_large_d, fss_embedded_list_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); - f_string_range_t range = f_string_range_t_initialize; - - if (object) { - uint8_t complete = f_fss_complete_none_e; - - if (object->used) { - range.start = 0; - range.stop = object->used - 1; - } - else { - range.start = 1; - range.stop = 0; - } - - if (content) { - if (main->parameters.array[fss_embedded_list_write_parameter_trim_e].result & f_console_result_found_e) { - complete = f_fss_complete_full_trim_e; - } - else { - complete = f_fss_complete_full_e; - } - } - - status = fl_fss_embedded_list_object_write(*object, complete, state, &range, buffer); - - if (F_status_set_fine(status) == F_none_eol) { - fss_embedded_list_write_error_parameter_unsupported_eol_print(main); - - return F_status_set_error(F_support_not); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fl_fss_embedded_list_object_write", F_true); - - return status; - } - } - - if (content && content->used) { - range.start = 0; - range.stop = content->used - 1; - - f_string_static_t *prepend = 0; - - if (main->parameters.array[fss_embedded_list_write_parameter_prepend_e].result & f_console_result_value_e) { - const f_array_length_t index = main->parameters.array[fss_embedded_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_embedded_list_write_parameter_prepend_e].values.used - 1]; - - prepend = &main->parameters.arguments.array[index]; - } - - status = fl_fss_embedded_list_content_write(*content, object ? f_fss_complete_full_e : f_fss_complete_none_e, prepend, ignore, state, &range, buffer); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fl_fss_embedded_list_content_write", F_true); - - return status; - } - } - - if (!object || !content) { - status = f_string_dynamic_append(f_string_eol_s, buffer); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); - - return status; - } - } - - fll_print_dynamic(*buffer, output); - - buffer->used = 0; - - return status; - } -#endif // _di_fss_embedded_list_write_process_ - -#ifndef _di_fss_embedded_list_write_process_pipe_ - f_status_t fss_embedded_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) { - - f_status_t status = F_none; - f_status_t status_pipe = F_none; - - f_file_t input = f_file_t_initialize; - - input.id = F_type_descriptor_input_d; - input.size_read = 2048; - - f_array_length_t total = 0; - - f_string_range_t range = f_string_range_t_initialize; - f_string_range_t range_ignore = f_string_range_t_initialize; - - f_string_dynamic_t block = f_string_dynamic_t_initialize; - f_string_dynamic_t object = f_string_dynamic_t_initialize; - f_string_dynamic_t content = f_string_dynamic_t_initialize; - - // 0x0 = start new object/content set, 0x1 = processing object, 0x2 = processing content, 0x3 = end object/content set. - uint8_t state = 0; - - for (;;) { - - if (!((++main->signal_check) % fss_embedded_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - f_string_dynamic_resize(0, &block); - f_string_dynamic_resize(0, &object); - f_string_dynamic_resize(0, &content); - - return F_status_set_error(F_interrupt); - } - - main->signal_check = 0; - } - - if (range.start > range.stop) { - if (status_pipe == F_none_eof) break; - - block.used = 0; - - status_pipe = f_file_read_block(input, &block); - - if (F_status_is_error(status_pipe)) { - fll_error_print(main->error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); - - status_pipe = F_status_set_error(F_pipe); - - break; - } - - if (!block.used) break; - - range.start = 0; - range.stop = block.used - 1; - } - - if (!state || state == 0x1) { - if (!state) { - object.used = 0; - content.used = 0; - - state = 0x1; - - range_ignore.start = 1; - range_ignore.stop = 0; - } - - if (object.used + block.used > object.size) { - status = f_string_dynamic_increase_by(block.used, &object); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); - - break; - } - } - - for (; range.start <= range.stop; ++range.start) { - - if (block.string[range.start] == fss_embedded_list_write_pipe_content_start_s.string[0]) { - state = 0x2; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_embedded_list_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_embedded_list_write_pipe_content_ignore_s.string[0]) { - // This is not used by objects. - continue; - } - - object.string[object.used++] = block.string[range.start]; - } // for - - if (F_status_is_error(status)) break; - - // If the start of content was not found, then fetch the next block. - if (state == 0x1) continue; - - // If the end of the current block is reached, fetch the next block. - if (range.start > range.stop) continue; - } - - if (state == 0x2) { - if (range.start <= range.stop) { - total = (range.stop - range.start) + 1; - } - else { - total = 0; - } - - if (total) { - status = f_string_dynamic_increase_by(total, &content); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); - - break; - } - - for (; range.start <= range.stop; ++range.start) { - - if (block.string[range.start] == fss_embedded_list_write_pipe_content_start_s.string[0]) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_format("%r%[%QThe FSS-0008 (Embedded List) standard only supports one content per object.%]%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_support_not); - - break; - } - - if (block.string[range.start] == fss_embedded_list_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_embedded_list_write_pipe_content_ignore_s.string[0]) { - if (ignore) { - if (range_ignore.start > range_ignore.stop) { - range_ignore.start = content.used; - range_ignore.stop = content.used; - } - else { - if (ignore->used + 1 > ignore->size) { - if (ignore->size + F_fss_default_allocation_step_d > F_array_length_t_size_d) { - if (ignore->size + 1 > F_array_length_t_size_d) { - fll_error_print(main->error, F_string_too_large, "fss_embedded_list_write_process_pipe", F_true); - - status = F_status_set_error(F_string_too_large); - - break; - } - - macro_f_string_ranges_t_resize(status, (*ignore), ignore->size + 1); - } - else { - macro_f_string_ranges_t_resize(status, (*ignore), ignore->size + F_fss_default_allocation_step_d); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_string_too_large, "fss_embedded_list_write_process_pipe", F_true); - - break; - } - } - - ignore->array[ignore->used].start = range_ignore.start; - ignore->array[ignore->used++].stop = content.used - 1; - - range_ignore.start = 1; - range_ignore.stop = 0; - } - } - - continue; - } - - content.string[content.used++] = block.string[range.start]; - } // for - - if (F_status_is_error(status)) break; - } - else { - state = 0x3; - } - } - - if (state == 0x3) { - status = fss_embedded_list_write_process(main, output, quote, &object, &content, ignore, buffer); - if (F_status_is_error(status)) break; - - state = 0; - } - } // for - - // If the pipe ended before finishing, then attempt to wrap up. - if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) { - status = fss_embedded_list_write_process(main, output, quote, &object, &content, ignore, buffer); - } - - f_string_dynamic_resize(0, &block); - f_string_dynamic_resize(0, &object); - f_string_dynamic_resize(0, &content); - - return status; - } -#endif // _di_fss_embedded_list_write_process_pipe_ - -#ifndef _di_fss_embedded_list_write_process_parameter_ignore_ - f_status_t fss_embedded_list_write_process_parameter_ignore(fll_program_data_t * const main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) { - - f_status_t status = F_none; - - f_array_length_t i = 0; - f_array_length_t l = 0; - f_array_length_t index = 0; - - f_string_range_t range = f_string_range_t_initialize; - - f_number_unsigned_t number = 0; - - f_string_static_t * const argv = main->parameters.arguments.array; - - range.start = 0; - - for (; i < main->parameters.array[fss_embedded_list_write_parameter_ignore_e].locations.used; ++i) { - - if (!((++main->signal_check) % fss_embedded_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - return F_status_set_error(F_interrupt); - } - - main->signal_check = 0; - } - - l = main->parameters.array[fss_embedded_list_write_parameter_ignore_e].locations.array[i]; - - if (l < contents.array[location]) continue; - if (location + 1 < contents.used && l > contents.array[location + 1]) continue; - - if (ignore->used + 1 > ignore->size) { - if (ignore->size + F_fss_default_allocation_step_d > F_array_length_t_size_d) { - if (ignore->size + 1 > F_array_length_t_size_d) { - fll_error_print(main->error, F_string_too_large, "fss_embedded_list_write_process_parameter_ignore", F_true); - - return F_status_set_error(F_string_too_large); - } - - macro_f_string_ranges_t_resize(status, (*ignore), ignore->size + 1); - } - else { - macro_f_string_ranges_t_resize(status, (*ignore), ignore->size + F_fss_default_allocation_step_d); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fss_embedded_list_write_process_parameter_ignore", F_true); - - return status; - } - } - - index = main->parameters.array[fss_embedded_list_write_parameter_ignore_e].values.array[i * 2]; - - range.start = 0; - range.stop = argv[index].used - 1; - - // allow and ignore the positive sign. - if (range.stop && argv[index].string[0] == f_string_ascii_plus_s.string[0]) { - range.start = 1; - } - - status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, argv[index], range, &number); - - 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_write_long_ignore_s, argv[index]); - - return status; - } - - ignore->array[ignore->used].start = number; - - index = main->parameters.array[fss_embedded_list_write_parameter_ignore_e].values.array[(i * 2) + 1]; - - range.start = 0; - range.stop = argv[index].used - 1; - - // Allow and ignore the positive sign. - if (range.stop && argv[index].string[0] == f_string_ascii_plus_s.string[0]) { - range.start = 1; - } - - status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, argv[index], range, &number); - - 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_write_long_ignore_s, argv[index]); - - return status; - } - - ignore->array[ignore->used++].stop = number; - } // for - - return F_none; - } -#endif // _di_fss_embedded_list_write_process_parameter_ignore_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_embedded_list_write/c/private-write.h b/level_3/fss_embedded_list_write/c/private-write.h deleted file mode 100644 index bba97f7..0000000 --- a/level_3/fss_embedded_list_write/c/private-write.h +++ /dev/null @@ -1,127 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_write_h -#define _PRIVATE_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print an message about the object and content parameters not being specified the same number of times. - * - * @param main - * The main program data. - */ -#ifndef _di_fss_embedded_list_write_error_parameter_same_times_print_ - void fss_embedded_list_write_error_parameter_same_times_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_write_error_parameter_same_times_print_ - -/** - * Print an error message about a parameter a New Line character '\n' (U+000A) being unsupported. - * - * @param main - * The main program data. - */ -#ifndef _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ - void fss_embedded_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_ - -/** - * Print an error message about a parameter missing a value. - * - * @param main - * The main program data. - * @param symbol - * The console symbol, such as "--" in "--help". - * @param parameter - * The parameter name, such as "help" in "--help". - */ -#ifndef _di_fss_embedded_list_write_error_parameter_value_missing_print_ - void fss_embedded_list_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_write_error_parameter_value_missing_print_ - -/** - * Process a given object and content, printing the FSS if valid or an error if invalid. - * - * @param main - * The main program data. - * @param output - * The file to output to. - * @param quote - * The quote character to use. - * This is either single our double quote. - * @param object - * The object to validate and print. - * Set pointer address to 0 to not use. - * @param content - * The content to escape and print. - * Set pointer address to 0 to not use. - * @param ignore - * An array of ranges within the Content to ignore. - * Set pointer address to 0 to not use. - * @param buffer - * The buffer array used as a cache to construct the output before printing. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_embedded_list_write_process_ - extern f_status_t fss_embedded_list_write_process(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_write_process_ - -/** - * Process the pipe, reading from the pipe and writing to the output. - * - * @param main - * The main program data. - * @param output - * The file to output to. - * @param quote - * The quote character to use. - * This is either single our double quote. - * @param buffer - * The buffer array used as a cache to construct the output before printing. - * @param ignore - * An array of ranges within the Content to ignore. - * Set pointer address to 0 to not use. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_embedded_list_write_process_pipe_ - extern f_status_t fss_embedded_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_write_process_pipe_ - -/** - * Process the ignore parameter associated with a specific content parameter. - * - * @param main - * The main program data. - * @param contents - * The console parameter locations array for the content parameter. - * @param location - * The specific location within the contents locations array. - * @param ignore - * An array of ranges within the Content to ignore. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_embedded_list_write_process_parameter_ignore_ - extern f_status_t fss_embedded_list_write_process_parameter_ignore(fll_program_data_t * const main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; -#endif // _di_fss_embedded_list_write_process_parameter_ignore_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_write_h diff --git a/level_3/fss_embedded_list_write/data/build/defines b/level_3/fss_embedded_list_write/data/build/defines deleted file mode 100644 index c665317..0000000 --- a/level_3/fss_embedded_list_write/data/build/defines +++ /dev/null @@ -1,2 +0,0 @@ -# fss-0000 - diff --git a/level_3/fss_embedded_list_write/data/build/dependencies b/level_3/fss_embedded_list_write/data/build/dependencies deleted file mode 100644 index aa10ae3..0000000 --- a/level_3/fss_embedded_list_write/data/build/dependencies +++ /dev/null @@ -1,27 +0,0 @@ -# fss-0000 - -f_type -f_status -f_memory -f_type_array -f_string -f_utf -f_color -f_console -f_conversion -f_directory -f_environment -f_file -f_fss -f_pipe -f_print -f_signal -fl_conversion -fl_fss -fl_print -fl_string -fll_error -fll_file -fll_fss -fll_print -fll_program diff --git a/level_3/fss_embedded_list_write/data/build/fakefile b/level_3/fss_embedded_list_write/data/build/fakefile deleted file mode 100644 index 5328059..0000000 --- a/level_3/fss_embedded_list_write/data/build/fakefile +++ /dev/null @@ -1,11 +0,0 @@ -# fss-0005 iki-0002 - -settings: - fail exit - modes individual level monolithic clang test - - environment PATH LD_LIBRARY_PATH - -main: - - build diff --git a/level_3/fss_embedded_list_write/data/build/settings b/level_3/fss_embedded_list_write/data/build/settings deleted file mode 100644 index 2359e05..0000000 --- a/level_3/fss_embedded_list_write/data/build/settings +++ /dev/null @@ -1,64 +0,0 @@ -# fss-0001 - -build_name fss_embedded_list_write - -version_major 0 -version_minor 7 -version_micro 0 -version_file micro -version_target minor - -modes individual level monolithic clang test -modes_default monolithic - -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 -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_status_string -lf_string -lf_type_array -lf_utf -build_libraries-level -lfll_2 -lfll_1 -lfll_0 -build_libraries-monolithic -lfll - -build_sources_library fss_embedded_list_write.c common.c print.c private-common.c private-write.c - -build_sources_program main.c -build_sources_headers fss_embedded_list_write.h common.h print.h - -build_script yes -build_shared yes -build_static no - -path_headers program/fss_embedded_list_write -path_library_script script -path_library_shared shared -path_library_static static -path_object_script script -path_object_shared shared -path_object_static static -path_program_script script -path_program_shared shared -path_program_static static - -has_path_standard yes -preserve_path_headers yes - -search_exclusive yes -search_shared yes -search_static yes - -environment PATH LD_LIBRARY_PATH - -#defines -D_di_libcap_ -D_di_thread_support_ -defines -D_libcap_legacy_only_ -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-clang -Wno-logical-op-parentheses -flags-test -O0 -fstack-protector -Wall -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_extended_list_write/c/common.c b/level_3/fss_extended_list_write/c/common.c deleted file mode 100644 index 89d6406..0000000 --- a/level_3/fss_extended_list_write/c/common.c +++ /dev/null @@ -1,173 +0,0 @@ -#include "fss_extended_list_write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_extended_list_write_program_version_s_ - const f_string_static_t fss_extended_list_write_program_version_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_program_version_s, 0, FSS_EXTENDED_LIST_WRITE_program_version_s_length); -#endif // _di_fss_extended_list_write_program_version_s_ - -#ifndef _di_fss_extended_list_write_program_name_s_ - const f_string_static_t fss_extended_list_write_program_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_program_name_s, 0, FSS_EXTENDED_LIST_WRITE_program_name_s_length); - const f_string_static_t fss_extended_list_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_program_name_long_s, 0, FSS_EXTENDED_LIST_WRITE_program_name_long_s_length); -#endif // _di_fss_extended_list_write_program_name_s_ - -#ifndef _di_fss_extended_list_write_pipe_s_ - const f_string_static_t fss_extended_list_write_pipe_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_pipe_name_s, 0, FSS_EXTENDED_LIST_WRITE_pipe_name_s_length); - const f_string_static_t fss_extended_list_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_pipe_content_end_s, 0, FSS_EXTENDED_LIST_WRITE_pipe_content_end_s_length); - const f_string_static_t fss_extended_list_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_pipe_content_ignore_s, 0, FSS_EXTENDED_LIST_WRITE_pipe_content_ignore_s_length); - const f_string_static_t fss_extended_list_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_pipe_content_start_s, 0, FSS_EXTENDED_LIST_WRITE_pipe_content_start_s_length); -#endif // _di_fss_extended_list_write_pipe_s_ - -#ifndef _di_fss_extended_list_write_parameter_d_ - const f_string_static_t fss_extended_list_write_short_file_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_file_s, 0, FSS_EXTENDED_LIST_WRITE_short_file_s_length); - const f_string_static_t fss_extended_list_write_short_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_content_s, 0, FSS_EXTENDED_LIST_WRITE_short_content_s_length); - const f_string_static_t fss_extended_list_write_short_double_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_double_s, 0, FSS_EXTENDED_LIST_WRITE_short_double_s_length); - const f_string_static_t fss_extended_list_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_ignore_s, 0, FSS_EXTENDED_LIST_WRITE_short_ignore_s_length); - const f_string_static_t fss_extended_list_write_short_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_object_s, 0, FSS_EXTENDED_LIST_WRITE_short_object_s_length); - const f_string_static_t fss_extended_list_write_short_partial_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_partial_s, 0, FSS_EXTENDED_LIST_WRITE_short_partial_s_length); - const f_string_static_t fss_extended_list_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_prepend_s, 0, FSS_EXTENDED_LIST_WRITE_short_prepend_s_length); - const f_string_static_t fss_extended_list_write_short_single_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_single_s, 0, FSS_EXTENDED_LIST_WRITE_short_single_s_length); - const f_string_static_t fss_extended_list_write_short_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_short_trim_s, 0, FSS_EXTENDED_LIST_WRITE_short_trim_s_length); - - const f_string_static_t fss_extended_list_write_long_file_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_file_s, 0, FSS_EXTENDED_LIST_WRITE_long_file_s_length); - const f_string_static_t fss_extended_list_write_long_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_content_s, 0, FSS_EXTENDED_LIST_WRITE_long_content_s_length); - const f_string_static_t fss_extended_list_write_long_double_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_double_s, 0, FSS_EXTENDED_LIST_WRITE_long_double_s_length); - const f_string_static_t fss_extended_list_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_ignore_s, 0, FSS_EXTENDED_LIST_WRITE_long_ignore_s_length); - const f_string_static_t fss_extended_list_write_long_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_object_s, 0, FSS_EXTENDED_LIST_WRITE_long_object_s_length); - const f_string_static_t fss_extended_list_write_long_partial_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_partial_s, 0, FSS_EXTENDED_LIST_WRITE_long_partial_s_length); - const f_string_static_t fss_extended_list_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_prepend_s, 0, FSS_EXTENDED_LIST_WRITE_long_prepend_s_length); - const f_string_static_t fss_extended_list_write_long_single_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_single_s, 0, FSS_EXTENDED_LIST_WRITE_long_single_s_length); - const f_string_static_t fss_extended_list_write_long_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_LIST_WRITE_long_trim_s, 0, FSS_EXTENDED_LIST_WRITE_long_trim_s_length); -#endif // _di_fss_extended_list_write_parameter_d_ - -#ifndef _di_fss_extended_list_write_main_delete_ - f_status_t fss_extended_list_write_main_delete(fll_program_data_t *main) { - - return fll_program_data_delete(main); - } -#endif // _di_fss_extended_list_write_main_delete_ - -#ifndef _di_fss_extended_list_write_setting_delete_ - f_status_t fss_extended_list_write_setting_delete(fss_extended_list_write_setting_t * const setting) { - - if (!setting) return F_status_set_error(F_parameter); - - return F_none; - } -#endif // _di_fss_extended_list_write_setting_delete_ - -#ifndef _di_fss_extended_list_write_setting_load_ - void fss_extended_list_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_list_write_setting_t * const setting) { - - if (!main || !setting) return; - - setting->flag = 0; - - // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); - - if (F_status_is_error(setting->status)) { - fss_extended_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true); - fss_extended_list_write_print_line_last_locked(setting, main->error); - - return; - } - - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_extended_list_write_parameter_no_color_e, fss_extended_list_write_parameter_light_e, fss_extended_list_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(setting->status)) { - fss_extended_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true); - fss_extended_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - - if (main->parameters.array[fss_extended_list_write_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_extended_list_write_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_extended_list_write_parameter_verbosity_quiet_e, fss_extended_list_write_parameter_verbosity_error_e, fss_extended_list_write_parameter_verbosity_verbose_e, fss_extended_list_write_parameter_verbosity_debug_e, fss_extended_list_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); - - if (F_status_is_error(setting->status)) { - fss_extended_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true); - fss_extended_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - } - - main->output.to.id = F_type_descriptor_output_d; - main->output.to.stream = F_type_output_d; - main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - - if (main->parameters.array[fss_extended_list_write_parameter_help_e].result & f_console_result_found_e) { - setting->flag |= fss_extended_list_write_main_flag_help_e; - - return; - } - - if (main->parameters.array[fss_extended_list_write_parameter_version_e].result & f_console_result_found_e) { - setting->flag |= fss_extended_list_write_main_flag_version_e; - - return; - } - - f_string_static_t * const args = main->parameters.arguments.array; - - if (main->parameters.array[fss_extended_list_write_parameter_strip_invalid_e].result & f_console_result_found_e) { - setting->flag |= fss_extended_list_write_main_flag_strip_invalid_e; - } - } -#endif // _di_fss_extended_list_write_setting_load_ - -#ifndef _di_fss_extended_list_write_setting_unload_ - f_status_t fss_extended_list_write_setting_unload(fll_program_data_t * const main, fss_extended_list_write_setting_t * const setting) { - - if (!main || !setting) return F_status_set_error(F_parameter); - - fss_extended_list_write_setting_delete(setting); - - return F_none; - } -#endif // _di_fss_extended_list_write_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_extended_list_write/c/common.h b/level_3/fss_extended_list_write/c/common.h deleted file mode 100644 index 20e27bb..0000000 --- a/level_3/fss_extended_list_write/c/common.h +++ /dev/null @@ -1,365 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Extended List Write - * 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_extended_list_write_common_h -#define _fss_extended_list_write_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * The program version. - */ -#ifndef _di_fss_extended_list_write_program_version_s_ - #define FSS_EXTENDED_LIST_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_EXTENDED_LIST_WRITE_program_version_minor_s F_string_ascii_7_s - #define FSS_EXTENDED_LIST_WRITE_program_version_micro_s F_string_ascii_0_s - - #define FSS_EXTENDED_LIST_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_EXTENDED_LIST_WRITE_program_version_minor_s_length F_string_ascii_7_s_length - #define FSS_EXTENDED_LIST_WRITE_program_version_micro_s_length F_string_ascii_0_s_length - - #if !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length)) - #define FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s - #define FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length)) - #define FSS_EXTENDED_LIST_WRITE_program_version_nano_s - #define FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length)) - - #define FSS_EXTENDED_LIST_WRITE_program_version_s FSS_EXTENDED_LIST_WRITE_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_LIST_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_LIST_WRITE_program_version_micro_s FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s FSS_EXTENDED_LIST_WRITE_program_version_nano_s - - #define FSS_EXTENDED_LIST_WRITE_program_version_s_length FSS_EXTENDED_LIST_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_LIST_WRITE_program_version_micro_s_length + FSS_EXTENDED_LIST_WRITE_program_version_nano_prefix_s_length + FSS_EXTENDED_LIST_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_extended_list_write_program_version_s; -#endif // _di_fss_extended_list_write_program_version_s_ - -/** - * The program name. - */ -#ifndef _di_fss_extended_list_write_program_name_s_ - #define FSS_EXTENDED_LIST_WRITE_program_name_s "fss_extended_list_write" - #define FSS_EXTENDED_LIST_WRITE_program_name_long_s "FSS Extended List Write" - - #define FSS_EXTENDED_LIST_WRITE_program_name_s_length 23 - #define FSS_EXTENDED_LIST_WRITE_program_name_long_s_length 23 - - extern const f_string_static_t fss_extended_list_write_program_name_s; - extern const f_string_static_t fss_extended_list_write_program_name_long_s; -#endif // _di_fss_extended_list_write_program_name_s_ - -/** - * The program defines. - */ -#ifndef _di_fss_extended_list_write_d_ - #define fss_extended_list_write_signal_check_d 20000 -#endif // _di_fss_extended_list_write_d_ - -/** - * The program pipe strings. - * - * fss_extended_list_write_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_extended_list_write_pipe_s_ - #define FSS_EXTENDED_LIST_WRITE_pipe_name_s "(pipe)" - - #define FSS_EXTENDED_LIST_WRITE_pipe_name_s_length 6 - - #define FSS_EXTENDED_LIST_WRITE_pipe_content_end_s "\f" - #define FSS_EXTENDED_LIST_WRITE_pipe_content_ignore_s "\v" - #define FSS_EXTENDED_LIST_WRITE_pipe_content_start_s "\b" - - #define FSS_EXTENDED_LIST_WRITE_pipe_content_end_s_length 1 - #define FSS_EXTENDED_LIST_WRITE_pipe_content_ignore_s_length 1 - #define FSS_EXTENDED_LIST_WRITE_pipe_content_start_s_length 1 - - extern const f_string_static_t fss_extended_list_write_pipe_name_s; - - extern const f_string_static_t fss_extended_list_write_pipe_content_end_s; - extern const f_string_static_t fss_extended_list_write_pipe_content_ignore_s; - extern const f_string_static_t fss_extended_list_write_pipe_content_start_s; -#endif // _di_fss_extended_list_write_pipe_s_ - -/** - * The main program parameters. - */ -#ifndef _di_fss_extended_list_write_parameter_d_ - #define FSS_EXTENDED_LIST_WRITE_short_file_s "f" - #define FSS_EXTENDED_LIST_WRITE_short_content_s "c" - #define FSS_EXTENDED_LIST_WRITE_short_double_s "d" - #define FSS_EXTENDED_LIST_WRITE_short_ignore_s "I" - #define FSS_EXTENDED_LIST_WRITE_short_object_s "o" - #define FSS_EXTENDED_LIST_WRITE_short_partial_s "p" - #define FSS_EXTENDED_LIST_WRITE_short_prepend_s "P" - #define FSS_EXTENDED_LIST_WRITE_short_single_s "s" - #define FSS_EXTENDED_LIST_WRITE_short_trim_s "T" - - #define FSS_EXTENDED_LIST_WRITE_long_file_s "file" - #define FSS_EXTENDED_LIST_WRITE_long_content_s "content" - #define FSS_EXTENDED_LIST_WRITE_long_double_s "double" - #define FSS_EXTENDED_LIST_WRITE_long_ignore_s "ignore" - #define FSS_EXTENDED_LIST_WRITE_long_object_s "object" - #define FSS_EXTENDED_LIST_WRITE_long_partial_s "partial" - #define FSS_EXTENDED_LIST_WRITE_long_prepend_s "prepend" - #define FSS_EXTENDED_LIST_WRITE_long_single_s "single" - #define FSS_EXTENDED_LIST_WRITE_long_trim_s "trim" - - #define FSS_EXTENDED_LIST_WRITE_short_file_s_length 1 - #define FSS_EXTENDED_LIST_WRITE_short_content_s_length 1 - #define FSS_EXTENDED_LIST_WRITE_short_double_s_length 1 - #define FSS_EXTENDED_LIST_WRITE_short_ignore_s_length 1 - #define FSS_EXTENDED_LIST_WRITE_short_object_s_length 1 - #define FSS_EXTENDED_LIST_WRITE_short_partial_s_length 1 - #define FSS_EXTENDED_LIST_WRITE_short_prepend_s_length 1 - #define FSS_EXTENDED_LIST_WRITE_short_single_s_length 1 - #define FSS_EXTENDED_LIST_WRITE_short_trim_s_length 1 - - #define FSS_EXTENDED_LIST_WRITE_long_file_s_length 4 - #define FSS_EXTENDED_LIST_WRITE_long_content_s_length 7 - #define FSS_EXTENDED_LIST_WRITE_long_double_s_length 6 - #define FSS_EXTENDED_LIST_WRITE_long_ignore_s_length 6 - #define FSS_EXTENDED_LIST_WRITE_long_object_s_length 6 - #define FSS_EXTENDED_LIST_WRITE_long_partial_s_length 7 - #define FSS_EXTENDED_LIST_WRITE_long_prepend_s_length 7 - #define FSS_EXTENDED_LIST_WRITE_long_single_s_length 6 - #define FSS_EXTENDED_LIST_WRITE_long_trim_s_length 4 - - extern const f_string_static_t fss_extended_list_write_short_file_s; - extern const f_string_static_t fss_extended_list_write_short_content_s; - extern const f_string_static_t fss_extended_list_write_short_double_s; - extern const f_string_static_t fss_extended_list_write_short_ignore_s; - extern const f_string_static_t fss_extended_list_write_short_object_s; - extern const f_string_static_t fss_extended_list_write_short_partial_s; - extern const f_string_static_t fss_extended_list_write_short_prepend_s; - extern const f_string_static_t fss_extended_list_write_short_single_s; - extern const f_string_static_t fss_extended_list_write_short_trim_s; - - extern const f_string_static_t fss_extended_list_write_long_file_s; - extern const f_string_static_t fss_extended_list_write_long_content_s; - extern const f_string_static_t fss_extended_list_write_long_double_s; - extern const f_string_static_t fss_extended_list_write_long_ignore_s; - extern const f_string_static_t fss_extended_list_write_long_object_s; - extern const f_string_static_t fss_extended_list_write_long_partial_s; - extern const f_string_static_t fss_extended_list_write_long_prepend_s; - extern const f_string_static_t fss_extended_list_write_long_single_s; - extern const f_string_static_t fss_extended_list_write_long_trim_s; - - enum { - fss_extended_list_write_parameter_help_e, - fss_extended_list_write_parameter_light_e, - fss_extended_list_write_parameter_dark_e, - fss_extended_list_write_parameter_no_color_e, - fss_extended_list_write_parameter_verbosity_quiet_e, - fss_extended_list_write_parameter_verbosity_error_e, - fss_extended_list_write_parameter_verbosity_normal_e, - fss_extended_list_write_parameter_verbosity_verbose_e, - fss_extended_list_write_parameter_verbosity_debug_e, - fss_extended_list_write_parameter_version_e, - fss_extended_list_write_parameter_line_first_no_e, - fss_extended_list_write_parameter_line_last_no_e, - - fss_extended_list_write_parameter_file_e, - fss_extended_list_write_parameter_content_e, - fss_extended_list_write_parameter_double_e, - fss_extended_list_write_parameter_ignore_e, - fss_extended_list_write_parameter_object_e, - fss_extended_list_write_parameter_partial_e, - fss_extended_list_write_parameter_prepend_e, - fss_extended_list_write_parameter_single_e, - fss_extended_list_write_parameter_trim_e, - }; // enum - - #define fss_extended_list_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ - \ - macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_file_s.string, fss_extended_list_write_long_file_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_content_s.string, fss_extended_list_write_long_content_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_double_s.string, fss_extended_list_write_long_double_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_ignore_s.string, fss_extended_list_write_long_ignore_s.string, 0, 2, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_object_s.string, fss_extended_list_write_long_object_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_partial_s.string, fss_extended_list_write_long_partial_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_prepend_s.string, fss_extended_list_write_long_prepend_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_single_s.string, fss_extended_list_write_long_single_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_trim_s.string, fss_extended_list_write_long_trim_s.string, 0, 0, f_console_flag_normal_e), \ - } - - #define fss_extended_list_write_total_parameters_d 21 -#endif // _di_fss_extended_list_write_parameter_d_ - -/** - * Deallocate main. - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @see fss_extended_list_write_main() - */ -#ifndef _di_fss_extended_list_write_main_delete_ - extern f_status_t fss_extended_list_write_main_delete(fll_program_data_t *main); -#endif // _di_fss_extended_list_write_main_delete_ - -/** - * Flags used to represent flags passed to the main function. - * - * fss_extended_list_write_main_flag_*_e: - * - none: No modes in use. - * - file_from: Using a specified source file. - * - file_to: Using a specified destination file. - * - help: Print help. - * - header: Enable printing of headers. - * - separate: Enable printing of separators. - * - strip_invalid: Using strip invalid character mode. - * - verify: Using verify mode. - * - version: Print version. - */ -#ifndef _di_fss_extended_list_write_main_flag_e_ - enum { - fss_extended_list_write_main_flag_none_e = 0x0, - fss_extended_list_write_main_flag_file_from_e = 0x1, - fss_extended_list_write_main_flag_file_to_e = 0x2, - fss_extended_list_write_main_flag_header_e = 0x4, - fss_extended_list_write_main_flag_help_e = 0x8, - fss_extended_list_write_main_flag_separate_e = 0x10, - fss_extended_list_write_main_flag_strip_invalid_e = 0x20, - fss_extended_list_write_main_flag_verify_e = 0x40, - fss_extended_list_write_main_flag_version_e = 0x80, - }; // enum -#endif // _di_fss_extended_list_write_main_flag_e_ - -/** - * The fss extended list write 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. - * - * status: The main status code, generally used by the load settings and main functions. - * - * line_first: A string expected to represent either "\n" or NULL to allow for easy handling of when to print first new line or not. - * line_last: A string expected to represent either "\n" or NULL to allow for easy handling of when to print last new line or not. - */ -#ifndef _di_fss_extended_list_write_setting_t_ - typedef struct { - uint16_t flag; - - f_status_t status; - - f_string_static_t line_first; - f_string_static_t line_last; - } fss_extended_list_write_setting_t; - - #define fss_extended_list_write_setting_t_initialize \ - { \ - fss_extended_list_write_main_flag_none_e, \ - F_none, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ - } -#endif // _di_fss_extended_list_write_setting_t_ - -/** - * Delete the program main setting data. - * - * @param setting - * The program main setting data. - * - * This does not alter setting.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fss_extended_list_write_setting_delete_ - extern f_status_t fss_extended_list_write_setting_delete(fss_extended_list_write_setting_t * const setting); -#endif // _di_fss_extended_list_write_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 retuns 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.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_extended_list_write_setting_load_ - extern void fss_extended_list_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_list_write_setting_t * const setting); -#endif // _di_fss_extended_list_write_setting_load_ - -/** - * Perform the standard program setting unload process. - * - * @param main - * The main program data. - * @param setting - * The main program settings. - * All buffers are deallocated. - * - * This does not alter setting.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: utf8_setting_delete(). - * - * @see utf8_setting_delete() - */ -#ifndef _di_fss_extended_list_write_setting_unload_ - extern f_status_t fss_extended_list_write_setting_unload(fll_program_data_t * const main, fss_extended_list_write_setting_t * const setting); -#endif // _di_fss_extended_list_write_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_extended_list_write_common_h diff --git a/level_3/fss_extended_list_write/c/fss_extended_list_write.c b/level_3/fss_extended_list_write/c/fss_extended_list_write.c deleted file mode 100644 index 3d0823e..0000000 --- a/level_3/fss_extended_list_write/c/fss_extended_list_write.c +++ /dev/null @@ -1,466 +0,0 @@ -#include "fss_extended_list_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_extended_list_write_main_ - f_status_t fss_extended_list_write_main(fll_program_data_t * const main, fss_extended_list_write_setting_t * const setting) { - - f_status_t status = F_none; - - setting->flag = 0; - - // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); - if (F_status_is_error(setting->status)) return; - - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_extended_list_write_parameter_no_color_e, fss_extended_list_write_parameter_light_e, fss_extended_list_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(status)) { - fss_extended_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true); - fss_extended_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_extended_list_write_parameter_verbosity_quiet_e, fss_extended_list_write_parameter_verbosity_error_e, fss_extended_list_write_parameter_verbosity_verbose_e, fss_extended_list_write_parameter_verbosity_debug_e, fss_extended_list_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); - - if (F_status_is_error(status)) { - fss_extended_list_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true); - fss_extended_list_write_print_line_last_locked(setting, main->error); - - return; - } - } - } - - f_string_static_t * const argv = main->parameters.arguments.array; - - status = F_none; - - if (main->parameters.array[fss_extended_list_write_parameter_help_e].result & f_console_result_found_e) { - fss_extended_list_write_print_help(setting, main->message); - - return status; - } - - if (main->parameters.array[fss_extended_list_write_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, fss_extended_list_write_program_version_s); - - return status; - } - - f_file_t output = f_file_t_initialize; - - output.id = F_type_descriptor_output_d; - output.stream = F_type_output_d; - output.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_extended_list_write_parameter_file_e].result & f_console_result_value_e) { - if (main->parameters.array[fss_extended_list_write_parameter_file_e].values.used > 1) { - if (main->error.verbosity > f_console_verbosity_quiet_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_extended_list_write_long_file_s, main->error.notable); - fl_print_format("%[' may only be specified once.%]%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 { - const f_array_length_t index = main->parameters.array[fss_extended_list_write_parameter_file_e].values.array[0]; - - output.id = -1; - output.stream = 0; - status = f_file_stream_open(argv[index], f_string_empty_s, &output); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e); - } - } - } - else if (main->parameters.array[fss_extended_list_write_parameter_file_e].result & f_console_result_found_e) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_extended_list_write_long_file_s); - status = F_status_set_error(F_parameter); - } - } - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_extended_list_write_parameter_object_e].locations.used || main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_extended_list_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_extended_list_write_parameter_object_e].locations.used != main->parameters.array[fss_extended_list_write_parameter_object_e].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_extended_list_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used != main->parameters.array[fss_extended_list_write_parameter_content_e].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_extended_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_extended_list_write_parameter_object_e].locations.used != main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used && !(main->parameters.array[fss_extended_list_write_parameter_partial_e].result & f_console_result_found_e)) { - fss_extended_list_write_error_parameter_same_times_print(main); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used && main->parameters.array[fss_extended_list_write_parameter_partial_e].locations.used) { - if (main->parameters.array[fss_extended_list_write_parameter_content_e].result & f_console_result_value_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_extended_list_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter only allows either the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter or the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter, but not both.%]%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)) { - if (main->parameters.array[fss_extended_list_write_parameter_content_e].result & f_console_result_value_e) { - f_array_length_t location_object = 0; - f_array_length_t location_content = 0; - f_array_length_t location_sub_object = 0; - f_array_length_t location_sub_content = 0; - - for (f_array_length_t i = 0; i < main->parameters.array[fss_extended_list_write_parameter_object_e].locations.used; ++i) { - location_object = main->parameters.array[fss_extended_list_write_parameter_object_e].locations.array[i]; - location_content = main->parameters.array[fss_extended_list_write_parameter_content_e].locations.array[i]; - location_sub_object = main->parameters.array[fss_extended_list_write_parameter_object_e].locations_sub.array[i]; - location_sub_content = main->parameters.array[fss_extended_list_write_parameter_content_e].locations_sub.array[i]; - - if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QEach '%]", 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_extended_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter must be specified before a '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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); - break; - } - } // for - } - } - } - else if (main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used != main->parameters.array[fss_extended_list_write_parameter_content_e].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_extended_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_extended_list_write_parameter_partial_e].locations.used) { - fss_extended_list_write_error_parameter_same_times_print(main); - status = F_status_set_error(F_parameter); - } - } - } - else if (!(main->pipe & fll_program_data_pipe_input_e)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", 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_extended_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter with the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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)) { - if (main->parameters.array[fss_extended_list_write_parameter_partial_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThis '%]", 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_extended_list_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter cannot be used when processing a pipe.%]%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)) { - if (main->parameters.array[fss_extended_list_write_parameter_prepend_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_extended_list_write_long_prepend_s, main->error.notable); - fl_print_format("%[' is specified, but no value is given.%]%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_extended_list_write_parameter_prepend_e].result & f_console_result_value_e) { - const f_array_length_t index = main->parameters.array[fss_extended_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_extended_list_write_parameter_prepend_e].values.used - 1]; - - if (argv[index].used) { - f_string_range_t range = macro_f_string_range_t_initialize2(argv[index].used); - f_state_t state = f_state_t_initialize; - - for (; range.start < argv[index].used; ++range.start) { - - status = f_fss_is_space(state, argv[index], range); - if (F_status_is_error(status)) break; - - if (status == F_false) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - 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_extended_list_write_long_prepend_s, main->error.notable); - fl_print_format("%[' must only contain white space.%]%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); - - break; - } - } // for - } - else { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - 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_extended_list_write_long_prepend_s, main->error.notable); - fl_print_format("%[' must not be an empty 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)) { - if (main->parameters.array[fss_extended_list_write_parameter_ignore_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_extended_list_write_long_ignore_s, main->error.notable); - fl_print_format("%[' was specified, but no values were given.%]%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_extended_list_write_parameter_ignore_e].result & f_console_result_value_e) { - const f_array_length_t total_locations = main->parameters.array[fss_extended_list_write_parameter_ignore_e].locations.used; - const f_array_length_t total_arguments = main->parameters.array[fss_extended_list_write_parameter_ignore_e].values.used; - - if (total_locations * 2 > total_arguments) { - 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_extended_list_write_long_ignore_s, main->error.notable); - fl_print_format("%[' requires two values.%]%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); - } - } - } - - uint8_t quote = f_fss_quote_double_s; - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_extended_list_write_parameter_double_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_extended_list_write_parameter_single_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_extended_list_write_parameter_double_e].location < main->parameters.array[fss_extended_list_write_parameter_single_e].location) { - quote = f_fss_quote_single_s; - } - } - } - else if (main->parameters.array[fss_extended_list_write_parameter_single_e].result & f_console_result_found_e) { - quote = f_fss_quote_single_s; - } - } - - f_string_dynamic_t buffer = f_string_dynamic_t_initialize; - - if (F_status_is_error_not(status)) { - f_string_ranges_t ignore = f_string_ranges_t_initialize; - - if (main->pipe & fll_program_data_pipe_input_e) { - status = fss_extended_list_write_process_pipe(main, output, quote, &buffer, &ignore); - - if (F_status_is_error(status)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); - fl_print_format("%['.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } - } - - ignore.used = 0; - } - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_extended_list_write_parameter_partial_e].result & f_console_result_found_e) { - - if (main->parameters.array[fss_extended_list_write_parameter_object_e].result & f_console_result_value_e) { - for (f_array_length_t i = 0; i < main->parameters.array[fss_extended_list_write_parameter_object_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_extended_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - status = fss_extended_list_write_process(main, output, quote, &argv[main->parameters.array[fss_extended_list_write_parameter_object_e].values.array[i]], 0, 0, &buffer); - if (F_status_is_error(status)) break; - } // for - } - else { - for (f_array_length_t i = 0; i < main->parameters.array[fss_extended_list_write_parameter_content_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_extended_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - status = fss_extended_list_write_process_parameter_ignore(main, main->parameters.array[fss_extended_list_write_parameter_content_e].locations, i, &ignore); - if (F_status_is_error(status)) break; - - status = fss_extended_list_write_process(main, output, quote, 0, &argv[main->parameters.array[fss_extended_list_write_parameter_content_e].values.array[i]], &ignore, &buffer); - if (F_status_is_error(status)) break; - } // for - } - } - else { - for (f_array_length_t i = 0; i < main->parameters.array[fss_extended_list_write_parameter_object_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_extended_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - status = fss_extended_list_write_process_parameter_ignore(main, main->parameters.array[fss_extended_list_write_parameter_content_e].locations, i, &ignore); - if (F_status_is_error(status)) break; - - status = fss_extended_list_write_process(main, output, quote, &argv[main->parameters.array[fss_extended_list_write_parameter_object_e].values.array[i]], &argv[main->parameters.array[fss_extended_list_write_parameter_content_e].values.array[i]], &ignore, &buffer); - if (F_status_is_error(status)) break; - } // for - } - - if (F_status_is_error(status)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); - fl_print_format("%['.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } - } - else if (main->error.verbosity > f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && !(main->parameters.array[fss_extended_list_write_parameter_file_e].result & f_console_result_found_e)) { - - // Ensure there is always a newline at the end, unless in quiet mode. - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } - } - - macro_f_string_ranges_t_delete_simple(ignore); - } - - if (main->parameters.array[fss_extended_list_write_parameter_file_e].result & f_console_result_value_e) { - f_file_stream_flush(output); - f_file_stream_close(&output); - } - - // Ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (main->error.verbosity > f_console_verbosity_quiet_e) { - if (F_status_is_error(status)) { - fll_print_dynamic_raw(f_string_eol_s, main->error.to); - } - } - - f_string_dynamic_resize(0, &buffer); - - return status; - } -#endif // _di_fss_extended_list_write_main_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_extended_list_write/c/fss_extended_list_write.h b/level_3/fss_extended_list_write/c/fss_extended_list_write.h deleted file mode 100644 index 6dea20d..0000000 --- a/level_3/fss_extended_list_write/c/fss_extended_list_write.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * This program provides FSS-0003 Extended List write functionality. - */ -#ifndef _fss_extended_list_write_h -#define _fss_extended_list_write_h - -// Libc includes. -#include -#include -#include -#include - -// FLL-0 includes. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// FLL-1 includes. -#include -#include -#include -#include - -// FLL-2 includes. -#include -#include -#include - -// FSS Extended List Write 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.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_extended_list_write_main_ - extern f_status_t fss_extended_list_write_main(fll_program_data_t * const main, fss_extended_list_write_setting_t * const setting); -#endif // _di_fss_extended_list_write_main_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_extended_list_write_h diff --git a/level_3/fss_extended_list_write/c/main.c b/level_3/fss_extended_list_write/c/main.c deleted file mode 100644 index 40848be..0000000 --- a/level_3/fss_extended_list_write/c/main.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "fss_extended_list_write.h" - -int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - - fll_program_data_t data = fll_program_data_t_initialize; - fss_extended_list_write_setting_t setting = fss_extended_list_write_setting_t_initialize; - - f_console_parameter_t parameters[] = fss_extended_list_write_console_parameter_t_initialize; - data.parameters.array = parameters; - data.parameters.used = fss_extended_list_write_total_parameters_d; - data.environment = envp; - - if (f_pipe_input_exists()) { - data.pipe = fll_program_data_pipe_input_e; - } - - fll_program_standard_set_up(&data); - - { - const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - - fss_extended_list_write_setting_load(arguments, &data, &setting); - } - - const f_status_t status = fss_extended_list_write_main(&data, arguments); - - fss_extended_list_write_main(&data, &setting); - - fss_extended_list_write_setting_unload(&data, &setting); - - fll_program_data_delete(&data); - - fll_program_standard_set_down(&data); - - return F_status_is_error(status) ? 1 : 0; -} diff --git a/level_3/fss_extended_list_write/c/print.c b/level_3/fss_extended_list_write/c/print.c deleted file mode 100644 index f8c9fea..0000000 --- a/level_3/fss_extended_list_write/c/print.c +++ /dev/null @@ -1,125 +0,0 @@ -#include "fss_embedded_list_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_extended_list_write_print_help_ - f_status_t fss_extended_list_write_print_help(fss_extended_list_write_setting_t * const setting, const fl_print_t print) { - - f_file_stream_lock(print.to); - - f_print_dynamic_raw(setting->line_first, print.to); - - fll_program_print_help_header(print, fss_extended_list_write_program_name_long_s, fss_extended_list_write_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_extended_list_write_short_file_s, fss_extended_list_write_long_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a file to send data to."); - fll_program_print_help_option(print, fss_extended_list_write_short_content_s, fss_extended_list_write_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The Content to write."); - fll_program_print_help_option(print, fss_extended_list_write_short_double_s, fss_extended_list_write_long_double_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use double quotes (default)."); - fll_program_print_help_option(print, fss_extended_list_write_short_ignore_s, fss_extended_list_write_long_ignore_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Ignore a given range within a Content."); - fll_program_print_help_option(print, fss_extended_list_write_short_object_s, fss_extended_list_write_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The Object to write."); - fll_program_print_help_option(print, fss_extended_list_write_short_partial_s, fss_extended_list_write_long_partial_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Do not write end of Object/Content character."); - fll_program_print_help_option(print, fss_extended_list_write_short_prepend_s, fss_extended_list_write_long_prepend_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Prepend the given white space characters to the start of each multi-line Content."); - fll_program_print_help_option(print, fss_extended_list_write_short_single_s, fss_extended_list_write_long_single_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use single quotes."); - fll_program_print_help_option(print, fss_extended_list_write_short_trim_s, fss_extended_list_write_long_trim_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Trim Object names."); - - 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_extended_list_write_program_name_s, f_string_empty_s); - - fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The pipe uses the Form Feed character '%[\\f%]' (%[U+000C%]) to designate the end of the last Content.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The pipe uses the Vertical Line character '%[\\v%]' (%[U+000B%]) is used to ignore a Content range (use this both before and after the range).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable); - fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The FSS-0003 (Extended List) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_single_s, print.set->notable); - fl_print_format(" and '%[%r%r%]' do nothing.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_double_s, print.set->notable, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The parameter '%[%r%r%]' designates to not escape any valid nested Object or Content within some Content.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_ignore_s, print.set->notable, f_string_eol_s); - fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s); - fl_print_format(" This parameter is not used for ignoring anything from the input pipe.%r", print.to, f_string_eol_s); - fl_print_format(" This parameter must be specified after a '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_content_s, print.set->notable); - fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_content_s, print.set->notable, f_string_eol_s); - - f_print_dynamic_raw(setting->line_last, print.to); - - f_file_stream_flush(print.to); - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fss_extended_list_write_print_help_ - -#ifndef _di_fss_extended_list_write_print_line_first_locked_ - f_status_t fss_extended_list_write_print_line_first_locked(fss_extended_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_extended_list_write_print_line_first_locked_ - -#ifndef _di_fss_extended_list_write_print_line_first_unlocked_ - f_status_t fss_extended_list_write_print_line_first_unlocked(fss_extended_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_extended_list_write_print_line_first_unlocked_ - -#ifndef _di_fss_extended_list_write_print_line_last_locked_ - f_status_t fss_extended_list_write_print_line_last_locked(fss_extended_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - if (setting->flag & (fss_extended_list_write_main_flag_verify_e | fss_extended_list_write_main_flag_file_to_e)) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_extended_list_write_print_line_last_locked_ - -#ifndef _di_fss_extended_list_write_print_line_last_unlocked_ - f_status_t fss_extended_list_write_print_line_last_unlocked(fss_extended_list_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - if (setting->flag & (fss_extended_list_write_main_flag_verify_e | fss_extended_list_write_main_flag_file_to_e)) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_extended_list_write_print_line_last_unlocked_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_extended_list_write/c/print.h b/level_3/fss_extended_list_write/c/print.h deleted file mode 100644 index ee6f6a5..0000000 --- a/level_3/fss_extended_list_write/c/print.h +++ /dev/null @@ -1,123 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: UTF-8 - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _fss_embedded_list_write_print_h -#define _fss_embedded_list_write_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print help. - * - * @param setting - * The main program settings. - * This does not alter setting.status. - * @param print - * The output structure to print to. - * - * @return - * F_none on success. - */ -#ifndef _di_fss_extended_list_write_print_help_ - extern f_status_t fss_extended_list_write_print_help(fss_extended_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_list_write_print_help_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_list_write_print_line_first_locked_ - extern f_status_t fss_extended_list_write_print_line_first_locked(fss_extended_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_list_write_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_list_write_print_line_first_unlocked_ - extern f_status_t fss_extended_list_write_print_line_first_unlocked(fss_extended_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_list_write_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_list_write_print_line_last_locked_ - extern f_status_t fss_extended_list_write_print_line_last_locked(fss_extended_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_list_write_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_list_write_print_line_last_unlocked_ - extern f_status_t fss_extended_list_write_print_line_last_unlocked(fss_extended_list_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_list_write_print_line_last_unlocked_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_embedded_list_write_print_h diff --git a/level_3/fss_extended_list_write/c/private-common.c b/level_3/fss_extended_list_write/c/private-common.c deleted file mode 100644 index 4e3d529..0000000 --- a/level_3/fss_extended_list_write/c/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_extended_list_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_extended_list_write/c/private-common.h b/level_3/fss_extended_list_write/c/private-common.h deleted file mode 100644 index 08cc099..0000000 --- a/level_3/fss_extended_list_write/c/private-common.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Extended List Write - * 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. - * - * extended_list_write_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. - */ -#ifndef _di_fss_extended_list_write_common_ - #define fss_extended_list_write_common_allocation_large_d 2048 - #define fss_extended_list_write_common_allocation_small_d 128 -#endif // _di_fss_extended_list_write_common_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_common_h diff --git a/level_3/fss_extended_list_write/c/private-write.c b/level_3/fss_extended_list_write/c/private-write.c deleted file mode 100644 index 9e0bd5f..0000000 --- a/level_3/fss_extended_list_write/c/private-write.c +++ /dev/null @@ -1,463 +0,0 @@ -#include "fss_extended_list_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_extended_list_write_error_parameter_same_times_print_ - void fss_extended_list_write_error_parameter_same_times_print(fll_program_data_t * const main) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return; - - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QMust specify the '%]", 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_extended_list_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_list_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_extended_list_write_error_parameter_same_times_print_ - -#ifndef _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ - void fss_extended_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return; - - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe FSS-0003 (Extended List) standard does not support end of line character '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[\\n%]", main->error.to, main->error.notable, main->error.notable); - fl_print_format("%[' (%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[U+000A%]", main->error.to, main->error.notable, main->error.notable); - fl_print_format("%[) in objects.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ - -#ifndef _di_fss_extended_list_write_error_parameter_value_missing_print_ - void fss_extended_list_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return; - - 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, symbol, parameter, main->error.notable); - fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_extended_list_write_error_parameter_value_missing_print_ - -#ifndef _di_fss_extended_list_write_process_ - f_status_t fss_extended_list_write_process(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) { - - f_status_t status = F_none; - f_state_t state = macro_f_state_t_initialize(fss_extended_list_write_common_allocation_large_d, fss_extended_list_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); - f_string_range_t range = f_string_range_t_initialize; - - if (object) { - uint8_t complete = f_fss_complete_none_e; - - if (object->used) { - range.start = 0; - range.stop = object->used - 1; - } - else { - range.start = 1; - range.stop = 0; - } - - if (content) { - if (main->parameters.array[fss_extended_list_write_parameter_trim_e].result & f_console_result_found_e) { - complete = f_fss_complete_full_trim_e; - } - else { - complete = f_fss_complete_full_e; - } - } - - status = fl_fss_extended_list_object_write(*object, complete, state, &range, buffer); - - if (F_status_set_fine(status) == F_none_eol) { - fss_extended_list_write_error_parameter_unsupported_eol_print(main); - - return F_status_set_error(F_support_not); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fl_fss_extended_list_object_write", F_true); - - return status; - } - } - - if (content && content->used) { - range.start = 0; - range.stop = content->used - 1; - - const f_string_static_t *prepend = 0; - - if (main->parameters.array[fss_extended_list_write_parameter_prepend_e].result & f_console_result_value_e) { - const f_array_length_t index = main->parameters.array[fss_extended_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_extended_list_write_parameter_prepend_e].values.used - 1]; - - prepend = &main->parameters.arguments.array[index]; - } - - status = fl_fss_extended_list_content_write(*content, object ? f_fss_complete_full_e : f_fss_complete_none_e, prepend, ignore, state, &range, buffer); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fl_fss_extended_list_content_write", F_true); - - return status; - } - } - - if (!object || !content) { - status = f_string_dynamic_append(f_string_eol_s, buffer); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); - - return status; - } - } - - fll_print_dynamic(*buffer, output); - - buffer->used = 0; - - return status; - } -#endif // _di_fss_extended_list_write_process_ - -#ifndef _di_fss_extended_list_write_process_pipe_ - f_status_t fss_extended_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) { - - f_status_t status = F_none; - f_status_t status_pipe = F_none; - - f_file_t input = f_file_t_initialize; - - input.id = F_type_descriptor_input_d; - input.size_read = 2048; - - f_array_length_t total = 0; - - f_string_range_t range = f_string_range_t_initialize; - f_string_range_t range_ignore = f_string_range_t_initialize; - - f_string_dynamic_t block = f_string_dynamic_t_initialize; - f_string_dynamic_t object = f_string_dynamic_t_initialize; - f_string_dynamic_t content = f_string_dynamic_t_initialize; - - // 0x0 = start new object/content set, 0x1 = processing object, 0x2 = processing content, 0x3 = end object/content set. - uint8_t state = 0; - - for (;;) { - - if (!((++main->signal_check) % fss_extended_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - return F_status_set_error(F_interrupt); - } - - main->signal_check = 0; - } - - if (range.start > range.stop) { - if (status_pipe == F_none_eof) break; - - block.used = 0; - - status_pipe = f_file_read_block(input, &block); - - if (F_status_is_error(status_pipe)) { - fll_error_print(main->error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); - - status_pipe = F_status_set_error(F_pipe); - - break; - } - - if (!block.used) break; - - range.start = 0; - range.stop = block.used - 1; - } - - if (!state || state == 0x1) { - if (!state) { - object.used = 0; - content.used = 0; - - state = 0x1; - - range_ignore.start = 1; - range_ignore.stop = 0; - } - - if (object.used + block.used > object.size) { - status = f_string_dynamic_increase_by(block.used, &object); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); - - break; - } - } - - for (; range.start <= range.stop; ++range.start) { - - if (block.string[range.start] == fss_extended_list_write_pipe_content_start_s.string[0]) { - state = 0x2; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_extended_list_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_extended_list_write_pipe_content_ignore_s.string[0]) { - - // This is not used by objects. - continue; - } - - object.string[object.used++] = block.string[range.start]; - } // for - - if (F_status_is_error(status)) break; - - // If the start of content was not found, then fetch the next block. - if (state == 0x1) continue; - - // If the end of the current block is reached, fetch the next block. - if (range.start > range.stop) continue; - } - - if (state == 0x2) { - if (range.start <= range.stop) { - total = (range.stop - range.start) + 1; - } - else { - total = 0; - } - - if (total) { - status = f_string_dynamic_increase_by(total, &content); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); - - break; - } - - for (; range.start <= range.stop; ++range.start) { - - if (block.string[range.start] == fss_extended_list_write_pipe_content_start_s.string[0]) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_format("%r%[%QThe FSS-0003 (Extended List) standard only supports one content per object.%]%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_support_not); - - break; - } - - if (block.string[range.start] == fss_extended_list_write_pipe_content_end_s.string[0]) { - state = 0x3; - range.start++; - - break; - } - - if (block.string[range.start] == fss_extended_list_write_pipe_content_ignore_s.string[0]) { - if (ignore) { - if (range_ignore.start > range_ignore.stop) { - range_ignore.start = content.used; - range_ignore.stop = content.used; - } - else { - if (ignore->used + 1 > ignore->size) { - if (ignore->size + F_fss_default_allocation_step_d > F_array_length_t_size_d) { - if (ignore->size + 1 > F_array_length_t_size_d) { - fll_error_print(main->error, F_string_too_large, "fss_extended_list_write_process_pipe", F_true); - - status = F_status_set_error(F_string_too_large); - - break; - } - - macro_f_string_ranges_t_resize(status, (*ignore), ignore->size + 1); - } - else { - macro_f_string_ranges_t_resize(status, (*ignore), ignore->size + F_fss_default_allocation_step_d); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_string_too_large, "fss_extended_list_write_process_pipe", F_true); - - break; - } - } - - ignore->array[ignore->used].start = range_ignore.start; - ignore->array[ignore->used++].stop = content.used - 1; - - range_ignore.start = 1; - range_ignore.stop = 0; - } - } - - continue; - } - - content.string[content.used++] = block.string[range.start]; - } // for - - if (F_status_is_error(status)) break; - } - else { - state = 0x3; - } - } - - if (state == 0x3) { - status = fss_extended_list_write_process(main, output, quote, &object, &content, ignore, buffer); - if (F_status_is_error(status)) break; - - state = 0; - } - } // for - - // If the pipe ended before finishing, then attempt to wrap up. - if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) { - status = fss_extended_list_write_process(main, output, quote, &object, &content, ignore, buffer); - } - - f_string_dynamic_resize(0, &block); - f_string_dynamic_resize(0, &object); - f_string_dynamic_resize(0, &content); - - return status; - } -#endif // _di_fss_extended_list_write_process_pipe_ - -#ifndef _di_fss_extended_list_write_process_parameter_ignore_ - f_status_t fss_extended_list_write_process_parameter_ignore(fll_program_data_t * const main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) { - - f_status_t status = F_none; - - f_array_length_t i = 0; - f_array_length_t l = 0; - f_array_length_t index = 0; - - f_string_range_t range = f_string_range_t_initialize; - - f_number_unsigned_t number = 0; - - f_string_static_t * const argv = main->parameters.arguments.array; - - range.start = 0; - - for (; i < main->parameters.array[fss_extended_list_write_parameter_ignore_e].locations.used; ++i) { - - if (!((++main->signal_check) % fss_extended_list_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - return F_status_set_error(F_interrupt); - } - - main->signal_check = 0; - } - - l = main->parameters.array[fss_extended_list_write_parameter_ignore_e].locations.array[i]; - - if (l < contents.array[location]) continue; - if (location + 1 < contents.used && l > contents.array[location + 1]) continue; - - if (ignore->used + 1 > ignore->size) { - if (ignore->size + F_fss_default_allocation_step_d > F_array_length_t_size_d) { - if (ignore->size + 1 > F_array_length_t_size_d) { - fll_error_print(main->error, F_string_too_large, "fss_extended_list_write_process_parameter_ignore", F_true); - - return F_status_set_error(F_string_too_large); - } - - macro_f_string_ranges_t_resize(status, (*ignore), ignore->size + 1); - } - else { - macro_f_string_ranges_t_resize(status, (*ignore), ignore->size + F_fss_default_allocation_step_d); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fss_extended_list_write_process_parameter_ignore", F_true); - - return status; - } - } - - index = main->parameters.array[fss_extended_list_write_parameter_ignore_e].values.array[i * 2]; - - range.start = 0; - range.stop = argv[index].used - 1; - - // allow and ignore the positive sign. - if (range.stop > 0 && argv[index].string[0] == f_string_ascii_plus_s.string[0]) { - range.start = 1; - } - - status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, argv[index], range, &number); - - 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_extended_list_write_long_ignore_s, argv[index]); - - return status; - } - - ignore->array[ignore->used].start = number; - - index = main->parameters.array[fss_extended_list_write_parameter_ignore_e].values.array[(i * 2) + 1]; - - range.start = 0; - range.stop = argv[index].used - 1; - - // allow and ignore the positive sign. - if (range.stop > 0 && argv[index].string[0] == f_string_ascii_plus_s.string[0]) { - range.start = 1; - } - - status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, argv[index], range, &number); - - 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_extended_list_write_long_ignore_s, argv[index]); - - return status; - } - - ignore->array[ignore->used++].stop = number; - } // for - - return F_none; - } -#endif // _di_fss_extended_list_write_process_parameter_ignore_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_extended_list_write/c/private-write.h b/level_3/fss_extended_list_write/c/private-write.h deleted file mode 100644 index 23616a9..0000000 --- a/level_3/fss_extended_list_write/c/private-write.h +++ /dev/null @@ -1,127 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_write_h -#define _PRIVATE_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print an message about the object and content parameters not being specified the same number of times. - * - * @param main - * The main program data. - */ -#ifndef _di_fss_extended_list_write_error_parameter_same_times_print_ - void fss_extended_list_write_error_parameter_same_times_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_list_write_error_parameter_same_times_print_ - -/** - * Print an error message about a parameter New Line character '\n' (U+000A) being unsupported. - * - * @param main - * The main program data. - */ -#ifndef _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ - void fss_extended_list_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_list_write_error_parameter_unsupported_eol_print_ - -/** - * Print an error message about a parameter missing a value. - * - * @param main - * The main program data. - * @param symbol - * The console symbol, such as "--" in "--help". - * @param parameter - * The parameter name, such as "help" in "--help". - */ -#ifndef _di_fss_extended_list_write_error_parameter_value_missing_print_ - void fss_extended_list_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_list_write_error_parameter_value_missing_print_ - -/** - * Process a given object and content, printing the FSS if valid or an error if invalid. - * - * @param main - * The main program data. - * @param output - * The file to output to. - * @param quote - * The quote character to use. - * This is either single our double quote. - * @param object - * The object to validate and print. - * Set pointer address to 0 to not use. - * @param content - * The content to escape and print. - * Set pointer address to 0 to not use. - * @param ignore - * An array of ranges within the Content to ignore. - * Set pointer address to 0 to not use. - * @param buffer - * The buffer array used as a cache to construct the output before printing. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_extended_list_write_process_ - extern f_status_t fss_extended_list_write_process(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, const f_string_static_t *object, const f_string_static_t *content, const f_string_ranges_t *ignore, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_list_write_process_ - -/** - * Process the pipe, reading from the pipe and writing to the output. - * - * @param main - * The main program data. - * @param output - * The file to output to. - * @param quote - * The quote character to use. - * This is either single our double quote. - * @param buffer - * The buffer array used as a cache to construct the output before printing. - * @param ignore - * An array of ranges within the Content to ignore. - * Set pointer address to 0 to not use. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_extended_list_write_process_pipe_ - extern f_status_t fss_extended_list_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, f_string_dynamic_t *buffer, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_list_write_process_pipe_ - -/** - * Process the ignore parameter associated with a specific content parameter. - * - * @param main - * The main program data. - * @param contents - * The console parameter locations array for the content parameter. - * @param location - * The specific location within the contents locations array. - * @param ignore - * An array of ranges within the Content to ignore. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_extended_list_write_process_parameter_ignore_ - extern f_status_t fss_extended_list_write_process_parameter_ignore(fll_program_data_t * const main, const f_array_lengths_t contents, const f_array_length_t location, f_string_ranges_t *ignore) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_list_write_process_parameter_ignore_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_write_h diff --git a/level_3/fss_extended_list_write/data/build/defines b/level_3/fss_extended_list_write/data/build/defines deleted file mode 100644 index c665317..0000000 --- a/level_3/fss_extended_list_write/data/build/defines +++ /dev/null @@ -1,2 +0,0 @@ -# fss-0000 - diff --git a/level_3/fss_extended_list_write/data/build/dependencies b/level_3/fss_extended_list_write/data/build/dependencies deleted file mode 100644 index aa10ae3..0000000 --- a/level_3/fss_extended_list_write/data/build/dependencies +++ /dev/null @@ -1,27 +0,0 @@ -# fss-0000 - -f_type -f_status -f_memory -f_type_array -f_string -f_utf -f_color -f_console -f_conversion -f_directory -f_environment -f_file -f_fss -f_pipe -f_print -f_signal -fl_conversion -fl_fss -fl_print -fl_string -fll_error -fll_file -fll_fss -fll_print -fll_program diff --git a/level_3/fss_extended_list_write/data/build/fakefile b/level_3/fss_extended_list_write/data/build/fakefile deleted file mode 100644 index 5328059..0000000 --- a/level_3/fss_extended_list_write/data/build/fakefile +++ /dev/null @@ -1,11 +0,0 @@ -# fss-0005 iki-0002 - -settings: - fail exit - modes individual level monolithic clang test - - environment PATH LD_LIBRARY_PATH - -main: - - build diff --git a/level_3/fss_extended_list_write/data/build/settings b/level_3/fss_extended_list_write/data/build/settings deleted file mode 100644 index 4d34c0e..0000000 --- a/level_3/fss_extended_list_write/data/build/settings +++ /dev/null @@ -1,56 +0,0 @@ -# fss-0001 - -build_name fss_extended_list_write - -version_major 0 -version_minor 7 -version_micro 0 -version_file micro -version_target minor - -modes individual level monolithic clang test -modes_default monolithic - -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 -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_status_string -lf_string -lf_type_array -lf_utf -build_libraries-level -lfll_2 -lfll_1 -lfll_0 -build_libraries-monolithic -lfll - -build_sources_library fss_extended_list_write.c common.c print.c private-common.c private-write.c - -build_sources_program main.c - -build_sources_headers fss_extended_list_write.h common.h print.h - -build_script yes -build_shared yes -build_static no - -path_headers program/fss_extended_list_write - -has_path_standard yes -preserve_path_headers yes - -search_exclusive yes -search_shared yes -search_static yes - -environment PATH LD_LIBRARY_PATH - -#defines -D_di_libcap_ -D_di_thread_support_ -defines -D_libcap_legacy_only_ -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-clang -Wno-logical-op-parentheses -flags-test -O0 -fstack-protector -Wall -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_extended_write/c/common.c b/level_3/fss_extended_write/c/common.c deleted file mode 100644 index 037c36a..0000000 --- a/level_3/fss_extended_write/c/common.c +++ /dev/null @@ -1,166 +0,0 @@ -#include "fss_extended_write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_extended_write_program_version_s_ - const f_string_static_t fss_extended_write_program_version_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_program_version_s, 0, FSS_EXTENDED_WRITE_program_version_s_length); -#endif // _di_fss_extended_write_program_version_s_ - -#ifndef _di_fss_extended_write_program_name_s_ - const f_string_static_t fss_extended_write_program_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_program_name_s, 0, FSS_EXTENDED_WRITE_program_name_s_length); - const f_string_static_t fss_extended_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_program_name_long_s, 0, FSS_EXTENDED_WRITE_program_name_long_s_length); -#endif // _di_fss_extended_write_program_name_s_ - -#ifndef _di_fss_extended_write_pipe_s_ - const f_string_static_t fss_extended_write_pipe_name_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_pipe_name_s, 0, FSS_EXTENDED_WRITE_pipe_name_s_length); - const f_string_static_t fss_extended_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_pipe_content_end_s, 0, FSS_EXTENDED_WRITE_pipe_content_end_s_length); - const f_string_static_t fss_extended_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_pipe_content_ignore_s, 0, FSS_EXTENDED_WRITE_pipe_content_ignore_s_length); - const f_string_static_t fss_extended_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_pipe_content_start_s, 0, FSS_EXTENDED_WRITE_pipe_content_start_s_length); -#endif // _di_fss_extended_write_pipe_s_ - -#ifndef _di_fss_extended_write_parameter_d_ - const f_string_static_t fss_extended_write_short_file_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_file_s, 0, FSS_EXTENDED_WRITE_short_file_s_length); - const f_string_static_t fss_extended_write_short_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_content_s, 0, FSS_EXTENDED_WRITE_short_content_s_length); - const f_string_static_t fss_extended_write_short_double_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_double_s, 0, FSS_EXTENDED_WRITE_short_double_s_length); - const f_string_static_t fss_extended_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_ignore_s, 0, FSS_EXTENDED_WRITE_short_ignore_s_length); - const f_string_static_t fss_extended_write_short_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_object_s, 0, FSS_EXTENDED_WRITE_short_object_s_length); - const f_string_static_t fss_extended_write_short_partial_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_partial_s, 0, FSS_EXTENDED_WRITE_short_partial_s_length); - const f_string_static_t fss_extended_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_prepend_s, 0, FSS_EXTENDED_WRITE_short_prepend_s_length); - const f_string_static_t fss_extended_write_short_single_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_single_s, 0, FSS_EXTENDED_WRITE_short_single_s_length); - const f_string_static_t fss_extended_write_short_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_short_trim_s, 0, FSS_EXTENDED_WRITE_short_trim_s_length); - - const f_string_static_t fss_extended_write_long_file_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_file_s, 0, FSS_EXTENDED_WRITE_long_file_s_length); - const f_string_static_t fss_extended_write_long_content_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_content_s, 0, FSS_EXTENDED_WRITE_long_content_s_length); - const f_string_static_t fss_extended_write_long_double_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_double_s, 0, FSS_EXTENDED_WRITE_long_double_s_length); - const f_string_static_t fss_extended_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_ignore_s, 0, FSS_EXTENDED_WRITE_long_ignore_s_length); - const f_string_static_t fss_extended_write_long_object_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_object_s, 0, FSS_EXTENDED_WRITE_long_object_s_length); - const f_string_static_t fss_extended_write_long_partial_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_partial_s, 0, FSS_EXTENDED_WRITE_long_partial_s_length); - const f_string_static_t fss_extended_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_prepend_s, 0, FSS_EXTENDED_WRITE_long_prepend_s_length); - const f_string_static_t fss_extended_write_long_single_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_single_s, 0, FSS_EXTENDED_WRITE_long_single_s_length); - const f_string_static_t fss_extended_write_long_trim_s = macro_f_string_static_t_initialize(FSS_EXTENDED_WRITE_long_trim_s, 0, FSS_EXTENDED_WRITE_long_trim_s_length); -#endif // _di_fss_extended_write_parameter_d_ - -#ifndef _di_fss_extended_write_setting_delete_ - f_status_t fss_extended_write_setting_delete(fss_extended_write_setting_t * const setting) { - - if (!setting) return F_status_set_error(F_parameter); - - return F_none; - } -#endif // _di_fss_extended_write_setting_delete_ - -#ifndef _di_fss_extended_write_setting_load_ - void fss_extended_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_write_setting_t * const setting) { - - if (!main || !setting) return; - - setting->flag = 0; - - // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); - - if (F_status_is_error(setting->status)) { - fss_extended_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true); - fss_extended_write_print_line_last_locked(setting, main->error); - - return; - } - - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_extended_write_parameter_no_color_e, fss_extended_write_parameter_light_e, fss_extended_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(setting->status)) { - fss_extended_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true); - fss_extended_write_print_line_last_locked(setting, main->error); - - return; - } - } - - if (main->parameters.array[fss_extended_write_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_extended_write_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_extended_write_parameter_verbosity_quiet_e, fss_extended_write_parameter_verbosity_error_e, fss_extended_write_parameter_verbosity_verbose_e, fss_extended_write_parameter_verbosity_debug_e, fss_extended_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); - - if (F_status_is_error(setting->status)) { - fss_extended_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true); - fss_extended_write_print_line_last_locked(setting, main->error); - - return; - } - } - } - - main->output.to.id = F_type_descriptor_output_d; - main->output.to.stream = F_type_output_d; - main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - - if (main->parameters.array[fss_extended_write_parameter_help_e].result & f_console_result_found_e) { - setting->flag |= fss_extended_write_main_flag_help_e; - - return; - } - - if (main->parameters.array[fss_extended_write_parameter_version_e].result & f_console_result_found_e) { - setting->flag |= fss_extended_write_main_flag_version_e; - - return; - } - - f_string_static_t * const args = main->parameters.arguments.array; - - if (main->parameters.array[fss_extended_write_parameter_strip_invalid_e].result & f_console_result_found_e) { - setting->flag |= fss_extended_write_main_flag_strip_invalid_e; - } - } -#endif // _di_fss_extended_write_setting_load_ - -#ifndef _di_fss_extended_write_setting_unload_ - f_status_t fss_extended_write_setting_unload(fll_program_data_t * const main, fss_extended_write_setting_t * const setting) { - - if (!main || !setting) return F_status_set_error(F_parameter); - - fss_extended_write_setting_delete(setting); - - return F_none; - } -#endif // _di_fss_extended_write_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_extended_write/c/common.h b/level_3/fss_extended_write/c/common.h deleted file mode 100644 index 26fc63f..0000000 --- a/level_3/fss_extended_write/c/common.h +++ /dev/null @@ -1,348 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Extended Write - * 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_extended_write_common_h -#define _fss_extended_write_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * The program version. - */ -#ifndef _di_fss_extended_write_program_version_s_ - #define FSS_EXTENDED_WRITE_program_version_major_s F_string_ascii_0_s - #define FSS_EXTENDED_WRITE_program_version_minor_s F_string_ascii_7_s - #define FSS_EXTENDED_WRITE_program_version_micro_s F_string_ascii_0_s - - #define FSS_EXTENDED_WRITE_program_version_major_s_length F_string_ascii_0_s_length - #define FSS_EXTENDED_WRITE_program_version_minor_s_length F_string_ascii_7_s_length - #define FSS_EXTENDED_WRITE_program_version_micro_s_length F_string_ascii_0_s_length - - #if !(defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length)) - #define FSS_EXTENDED_WRITE_program_version_nano_prefix_s - #define FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length 0 - #endif // !(defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length)) - - #if !(defined(FSS_EXTENDED_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_s_length)) - #define FSS_EXTENDED_WRITE_program_version_nano_s - #define FSS_EXTENDED_WRITE_program_version_nano_s_length 0 - #endif // !(defined(FSS_EXTENDED_WRITE_program_version_nano_s) && defined(FSS_EXTENDED_WRITE_program_version_nano_s_length)) - - #define FSS_EXTENDED_WRITE_program_version_s FSS_EXTENDED_WRITE_program_version_major_s F_string_ascii_period_s FSS_EXTENDED_WRITE_program_version_minor_s F_string_ascii_period_s FSS_EXTENDED_WRITE_program_version_micro_s FSS_EXTENDED_WRITE_program_version_nano_prefix_s FSS_EXTENDED_WRITE_program_version_nano_s - - #define FSS_EXTENDED_WRITE_program_version_s_length FSS_EXTENDED_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_EXTENDED_WRITE_program_version_micro_s_length + FSS_EXTENDED_WRITE_program_version_nano_prefix_s_length + FSS_EXTENDED_WRITE_program_version_nano_s_length - - extern const f_string_static_t fss_extended_write_program_version_s; -#endif // _di_fss_extended_write_program_version_s_ - -/** - * The program name. - */ -#ifndef _di_fss_extended_write_program_name_s_ - #define FSS_EXTENDED_WRITE_program_name_s "fss_extended_write" - #define FSS_EXTENDED_WRITE_program_name_long_s "FSS Extended Write" - - #define FSS_EXTENDED_WRITE_program_name_s_length 18 - #define FSS_EXTENDED_WRITE_program_name_long_s_length 18 - - extern const f_string_static_t fss_extended_write_program_name_s; - extern const f_string_static_t fss_extended_write_program_name_long_s; -#endif // _di_fss_extended_write_program_name_s_ - -/** - * The main program signal defines. - */ -#ifndef _di_fss_extended_write_d_ - #define fss_extended_write_signal_check_d 20000 -#endif // _di_fss_extended_write_d_ - -/** - * The main program pipe strings. - * - * fss_extended_write_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_extended_write_pipe_s_ - #define FSS_EXTENDED_WRITE_pipe_name_s "(pipe)" - - #define FSS_EXTENDED_WRITE_pipe_content_end_s "\f" - #define FSS_EXTENDED_WRITE_pipe_content_ignore_s "\v" - #define FSS_EXTENDED_WRITE_pipe_content_start_s "\b" - - #define FSS_EXTENDED_WRITE_pipe_name_s_length 6 - - #define FSS_EXTENDED_WRITE_pipe_content_end_s_length 1 - #define FSS_EXTENDED_WRITE_pipe_content_ignore_s_length 1 - #define FSS_EXTENDED_WRITE_pipe_content_start_s_length 1 - - extern const f_string_static_t fss_extended_write_pipe_name_s; - - extern const f_string_static_t fss_extended_write_pipe_content_end_s; - extern const f_string_static_t fss_extended_write_pipe_content_ignore_s; - extern const f_string_static_t fss_extended_write_pipe_content_start_s; -#endif // _di_fss_extended_write_pipe_s_ - -/** - * The main program parameters. - */ -#ifndef _di_fss_extended_write_parameter_d_ - #define FSS_EXTENDED_WRITE_short_file_s "f" - #define FSS_EXTENDED_WRITE_short_content_s "c" - #define FSS_EXTENDED_WRITE_short_double_s "d" - #define FSS_EXTENDED_WRITE_short_ignore_s "I" - #define FSS_EXTENDED_WRITE_short_object_s "o" - #define FSS_EXTENDED_WRITE_short_partial_s "p" - #define FSS_EXTENDED_WRITE_short_prepend_s "P" - #define FSS_EXTENDED_WRITE_short_single_s "s" - #define FSS_EXTENDED_WRITE_short_trim_s "T" - - #define FSS_EXTENDED_WRITE_long_file_s "file" - #define FSS_EXTENDED_WRITE_long_content_s "content" - #define FSS_EXTENDED_WRITE_long_double_s "double" - #define FSS_EXTENDED_WRITE_long_ignore_s "ignore" - #define FSS_EXTENDED_WRITE_long_object_s "object" - #define FSS_EXTENDED_WRITE_long_partial_s "partial" - #define FSS_EXTENDED_WRITE_long_prepend_s "prepend" - #define FSS_EXTENDED_WRITE_long_single_s "single" - #define FSS_EXTENDED_WRITE_long_trim_s "trim" - - #define FSS_EXTENDED_WRITE_short_file_s_length 1 - #define FSS_EXTENDED_WRITE_short_content_s_length 1 - #define FSS_EXTENDED_WRITE_short_double_s_length 1 - #define FSS_EXTENDED_WRITE_short_ignore_s_length 1 - #define FSS_EXTENDED_WRITE_short_object_s_length 1 - #define FSS_EXTENDED_WRITE_short_partial_s_length 1 - #define FSS_EXTENDED_WRITE_short_prepend_s_length 1 - #define FSS_EXTENDED_WRITE_short_single_s_length 1 - #define FSS_EXTENDED_WRITE_short_trim_s_length 1 - - #define FSS_EXTENDED_WRITE_long_file_s_length 4 - #define FSS_EXTENDED_WRITE_long_content_s_length 7 - #define FSS_EXTENDED_WRITE_long_double_s_length 6 - #define FSS_EXTENDED_WRITE_long_ignore_s_length 6 - #define FSS_EXTENDED_WRITE_long_object_s_length 6 - #define FSS_EXTENDED_WRITE_long_partial_s_length 7 - #define FSS_EXTENDED_WRITE_long_prepend_s_length 7 - #define FSS_EXTENDED_WRITE_long_single_s_length 6 - #define FSS_EXTENDED_WRITE_long_trim_s_length 4 - - extern const f_string_static_t fss_extended_write_short_file_s; - extern const f_string_static_t fss_extended_write_short_content_s; - extern const f_string_static_t fss_extended_write_short_double_s; - extern const f_string_static_t fss_extended_write_short_ignore_s; - extern const f_string_static_t fss_extended_write_short_object_s; - extern const f_string_static_t fss_extended_write_short_partial_s; - extern const f_string_static_t fss_extended_write_short_prepend_s; - extern const f_string_static_t fss_extended_write_short_single_s; - extern const f_string_static_t fss_extended_write_short_trim_s; - - extern const f_string_static_t fss_extended_write_long_file_s; - extern const f_string_static_t fss_extended_write_long_content_s; - extern const f_string_static_t fss_extended_write_long_double_s; - extern const f_string_static_t fss_extended_write_long_ignore_s; - extern const f_string_static_t fss_extended_write_long_object_s; - extern const f_string_static_t fss_extended_write_long_partial_s; - extern const f_string_static_t fss_extended_write_long_prepend_s; - extern const f_string_static_t fss_extended_write_long_single_s; - extern const f_string_static_t fss_extended_write_long_trim_s; - - enum { - fss_extended_write_parameter_help_e, - fss_extended_write_parameter_light_e, - fss_extended_write_parameter_dark_e, - fss_extended_write_parameter_no_color_e, - fss_extended_write_parameter_verbosity_quiet_e, - fss_extended_write_parameter_verbosity_error_e, - fss_extended_write_parameter_verbosity_normal_e, - fss_extended_write_parameter_verbosity_verbose_e, - fss_extended_write_parameter_verbosity_debug_e, - fss_extended_write_parameter_version_e, - fss_extended_write_parameter_line_first_no_e, - fss_extended_write_parameter_line_last_no_e, - - fss_extended_write_parameter_file_e, - fss_extended_write_parameter_content_e, - fss_extended_write_parameter_double_e, - fss_extended_write_parameter_ignore_e, - fss_extended_write_parameter_object_e, - fss_extended_write_parameter_partial_e, - fss_extended_write_parameter_prepend_e, - fss_extended_write_parameter_single_e, - fss_extended_write_parameter_trim_e, - }; // enum - - #define fss_extended_write_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ - \ - macro_f_console_parameter_t_initialize2(fss_extended_write_short_file_s.string, fss_extended_write_long_file_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_write_short_content_s.string, fss_extended_write_long_content_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_write_short_double_s.string, fss_extended_write_long_double_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_write_short_ignore_s.string, fss_extended_write_long_ignore_s.string, 0, 2, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_write_short_object_s.string, fss_extended_write_long_object_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_write_short_partial_s.string, fss_extended_write_long_partial_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_write_short_prepend_s.string, fss_extended_write_long_prepend_s.string, 0, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_write_short_single_s.string, fss_extended_write_long_single_s.string, 0, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize2(fss_extended_write_short_trim_s.string, fss_extended_write_long_trim_s.string, 0, 0, f_console_flag_normal_e), \ - } - - #define fss_extended_write_total_parameters_d 20 -#endif // _di_fss_extended_write_parameter_d_ - -/** - * Flags used to represent flags passed to the main function. - * - * fss_extended_write_main_flag_*_e: - * - none: No modes in use. - * - file_from: Using a specified source file. - * - file_to: Using a specified destination file. - * - help: Print help. - * - header: Enable printing of headers. - * - separate: Enable printing of separators. - * - strip_invalid: Using strip invalid character mode. - * - verify: Using verify mode. - * - version: Print version. - */ -#ifndef _di_fss_extended_write_main_flag_e_ - enum { - fss_extended_write_main_flag_none_e = 0x0, - fss_extended_write_main_flag_file_from_e = 0x1, - fss_extended_write_main_flag_file_to_e = 0x2, - fss_extended_write_main_flag_header_e = 0x4, - fss_extended_write_main_flag_help_e = 0x8, - fss_extended_write_main_flag_separate_e = 0x10, - fss_extended_write_main_flag_strip_invalid_e = 0x20, - fss_extended_write_main_flag_verify_e = 0x40, - fss_extended_write_main_flag_version_e = 0x80, - }; // enum -#endif // _di_fss_extended_write_main_flag_e_ - -/** - * The fss extended write 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. - * - * status: The main status code, generally used by the load settings and main functions. - * - * line_first: A string expected to represent either "\n" or NULL to allow for easy handling of when to print first new line or not. - * line_last: A string expected to represent either "\n" or NULL to allow for easy handling of when to print last new line or not. - */ -#ifndef _di_fss_extended_write_setting_t_ - typedef struct { - uint16_t flag; - - f_status_t status; - - f_string_static_t line_first; - f_string_static_t line_last; - } fss_extended_write_setting_t; - - #define fss_extended_write_setting_t_initialize \ - { \ - fss_extended_write_main_flag_none_e, \ - F_none, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ - } -#endif // _di_fss_extended_write_setting_t_ - -/** - * Delete the program main setting data. - * - * @param setting - * The program main setting data. - * - * This does not alter setting.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_fss_extended_write_setting_delete_ - extern f_status_t fss_extended_write_setting_delete(fss_extended_write_setting_t * const setting); -#endif // _di_fss_extended_write_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 retuns 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.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_extended_write_setting_load_ - extern void fss_extended_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_write_setting_t * const setting); -#endif // _di_fss_extended_write_setting_load_ - -/** - * Perform the standard program setting unload process. - * - * @param main - * The main program data. - * @param setting - * The main program settings. - * All buffers are deallocated. - * - * This does not alter setting.status. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: utf8_setting_delete(). - * - * @see utf8_setting_delete() - */ -#ifndef _di_fss_extended_write_setting_unload_ - extern f_status_t fss_extended_write_setting_unload(fll_program_data_t * const main, fss_extended_write_setting_t * const setting); -#endif // _di_fss_extended_write_setting_unload_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_extended_write_common_h diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c deleted file mode 100644 index 1641a28..0000000 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ /dev/null @@ -1,525 +0,0 @@ -#include "fss_extended_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_extended_write_main_ - f_status_t fss_extended_write_main(fll_program_data_t * const main, fss_extended_write_setting_t * const setting) { - - f_status_t status = F_none; - - // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); - if (F_status_is_error(status)) return; - - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_extended_write_parameter_no_color_e, fss_extended_write_parameter_light_e, fss_extended_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true); - - return; - } - } - - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_extended_write_parameter_verbosity_quiet_e, fss_extended_write_parameter_verbosity_error_e, fss_extended_write_parameter_verbosity_verbose_e, fss_extended_write_parameter_verbosity_debug_e, fss_extended_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); - - if (F_status_is_error(status)) { - fss_extended_write_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true); - fss_extended_write_print_line_last_locked(setting, main->error); - - return; - } - } - } - - f_string_static_t * const argv = main->parameters.arguments.array; - - status = F_none; - - if (main->parameters.array[fss_extended_write_parameter_help_e].result & f_console_result_found_e) { - fss_extended_write_print_help(setting, main->message); - - return status; - } - - if (main->parameters.array[fss_extended_write_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, fss_extended_write_program_version_s); - - return status; - } - - f_file_t output = f_file_t_initialize; - - output.id = F_type_descriptor_output_d; - output.stream = F_type_output_d; - output.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_extended_write_parameter_file_e].result & f_console_result_value_e) { - if (main->parameters.array[fss_extended_write_parameter_file_e].values.used > 1) { - if (main->error.verbosity > f_console_verbosity_quiet_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_extended_write_long_file_s, main->error.notable); - fl_print_format("%[' may only be specified once.%]%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 { - const f_array_length_t index = main->parameters.array[fss_extended_write_parameter_file_e].values.array[0]; - - output.id = -1; - output.stream = 0; - status = f_file_stream_open(argv[index], f_string_empty_s, &output); - - if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e); - } - } - } - else if (main->parameters.array[fss_extended_write_parameter_file_e].result & f_console_result_found_e) { - fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_extended_write_long_file_s); - status = F_status_set_error(F_parameter); - } - } - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_extended_write_parameter_object_e].locations.used || main->parameters.array[fss_extended_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_extended_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_extended_write_parameter_object_e].locations.used != main->parameters.array[fss_extended_write_parameter_object_e].values.used) { - fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_extended_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_extended_write_parameter_content_e].locations.used != main->parameters.array[fss_extended_write_parameter_content_e].values.used) { - fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_extended_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_extended_write_parameter_content_e].locations.used && !(main->parameters.array[fss_extended_write_parameter_partial_e].result & f_console_result_found_e)) { - fss_extended_write_error_parameter_at_least_once(main); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_extended_write_parameter_content_e].locations.used && main->parameters.array[fss_extended_write_parameter_partial_e].locations.used) { - if (main->parameters.array[fss_extended_write_parameter_content_e].result & f_console_result_value_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_extended_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter only allows either the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter or the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter, but not both.%]%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)) { - if (main->parameters.array[fss_extended_write_parameter_content_e].result & f_console_result_value_e) { - f_array_length_t location_object = main->parameters.array[fss_extended_write_parameter_object_e].locations.array[0]; - f_array_length_t location_content = main->parameters.array[fss_extended_write_parameter_content_e].locations.array[0]; - f_array_length_t location_sub_object = main->parameters.array[fss_extended_write_parameter_object_e].locations_sub.array[0]; - f_array_length_t location_sub_content = main->parameters.array[fss_extended_write_parameter_content_e].locations_sub.array[0]; - - if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QEach '%]", 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_extended_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter must be specified before a '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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 { - location_object = main->parameters.array[fss_extended_write_parameter_object_e].locations.array[main->parameters.array[fss_extended_write_parameter_object_e].locations.used - 1]; - location_content = main->parameters.array[fss_extended_write_parameter_content_e].locations.array[main->parameters.array[fss_extended_write_parameter_content_e].locations.used - 1]; - location_sub_object = main->parameters.array[fss_extended_write_parameter_object_e].locations_sub.array[main->parameters.array[fss_extended_write_parameter_object_e].locations_sub.used - 1]; - location_sub_content = main->parameters.array[fss_extended_write_parameter_content_e].locations_sub.array[main->parameters.array[fss_extended_write_parameter_content_e].locations_sub.used - 1]; - - if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QEach '%]", 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_extended_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter must have at least one '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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_extended_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_extended_write_parameter_content_e].locations.used != main->parameters.array[fss_extended_write_parameter_content_e].values.used) { - fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_normal_s, fss_extended_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_extended_write_parameter_partial_e].locations.used) { - fss_extended_write_error_parameter_at_least_once(main); - status = F_status_set_error(F_parameter); - } - } - } - else if (!(main->pipe & fll_program_data_pipe_input_e)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", 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_extended_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter with the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter.%]%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)) { - if (main->parameters.array[fss_extended_write_parameter_partial_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThis '%]", 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_extended_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter cannot be used when processing a pipe.%]%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)) { - if (main->parameters.array[fss_extended_write_parameter_prepend_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_extended_write_long_prepend_s, main->error.notable); - fl_print_format("%[' is specified, but no value is given.%]%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_extended_write_parameter_prepend_e].result & f_console_result_value_e) { - const f_array_length_t index = main->parameters.array[fss_extended_write_parameter_prepend_e].values.array[main->parameters.array[fss_extended_write_parameter_prepend_e].values.used - 1]; - - // Even though this standard does not utilize this parameter, provide the validation for consistency. - if (argv[index].used) { - f_string_range_t range = macro_f_string_range_t_initialize2(argv[index].used); - f_state_t state = f_state_t_initialize; - - for (; range.start < argv[index].used; ++range.start) { - - status = f_fss_is_space(state, argv[index], range); - if (F_status_is_error(status)) break; - - if (status == F_false) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - 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_extended_write_long_prepend_s, main->error.notable); - fl_print_format("%[' must only contain white space.%]%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); - - break; - } - } // for - } - else { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - 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_extended_write_long_prepend_s, main->error.notable); - fl_print_format("%[' must not be an empty 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)) { - if (main->parameters.array[fss_extended_write_parameter_ignore_e].result & f_console_result_found_e) { - if (main->error.verbosity > f_console_verbosity_quiet_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_extended_write_long_ignore_s, main->error.notable); - fl_print_format("%[' was specified, but no values were given.%]%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_extended_write_parameter_ignore_e].result & f_console_result_value_e) { - const f_array_length_t total_locations = main->parameters.array[fss_extended_write_parameter_ignore_e].locations.used; - const f_array_length_t total_arguments = main->parameters.array[fss_extended_write_parameter_ignore_e].values.used; - - if (total_locations * 2 > total_arguments) { - 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_extended_write_long_ignore_s, main->error.notable); - fl_print_format("%[' requires two values.%]%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); - } - } - } - - uint8_t quote = f_fss_quote_double_s; - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_extended_write_parameter_double_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_extended_write_parameter_single_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_extended_write_parameter_double_e].location < main->parameters.array[fss_extended_write_parameter_single_e].location) { - quote = f_fss_quote_single_s; - } - } - } - else if (main->parameters.array[fss_extended_write_parameter_single_e].result & f_console_result_found_e) { - quote = f_fss_quote_single_s; - } - } - - f_string_dynamic_t buffer = f_string_dynamic_t_initialize; - f_string_dynamics_t contents = f_string_dynamics_t_initialize; - - if (F_status_is_error_not(status)) { - f_string_dynamic_t escaped = f_string_dynamic_t_initialize; - - if (main->pipe & fll_program_data_pipe_input_e) { - status = fss_extended_write_process_pipe(main, output, quote, &buffer); - - if (F_status_is_error(status)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); - fl_print_format("%['.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } - } - } - - if (F_status_is_error_not(status)) { - if (main->parameters.array[fss_extended_write_parameter_partial_e].result & f_console_result_found_e) { - if (main->parameters.array[fss_extended_write_parameter_object_e].result & f_console_result_value_e) { - contents.used = 0; - - for (f_array_length_t i = 0; i < main->parameters.array[fss_extended_write_parameter_object_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_extended_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - status = fss_extended_write_process(main, output, quote, &argv[main->parameters.array[fss_extended_write_parameter_object_e].values.array[i]], 0, &buffer); - if (F_status_is_error(status)) break; - } // for - } - else { - status = f_string_dynamics_increase_by(main->parameters.array[fss_extended_write_parameter_content_e].values.used, &contents); - - if (status == F_array_too_large) { - status = F_status_set_error(status); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); - } - else { - f_array_length_t i = 0; - - for (; i < main->parameters.array[fss_extended_write_parameter_content_e].values.used; ++i) { - - contents.array[contents.used++] = argv[main->parameters.array[fss_extended_write_parameter_content_e].values.array[i]]; - } // for - - status = fss_extended_write_process(main, output, quote, 0, &contents, &buffer); - } - } - } - else { - f_array_length_t i = 0; - f_array_length_t j = 0; - f_array_length_t object_current = 0; - f_array_length_t object_next = 0; - f_array_length_t content_current = 0; - - for (; i < main->parameters.array[fss_extended_write_parameter_object_e].values.used; ++i) { - - if (!((++main->signal_check) % fss_extended_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - object_current = main->parameters.array[fss_extended_write_parameter_object_e].locations.array[i]; - - if (i + 1 < main->parameters.array[fss_extended_write_parameter_object_e].values.used) { - object_next = main->parameters.array[fss_extended_write_parameter_object_e].locations.array[i + 1]; - } - - contents.used = 0; - - for (; j < main->parameters.array[fss_extended_write_parameter_content_e].values.used; ++j) { - - content_current = main->parameters.array[fss_extended_write_parameter_content_e].locations.array[j]; - - if (i + 1 < main->parameters.array[fss_extended_write_parameter_object_e].values.used) { - if (content_current < object_current || content_current > object_next) break; - } - - status = f_string_dynamics_increase_by(F_fss_default_allocation_step_d, &contents); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); - - break; - } - - if (contents.array[contents.used].used) { - contents.array[contents.used].used = 0; - } - - status = f_string_dynamic_append(argv[main->parameters.array[fss_extended_write_parameter_content_e].values.array[j]], &contents.array[contents.used]); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); - - break; - } - - ++contents.used; - } // for - - if (F_status_is_error(status)) break; - - status = fss_extended_write_process(main, output, quote, &argv[main->parameters.array[fss_extended_write_parameter_object_e].values.array[i]], &contents, &buffer); - if (F_status_is_error(status)) break; - } // for - } - - if (F_status_is_error(status)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable); - fl_print_format("%['.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } - } - else if (main->error.verbosity > f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && !(main->parameters.array[fss_extended_write_parameter_file_e].result & f_console_result_found_e)) { - - // Ensure there is always a newline at the end, unless in quiet mode. - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } - } - - f_string_dynamic_resize(0, &escaped); - } - - if (main->parameters.array[fss_extended_write_parameter_file_e].result & f_console_result_value_e) { - f_file_stream_flush(output); - f_file_stream_close(&output); - } - - // Ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (main->error.verbosity > f_console_verbosity_quiet_e) { - if (F_status_is_error(status)) { - 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); - } - } - - f_string_dynamic_resize(0, &buffer); - f_string_dynamics_resize(0, &contents); - - return status; - } -#endif // _di_fss_extended_write_main_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_extended_write/c/fss_extended_write.h b/level_3/fss_extended_write/c/fss_extended_write.h deleted file mode 100644 index 8f1ea51..0000000 --- a/level_3/fss_extended_write/c/fss_extended_write.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * This program provides fss basic write functionality. - */ -#ifndef _fss_extended_write_h -#define _fss_extended_write_h - -// Libc includes. -#include -#include -#include -#include - -// FLL-0 includes. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// FLL-1 includes. -#include -#include -#include - -// FLL-2 includes. -#include -#include -#include -#include - -// FSS Extended Write 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.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_extended_write_main_ - extern f_status_t fss_extended_write_main(fll_program_data_t * const main, fss_extended_write_setting_t * const setting); -#endif // _di_fss_extended_write_main_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_extended_write_h diff --git a/level_3/fss_extended_write/c/main.c b/level_3/fss_extended_write/c/main.c deleted file mode 100644 index c6cc6f3..0000000 --- a/level_3/fss_extended_write/c/main.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "fss_extended_write.h" - -int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - - fll_program_data_t data = fll_program_data_t_initialize; - fss_extended_write_setting_t setting = fss_extended_write_setting_t_initialize; - - f_console_parameter_t parameters[] = fss_extended_write_console_parameter_t_initialize; - data.parameters.array = parameters; - data.parameters.used = fss_extended_write_total_parameters_d; - data.environment = envp; - - if (f_pipe_input_exists()) { - data.pipe = fll_program_data_pipe_input_e; - } - - fll_program_standard_set_up(&data); - - { - const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - - fss_extended_write_setting_load(arguments, &data, &setting); - } - - fss_extended_write_main(&data, &setting); - - fss_extended_write_setting_unload(&data, &setting); - - fll_program_data_delete(&data); - - fll_program_standard_set_down(&data); - - return F_status_is_error(status) ? 1 : 0; -} diff --git a/level_3/fss_extended_write/c/print.c b/level_3/fss_extended_write/c/print.c deleted file mode 100644 index 3993d46..0000000 --- a/level_3/fss_extended_write/c/print.c +++ /dev/null @@ -1,122 +0,0 @@ -#include "fss_extended_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_extended_write_print_help_ - f_status_t fss_extended_write_print_help(fss_extended_write_setting_t * const setting, const fl_print_t print) { - - f_file_stream_lock(print.to); - - f_print_dynamic_raw(setting->line_first, print.to); - - fll_program_print_help_header(print, fss_extended_write_program_name_long_s, fss_extended_write_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_extended_write_short_file_s, fss_extended_write_long_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a file to send data to."); - fll_program_print_help_option(print, fss_extended_write_short_content_s, fss_extended_write_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The Content to write."); - fll_program_print_help_option(print, fss_extended_write_short_double_s, fss_extended_write_long_double_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use double quotes (default)."); - fll_program_print_help_option(print, fss_extended_write_short_ignore_s, fss_extended_write_long_ignore_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Ignore a given range within a Content."); - fll_program_print_help_option(print, fss_extended_write_short_object_s, fss_extended_write_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The Object to write."); - fll_program_print_help_option(print, fss_extended_write_short_partial_s, fss_extended_write_long_partial_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Do not write end of Object/Content character."); - fll_program_print_help_option(print, fss_extended_write_short_prepend_s, fss_extended_write_long_prepend_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Prepend the given white space characters to the start of each multi-line Content."); - fll_program_print_help_option(print, fss_extended_write_short_single_s, fss_extended_write_long_single_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use single quotes."); - fll_program_print_help_option(print, fss_extended_write_short_trim_s, fss_extended_write_long_trim_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Trim Object names."); - - 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_extended_write_program_name_s, f_string_empty_s); - - fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The pipe uses the Form Feed character '%[\\f%]' (%[U+000C%]) to designate the end of the last Content.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The pipe uses the Vertical Line character '%[\\v%]' (%[U+000B%]) is used to ignore a Content range, which does nothing in this program.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable); - fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" The end of the pipe represents the end of any Object or Content.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" The FSS-0001 (Extended) specification does not support multi-line Content, therefore the parameter '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_extended_write_long_prepend_s, print.set->notable); - fl_print_format(" does nothing.%r%r", print.to, f_string_eol_s, f_string_eol_s); - - fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_extended_write_long_ignore_s, print.set->notable, f_string_eol_s); - fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s); - - f_print_dynamic_raw(setting->line_last, print.to); - - f_file_stream_flush(print.to); - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fss_extended_write_print_help_ - -#ifndef _di_fss_extended_write_print_line_first_locked_ - f_status_t fss_extended_write_print_line_first_locked(fss_extended_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_extended_write_print_line_first_locked_ - -#ifndef _di_fss_extended_write_print_line_first_unlocked_ - f_status_t fss_extended_write_print_line_first_unlocked(fss_extended_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_extended_write_print_line_first_unlocked_ - -#ifndef _di_fss_extended_write_print_line_last_locked_ - f_status_t fss_extended_write_print_line_last_locked(fss_extended_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - if (setting->flag & (fss_extended_write_main_flag_verify_e | fss_extended_write_main_flag_file_to_e)) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_extended_write_print_line_last_locked_ - -#ifndef _di_fss_extended_write_print_line_last_unlocked_ - f_status_t fss_extended_write_print_line_last_unlocked(fss_extended_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - if (setting->flag & (fss_extended_write_main_flag_verify_e | fss_extended_write_main_flag_file_to_e)) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_extended_write_print_line_last_unlocked_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_extended_write/c/print.h b/level_3/fss_extended_write/c/print.h deleted file mode 100644 index eb5f777..0000000 --- a/level_3/fss_extended_write/c/print.h +++ /dev/null @@ -1,124 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: UTF-8 - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _fss_extended_write_print_h -#define _fss_extended_write_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print help. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * - * @return - * F_none on success. - */ -#ifndef _di_fss_extended_write_print_help_ - extern f_status_t fss_extended_write_print_help(fss_extended_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_write_print_help_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_write_print_line_first_locked_ - extern f_status_t fss_extended_write_print_line_first_locked(fss_extended_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_write_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_write_print_line_first_unlocked_ - extern f_status_t fss_extended_write_print_line_first_unlocked(fss_extended_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_write_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_write_print_line_last_locked_ - extern f_status_t fss_extended_write_print_line_last_locked(fss_extended_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_write_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_write_print_line_last_unlocked_ - extern f_status_t fss_extended_write_print_line_last_unlocked(fss_extended_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_write_print_line_last_unlocked_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _fss_extended_write_print_h diff --git a/level_3/fss_extended_write/c/private-common.c b/level_3/fss_extended_write/c/private-common.c deleted file mode 100644 index 635db9c..0000000 --- a/level_3/fss_extended_write/c/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_extended_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_extended_write/c/private-common.h b/level_3/fss_extended_write/c/private-common.h deleted file mode 100644 index d7617be..0000000 --- a/level_3/fss_extended_write/c/private-common.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Extended Write - * 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. - * - * extended_write_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. - */ -#ifndef _di_fss_extended_write_common_ - #define fss_extended_write_common_allocation_large_d 2048 - #define fss_extended_write_common_allocation_small_d 128 -#endif // _di_fss_extended_write_common_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_common_h diff --git a/level_3/fss_extended_write/c/private-write.c b/level_3/fss_extended_write/c/private-write.c deleted file mode 100644 index f25d96d..0000000 --- a/level_3/fss_extended_write/c/private-write.c +++ /dev/null @@ -1,375 +0,0 @@ -#include "fss_extended_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fss_extended_write_error_parameter_at_least_once_print_ - void fss_extended_write_error_parameter_at_least_once(fll_program_data_t * const main) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) { - return; - } - - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QMust specify the '%]", 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_extended_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[%r%r%]", main->error.to, main->error.notable, f_console_symbol_long_normal_s, fss_extended_write_long_partial_s, main->error.notable); - fl_print_format("%[' parameter.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_extended_write_error_parameter_at_least_once_print_ - -#ifndef _di_fss_extended_write_error_parameter_value_missing_print_ - void fss_extended_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) { - return; - } - - 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, symbol, parameter, main->error.notable); - fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_extended_write_error_parameter_value_missing_print_ - -#ifndef _di_fss_extended_write_error_parameter_unsupported_eol_print_ - void fss_extended_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) { - return; - } - - f_file_stream_lock(main->error.to); - - fl_print_format("%r%[%QThe FSS-0001 (Extended) standard does not support end of line character '%]", main->error.to, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[\\n%]", main->error.to, main->error.notable, main->error.notable); - fl_print_format("%[' (%]", main->error.to, main->error.context, main->error.context); - fl_print_format("%[U+000A%]", main->error.to, main->error.notable, main->error.notable); - fl_print_format("%[) in objects.%]%r", main->error.to, main->error.context, main->error.context, f_string_eol_s); - - f_file_stream_unlock(main->error.to); - } -#endif // _di_fss_extended_write_error_parameter_unsupported_eol_print_ - -#ifndef _di_fss_extended_write_process_ - f_status_t fss_extended_write_process(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) { - - f_status_t status = F_none; - f_state_t state = macro_f_state_t_initialize(fss_extended_write_common_allocation_large_d, fss_extended_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); - f_string_range_t range = f_string_range_t_initialize; - - if (object) { - uint8_t complete = f_fss_complete_none_e; - - if (object->used) { - range.start = 0; - range.stop = object->used - 1; - } - else { - range.start = 1; - range.stop = 0; - } - - if (contents && contents->used) { - if (main->parameters.array[fss_extended_write_parameter_trim_e].result & f_console_result_found_e) { - complete = f_fss_complete_full_trim_e; - } - else { - complete = f_fss_complete_full_e; - } - } - - status = fl_fss_extended_object_write(*object, quote, complete, state, &range, buffer); - - if (F_status_set_fine(status) == F_none_eol) { - fss_extended_write_error_parameter_unsupported_eol_print(main); - - return F_status_set_error(F_support_not); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fl_fss_extended_object_write", F_true); - - return F_status_set_error(status); - } - } - - if (contents) { - if (contents->used) { - for (f_array_length_t i = 0; i < contents->used; ++i) { - - if (contents->array[i].used) { - range.start = 0; - range.stop = contents->array[i].used - 1; - } - else { - range.start = 1; - range.stop = 0; - } - - status = fl_fss_extended_content_write(contents->array[i], quote, i + 1 < contents->used ? f_fss_complete_next_e : f_fss_complete_end_e, state, &range, buffer); - - if (F_status_set_fine(status) == F_none_eol) { - fss_extended_write_error_parameter_unsupported_eol_print(main); - - return F_status_set_error(F_support_not); - } - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fl_fss_extended_content_write", F_true); - - return F_status_set_error(status); - } - } // for - } - } - else if (!object) { - status = f_string_dynamic_append(f_string_eol_s, buffer); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); - - return status; - } - } - - fll_print_dynamic(*buffer, output); - - buffer->used = 0; - - return status; - } -#endif // _di_fss_extended_write_process_ - -#ifndef _di_fss_extended_write_process_pipe_ - f_status_t fss_extended_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, f_string_dynamic_t *buffer) { - - f_status_t status = F_none; - f_status_t status_pipe = F_none; - - f_file_t input = f_file_t_initialize; - - input.id = F_type_descriptor_input_d; - input.size_read = 2048; - - f_array_length_t i = 0; - - f_array_length_t total = 0; - f_string_range_t range = f_string_range_t_initialize; - - f_string_dynamic_t block = f_string_dynamic_t_initialize; - f_string_dynamic_t object = f_string_dynamic_t_initialize; - f_string_dynamics_t contents = f_string_dynamics_t_initialize; - - // 0x0 = start new object/content set, 0x1 = processing object, 0x2 = new individual content, 0x3 = processing content, 0x4 = end object/content set. - uint8_t state = 0; - - for (;;) { - - if (!((++main->signal_check) % fss_extended_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - - status = F_status_set_error(F_interrupt); - - break; - } - - main->signal_check = 0; - } - - if (range.start > range.stop) { - if (status_pipe == F_none_eof) break; - - block.used = 0; - - status_pipe = f_file_read_block(input, &block); - - if (F_status_is_error(status_pipe)) { - fll_error_print(main->error, F_status_set_fine(status_pipe), "f_file_read_block", F_true); - - status_pipe = F_status_set_error(F_pipe); - break; - } - - if (!block.used) break; - - range.start = 0; - range.stop = block.used - 1; - } - - if (!state || state == 0x1) { - if (!state) { - if (contents.used) { - for (i = 0; i < contents.used; ++i) { - contents.array[i].used = 0; - } // for - } - - object.used = 0; - contents.used = 0; - - state = 0x1; - } - - if (object.used + block.used > object.size) { - status = f_string_dynamic_increase_by(block.used, &object); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); - break; - } - } - - for (; range.start <= range.stop; ++range.start) { - - if (block.string[range.start] == fss_extended_write_pipe_content_start_s.string[0]) { - state = 0x2; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_extended_write_pipe_content_end_s.string[0]) { - state = 0x4; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_extended_write_pipe_content_ignore_s.string[0]) { - - // This is not used by objects. - continue; - } - - object.string[object.used++] = block.string[range.start]; - } // for - - if (F_status_is_error(status)) break; - - // If the start of content was not found, then fetch the next block. - if (state == 0x1) continue; - - // If the end of the current block is reached, fetch the next block. - if (range.start > range.stop) continue; - } - - if (state == 0x2) { - if (contents.used + 1 > contents.size) { - status = f_string_dynamics_increase_by(F_fss_default_allocation_step_d, &contents); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); - break; - } - } - - state = 0x3; - ++contents.used; - } - - if (state == 0x3) { - if (range.start <= range.stop) { - total = (range.stop - range.start) + 1; - } - else { - total = 0; - } - - if (total) { - for (; range.start <= range.stop; ++range.start) { - - if (block.string[range.start] == fss_extended_write_pipe_content_start_s.string[0]) { - if (contents.used + 1 > contents.size) { - status = f_string_dynamics_increase_by(F_fss_default_allocation_step_d, &contents); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true); - - break; - } - } - - ++contents.used; - - continue; - } - - if (block.string[range.start] == fss_extended_write_pipe_content_end_s.string[0]) { - state = 0x4; - ++range.start; - - break; - } - - if (block.string[range.start] == fss_extended_write_pipe_content_ignore_s.string[0]) { - - // This is not used by this program. - continue; - } - - if (F_status_set_fine(status) == F_none_eol) { - fss_extended_write_error_parameter_unsupported_eol_print(main); - - status = F_status_set_error(F_support_not); - - break; - } - - if (contents.array[contents.used - 1].used + 1 > contents.array[contents.used - 1].size) { - status = f_string_dynamic_increase_by(F_fss_default_allocation_step_d, &contents.array[contents.used - 1]); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); - - break; - } - } - - contents.array[contents.used - 1].string[contents.array[contents.used - 1].used++] = block.string[range.start]; - } // for - - if (F_status_is_error(status)) break; - } - else { - state = 0x4; - } - } - - if (state == 0x4) { - status = fss_extended_write_process(main, output, quote, &object, &contents, buffer); - if (F_status_is_error(status)) break; - - state = 0; - } - } // for - - // If the pipe ended before finishing, then attempt to wrap up. - if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) { - status = fss_extended_write_process(main, output, quote, &object, &contents, buffer); - } - - f_string_dynamic_resize(0, &block); - f_string_dynamic_resize(0, &object); - f_string_dynamics_resize(0, &contents); - - return status; - } -#endif // _di_fss_extended_write_process_pipe_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_extended_write/c/private-write.h b/level_3/fss_extended_write/c/private-write.h deleted file mode 100644 index e5ebb79..0000000 --- a/level_3/fss_extended_write/c/private-write.h +++ /dev/null @@ -1,113 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_write_h -#define _PRIVATE_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Print an message about the object and content parameters not being specified the correct number of times. - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_extended_write_error_parameter_at_least_once_print_ - void fss_extended_write_error_parameter_at_least_once(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_write_error_parameter_at_least_once_print_ - -/** - * Print an error message about a parameter missing a value. - * - * @param main - * The main program data. - * @param symbol - * The console symbol, such as "--" in "--help". - * @param parameter - * The parameter name, such as "help" in "--help". - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_extended_write_error_parameter_value_missing_print_ - void fss_extended_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_write_error_parameter_value_missing_print_ - -/** - * Print an error message about a parameter a New Line character '\n' (U+000A) being unsupported. - * - * @param main - * The main program data. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_extended_write_error_parameter_unsupported_eol_print_ - void fss_extended_write_error_parameter_unsupported_eol_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_write_error_parameter_unsupported_eol_print_ - -/** - * Process a given object and content, printing the FSS if valid or an error if invalid. - * - * @param main - * The main program data. - * @param output - * The file to output to. - * @param quote - * The quote character to use. - * This is either single our double quote. - * @param object - * A pointer to the object to validate and print. - * Set pointer address to 0 to not use. - * @param content - * A pointer to the content to escape and print. - * Set pointer address to 0 to not use. - * @param buffer - * The buffer array used as a cache to construct the output before printing. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_extended_write_process_ - extern f_status_t fss_extended_write_process(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, const f_string_static_t *object, const f_string_statics_t *contents, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_write_process_ - -/** - * Process the pipe, reading from the pipe and writing to the output. - * - * @param main - * The main program data. - * @param output - * The file to output to. - * @param quote - * The quote character to use. - * This is either single our double quote. - * @param buffer - * The buffer array used as a cache to construct the output before printing. - * - * @return - * F_none on success. - * F_failure (with error bit) for any other failure. - */ -#ifndef _di_fss_extended_write_process_pipe_ - extern f_status_t fss_extended_write_process_pipe(fll_program_data_t * const main, const f_file_t output, const uint8_t quote, f_string_dynamic_t *buffer) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_write_process_pipe_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_write_h diff --git a/level_3/fss_extended_write/data/build/defines b/level_3/fss_extended_write/data/build/defines deleted file mode 100644 index c665317..0000000 --- a/level_3/fss_extended_write/data/build/defines +++ /dev/null @@ -1,2 +0,0 @@ -# fss-0000 - diff --git a/level_3/fss_extended_write/data/build/dependencies b/level_3/fss_extended_write/data/build/dependencies deleted file mode 100644 index aa10ae3..0000000 --- a/level_3/fss_extended_write/data/build/dependencies +++ /dev/null @@ -1,27 +0,0 @@ -# fss-0000 - -f_type -f_status -f_memory -f_type_array -f_string -f_utf -f_color -f_console -f_conversion -f_directory -f_environment -f_file -f_fss -f_pipe -f_print -f_signal -fl_conversion -fl_fss -fl_print -fl_string -fll_error -fll_file -fll_fss -fll_print -fll_program diff --git a/level_3/fss_extended_write/data/build/fakefile b/level_3/fss_extended_write/data/build/fakefile deleted file mode 100644 index 5328059..0000000 --- a/level_3/fss_extended_write/data/build/fakefile +++ /dev/null @@ -1,11 +0,0 @@ -# fss-0005 iki-0002 - -settings: - fail exit - modes individual level monolithic clang test - - environment PATH LD_LIBRARY_PATH - -main: - - build diff --git a/level_3/fss_extended_write/data/build/settings b/level_3/fss_extended_write/data/build/settings deleted file mode 100644 index 22315b9..0000000 --- a/level_3/fss_extended_write/data/build/settings +++ /dev/null @@ -1,65 +0,0 @@ -# fss-0001 - -build_name fss_extended_write - -version_major 0 -version_minor 7 -version_micro 0 -version_file micro -version_target minor - -modes individual level monolithic clang test -modes_default monolithic - -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 -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_status_string -lf_string -lf_type_array -lf_utf -build_libraries-level -lfll_2 -lfll_1 -lfll_0 -build_libraries-monolithic -lfll - -build_sources_library fss_extended_write.c common.c print.c private-common.c private-write.c - -build_sources_program main.c - -build_sources_headers fss_extended_write.h common.h print.h - -build_script yes -build_shared yes -build_static no - -path_headers program/fss_extended_write -path_library_script script -path_library_shared shared -path_library_static static -path_object_script script -path_object_shared shared -path_object_static static -path_program_script script -path_program_shared shared -path_program_static static - -has_path_standard yes -preserve_path_headers yes - -search_exclusive yes -search_shared yes -search_static yes - -environment PATH LD_LIBRARY_PATH - -#defines -D_di_libcap_ -D_di_thread_support_ -defines -D_libcap_legacy_only_ -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-clang -Wno-logical-op-parentheses -flags-test -O0 -fstack-protector -Wall -flags-coverage -O0 --coverage -fprofile-abs-path -fprofile-dir=build/coverage/ - -flags_library -fPIC -flags_object -fPIC -flags_program -fPIE