From 4356454eb65a4b294e436370508bf6c4297e3917 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 10 Dec 2022 11:28:35 -0600 Subject: [PATCH] Update: Finish updating fss_write. Remove the unused files. Simplify the processing callbacks using ternary operators. Resolve the void_setting to the specific setting for easier to read code at the cost of allocation more memory (1 memory address variable per function). Implement the ignore functionality. Make sure the multiple Content is supported where appropriate. The flags must not be reset at the start of the setting load so that main.c programs can pre-fill the flags. Add all of the supported write program setting files. Other miscellaneous changes and fixes. The pipe data is lacking and will need future reviews and probably will need fixes. The original fss_*_write pipe data is also lacking so I feel that it is fine to leave it alone for now to be addressed later on. --- level_3/fss_write/c/basic/fss_write.c | 115 +++++----- level_3/fss_write/c/basic/main.c | 8 +- level_3/fss_write/c/basic/print.c | 1 - level_3/fss_write/c/basic/private-common.c | 10 - level_3/fss_write/c/basic/private-common.h | 19 -- level_3/fss_write/c/basic/private-print.c | 11 - level_3/fss_write/c/basic/private-print.h | 19 -- level_3/fss_write/c/basic/private-write.c | 11 - level_3/fss_write/c/basic/private-write.h | 19 -- level_3/fss_write/c/basic_list/fss_write.c | 115 +++++----- level_3/fss_write/c/basic_list/main.c | 10 +- level_3/fss_write/c/basic_list/print.c | 1 - level_3/fss_write/c/basic_list/private-common.c | 10 - level_3/fss_write/c/basic_list/private-common.h | 19 -- level_3/fss_write/c/basic_list/private-print.c | 11 - level_3/fss_write/c/basic_list/private-print.h | 19 -- level_3/fss_write/c/basic_list/private-write.c | 11 - level_3/fss_write/c/basic_list/private-write.h | 19 -- level_3/fss_write/c/embedded_list/fss_write.c | 118 +++++----- level_3/fss_write/c/embedded_list/main.c | 11 +- level_3/fss_write/c/embedded_list/print.c | 1 - level_3/fss_write/c/embedded_list/private-common.c | 10 - level_3/fss_write/c/embedded_list/private-common.h | 19 -- level_3/fss_write/c/embedded_list/private-print.c | 11 - level_3/fss_write/c/embedded_list/private-print.h | 19 -- level_3/fss_write/c/embedded_list/private-write.c | 11 - level_3/fss_write/c/embedded_list/private-write.h | 19 -- level_3/fss_write/c/extended/fss_write.c | 130 +++++------ level_3/fss_write/c/extended/main.c | 15 +- level_3/fss_write/c/extended/print.c | 1 - level_3/fss_write/c/extended/private-common.c | 10 - level_3/fss_write/c/extended/private-common.h | 19 -- level_3/fss_write/c/extended/private-print.c | 11 - level_3/fss_write/c/extended/private-print.h | 19 -- level_3/fss_write/c/extended/private-write.c | 11 - level_3/fss_write/c/extended/private-write.h | 19 -- level_3/fss_write/c/extended_list/fss_write.c | 98 ++++----- level_3/fss_write/c/extended_list/main.c | 14 +- level_3/fss_write/c/extended_list/print.c | 1 - level_3/fss_write/c/extended_list/private-common.c | 10 - level_3/fss_write/c/extended_list/private-common.h | 19 -- level_3/fss_write/c/extended_list/private-print.c | 11 - level_3/fss_write/c/extended_list/private-print.h | 19 -- level_3/fss_write/c/extended_list/private-write.c | 11 - level_3/fss_write/c/extended_list/private-write.h | 19 -- level_3/fss_write/c/main/common.c | 4 +- level_3/fss_write/c/main/common.h | 5 - level_3/fss_write/c/main/fss_write.c | 174 ++++++++------- level_3/fss_write/c/main/fss_write.h | 9 - level_3/fss_write/c/main/main.c | 3 +- level_3/fss_write/c/main/print.c | 1 - level_3/fss_write/c/main/private-common.c | 10 - level_3/fss_write/c/main/private-common.h | 19 -- level_3/fss_write/c/main/private-write.c | 11 - level_3/fss_write/c/main/private-write.h | 19 -- level_3/fss_write/c/payload/fss_write.c | 240 ++++++++++++--------- level_3/fss_write/c/payload/fss_write.h | 3 - level_3/fss_write/c/payload/main.c | 1 + level_3/fss_write/c/payload/print.c | 1 - level_3/fss_write/c/payload/private-common.c | 10 - level_3/fss_write/c/payload/private-common.h | 19 -- level_3/fss_write/c/payload/private-print.c | 11 - level_3/fss_write/c/payload/private-print.h | 19 -- level_3/fss_write/c/payload/private-write.c | 11 - level_3/fss_write/c/payload/private-write.h | 19 -- level_3/fss_write/data/build/fakefile | 32 +-- level_3/fss_write/data/build/settings | 28 +-- level_3/fss_write/data/build/settings.basic | 56 +++++ level_3/fss_write/data/build/settings.basic_list | 56 +++++ .../fss_write/data/build/settings.embedded_list | 56 +++++ level_3/fss_write/data/build/settings.extended | 56 +++++ .../fss_write/data/build/settings.extended_list | 56 +++++ 72 files changed, 828 insertions(+), 1185 deletions(-) delete mode 100644 level_3/fss_write/c/basic/private-common.c delete mode 100644 level_3/fss_write/c/basic/private-common.h delete mode 100644 level_3/fss_write/c/basic/private-print.c delete mode 100644 level_3/fss_write/c/basic/private-print.h delete mode 100644 level_3/fss_write/c/basic/private-write.c delete mode 100644 level_3/fss_write/c/basic/private-write.h delete mode 100644 level_3/fss_write/c/basic_list/private-common.c delete mode 100644 level_3/fss_write/c/basic_list/private-common.h delete mode 100644 level_3/fss_write/c/basic_list/private-print.c delete mode 100644 level_3/fss_write/c/basic_list/private-print.h delete mode 100644 level_3/fss_write/c/basic_list/private-write.c delete mode 100644 level_3/fss_write/c/basic_list/private-write.h delete mode 100644 level_3/fss_write/c/embedded_list/private-common.c delete mode 100644 level_3/fss_write/c/embedded_list/private-common.h delete mode 100644 level_3/fss_write/c/embedded_list/private-print.c delete mode 100644 level_3/fss_write/c/embedded_list/private-print.h delete mode 100644 level_3/fss_write/c/embedded_list/private-write.c delete mode 100644 level_3/fss_write/c/embedded_list/private-write.h delete mode 100644 level_3/fss_write/c/extended/private-common.c delete mode 100644 level_3/fss_write/c/extended/private-common.h delete mode 100644 level_3/fss_write/c/extended/private-print.c delete mode 100644 level_3/fss_write/c/extended/private-print.h delete mode 100644 level_3/fss_write/c/extended/private-write.c delete mode 100644 level_3/fss_write/c/extended/private-write.h delete mode 100644 level_3/fss_write/c/extended_list/private-common.c delete mode 100644 level_3/fss_write/c/extended_list/private-common.h delete mode 100644 level_3/fss_write/c/extended_list/private-print.c delete mode 100644 level_3/fss_write/c/extended_list/private-print.h delete mode 100644 level_3/fss_write/c/extended_list/private-write.c delete mode 100644 level_3/fss_write/c/extended_list/private-write.h delete mode 100644 level_3/fss_write/c/main/private-common.c delete mode 100644 level_3/fss_write/c/main/private-common.h delete mode 100644 level_3/fss_write/c/main/private-write.c delete mode 100644 level_3/fss_write/c/main/private-write.h delete mode 100644 level_3/fss_write/c/payload/private-common.c delete mode 100644 level_3/fss_write/c/payload/private-common.h delete mode 100644 level_3/fss_write/c/payload/private-print.c delete mode 100644 level_3/fss_write/c/payload/private-print.h delete mode 100644 level_3/fss_write/c/payload/private-write.c delete mode 100644 level_3/fss_write/c/payload/private-write.h create mode 100644 level_3/fss_write/data/build/settings.basic create mode 100644 level_3/fss_write/data/build/settings.basic_list create mode 100644 level_3/fss_write/data/build/settings.embedded_list create mode 100644 level_3/fss_write/data/build/settings.extended create mode 100644 level_3/fss_write/data/build/settings.extended_list diff --git a/level_3/fss_write/c/basic/fss_write.c b/level_3/fss_write/c/basic/fss_write.c index 92f6048..57c01c3 100644 --- a/level_3/fss_write/c/basic/fss_write.c +++ b/level_3/fss_write/c/basic/fss_write.c @@ -1,6 +1,4 @@ #include "fss_write.h" -#include "private-common.h" -#include "private-write.h" #include "../main/fss_write.h" #ifdef __cplusplus @@ -8,39 +6,32 @@ extern "C" { #endif #ifndef _di_fss_write_basic_process_content_ - void fss_write_basic_process_content(fll_program_data_t * const main, void * const setting, const bool last) { - - if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { - macro_fss_write_setting(setting)->status = fl_fss_basic_content_write( - *macro_fss_write_setting(setting)->content, - f_fss_complete_none_e, // @fixme each of these needs to have "partial", "trim", etc.. - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - else { - macro_fss_write_setting(setting)->status = fl_fss_basic_content_write( - *macro_fss_write_setting(setting)->content, - (macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } + void fss_write_basic_process_content(fll_program_data_t * const main, void * const void_setting, const bool last) { + + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + + setting->status = fl_fss_basic_content_write( + *setting->content, + (setting->flag & fss_write_flag_partial_e) + ? f_fss_complete_partial_e + : f_fss_complete_full_e, + setting->state, + &setting->range, + &setting->buffer + ); - if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { - macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); + if (F_status_set_fine(setting->status) == F_none_eol) { + setting->status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); - fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); - fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); + fss_write_print_line_first_locked(setting, main->error); + fss_write_print_error_unsupported_eol(setting, main->error); + fss_write_print_line_last_locked(setting, main->error); return; } - if (F_status_is_error(macro_fss_write_setting(setting)->status)) { - fss_write_print_error(macro_fss_write_setting(setting), main->error, "fl_fss_basic_content_write"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "fl_fss_basic_content_write"); return; } @@ -50,50 +41,44 @@ extern "C" { #ifndef _di_fss_write_basic_process_help_ void fss_write_basic_process_help(fll_program_data_t * const main, void * const setting) { - fss_write_basic_print_help(macro_fss_write_setting(setting), main->message); + fss_write_basic_print_help(setting, main->message); } #endif // _di_fss_write_basic_process_help_ #ifndef _di_fss_write_basic_process_object_ - void fss_write_basic_process_object(fll_program_data_t * const main, void * const setting) { - - if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { - macro_fss_write_setting(setting)->status = fl_fss_basic_object_write( - *macro_fss_write_setting(setting)->object, - macro_fss_write_setting(setting)->quote.used - ? macro_fss_write_setting(setting)->quote.string[0] - : f_fss_quote_double_s.string[0], - f_fss_complete_none_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - else { - macro_fss_write_setting(setting)->status = fl_fss_basic_object_write( - *macro_fss_write_setting(setting)->object, - macro_fss_write_setting(setting)->quote.used - ? macro_fss_write_setting(setting)->quote.string[0] - : f_fss_quote_double_s.string[0], - (macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - - if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { - macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); - - fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); - fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); - fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); + void fss_write_basic_process_object(fll_program_data_t * const main, void * const void_setting) { + + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + + setting->status = fl_fss_basic_object_write( + *setting->object, + setting->quote.used + ? setting->quote.string[0] + : f_fss_quote_double_s.string[0], + (setting->flag & fss_write_flag_partial_e) + ? (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_partial_trim_e + : f_fss_complete_partial_e + : (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_full_trim_e + : f_fss_complete_full_e, + setting->state, + &setting->range, + &setting->buffer + ); + + if (F_status_set_fine(setting->status) == F_none_eol) { + setting->status = F_status_set_error(F_support_not); + + fss_write_print_line_first_locked(setting, main->error); + fss_write_print_error_unsupported_eol(setting, main->error); + fss_write_print_line_last_locked(setting, main->error); return; } - if (F_status_is_error(macro_fss_write_setting(setting)->status)) { - fss_write_print_error(macro_fss_write_setting(setting), main->error, "fl_fss_basic_object_write"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "fl_fss_basic_object_write"); } } #endif // _di_fss_write_basic_process_object_ diff --git a/level_3/fss_write/c/basic/main.c b/level_3/fss_write/c/basic/main.c index c329c3c..2037ba2 100644 --- a/level_3/fss_write/c/basic/main.c +++ b/level_3/fss_write/c/basic/main.c @@ -1,18 +1,20 @@ #include "fss_write.h" +#include "../main/fss_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_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; + setting.standard = fss_write_basic_standard_s; setting.program_name = &fss_write_basic_program_name_s; setting.program_name_long = &fss_write_basic_program_name_long_s; setting.process_content = &fss_write_basic_process_content; setting.process_help = &fss_write_basic_process_help; - setting.process_normal = &fss_write_basic_process_normal; + setting.process_normal = &fss_write_process_normal; setting.process_object = &fss_write_basic_process_object; setting.process_pipe = &fss_write_process_pipe; - setting.process_set = &fss_write_process_normal; + setting.process_set = &fss_write_process_set; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; @@ -32,7 +34,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_load(arguments, &data, &setting, 0); } - fss_write_basic_main(&data, &setting); + fss_write_main(&data, &setting); fss_write_setting_unload(&data, &setting); diff --git a/level_3/fss_write/c/basic/print.c b/level_3/fss_write/c/basic/print.c index 75ff0f7..d34c78b 100644 --- a/level_3/fss_write/c/basic/print.c +++ b/level_3/fss_write/c/basic/print.c @@ -1,5 +1,4 @@ #include "fss_write.h" -#include "private-common.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_write/c/basic/private-common.c b/level_3/fss_write/c/basic/private-common.c deleted file mode 100644 index 8ae3dfd..0000000 --- a/level_3/fss_write/c/basic/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/basic/private-common.h b/level_3/fss_write/c/basic/private-common.h deleted file mode 100644 index 372a8f3..0000000 --- a/level_3/fss_write/c/basic/private-common.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_basic_common_h -#define _PRIVATE_fss_write_basic_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_basic_common_h diff --git a/level_3/fss_write/c/basic/private-print.c b/level_3/fss_write/c/basic/private-print.c deleted file mode 100644 index 0f7be74..0000000 --- a/level_3/fss_write/c/basic/private-print.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-print.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/basic/private-print.h b/level_3/fss_write/c/basic/private-print.h deleted file mode 100644 index d5185f4..0000000 --- a/level_3/fss_write/c/basic/private-print.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_basic_print_h -#define _PRIVATE_fss_write_basic_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_basic_print_h diff --git a/level_3/fss_write/c/basic/private-write.c b/level_3/fss_write/c/basic/private-write.c deleted file mode 100644 index e3c2ad5..0000000 --- a/level_3/fss_write/c/basic/private-write.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/basic/private-write.h b/level_3/fss_write/c/basic/private-write.h deleted file mode 100644 index 0c87310..0000000 --- a/level_3/fss_write/c/basic/private-write.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_basic_write_h -#define _PRIVATE_fss_write_basic_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_basic_write_h diff --git a/level_3/fss_write/c/basic_list/fss_write.c b/level_3/fss_write/c/basic_list/fss_write.c index f2d86a1..df63592 100644 --- a/level_3/fss_write/c/basic_list/fss_write.c +++ b/level_3/fss_write/c/basic_list/fss_write.c @@ -1,6 +1,4 @@ #include "fss_write.h" -#include "private-common.h" -#include "private-write.h" #include "../main/fss_write.h" #ifdef __cplusplus @@ -8,41 +6,35 @@ extern "C" { #endif #ifndef _di_fss_write_basic_list_process_content_ - void fss_write_basic_list_process_content(fll_program_data_t * const main, void * const setting, const bool last) { - - if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { - macro_fss_write_setting(setting)->status = fl_fss_basic_list_content_write( - *macro_fss_write_setting(setting)->content, - f_fss_complete_none_e, - ¯o_fss_write_setting(setting)->prepend, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - else { - macro_fss_write_setting(setting)->status = fl_fss_basic_list_content_write( - *macro_fss_write_setting(setting)->content, - (macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - ¯o_fss_write_setting(setting)->prepend, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - - if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { - macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); - - fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); - fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); - fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); + void fss_write_basic_list_process_content(fll_program_data_t * const main, void * const void_setting, const bool last) { + + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + + setting->status = fl_fss_basic_list_content_write( + *setting->content, + (setting->flag & fss_write_flag_partial_e) + ? f_fss_complete_partial_e + : (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_full_trim_e + : f_fss_complete_full_e, + &setting->prepend, + setting->state, + &setting->range, + &setting->buffer + ); + + if (F_status_set_fine(setting->status) == F_none_eol) { + setting->status = F_status_set_error(F_support_not); + + fss_write_print_line_first_locked(setting, main->error); + fss_write_print_error_unsupported_eol(setting, main->error); + fss_write_print_line_last_locked(setting, main->error); return; } - if (F_status_is_error(macro_fss_write_setting(setting)->status)) { - fss_write_print_error(macro_fss_write_setting(setting), main->error, "fl_fss_basic_list_content_write"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "fl_fss_basic_list_content_write"); return; } @@ -52,44 +44,41 @@ extern "C" { #ifndef _di_fss_write_basic_list_process_help_ void fss_write_basic_list_process_help(fll_program_data_t * const main, void * const setting) { - fss_write_basic_list_print_help(macro_fss_write_setting(setting), main->message); + fss_write_basic_list_print_help(setting, main->message); } #endif // _di_fss_write_basic_list_process_help_ #ifndef _di_fss_write_basic_list_process_object_ - void fss_write_basic_list_process_object(fll_program_data_t * const main, void * const setting) { - - if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { - macro_fss_write_setting(setting)->status = fl_fss_basic_list_object_write( - *macro_fss_write_setting(setting)->object, - f_fss_complete_none_e, // @fixme each of these needs to have "partial", "trim", etc.. - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - else { - macro_fss_write_setting(setting)->status = fl_fss_basic_list_object_write( - *macro_fss_write_setting(setting)->object, - (macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - - if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { - macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); - - fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); - fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); - fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); + void fss_write_basic_list_process_object(fll_program_data_t * const main, void * const void_setting) { + + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + + setting->status = fl_fss_basic_list_object_write( + *setting->object, + (setting->flag & fss_write_flag_partial_e) + ? (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_partial_trim_e + : f_fss_complete_partial_e + : (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_full_trim_e + : f_fss_complete_full_e, + setting->state, + &setting->range, + &setting->buffer + ); + + if (F_status_set_fine(setting->status) == F_none_eol) { + setting->status = F_status_set_error(F_support_not); + + fss_write_print_line_first_locked(setting, main->error); + fss_write_print_error_unsupported_eol(setting, main->error); + fss_write_print_line_last_locked(setting, main->error); return; } - if (F_status_is_error(macro_fss_write_setting(setting)->status)) { - fss_write_print_error(macro_fss_write_setting(setting), main->error, "fl_fss_basic_list_object_write"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "fl_fss_basic_list_object_write"); } } #endif // _di_fss_write_basic_list_process_object_ diff --git a/level_3/fss_write/c/basic_list/main.c b/level_3/fss_write/c/basic_list/main.c index 2c5b01f..3101786 100644 --- a/level_3/fss_write/c/basic_list/main.c +++ b/level_3/fss_write/c/basic_list/main.c @@ -1,18 +1,20 @@ #include "fss_write.h" +#include "../main/fss_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_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; + setting.standard = fss_write_basic_list_standard_s; setting.program_name = &fss_write_basic_list_program_name_s; setting.program_name_long = &fss_write_basic_list_program_name_long_s; setting.process_content = &fss_write_basic_list_process_content; setting.process_help = &fss_write_basic_list_process_help; - setting.process_normal = &fss_write_basic_list_process_normal; + setting.process_normal = &fss_write_process_normal; setting.process_object = &fss_write_basic_list_process_object; - setting.process_pipe = &fss_write_basic_list_process_pipe; - setting.process_set = &fss_write_process_normal; + setting.process_pipe = &fss_write_process_pipe; + setting.process_set = &fss_write_process_set; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; @@ -32,7 +34,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_load(arguments, &data, &setting, 0); } - fss_write_basic_list_main(&data, &setting); + fss_write_main(&data, &setting); fss_write_setting_unload(&data, &setting); diff --git a/level_3/fss_write/c/basic_list/print.c b/level_3/fss_write/c/basic_list/print.c index 78a16fa..2ee5e26 100644 --- a/level_3/fss_write/c/basic_list/print.c +++ b/level_3/fss_write/c/basic_list/print.c @@ -1,5 +1,4 @@ #include "fss_write.h" -#include "private-common.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_write/c/basic_list/private-common.c b/level_3/fss_write/c/basic_list/private-common.c deleted file mode 100644 index 8ae3dfd..0000000 --- a/level_3/fss_write/c/basic_list/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/basic_list/private-common.h b/level_3/fss_write/c/basic_list/private-common.h deleted file mode 100644 index 15d08f1..0000000 --- a/level_3/fss_write/c/basic_list/private-common.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_basic_list_common_h -#define _PRIVATE_fss_write_basic_list_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_basic_list_common_h diff --git a/level_3/fss_write/c/basic_list/private-print.c b/level_3/fss_write/c/basic_list/private-print.c deleted file mode 100644 index 0f7be74..0000000 --- a/level_3/fss_write/c/basic_list/private-print.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-print.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/basic_list/private-print.h b/level_3/fss_write/c/basic_list/private-print.h deleted file mode 100644 index a73b839..0000000 --- a/level_3/fss_write/c/basic_list/private-print.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_basic_list_print_h -#define _PRIVATE_fss_write_basic_list_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_basic_list_print_h diff --git a/level_3/fss_write/c/basic_list/private-write.c b/level_3/fss_write/c/basic_list/private-write.c deleted file mode 100644 index e3c2ad5..0000000 --- a/level_3/fss_write/c/basic_list/private-write.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/basic_list/private-write.h b/level_3/fss_write/c/basic_list/private-write.h deleted file mode 100644 index dbe4d7f..0000000 --- a/level_3/fss_write/c/basic_list/private-write.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_basic_list_write_h -#define _PRIVATE_fss_write_basic_list_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_basic_list_write_h diff --git a/level_3/fss_write/c/embedded_list/fss_write.c b/level_3/fss_write/c/embedded_list/fss_write.c index 69c2743..c3a4756 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.c +++ b/level_3/fss_write/c/embedded_list/fss_write.c @@ -1,6 +1,4 @@ #include "fss_write.h" -#include "private-common.h" -#include "private-write.h" #include "../main/fss_write.h" #ifdef __cplusplus @@ -8,43 +6,36 @@ extern "C" { #endif #ifndef _di_fss_write_embedded_list_process_content_ - void fss_write_embedded_list_process_content(fll_program_data_t * const main, void * const setting, const bool last) { - - if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { - macro_fss_write_setting(setting)->status = fl_fss_embedded_list_content_write( - *macro_fss_write_setting(setting)->content, - f_fss_complete_none_e, // @fixme each of these needs to have "partial", "trim", etc.. - ¯o_fss_write_setting(setting)->prepend, - macro_fss_write_setting(setting)->ignores, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - else { - macro_fss_write_setting(setting)->status = fl_fss_embedded_list_content_write( - *macro_fss_write_setting(setting)->content, - (macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - ¯o_fss_write_setting(setting)->prepend, - macro_fss_write_setting(setting)->ignores, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - - if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { - macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); - - fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); - fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); - fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); + void fss_write_embedded_list_process_content(fll_program_data_t * const main, void * const void_setting, const bool last) { + + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + + setting->status = fl_fss_embedded_list_content_write( + *setting->content, + (setting->flag & fss_write_flag_partial_e) + ? f_fss_complete_partial_e + : last + ? f_fss_complete_end_e + : f_fss_complete_next_e, + &setting->prepend, + setting->ignores, + setting->state, + &setting->range, + &setting->buffer + ); + + if (F_status_set_fine(setting->status) == F_none_eol) { + setting->status = F_status_set_error(F_support_not); + + fss_write_print_line_first_locked(setting, main->error); + fss_write_print_error_unsupported_eol(setting, main->error); + fss_write_print_line_last_locked(setting, main->error); return; } - if (F_status_is_error(macro_fss_write_setting(setting)->status)) { - fss_write_print_error(macro_fss_write_setting(setting), main->error, "fl_fss_embedded_list_content_write"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "fl_fss_embedded_list_content_write"); return; } @@ -54,44 +45,41 @@ extern "C" { #ifndef _di_fss_write_embedded_list_process_help_ void fss_write_embedded_list_process_help(fll_program_data_t * const main, void * const setting) { - fss_write_embedded_list_print_help(macro_fss_write_setting(setting), main->message); + fss_write_embedded_list_print_help(setting, main->message); } #endif // _di_fss_write_embedded_list_process_help_ #ifndef _di_fss_write_embedded_list_process_object_ - void fss_write_embedded_list_process_object(fll_program_data_t * const main, void * const setting) { - - if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { - macro_fss_write_setting(setting)->status = fl_fss_embedded_list_object_write( - *macro_fss_write_setting(setting)->object, - f_fss_complete_none_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - else { - macro_fss_write_setting(setting)->status = fl_fss_embedded_list_object_write( - *macro_fss_write_setting(setting)->object, - (macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - - if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { - macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); - - fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); - fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); - fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); + void fss_write_embedded_list_process_object(fll_program_data_t * const main, void * const void_setting) { + + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + + setting->status = fl_fss_embedded_list_object_write( + *setting->object, + (setting->flag & fss_write_flag_partial_e) + ? (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_partial_trim_e + : f_fss_complete_partial_e + : (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_full_trim_e + : f_fss_complete_full_e, + setting->state, + &setting->range, + &setting->buffer + ); + + if (F_status_set_fine(setting->status) == F_none_eol) { + setting->status = F_status_set_error(F_support_not); + + fss_write_print_line_first_locked(setting, main->error); + fss_write_print_error_unsupported_eol(setting, main->error); + fss_write_print_line_last_locked(setting, main->error); return; } - if (F_status_is_error(macro_fss_write_setting(setting)->status)) { - fss_write_print_error(macro_fss_write_setting(setting), main->error, "fl_fss_embedded_list_object_write"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "fl_fss_embedded_list_object_write"); } } #endif // _di_fss_write_embedded_list_process_object_ diff --git a/level_3/fss_write/c/embedded_list/main.c b/level_3/fss_write/c/embedded_list/main.c index 253b605..bde0b19 100644 --- a/level_3/fss_write/c/embedded_list/main.c +++ b/level_3/fss_write/c/embedded_list/main.c @@ -1,19 +1,22 @@ #include "fss_write.h" +#include "../main/fss_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_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; + setting.standard = fss_write_embedded_list_standard_s; setting.program_name = &fss_write_embedded_list_program_name_s; setting.program_name_long = &fss_write_embedded_list_program_name_long_s; setting.process_content = &fss_write_embedded_list_process_content; setting.process_help = &fss_write_embedded_list_process_help; - setting.process_normal = &fss_write_embedded_list_process_normal; + setting.process_normal = &fss_write_process_normal; setting.process_object = &fss_write_embedded_list_process_object; - setting.process_pipe = &fss_write_embedded_list_process_pipe; - setting.process_set = &fss_write_process_normal; + setting.process_pipe = &fss_write_process_pipe; + setting.process_set = &fss_write_process_set; setting.flag |= fss_write_flag_ignore_e; + setting.flag |= fss_write_flag_content_multiple_e; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; @@ -33,7 +36,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_load(arguments, &data, &setting, 0); } - fss_write_embedded_list_main(&data, &setting); + fss_write_main(&data, &setting); fss_write_setting_unload(&data, &setting); diff --git a/level_3/fss_write/c/embedded_list/print.c b/level_3/fss_write/c/embedded_list/print.c index 20255fd..a5c338a 100644 --- a/level_3/fss_write/c/embedded_list/print.c +++ b/level_3/fss_write/c/embedded_list/print.c @@ -1,5 +1,4 @@ #include "fss_write.h" -#include "private-common.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_write/c/embedded_list/private-common.c b/level_3/fss_write/c/embedded_list/private-common.c deleted file mode 100644 index 8ae3dfd..0000000 --- a/level_3/fss_write/c/embedded_list/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/embedded_list/private-common.h b/level_3/fss_write/c/embedded_list/private-common.h deleted file mode 100644 index 3cc9f06..0000000 --- a/level_3/fss_write/c/embedded_list/private-common.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_embedded_list_common_h -#define _PRIVATE_fss_write_embedded_list_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_embedded_list_common_h diff --git a/level_3/fss_write/c/embedded_list/private-print.c b/level_3/fss_write/c/embedded_list/private-print.c deleted file mode 100644 index 0f7be74..0000000 --- a/level_3/fss_write/c/embedded_list/private-print.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-print.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/embedded_list/private-print.h b/level_3/fss_write/c/embedded_list/private-print.h deleted file mode 100644 index 26e7567..0000000 --- a/level_3/fss_write/c/embedded_list/private-print.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_embedded_list_print_h -#define _PRIVATE_fss_write_embedded_list_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_embedded_list_print_h diff --git a/level_3/fss_write/c/embedded_list/private-write.c b/level_3/fss_write/c/embedded_list/private-write.c deleted file mode 100644 index e3c2ad5..0000000 --- a/level_3/fss_write/c/embedded_list/private-write.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/embedded_list/private-write.h b/level_3/fss_write/c/embedded_list/private-write.h deleted file mode 100644 index 1b3876b..0000000 --- a/level_3/fss_write/c/embedded_list/private-write.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_embedded_list_write_h -#define _PRIVATE_fss_write_embedded_list_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_embedded_list_write_h diff --git a/level_3/fss_write/c/extended/fss_write.c b/level_3/fss_write/c/extended/fss_write.c index 8885091..6093ece 100644 --- a/level_3/fss_write/c/extended/fss_write.c +++ b/level_3/fss_write/c/extended/fss_write.c @@ -1,6 +1,4 @@ #include "fss_write.h" -#include "private-common.h" -#include "private-write.h" #include "../main/fss_write.h" #ifdef __cplusplus @@ -8,45 +6,37 @@ extern "C" { #endif #ifndef _di_fss_write_extended_process_content_ - void fss_write_extended_process_content(fll_program_data_t * const main, void * const setting, const bool last) { - - if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { - macro_fss_write_setting(setting)->status = fl_fss_extended_content_write( - *macro_fss_write_setting(setting)->content, - macro_fss_write_setting(setting)->quote.used - ? macro_fss_write_setting(setting)->quote.string[0] - : f_fss_quote_double_s.string[0], - f_fss_complete_none_e, // @fixme each of these needs to have "partial", "trim", etc.. - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - else { - macro_fss_write_setting(setting)->status = fl_fss_extended_content_write( - *macro_fss_write_setting(setting)->content, - macro_fss_write_setting(setting)->quote.used - ? macro_fss_write_setting(setting)->quote.string[0] - : f_fss_quote_double_s.string[0], - (macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - - if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { - macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); - - fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); - fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); - fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); + void fss_write_extended_process_content(fll_program_data_t * const main, void * const void_setting, const bool last) { + + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + + setting->status = fl_fss_extended_content_write( + *setting->content, + setting->quote.used + ? setting->quote.string[0] + : f_fss_quote_double_s.string[0], + (setting->flag & fss_write_flag_partial_e) + ? f_fss_complete_partial_e + : last + ? f_fss_complete_end_e + : f_fss_complete_next_e, + setting->state, + &setting->range, + &setting->buffer + ); + + if (F_status_set_fine(setting->status) == F_none_eol) { + setting->status = F_status_set_error(F_support_not); + + fss_write_print_line_first_locked(setting, main->error); + fss_write_print_error_unsupported_eol(setting, main->error); + fss_write_print_line_last_locked(setting, main->error); return; } - if (F_status_is_error(macro_fss_write_setting(setting)->status)) { - fss_write_print_error(macro_fss_write_setting(setting), main->error, "fl_fss_extended_content_write"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "fl_fss_extended_content_write"); return; } @@ -56,50 +46,44 @@ extern "C" { #ifndef _di_fss_write_extended_process_help_ void fss_write_extended_process_help(fll_program_data_t * const main, void * const setting) { - fss_write_extended_print_help(macro_fss_write_setting(setting), main->message); + fss_write_extended_print_help(setting, main->message); } #endif // _di_fss_write_extended_process_help_ #ifndef _di_fss_write_extended_process_object_ - void fss_write_extended_process_object(fll_program_data_t * const main, void * const setting) { - - if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { - macro_fss_write_setting(setting)->status = fl_fss_extended_object_write( - *macro_fss_write_setting(setting)->object, - macro_fss_write_setting(setting)->quote.used - ? macro_fss_write_setting(setting)->quote.string[0] - : f_fss_quote_double_s.string[0], - f_fss_complete_none_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - else { - macro_fss_write_setting(setting)->status = fl_fss_extended_object_write( - *macro_fss_write_setting(setting)->object, - macro_fss_write_setting(setting)->quote.used - ? macro_fss_write_setting(setting)->quote.string[0] - : f_fss_quote_double_s.string[0], - (macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - - if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { - macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); - - fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); - fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); - fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); + void fss_write_extended_process_object(fll_program_data_t * const main, void * const void_setting) { + + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + + setting->status = fl_fss_extended_object_write( + *setting->object, + setting->quote.used + ? setting->quote.string[0] + : f_fss_quote_double_s.string[0], + (setting->flag & fss_write_flag_partial_e) + ? (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_partial_trim_e + : f_fss_complete_partial_e + : (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_full_trim_e + : f_fss_complete_full_e, + setting->state, + &setting->range, + &setting->buffer + ); + + if (F_status_set_fine(setting->status) == F_none_eol) { + setting->status = F_status_set_error(F_support_not); + + fss_write_print_line_first_locked(setting, main->error); + fss_write_print_error_unsupported_eol(setting, main->error); + fss_write_print_line_last_locked(setting, main->error); return; } - if (F_status_is_error(macro_fss_write_setting(setting)->status)) { - fss_write_print_error(macro_fss_write_setting(setting), main->error, "fl_fss_extended_object_write"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "fl_fss_extended_object_write"); } } #endif // _di_fss_write_extended_process_object_ diff --git a/level_3/fss_write/c/extended/main.c b/level_3/fss_write/c/extended/main.c index 322f590..37bfa07 100644 --- a/level_3/fss_write/c/extended/main.c +++ b/level_3/fss_write/c/extended/main.c @@ -1,18 +1,21 @@ #include "fss_write.h" +#include "../main/fss_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_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; + setting.standard = fss_write_extended_standard_s; setting.program_name = &fss_write_extended_program_name_s; setting.program_name_long = &fss_write_extended_program_name_long_s; - setting.process_content = &fss_write_exended_process_content; + setting.process_content = &fss_write_extended_process_content; setting.process_help = &fss_write_extended_process_help; - setting.process_normal = &fss_write_extended_process_normal; - setting.process_object = &fss_write_exended_process_object; - setting.process_pipe = &fss_write_extended_process_pipe; - setting.process_set = &fss_write_process_normal; + setting.process_normal = &fss_write_process_normal; + setting.process_object = &fss_write_extended_process_object; + setting.process_pipe = &fss_write_process_pipe; + setting.process_set = &fss_write_process_set; + setting.flag |= fss_write_flag_content_multiple_e; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; @@ -32,7 +35,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_load(arguments, &data, &setting, 0); } - fss_write_extended_main(&data, &setting); + fss_write_main(&data, &setting); fss_write_setting_unload(&data, &setting); diff --git a/level_3/fss_write/c/extended/print.c b/level_3/fss_write/c/extended/print.c index ec4ff7f..887bd3a 100644 --- a/level_3/fss_write/c/extended/print.c +++ b/level_3/fss_write/c/extended/print.c @@ -1,5 +1,4 @@ #include "fss_write.h" -#include "private-common.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_write/c/extended/private-common.c b/level_3/fss_write/c/extended/private-common.c deleted file mode 100644 index 8ae3dfd..0000000 --- a/level_3/fss_write/c/extended/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/extended/private-common.h b/level_3/fss_write/c/extended/private-common.h deleted file mode 100644 index 75ef75a..0000000 --- a/level_3/fss_write/c/extended/private-common.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_extended_common_h -#define _PRIVATE_fss_write_extended_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_extended_common_h diff --git a/level_3/fss_write/c/extended/private-print.c b/level_3/fss_write/c/extended/private-print.c deleted file mode 100644 index 0f7be74..0000000 --- a/level_3/fss_write/c/extended/private-print.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-print.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/extended/private-print.h b/level_3/fss_write/c/extended/private-print.h deleted file mode 100644 index c9a1b96..0000000 --- a/level_3/fss_write/c/extended/private-print.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_extended_print_h -#define _PRIVATE_fss_write_extended_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_extended_print_h diff --git a/level_3/fss_write/c/extended/private-write.c b/level_3/fss_write/c/extended/private-write.c deleted file mode 100644 index e3c2ad5..0000000 --- a/level_3/fss_write/c/extended/private-write.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/extended/private-write.h b/level_3/fss_write/c/extended/private-write.h deleted file mode 100644 index 449dab4..0000000 --- a/level_3/fss_write/c/extended/private-write.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_extended_write_h -#define _PRIVATE_fss_write_extended_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_extended_write_h diff --git a/level_3/fss_write/c/extended_list/fss_write.c b/level_3/fss_write/c/extended_list/fss_write.c index a0b5871..0bce5f4 100644 --- a/level_3/fss_write/c/extended_list/fss_write.c +++ b/level_3/fss_write/c/extended_list/fss_write.c @@ -1,6 +1,4 @@ #include "fss_write.h" -#include "private-common.h" -#include "private-write.h" #include "../main/fss_write.h" #ifdef __cplusplus @@ -8,43 +6,36 @@ extern "C" { #endif #ifndef _di_fss_write_extended_list_process_content_ - void fss_write_extended_list_process_content(fll_program_data_t * const main, void * const setting, const bool last) { - - if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { - macro_fss_write_setting(setting)->status = fl_fss_extended_list_content_write( - *macro_fss_write_setting(setting)->content, - last ? f_fss_complete_partial_e : f_fss_complete_partial_trim_e, // @fixme each of these needs to have "partial", "trim", etc.. - ¯o_fss_write_setting(setting)->prepend, - macro_fss_write_setting(setting)->ignores, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - else { - macro_fss_write_setting(setting)->status = fl_fss_extended_list_content_write( - *macro_fss_write_setting(setting)->content, - (macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - ¯o_fss_write_setting(setting)->prepend, - macro_fss_write_setting(setting)->ignores, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - - if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { - macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); - - fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); - fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); - fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); + void fss_write_extended_list_process_content(fll_program_data_t * const main, void * const void_setting, const bool last) { + + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + + setting->status = fl_fss_extended_list_content_write( + *setting->content, + (setting->flag & fss_write_flag_partial_e) + ? last + ? f_fss_complete_none_e + : f_fss_complete_partial_e + : f_fss_complete_full_e, + &setting->prepend, + setting->ignores, + setting->state, + &setting->range, + &setting->buffer + ); + + if (F_status_set_fine(setting->status) == F_none_eol) { + setting->status = F_status_set_error(F_support_not); + + fss_write_print_line_first_locked(setting, main->error); + fss_write_print_error_unsupported_eol(setting, main->error); + fss_write_print_line_last_locked(setting, main->error); return; } - if (F_status_is_error(macro_fss_write_setting(setting)->status)) { - fss_write_print_error(macro_fss_write_setting(setting), main->error, "fl_fss_extended_list_content_write"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "fl_fss_extended_list_content_write"); return; } @@ -59,26 +50,23 @@ extern "C" { #endif // _di_fss_write_extended_list_process_help_ #ifndef _di_fss_write_extended_list_process_object_ - void fss_write_extended_list_process_object(fll_program_data_t * const main, void * const setting) { - - if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { - macro_fss_write_setting(setting)->status = fl_fss_extended_list_object_write( - *macro_fss_write_setting(setting)->object, - f_fss_complete_none_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } - else { - macro_fss_write_setting(setting)->status = fl_fss_extended_list_object_write( - *macro_fss_write_setting(setting)->object, - (macro_fss_write_setting(setting)->flag & fss_write_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - macro_fss_write_setting(setting)->state, - ¯o_fss_write_setting(setting)->range, - ¯o_fss_write_setting(setting)->buffer - ); - } + void fss_write_extended_list_process_object(fll_program_data_t * const main, void * const void_setting) { + + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + + setting->status = fl_fss_extended_list_object_write( + *setting->object, + (setting->flag & fss_write_flag_partial_e) + ? (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_partial_trim_e + : f_fss_complete_partial_e + : (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_full_trim_e + : f_fss_complete_full_e, + setting->state, + &setting->range, + &setting->buffer + ); if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); diff --git a/level_3/fss_write/c/extended_list/main.c b/level_3/fss_write/c/extended_list/main.c index 8bd3e77..33dad7b 100644 --- a/level_3/fss_write/c/extended_list/main.c +++ b/level_3/fss_write/c/extended_list/main.c @@ -1,18 +1,20 @@ #include "fss_write.h" +#include "../main/fss_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_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; + setting.standard = fss_write_extended_list_standard_s; setting.program_name = &fss_write_extended_list_program_name_s; setting.program_name_long = &fss_write_extended_list_program_name_long_s; - setting.process_content = &fss_write_exended_list_process_content; + setting.process_content = &fss_write_extended_list_process_content; setting.process_help = &fss_write_extended_list_process_help; - setting.process_normal = &fss_write_extended_list_process_normal; - setting.process_object = &fss_write_exended_list_process_object; - setting.process_pipe = &fss_write_extended_list_process_pipe; - setting.process_set = &fss_write_process_normal; + setting.process_normal = &fss_write_process_normal; + setting.process_object = &fss_write_extended_list_process_object; + setting.process_pipe = &fss_write_process_pipe; + setting.process_set = &fss_write_process_set; setting.flag |= fss_write_flag_ignore_e; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; @@ -33,7 +35,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_load(arguments, &data, &setting, 0); } - fss_write_extended_list_main(&data, &setting); + fss_write_main(&data, &setting); fss_write_setting_unload(&data, &setting); diff --git a/level_3/fss_write/c/extended_list/print.c b/level_3/fss_write/c/extended_list/print.c index 0409242..8622e55 100644 --- a/level_3/fss_write/c/extended_list/print.c +++ b/level_3/fss_write/c/extended_list/print.c @@ -1,5 +1,4 @@ #include "fss_write.h" -#include "private-common.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_write/c/extended_list/private-common.c b/level_3/fss_write/c/extended_list/private-common.c deleted file mode 100644 index 8ae3dfd..0000000 --- a/level_3/fss_write/c/extended_list/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/extended_list/private-common.h b/level_3/fss_write/c/extended_list/private-common.h deleted file mode 100644 index 87f37d3..0000000 --- a/level_3/fss_write/c/extended_list/private-common.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_extended_list_common_h -#define _PRIVATE_fss_write_extended_list_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_extended_list_common_h diff --git a/level_3/fss_write/c/extended_list/private-print.c b/level_3/fss_write/c/extended_list/private-print.c deleted file mode 100644 index 0f7be74..0000000 --- a/level_3/fss_write/c/extended_list/private-print.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-print.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/extended_list/private-print.h b/level_3/fss_write/c/extended_list/private-print.h deleted file mode 100644 index 7fea7e6..0000000 --- a/level_3/fss_write/c/extended_list/private-print.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_extended_list_print_h -#define _PRIVATE_fss_write_extended_list_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_extended_list_print_h diff --git a/level_3/fss_write/c/extended_list/private-write.c b/level_3/fss_write/c/extended_list/private-write.c deleted file mode 100644 index e3c2ad5..0000000 --- a/level_3/fss_write/c/extended_list/private-write.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/extended_list/private-write.h b/level_3/fss_write/c/extended_list/private-write.h deleted file mode 100644 index 8e5cc56..0000000 --- a/level_3/fss_write/c/extended_list/private-write.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_extended_list_write_h -#define _PRIVATE_fss_write_extended_list_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_extended_list_write_h diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index f21c0ba..3811190 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -72,8 +72,6 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; - // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); @@ -235,7 +233,7 @@ extern "C" { if ((main->parameters.array[fss_write_parameter_content_e].result & f_console_result_value_e) && main->parameters.array[fss_write_parameter_content_e].values.used) { - if (setting->flag & fss_write_flag_object_e) { + if (setting->flag & fss_write_flag_object_e) { if (!(setting->flag & fss_write_flag_content_multiple_e)) { if (main->parameters.array[fss_write_parameter_content_e].values.used > main->parameters.array[fss_write_parameter_object_e].values.used) { setting->status = F_status_set_error(F_support_not); diff --git a/level_3/fss_write/c/main/common.h b/level_3/fss_write/c/main/common.h index acbb791..03cbe4e 100644 --- a/level_3/fss_write/c/main/common.h +++ b/level_3/fss_write/c/main/common.h @@ -112,8 +112,6 @@ extern "C" { extern const f_string_static_t fss_write_pipe_content_end_s; extern const f_string_static_t fss_write_pipe_content_ignore_s; extern const f_string_static_t fss_write_pipe_content_start_s; - - #define macro_fss_write_setting(setting) ((fss_write_setting_t *) setting) #endif // _di_fss_write_pipe_s_ /** @@ -325,7 +323,6 @@ extern "C" { * content: A pointer to a specific Content used during processing. * contents: A pointer to a specific set of Content used during processing. * - * content_separator: A standard format specific string used to separate Content. * program_name: The short name of the program. * program_name_long: The human friendly name of the program. * @@ -365,7 +362,6 @@ extern "C" { f_string_static_t *content; f_string_statics_t *contents; - const f_string_static_t *content_separator; const f_string_static_t *program_name; const f_string_static_t *program_name_long; @@ -405,7 +401,6 @@ extern "C" { 0, \ 0, \ 0, \ - 0, \ } #endif // _di_fss_write_setting_t_ diff --git a/level_3/fss_write/c/main/fss_write.c b/level_3/fss_write/c/main/fss_write.c index ae13fce..a1e0cc0 100644 --- a/level_3/fss_write/c/main/fss_write.c +++ b/level_3/fss_write/c/main/fss_write.c @@ -1,6 +1,4 @@ #include "fss_write.h" -#include "private-common.h" -#include "private-write.h" #ifdef __cplusplus extern "C" { @@ -106,13 +104,17 @@ extern "C" { f_array_length_t total = 0; f_array_length_t length = 0; - f_array_length_t ignore_start = 0; + f_array_length_t ignore = 0; f_string_range_t range = f_string_range_t_initialize; const f_array_length_t used_objects = setting->objects.used; const f_array_length_t used_contentss = setting->contentss.used; const f_array_length_t used_ignoress = setting->ignoress.used; + setting->object = &setting->objects.array[used_objects]; + setting->contents = &setting->contentss.array[used_contentss]; + setting->ignores = &setting->ignoress.array[used_ignoress]; + // 0x0 = nothing printed, 0x1 = something printed, 0x2 = ignore enabled, 0x4 = added Content for Object. uint8_t flag = 0; @@ -137,23 +139,28 @@ extern "C" { return; } - // This is processed in a single set, so there is only ever one Ignores added. - setting->status = f_string_rangess_increase(setting->state.step_small, &setting->ignoress); + setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents); if (F_status_is_error(setting->status)) { - fss_write_print_error(setting, main->error, "f_string_rangess_increase"); + fss_write_print_error(setting, main->error, "f_string_dynamics_increase"); return; } - setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->contentss.array[used_contentss]); + // This is processed in a single set, so there is only ever one Ignores added. + setting->status = f_string_rangess_increase(setting->state.step_small, &setting->ignoress); if (F_status_is_error(setting->status)) { - fss_write_print_error(setting, main->error, "f_string_dynamics_increase"); + fss_write_print_error(setting, main->error, "f_string_rangess_increase"); return; } + // Reset all of the used data before starting the loop. + setting->object->used = 0; + setting->contents->used = 0; + setting->ignores->used = 0; + for (;;) { if (!((++main->signal_check) % fss_write_signal_check_d)) { @@ -192,48 +199,57 @@ extern "C" { // Start Object. if (!state || state == 0x1) { if (!state) { - setting->objects.array[used_objects].used = 0; + setting->object->used = 0; state = 0x1; } // Reset the "has Content for Object" flag and associated contents array used length. flag -= flag | 0x4; - setting->contentss.array[used_contentss].used = 0; + setting->contents->used = 0; - if (setting->objects.array[used_objects].used + setting->block.used > setting->objects.array[used_objects].size) { - setting->status = f_string_dynamic_increase_by(setting->block.used, &setting->objects.array[used_objects]); + setting->status = f_string_dynamic_increase_by(setting->block.used, setting->object); - if (F_status_is_error(setting->status)) { - fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); - break; - } + break; } for (; range.start <= range.stop; ++range.start) { - if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { - state = 0x2; - ++range.start; + // Do not handle start/end while inside an ignore set. + if (!(flag & 0x2)) { + if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { + state = 0x2; + ++range.start; - break; - } + break; + } - if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; + if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { + state = 0x3; + ++range.start; - break; + break; + } } + // There currently is no support for "ignore" in Objects, but the Ignore should still be processed. if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) { - // @todo implement this, populating the ignores array, continue until no ignores is found, so set a new state to represent this. + // Ignore is enabled. + if (flag & 0x2) { + flag -= 0x2; + } + else { + flag |= 0x2; + } + continue; } - setting->objects.array[used_objects].string[setting->objects.array[used_objects].used++] = setting->block.string[range.start]; + setting->object->string[setting->object->used++] = setting->block.string[range.start]; } // for if (F_status_is_error(setting->status)) break; @@ -258,7 +274,7 @@ extern "C" { break; } - setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->contentss.array[used_contentss]); + setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents); if (F_status_is_error(setting->status)) { fss_write_print_error(setting, main->error, "f_string_dynamics_increase"); @@ -275,7 +291,7 @@ extern "C" { } if (total) { - setting->status = f_string_dynamic_increase_by(total, &setting->contentss.array[used_contentss].array[setting->contentss.array[used_contentss].used]); + setting->status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]); if (F_status_is_error(setting->status)) { fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); @@ -285,33 +301,58 @@ extern "C" { for (; range.start <= range.stop; ++range.start) { - if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { - setting->status = F_status_set_error(F_support_not); + // Do not handle start/end while inside an ignore set. + if (!(flag & 0x2)) { + if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { + if (!(setting->flag & fss_write_flag_content_multiple_e)) { + setting->status = F_status_set_error(F_support_not); - fss_write_print_error_one_content_only(setting, main->error); + fss_write_print_error_one_content_only(setting, main->error); - break; - } + break; + } + } - if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; + if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { + state = 0x3; + ++range.start; - break; + break; + } } if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) { - // @todo implement this (a single fss_write_pipe_content_ignore_s followed by another fss_write_pipe_content_ignore_s should act as a delimit). (also consider delimits for other special escapes as well.) + // Ignore is enabled. + if (flag & 0x2) { + setting->status = f_string_ranges_increase(setting->state.step_small, setting->ignores); + + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "f_string_ranges_increase"); + + break; + } + + setting->ignores->array[setting->ignores->used].start = setting->contents->array[setting->contents->used].used; + setting->ignores->array[setting->ignores->used].stop = range.start; + + flag -= 0x2; + } + else { + ignore = setting->contents->array[setting->contents->used].used; + + flag |= 0x2; + } + continue; } - setting->contentss.array[used_contentss].array[setting->contentss.array[used_contentss].used].string[setting->contentss.array[used_contentss].array[setting->contentss.array[used_contentss].used].used++] = setting->block.string[range.start]; + setting->contents->array[setting->contents->used].string[setting->contents->array[setting->contents->used].used++] = setting->block.string[range.start]; } // for if (F_status_is_error(setting->status)) break; - ++setting->contentss.array[used_contentss].used; + ++setting->contents->used; flag |= 0x4; } else { @@ -321,52 +362,23 @@ extern "C" { // End Object or Content set. if (state == 0x3) { - if (setting->flag & fss_write_flag_partial_e) { - if (setting->flag & fss_write_flag_content_e) { - setting->object = 0; - setting->contents = &setting->contentss.array[used_contentss]; - } - else { - setting->object = &setting->objects.array[used_objects]; - setting->contents = 0; - } - } - else { - setting->object = &setting->objects.array[used_objects]; - setting->contents = &setting->contentss.array[used_contentss]; - } - - setting->ignores = &setting->ignoress.array[used_contentss]; - setting->process_set(main, void_setting); if (F_status_is_error(setting->status)) break; state = 0; flag |= 0x1; + // Reset all of the used data for next set. + setting->object->used = 0; + setting->contents->used = 0; + setting->ignores->used = 0; + continue; } } // for // If the pipe ended before finishing, then attempt to wrap up. if (F_status_is_error_not(setting->status) && status_pipe == F_none_eof && state) { - if (setting->flag & fss_write_flag_partial_e) { - if (setting->flag & fss_write_flag_content_e) { - setting->object = 0; - setting->contents = &setting->contentss.array[used_contentss]; - } - else { - setting->object = &setting->objects.array[used_objects]; - setting->contents = 0; - } - } - else { - setting->object = &setting->objects.array[used_objects]; - setting->contents = &setting->contentss.array[used_contentss]; - } - - setting->ignores = &setting->ignoress.array[used_contentss]; - setting->process_set(main, void_setting); flag |= 0x1; @@ -374,17 +386,15 @@ extern "C" { setting->block.used = 0; setting->buffer.used = 0; + setting->object->used = 0; + setting->contents->used = 0; + setting->ignores->used = 0; setting->ignoress.used = used_ignoress; setting->objects.used = used_objects; setting->contentss.used = used_contentss; if (F_status_is_error_not(setting->status)) { setting->status = (flag & 0x1) ? F_none : F_data_not; - - // Print newline character to separate data printed from pipe. - if ((setting->flag & fss_write_flag_partial_e) && setting->objects.used) { - fll_print_dynamic(f_string_eol_s, main->output.to); // @fixme review this, should this be sending to message or not at all? - } } } #endif // _di_fss_write_process_pipe_ @@ -396,7 +406,7 @@ extern "C" { setting->buffer.used = 0; - if (setting->object) { + if ((!(setting->flag & fss_write_flag_partial_e) || (setting->flag & fss_write_flag_partial_e) && (setting->flag & fss_write_flag_object_e)) && setting->object) { if (setting->object->used) { setting->range.start = 0; setting->range.stop = setting->object->used - 1; @@ -410,7 +420,7 @@ extern "C" { if (F_status_is_error(setting->status)) return; } - if (setting->contents) { + if ((!(setting->flag & fss_write_flag_partial_e) || (setting->flag & fss_write_flag_partial_e) && (setting->flag & fss_write_flag_content_e)) && setting->contents) { for (f_array_length_t i = 0; i < setting->contents->used; ++i) { if (setting->contents->array[i].used) { diff --git a/level_3/fss_write/c/main/fss_write.h b/level_3/fss_write/c/main/fss_write.h index 795a1cc..95f3434 100644 --- a/level_3/fss_write/c/main/fss_write.h +++ b/level_3/fss_write/c/main/fss_write.h @@ -146,20 +146,11 @@ extern "C" { * The main program settings. * Must be of type (fss_write_setting_t *). * - * Set setting.object to 0 to not use an Object. - * Set setting.contents to 0 to not use an Content set. - * * This alters setting.status: * F_none on success. * F_interrupt on (exit) signal received. * * F_parameter (with error bit) if main is NULL or setting is NULL. - * @param object - * The object to validate and print. - * Set to setting.objects.used to not use. - * @param content - * The content to escape and print. - * Set start to 1 and stop to 0 to not use. */ #ifndef _di_fss_write_process_set_ extern void fss_write_process_set(fll_program_data_t * const main, void * const setting); diff --git a/level_3/fss_write/c/main/main.c b/level_3/fss_write/c/main/main.c index b1d9231..9d2e0e1 100644 --- a/level_3/fss_write/c/main/main.c +++ b/level_3/fss_write/c/main/main.c @@ -61,9 +61,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->program_name_long = &fss_write_program_name_long_s; setting->process_content = &fss_write_basic_process_content; setting->process_help = &fss_write_main_process_help; + setting->process_normal = &fss_write_process_normal; setting->process_object = &fss_write_basic_process_object; setting->process_pipe = &fss_write_process_pipe; - setting->process_normal = &fss_write_process_normal; setting->process_set = &fss_write_process_set; if (main->parameters.array[fss_write_parameter_as_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_as_e].values.used) { @@ -96,7 +96,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0001_s) == F_equal_to) { setting->standard = fss_write_extended_standard_s; - setting->content_separator = 0; // Not used by extended. setting->program_name = &fss_write_extended_program_name_s; setting->program_name_long = &fss_write_extended_program_name_long_s; setting->process_content = &fss_write_extended_process_content; diff --git a/level_3/fss_write/c/main/print.c b/level_3/fss_write/c/main/print.c index cac7e2d..f45278f 100644 --- a/level_3/fss_write/c/main/print.c +++ b/level_3/fss_write/c/main/print.c @@ -1,5 +1,4 @@ #include "fss_write.h" -#include "private-common.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_write/c/main/private-common.c b/level_3/fss_write/c/main/private-common.c deleted file mode 100644 index 8ae3dfd..0000000 --- a/level_3/fss_write/c/main/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/main/private-common.h b/level_3/fss_write/c/main/private-common.h deleted file mode 100644 index d3b6b5e..0000000 --- a/level_3/fss_write/c/main/private-common.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_common_h -#define _PRIVATE_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_common_h diff --git a/level_3/fss_write/c/main/private-write.c b/level_3/fss_write/c/main/private-write.c deleted file mode 100644 index e3c2ad5..0000000 --- a/level_3/fss_write/c/main/private-write.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/main/private-write.h b/level_3/fss_write/c/main/private-write.h deleted file mode 100644 index 41cbaec..0000000 --- a/level_3/fss_write/c/main/private-write.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_write_h -#define _PRIVATE_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_write_h diff --git a/level_3/fss_write/c/payload/fss_write.c b/level_3/fss_write/c/payload/fss_write.c index f6e672b..08bf899 100644 --- a/level_3/fss_write/c/payload/fss_write.c +++ b/level_3/fss_write/c/payload/fss_write.c @@ -1,7 +1,5 @@ #include "fss_write.h" #include "../main/fss_write.h" -#include "private-common.h" -#include "private-write.h" #ifdef __cplusplus extern "C" { @@ -32,16 +30,17 @@ extern "C" { const f_array_length_t used_contentss = setting->contentss.used; const f_array_length_t used_ignoress = setting->ignoress.used; + setting->object = &setting->objects.array[used_objects]; + setting->contents = &setting->contentss.array[used_contentss]; + setting->ignores = &setting->ignoress.array[used_ignoress]; + // 0x0 = nothing printed, 0x1 = something printed, 0x2 = ignore enabled, 0x4 = added Content for Object, 0x8 = "payload" matched. uint8_t flag = 0; // 0x0 = start new object/content set, 0x1 = processing object, 0x2 = processing content, 0x3 = end object/content set, 0x4 = processing payload content. uint8_t state = 0; - setting->objects.used = 0; - setting->contentss.used = 0; - - // This is processed in a set, so there is only ever one Object. + // This is processed in a single set, so there is only ever one Object added. setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->objects); if (F_status_is_error(setting->status)) { @@ -50,7 +49,7 @@ extern "C" { return; } - // This is processed in a set, so there is only ever one Content set. + // This is processed in a single set, so there is only ever one Content added. setting->status = f_string_dynamicss_increase(setting->state.step_small, &setting->contentss); if (F_status_is_error(setting->status)) { @@ -59,7 +58,7 @@ extern "C" { return; } - setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->contentss.array[0]); + setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents); if (F_status_is_error(setting->status)) { fss_write_print_error(setting, main->error, "f_string_dynamics_increase"); @@ -67,6 +66,20 @@ extern "C" { return; } + // This is processed in a single set, so there is only ever one Ignores added. + setting->status = f_string_rangess_increase(setting->state.step_small, &setting->ignoress); + + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "f_string_rangess_increase"); + + return; + } + + // Reset all of the used data before starting the loop. + setting->object->used = 0; + setting->contents->used = 0; + setting->ignores->used = 0; + for (;;) { if (!((++main->signal_check) % fss_write_signal_check_d)) { @@ -102,51 +115,60 @@ extern "C" { range.stop = setting->block.used - 1; } - // Begin Object. + // Start Object. if (!state || state == 0x1) { if (!state) { - setting->objects.array[used_objects].used = 0; + setting->object->used = 0; state = 0x1; } // Reset the "has Content for Object" flag and associated contents array used length. flag -= flag | 0x4; - setting->contentss.array[used_contentss].used = 0; + setting->contents->used = 0; - if (setting->objects.array[used_objects].used + setting->block.used > setting->objects.array[used_objects].size) { - setting->status = f_string_dynamic_increase_by(setting->block.used, &setting->objects.array[used_objects]); + setting->status = f_string_dynamic_increase_by(setting->block.used, setting->object); - if (F_status_is_error(setting->status)) { - fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); + if (F_status_is_error(setting->status)) { + fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); - break; - } + break; } for (; range.start <= range.stop; ++range.start) { - if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { - state = 0x2; - ++range.start; + // Do not handle start/end while inside an ignore set. + if (!(flag & 0x2)) { + if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { + state = 0x2; + ++range.start; - break; - } + break; + } - if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; + if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { + state = 0x3; + ++range.start; - break; + break; + } } + // There currently is no support for "ignore" in Objects, but the Ignore should still be processed. if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) { - // @todo implement this (a single fss_write_pipe_content_ignore_s followed by another fss_write_pipe_content_ignore_s should act as a delimit). (also consider delimits for other special escapes as well.) + // Ignore is enabled. + if (flag & 0x2) { + flag -= 0x2; + } + else { + flag |= 0x2; + } + continue; } - setting->objects.array[used_objects].string[setting->objects.array[used_objects].used++] = setting->block.string[range.start]; + setting->object->string[setting->object->used++] = setting->block.string[range.start]; } // for if (F_status_is_error(setting->status)) break; @@ -171,7 +193,7 @@ extern "C" { break; } - setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->contentss.array[used_contentss]); + setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents); if (F_status_is_error(setting->status)) { fss_write_print_error(setting, main->error, "f_string_dynamics_increase"); @@ -188,9 +210,9 @@ extern "C" { } // When payload is provided, all data at this point is part of the payload until the end of the pipe. - if (fl_string_dynamic_compare(f_fss_payload_s, setting->objects.array[used_objects]) == F_equal_to) { + if (fl_string_dynamic_compare(f_fss_payload_s, *setting->object) == F_equal_to) { if (total > 1) { - setting->status = f_string_dynamic_increase_by(total, &setting->contentss.array[used_contentss].array[0]); + setting->status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]); if (F_status_is_error(setting->status)) { fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); @@ -198,9 +220,9 @@ extern "C" { break; } - memcpy(setting->contentss.array[used_contentss].array[0].string, setting->block.string + range.start, sizeof(f_char_t) * total); + memcpy(setting->contents->array[setting->contents->used].string, setting->block.string + range.start, sizeof(f_char_t) * total); - setting->contentss.array[used_contentss].array[0].used += total; + setting->contents->array[setting->contents->used].used += total; } state = 0x4; @@ -214,7 +236,7 @@ extern "C" { } if (total) { - setting->status = f_string_dynamic_increase_by(total, &setting->contentss.array[used_contentss].array[0]); + setting->status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]); if (F_status_is_error(setting->status)) { fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); @@ -224,33 +246,44 @@ extern "C" { for (; range.start <= range.stop; ++range.start) { - if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { - setting->status = F_status_set_error(F_support_not); + // Do not handle start/end while inside an ignore set. + if (!(flag & 0x2)) { + if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { + setting->status = F_status_set_error(F_support_not); - fss_write_print_error_one_content_only(setting, main->error); + fss_write_print_error_one_content_only(setting, main->error); - break; - } + break; + } - if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { - state = 0x3; - ++range.start; + if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { + state = 0x3; + ++range.start; - break; + break; + } } + // There currently is no support for "ignore" in Contents, but the Ignore should still be processed. if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) { - // @todo implement this (a single fss_write_pipe_content_ignore_s followed by another fss_write_pipe_content_ignore_s should act as a delimit). + // Ignore is enabled. + if (flag & 0x2) { + flag -= 0x2; + } + else { + flag |= 0x2; + } + continue; } - setting->contentss.array[used_contentss].array[0].string[setting->contentss.array[used_contentss].array[0].used++] = setting->block.string[range.start]; + setting->contents->array[setting->contents->used].string[setting->contents->array[setting->contents->used].used++] = setting->block.string[range.start]; } // for if (F_status_is_error(setting->status)) break; - ++setting->contentss.array[used_contentss].used; + ++setting->contents->used; flag |= 0x4; } else { @@ -260,29 +293,17 @@ extern "C" { // End Object or Content set. if (state == 0x3) { - if (setting->flag & fss_write_flag_partial_e) { - if (setting->flag & fss_write_flag_content_e) { - setting->object = 0; - setting->contents = &setting->contentss.array[used_contentss]; - } - else { - setting->object = &setting->objects.array[used_objects]; - setting->contents = 0; - } - } - else { - setting->object = &setting->objects.array[used_objects]; - setting->contents = &setting->contentss.array[used_contentss]; - } - - setting->ignores = &setting->ignoress.array[used_ignoress]; - fss_write_payload_process_set(main, void_setting); if (F_status_is_error(setting->status)) break; state = 0; flag |= 0x1; + // Reset all of the used data for next set. + setting->object->used = 0; + setting->contents->used = 0; + setting->ignores->used = 0; + continue; } @@ -291,7 +312,7 @@ extern "C" { if (setting->block.used && range.start <= range.stop) { length = (range.stop - range.start) + 1; - setting->status = f_string_dynamic_increase_by(length + 1, &setting->contentss.array[used_contentss].array[0]); + setting->status = f_string_dynamic_increase_by(length + 1, &setting->contents->array[setting->contents->used]); if (F_status_is_error(setting->status)) { fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); @@ -299,36 +320,24 @@ extern "C" { break; } - memcpy(setting->contentss.array[used_contentss].array[0].string + range.start, setting->block.string, sizeof(f_char_t) * length); + memcpy(setting->contents->array[setting->contents->used].string + range.start, setting->block.string, sizeof(f_char_t) * length); - setting->contentss.array[used_contentss].array[0].used += length; + setting->contents->array[setting->contents->used].used += length; } // Designate to read next block from pipe. range.start = 1; range.stop = 0; + + // Reset all of the used data for next set. + setting->object->used = 0; + setting->contents->used = 0; + setting->ignores->used = 0; } } // for // If the pipe ended before finishing, then attempt to wrap up. if (F_status_is_error_not(setting->status) && status_pipe == F_none_eof && state) { - if (setting->flag & fss_write_flag_partial_e) { - if (setting->flag & fss_write_flag_content_e) { - setting->object = 0; - setting->contents = &setting->contentss.array[used_contentss]; - } - else { - setting->object = &setting->objects.array[used_objects]; - setting->contents = 0; - } - } - else { - setting->object = &setting->objects.array[used_objects]; - setting->contents = &setting->contentss.array[used_contentss]; - } - - setting->ignores = &setting->ignoress.array[used_ignoress]; - fss_write_payload_process_set(main, void_setting); flag |= 0x1; @@ -336,6 +345,9 @@ extern "C" { setting->block.used = 0; setting->buffer.used = 0; + setting->object->used = 0; + setting->contents->used = 0; + setting->ignores->used = 0; setting->objects.used = used_objects; setting->contentss.used = used_contentss; setting->ignoress.used = used_ignoress; @@ -353,14 +365,9 @@ extern "C" { setting->status = F_data_not; } - // Print newline character to separate data printed from pipe. - if ((setting->flag & fss_write_flag_partial_e) && setting->objects.used) { - fll_print_dynamic(f_string_eol_s, main->output.to); // @fixme review this, should this be sending to message or not at all? - } - else if (setting->contentss.used) { - if (flag & 0x8) { - fll_print_dynamic(f_fss_payload_header_close_s, main->output.to); - } + // Payload. + if (setting->contentss.used && (flag & 0x8)) { + fll_print_dynamic(f_fss_payload_header_close_s, main->output.to); } } } @@ -371,8 +378,8 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); - if (setting->object) { - if (setting->contents && setting->contents->used) { + if ((!(setting->flag & fss_write_flag_partial_e) || (setting->flag & fss_write_flag_partial_e) && (setting->flag & fss_write_flag_object_e)) && setting->object) { + if (!(setting->flag & fss_write_flag_partial_e) && setting->contents && setting->contents->used) { if (setting->object->used) { setting->range.start = 0; setting->range.stop = setting->object->used - 1; @@ -382,7 +389,16 @@ extern "C" { setting->range.stop = 0; } - setting->status = fll_fss_payload_write(*setting->object, setting->contents->array[0], setting->flag & fss_write_flag_trim_e, setting->flag & fss_write_flag_prepend_e ? &setting->prepend : 0, setting->state, &setting->buffer); + setting->status = fll_fss_payload_write( + *setting->object, + setting->contents->array[0], + (setting->flag & fss_write_flag_trim_e), + (setting->flag & fss_write_flag_prepend_e) + ? &setting->prepend + : 0, + setting->state, + &setting->buffer + ); if (F_status_set_fine(setting->status) == F_none_eol) { setting->status = F_status_set_error(F_support_not); @@ -401,8 +417,6 @@ extern "C" { } } else { - bool complete = f_fss_complete_none_e; - if (setting->object->used) { setting->range.start = 0; setting->range.stop = setting->object->used - 1; @@ -412,16 +426,19 @@ extern "C" { setting->range.stop = 0; } - if (setting->contents && setting->contents->used) { - if (main->parameters.array[fss_write_parameter_trim_e].result & f_console_result_found_e) { - complete = f_fss_complete_full_trim_e; - } - else { - complete = f_fss_complete_full_e; - } - } - - setting->status = fl_fss_basic_list_object_write(*setting->object, complete, setting->state, &setting->range, &setting->buffer); + setting->status = fl_fss_basic_list_object_write( + *setting->object, + (setting->flag & fss_write_flag_partial_e) + ? (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_partial_trim_e + : f_fss_complete_partial_e + : (setting->flag & fss_write_flag_trim_e) + ? f_fss_complete_full_trim_e + : f_fss_complete_full_e, + setting->state, + &setting->range, + &setting->buffer + ); if (F_status_set_fine(setting->status) == F_none_eol) { setting->status = F_status_set_error(F_support_not); @@ -452,7 +469,16 @@ extern "C" { prepend = &main->parameters.arguments.array[index]; } - setting->status = fl_fss_basic_list_content_write(setting->contents->array[0], setting->object ? f_fss_complete_full_e : f_fss_complete_none_e, prepend, setting->state, &setting->range, &setting->buffer); + setting->status = fl_fss_basic_list_content_write( + setting->contents->array[0], + setting->object + ? f_fss_complete_full_e + : f_fss_complete_none_e, + prepend, + setting->state, + &setting->range, + &setting->buffer + ); if (F_status_is_error(setting->status)) { fss_write_print_error(setting, main->error, "fl_fss_payload_content_write"); diff --git a/level_3/fss_write/c/payload/fss_write.h b/level_3/fss_write/c/payload/fss_write.h index 12da9c6..6efc164 100644 --- a/level_3/fss_write/c/payload/fss_write.h +++ b/level_3/fss_write/c/payload/fss_write.h @@ -102,9 +102,6 @@ extern "C" { * The main program settings. * Must be of type (fss_write_setting_t *). * - * Set setting.object to 0 to not use an Object. - * Set setting.contents to 0 to not use an Content set. - * * This standard only supports a single Content per Object. * The setting.contents.array[0] must exist (settings.contents.used == 1), or it is treated as if (settings.contents == 0). * diff --git a/level_3/fss_write/c/payload/main.c b/level_3/fss_write/c/payload/main.c index 7f9344f..7dcb8d4 100644 --- a/level_3/fss_write/c/payload/main.c +++ b/level_3/fss_write/c/payload/main.c @@ -6,6 +6,7 @@ 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_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; + setting.standard = fss_write_payload_standard_s; setting.program_name = &fss_write_payload_program_name_s; setting.program_name_long = &fss_write_payload_program_name_long_s; setting.process_content = 0; // Not used by payload. diff --git a/level_3/fss_write/c/payload/print.c b/level_3/fss_write/c/payload/print.c index 60a2ea0..1d1e4d2 100644 --- a/level_3/fss_write/c/payload/print.c +++ b/level_3/fss_write/c/payload/print.c @@ -1,5 +1,4 @@ #include "fss_write.h" -#include "private-common.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_write/c/payload/private-common.c b/level_3/fss_write/c/payload/private-common.c deleted file mode 100644 index 8ae3dfd..0000000 --- a/level_3/fss_write/c/payload/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/payload/private-common.h b/level_3/fss_write/c/payload/private-common.h deleted file mode 100644 index b6c0689..0000000 --- a/level_3/fss_write/c/payload/private-common.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_payload_common_h -#define _PRIVATE_fss_write_payload_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_payload_common_h diff --git a/level_3/fss_write/c/payload/private-print.c b/level_3/fss_write/c/payload/private-print.c deleted file mode 100644 index 0f7be74..0000000 --- a/level_3/fss_write/c/payload/private-print.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-print.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/payload/private-print.h b/level_3/fss_write/c/payload/private-print.h deleted file mode 100644 index 77d402f..0000000 --- a/level_3/fss_write/c/payload/private-print.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_payload_print_h -#define _PRIVATE_fss_write_payload_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_payload_print_h diff --git a/level_3/fss_write/c/payload/private-write.c b/level_3/fss_write/c/payload/private-write.c deleted file mode 100644 index e3c2ad5..0000000 --- a/level_3/fss_write/c/payload/private-write.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fss_write.h" -#include "private-common.h" -#include "private-write.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fss_write/c/payload/private-write.h b/level_3/fss_write/c/payload/private-write.h deleted file mode 100644 index d04a353..0000000 --- a/level_3/fss_write/c/payload/private-write.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: FSS Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fss_write_payload_write_h -#define _PRIVATE_fss_write_payload_write_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fss_write_payload_write_h diff --git a/level_3/fss_write/data/build/fakefile b/level_3/fss_write/data/build/fakefile index 7bf428a..c2a49fc 100644 --- a/level_3/fss_write/data/build/fakefile +++ b/level_3/fss_write/data/build/fakefile @@ -20,29 +20,29 @@ main: using_default: build settings build settings.main - #build settings.basic - #build settings.basic_list - #build settings.extended - #build settings.extended_list - #build settings.embedded_list + build settings.basic + build settings.basic_list + build settings.extended + build settings.extended_list + build settings.embedded_list build settings.payload using_mode: build settings parameter:'mode:value' build settings.main parameter:'mode:value' - #build settings.basic parameter:'mode:value' - #build settings.basic_list parameter:'mode:value' - #build settings.extended parameter:'mode:value' - #build settings.extended_list parameter:'mode:value' - #build settings.embedded_list parameter:'mode:value' + build settings.basic parameter:'mode:value' + build settings.basic_list parameter:'mode:value' + build settings.extended parameter:'mode:value' + build settings.extended_list parameter:'mode:value' + build settings.embedded_list parameter:'mode:value' build settings.payload parameter:'mode:value' install: shell ./install.sh parameter:'work' - #shell ./install.sh parameter:'work' -s data/build/settings.main - #shell ./install.sh parameter:'work' -s data/build/settings.basic - #shell ./install.sh parameter:'work' -s data/build/settings.basic_list - #shell ./install.sh parameter:'work' -s data/build/settings.extended - #shell ./install.sh parameter:'work' -s data/build/settings.extended_list - #shell ./install.sh parameter:'work' -s data/build/settings.embedded_list + shell ./install.sh parameter:'work' -s data/build/settings.main + shell ./install.sh parameter:'work' -s data/build/settings.basic + shell ./install.sh parameter:'work' -s data/build/settings.basic_list + shell ./install.sh parameter:'work' -s data/build/settings.extended + shell ./install.sh parameter:'work' -s data/build/settings.extended_list + shell ./install.sh parameter:'work' -s data/build/settings.embedded_list shell ./install.sh parameter:'work' -s data/build/settings.payload diff --git a/level_3/fss_write/data/build/settings b/level_3/fss_write/data/build/settings index caf6ea1..d283c3d 100644 --- a/level_3/fss_write/data/build/settings +++ b/level_3/fss_write/data/build/settings @@ -25,21 +25,21 @@ build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_print -lfll_pr build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library main/fss_write.c main/common.c main/print.c main/private-common.c main/private-write.c -build_sources_library basic/fss_write.c basic/common.c basic/print.c basic/private-common.c basic/private-write.c basic/private-print.c -build_sources_library basic_list/fss_write.c basic_list/common.c basic_list/print.c basic_list/private-common.c basic_list/private-write.c basic_list/private-print.c -build_sources_library embedded_list/fss_write.c embedded_list/common.c embedded_list/print.c embedded_list/private-common.c embedded_list/private-write.c embedded_list/private-print.c -build_sources_library extended/fss_write.c extended/common.c extended/print.c extended/private-common.c extended/private-write.c extended/private-print.c -build_sources_library extended_list/fss_write.c extended_list/common.c extended_list/print.c extended_list/private-common.c extended_list/private-write.c extended_list/private-print.c -build_sources_library payload/fss_write.c payload/common.c payload/print.c payload/private-common.c payload/private-write.c payload/private-print.c +build_sources_library main/fss_write.c main/common.c main/print.c +build_sources_library basic/fss_write.c basic/common.c basic/print.c +build_sources_library basic_list/fss_write.c basic_list/common.c basic_list/print.c +build_sources_library embedded_list/fss_write.c embedded_list/common.c embedded_list/print.c +build_sources_library extended/fss_write.c extended/common.c extended/print.c +build_sources_library extended_list/fss_write.c extended_list/common.c extended_list/print.c +build_sources_library payload/fss_write.c payload/common.c payload/print.c -build_sources_headers main/fss_write.h main/common.h main/print.h main/private-common.h main/private-write.h -build_sources_headers basic/fss_write.h basic/common.h basic/print.h basic/private-common.h basic/private-write.h basic/private-print.h -build_sources_headers basic_list/fss_write.h basic_list/common.h basic_list/print.h basic_list/private-common.h basic_list/private-write.h basic_list/private-print.h -build_sources_headers embedded_list/fss_write.h embedded_list/common.h embedded_list/print.h embedded_list/private-common.h embedded_list/private-write.h embedded_list/private-print.h -build_sources_headers extended/fss_write.h extended/common.h extended/print.h extended/private-common.h extended/private-write.h extended/private-print.h -build_sources_headers extended_list/fss_write.h extended_list/common.h extended_list/print.h extended_list/private-common.h extended_list/private-write.h extended_list/private-print.h -build_sources_headers payload/fss_write.h payload/common.h payload/print.h payload/private-common.h payload/private-write.h payload/private-print.h +build_sources_headers main/fss_write.h main/common.h main/print.h main/private-common.h +build_sources_headers basic/fss_write.h basic/common.h basic/print.h basic/private-common.h +build_sources_headers basic_list/fss_write.h basic_list/common.h basic_list/print.h +build_sources_headers embedded_list/fss_write.h embedded_list/common.h embedded_list/print.h +build_sources_headers extended/fss_write.h extended/common.h extended/print.h +build_sources_headers extended_list/fss_write.h extended_list/common.h extended_list/print.h +build_sources_headers payload/fss_write.h payload/common.h payload/print.h build_script yes build_shared yes diff --git a/level_3/fss_write/data/build/settings.basic b/level_3/fss_write/data/build/settings.basic new file mode 100644 index 0000000..69073e0 --- /dev/null +++ b/level_3/fss_write/data/build/settings.basic @@ -0,0 +1,56 @@ +# fss-0001 +# +# Builds the "basic" program (fss_basic_write). +# This must be called after the "setting". +# + +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 -lfss_write +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_program basic/main.c + +build_script yes +build_shared yes +build_static no + +path_headers program/fss_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_write/data/build/settings.basic_list b/level_3/fss_write/data/build/settings.basic_list new file mode 100644 index 0000000..ede5fc0 --- /dev/null +++ b/level_3/fss_write/data/build/settings.basic_list @@ -0,0 +1,56 @@ +# fss-0001 +# +# Builds the "basic_list" program (fss_basic_list_write). +# This must be called after the "setting". +# + +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 -lfss_write +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_program basic_list/main.c + +build_script yes +build_shared yes +build_static no + +path_headers program/fss_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_write/data/build/settings.embedded_list b/level_3/fss_write/data/build/settings.embedded_list new file mode 100644 index 0000000..8bce02e --- /dev/null +++ b/level_3/fss_write/data/build/settings.embedded_list @@ -0,0 +1,56 @@ +# fss-0001 +# +# Builds the "embedded_list" program (fss_embedded_list_write). +# This must be called after the "setting". +# + +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 -lfss_write +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_program embedded_list/main.c + +build_script yes +build_shared yes +build_static no + +path_headers program/fss_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_write/data/build/settings.extended b/level_3/fss_write/data/build/settings.extended new file mode 100644 index 0000000..034dc25 --- /dev/null +++ b/level_3/fss_write/data/build/settings.extended @@ -0,0 +1,56 @@ +# fss-0001 +# +# Builds the "extended" program (fss_extended_write). +# This must be called after the "setting". +# + +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 -lfss_write +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_program extended/main.c + +build_script yes +build_shared yes +build_static no + +path_headers program/fss_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_write/data/build/settings.extended_list b/level_3/fss_write/data/build/settings.extended_list new file mode 100644 index 0000000..9046be7 --- /dev/null +++ b/level_3/fss_write/data/build/settings.extended_list @@ -0,0 +1,56 @@ +# fss-0001 +# +# Builds the "extended_list" program (fss_extended_list_write). +# This must be called after the "setting". +# + +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 -lfss_write +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_program extended_list/main.c + +build_script yes +build_shared yes +build_static no + +path_headers program/fss_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 -- 1.8.3.1