From 9b988d10e26339563d7555abdbb37533687981d6 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 3 Dec 2022 18:39:56 -0600 Subject: [PATCH] Progress: Continue program related work, updating fss_write. Minor improvement to comments and specifications. I've identified the structure I wanted and this is progress towards implementing the fss_write code across all currently supported formats. --- level_2/fll_program/c/program/common.h | 2 +- level_3/fss_write/c/basic/fss_write.c | 107 ++++++++++++++- level_3/fss_write/c/basic/fss_write.h | 41 +++++- level_3/fss_write/c/basic/main.c | 6 +- level_3/fss_write/c/basic_list/fss_write.c | 82 ++++++++++- level_3/fss_write/c/basic_list/fss_write.h | 36 +++++ level_3/fss_write/c/basic_list/main.c | 6 +- level_3/fss_write/c/embedded_list/fss_write.c | 84 ++++++++++- level_3/fss_write/c/embedded_list/fss_write.h | 36 +++++ level_3/fss_write/c/embedded_list/main.c | 6 +- level_3/fss_write/c/extended/fss_write.c | 84 ++++++++++- level_3/fss_write/c/extended/fss_write.h | 38 ++++- level_3/fss_write/c/extended/main.c | 6 +- level_3/fss_write/c/extended_list/fss_write.c | 84 ++++++++++- level_3/fss_write/c/extended_list/fss_write.h | 39 +++++- level_3/fss_write/c/extended_list/main.c | 6 +- level_3/fss_write/c/main/common.c | 61 +++----- level_3/fss_write/c/main/common.h | 52 ++++--- level_3/fss_write/c/main/fss_write.c | 54 +++++++- level_3/fss_write/c/main/fss_write.h | 24 ++++ level_3/fss_write/c/main/main.c | 25 +++- level_3/fss_write/c/main/print.c | 71 ++++++++-- level_3/fss_write/c/main/print.h | 32 ++++- level_3/fss_write/c/payload/common.c | 24 ---- level_3/fss_write/c/payload/common.h | 33 ----- level_3/fss_write/c/payload/fss_write.c | 191 ++++++++++++++------------ level_3/fss_write/c/payload/fss_write.h | 33 +++++ level_3/fss_write/c/payload/main.c | 6 +- level_3/fss_write/data/build/fakefile | 20 ++- level_3/iki_read/c/iki_read.c | 2 +- level_3/iki_write/c/iki_write.c | 2 +- specifications/fss-0000.txt | 2 +- specifications/fss-0001.txt | 2 +- specifications/fss-0009.txt | 2 +- specifications/fss-000a.txt | 2 +- 35 files changed, 1035 insertions(+), 266 deletions(-) diff --git a/level_2/fll_program/c/program/common.h b/level_2/fll_program/c/program/common.h index 8125fb0..cd06915 100644 --- a/level_2/fll_program/c/program/common.h +++ b/level_2/fll_program/c/program/common.h @@ -68,7 +68,7 @@ extern "C" { * signal: The process signal management structure. * * message: The output file for normal output messages (often stdout). - * output: The output file for normal/non-message output (often stdout or a file). + * output: The output file for normal/non-message output, aka data output (often stdout or a file). * error: The output file for error output messages. * warning: The output file for warning output messages. * diff --git a/level_3/fss_write/c/basic/fss_write.c b/level_3/fss_write/c/basic/fss_write.c index 9788cf0..9f3a3a5 100644 --- a/level_3/fss_write/c/basic/fss_write.c +++ b/level_3/fss_write/c/basic/fss_write.c @@ -7,17 +7,120 @@ 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 f_string_static_t * const content) { + + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + macro_fss_write_setting(setting)->status = fl_fss_basic_content_write( + *content, + 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_content_write( + *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 + ); + } + + 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_supported_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_basic_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(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"); + + return; + } + } +#endif // _di_fss_write_basic_process_content_ + #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((fss_write_setting_t *) setting, main->message); + fss_write_basic_print_help(macro_fss_write_setting(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, const f_string_static_t * const object) { + + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + macro_fss_write_setting(setting)->status = fl_fss_basic_object_write( + *object, + (macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e, + 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( + *object, + (macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e, + (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_supported_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_basic_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(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"); + } + } +#endif // _di_fss_write_basic_process_object_ + #ifndef _di_fss_write_basic_process_normal_ void fss_write_basic_process_normal(fll_program_data_t * const main, void * const setting) { - // @todo + f_string_statics_t * const data = (macro_fss_write_setting(setting)->flag & fss_write_flag_object_e) ? ¯o_fss_write_setting(setting)->objects : ¯o_fss_write_setting(setting)->contents; + + for (f_array_length_t i = 0; i < data->used; ++i) { + + // @todo replace all signal checks with forked main process that independently checks and assigns main->signal_received. + if (!((++main->signal_check) % fss_write_signal_check_d)) { + if (fll_program_standard_signal_received(main)) { + macro_fss_write_setting(setting)->status = F_status_set_error(F_interrupt); + + return; + } + + main->signal_check = 0; + } + + fss_write_process_set( + main, + macro_fss_write_setting(setting), + (macro_fss_write_setting(setting)->flag & fss_write_flag_object_e) ? ¯o_fss_write_setting(setting)->objects.array[i] : 0, + (macro_fss_write_setting(setting)->flag & fss_write_flag_content_e) ? ¯o_fss_write_setting(setting)->contents.array[i] : 0 + ); + + if (F_status_is_error(macro_fss_write_setting(setting)->status)) break; + } // for } #endif // _di_fss_write_basic_process_normal_ diff --git a/level_3/fss_write/c/basic/fss_write.h b/level_3/fss_write/c/basic/fss_write.h index 701999f..416d2f1 100644 --- a/level_3/fss_write/c/basic/fss_write.h +++ b/level_3/fss_write/c/basic/fss_write.h @@ -39,7 +39,6 @@ // FLL-2 includes. #include -#include #include #include @@ -54,6 +53,24 @@ extern "C" { #endif /** + * Process a single Content, printing the FSS-0000 (Basic) if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * Must be of type (fss_write_setting_t *). + * + * This alters setting.status. + * This uses and alters setting.buffer. + * @param content + * The string representing the Content to write to the buffer. + */ +#ifndef _di_fss_write_basic_process_content_ + extern void fss_write_basic_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content); +#endif // _di_fss_write_basic_process_content_ + +/** * Process help for FSS-0000 (Basic). * * @param main @@ -73,7 +90,7 @@ extern "C" { #endif // _di_fss_write_basic_process_help_ /** - * Process normally, writing to the output. + * Process normally, writing to the output for FSS-0000 (Basic). * * @param main * The main program data. @@ -92,7 +109,25 @@ extern "C" { #endif // _di_fss_write_basic_process_normal_ /** - * Process the pipe, reading from the pipe and writing to the output. + * Process a single Object, printing the FSS-0000 (Basic) if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * Must be of type (fss_write_setting_t *). + * + * This alters setting.status. + * This uses and alters setting.buffer. + * @param object + * The string representing the Object to write to the buffer. + */ +#ifndef _di_fss_write_basic_process_object_ + extern void fss_write_basic_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object); +#endif // _di_fss_write_basic_process_object_ + +/** + * Process the pipe, reading from the pipe and writing to the output for FSS-0000 (Basic). * * @param main * The main program data. diff --git a/level_3/fss_write/c/basic/main.c b/level_3/fss_write/c/basic/main.c index 2b95e0c..9c1d28b 100644 --- a/level_3/fss_write/c/basic/main.c +++ b/level_3/fss_write/c/basic/main.c @@ -5,11 +5,13 @@ 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.program_name = &fss_write_basic_program_name_s; + setting.program_name_long = &fss_write_basic_program_name_long_s; setting.process_help = &fss_write_basic_process_help; setting.process_pipe = &fss_write_basic_process_pipe; setting.process_normal = &fss_write_basic_process_normal; - setting.program_name = &fss_write_basic_program_name_s; - setting.program_name_long = &fss_write_basic_program_name_long_s; + setting.process_object = &fss_write_basic_process_object; + setting.process_content = &fss_write_basic_process_content; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; 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 ebc7a29..435c14d 100644 --- a/level_3/fss_write/c/basic_list/fss_write.c +++ b/level_3/fss_write/c/basic_list/fss_write.c @@ -7,10 +7,52 @@ 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 f_string_static_t * const content) { + + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + macro_fss_write_setting(setting)->status = fl_fss_basic_list_content_write( + *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( + *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_supported_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_basic_list_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(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"); + + return; + } + } +#endif // _di_fss_write_basic_list_process_content_ + #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((fss_write_setting_t *) setting, main->message); + fss_write_basic_list_print_help(macro_fss_write_setting(setting), main->message); } #endif // _di_fss_write_basic_list_process_help_ @@ -21,6 +63,44 @@ extern "C" { } #endif // _di_fss_write_basic_list_process_normal_ +#ifndef _di_fss_write_basic_list_process_object_ + void fss_write_basic_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object) { + + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + macro_fss_write_setting(setting)->status = fl_fss_basic_list_object_write( + *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_basic_list_object_write( + *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_supported_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_basic_list_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(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"); + } + } +#endif // _di_fss_write_basic_list_process_object_ + #ifndef _di_fss_write_basic_list_process_pipe_ void fss_write_basic_list_process_pipe(fll_program_data_t * const main, void * const setting) { diff --git a/level_3/fss_write/c/basic_list/fss_write.h b/level_3/fss_write/c/basic_list/fss_write.h index d7391c3..6ea235f 100644 --- a/level_3/fss_write/c/basic_list/fss_write.h +++ b/level_3/fss_write/c/basic_list/fss_write.h @@ -54,6 +54,24 @@ extern "C" { #endif /** + * Process a single Content, printing the FSS-0002 (Basic List) if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * Must be of type (fss_write_setting_t *). + * + * This alters setting.status. + * This uses and alters setting.buffer. + * @param content + * The string representing the Content to write to the buffer. + */ +#ifndef _di_fss_write_basic_list_process_content_ + extern void fss_write_basic_list_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content); +#endif // _di_fss_write_basic_list_process_content_ + +/** * Process help for FSS-0002 (Basic List). * * @param main @@ -92,6 +110,24 @@ extern "C" { #endif // _di_fss_write_basic_list_process_normal_ /** + * Process a single Object, printing the FSS-0002 (Basic List) if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * Must be of type (fss_write_setting_t *). + * + * This alters setting.status. + * This uses and alters setting.buffer. + * @param object + * The string representing the Object to write to the buffer. + */ +#ifndef _di_fss_write_basic_list_process_object_ + extern void fss_write_basic_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object); +#endif // _di_fss_write_basic_list_process_object_ + +/** * Process the pipe, reading from the pipe and writing to the output. * * @param main diff --git a/level_3/fss_write/c/basic_list/main.c b/level_3/fss_write/c/basic_list/main.c index 8e3452d..e8f6e86 100644 --- a/level_3/fss_write/c/basic_list/main.c +++ b/level_3/fss_write/c/basic_list/main.c @@ -5,11 +5,13 @@ 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.program_name = &fss_write_basic_list_program_name_s; + setting.program_name_long = &fss_write_basic_list_program_name_long_s; setting.process_help = &fss_write_basic_list_process_help; setting.process_pipe = &fss_write_basic_list_process_pipe; setting.process_normal = &fss_write_basic_list_process_normal; - setting.program_name = &fss_write_basic_list_program_name_s; - setting.program_name_long = &fss_write_basic_list_program_name_long_s; + setting.process_object = &fss_write_basic_list_process_object; + setting.process_content = &fss_write_basic_list_process_content; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; 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 4ad0c7f..08d5669 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.c +++ b/level_3/fss_write/c/embedded_list/fss_write.c @@ -7,10 +7,54 @@ 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 f_string_static_t * const content) { + + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + macro_fss_write_setting(setting)->status = fl_fss_embedded_list_content_write( + *content, + f_fss_complete_none_e, + ¯o_fss_write_setting(setting)->prepend, + ¯o_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( + *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, + ¯o_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_supported_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_embedded_list_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(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"); + + return; + } + } +#endif // _di_fss_write_embedded_list_process_content_ + #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((fss_write_setting_t *) setting, main->message); + fss_write_embedded_list_print_help(macro_fss_write_setting(setting), main->message); } #endif // _di_fss_write_embedded_list_process_help_ @@ -21,6 +65,44 @@ extern "C" { } #endif // _di_fss_write_embedded_list_process_normal_ +#ifndef _di_fss_write_embedded_list_process_object_ + void fss_write_embedded_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object) { + + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + macro_fss_write_setting(setting)->status = fl_fss_embedded_list_object_write( + *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( + *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_supported_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_embedded_list_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(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"); + } + } +#endif // _di_fss_write_embedded_list_process_object_ + #ifndef _di_fss_write_embedded_list_process_pipe_ void fss_write_embedded_list_process_pipe(fll_program_data_t * const main, void * const setting) { diff --git a/level_3/fss_write/c/embedded_list/fss_write.h b/level_3/fss_write/c/embedded_list/fss_write.h index 9483c6e..c94289a 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.h +++ b/level_3/fss_write/c/embedded_list/fss_write.h @@ -53,6 +53,24 @@ extern "C" { #endif /** + * Process a single Content, printing the FSS-0008 (Embedded List) if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * Must be of type (fss_write_setting_t *). + * + * This alters setting.status. + * This uses and alters setting.buffer. + * @param content + * The string representing the Content to write to the buffer. + */ +#ifndef _di_fss_write_embedded_list_process_content_ + extern void fss_write_embedded_list_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content); +#endif // _di_fss_write_embedded_list_process_content_ + +/** * Process help for FSS-0008 (Embedded List). * * @param main @@ -91,6 +109,24 @@ extern "C" { #endif // _di_fss_write_embedded_list_process_normal_ /** + * Process a single Object, printing the FSS-0008 (Embedded List) if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * Must be of type (fss_write_setting_t *). + * + * This alters setting.status. + * This uses and alters setting.buffer. + * @param object + * The string representing the Object to write to the buffer. + */ +#ifndef _di_fss_write_embedded_list_process_object_ + extern void fss_write_embedded_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object); +#endif // _di_fss_write_embedded_list_process_object_ + +/** * Process the pipe, reading from the pipe and writing to the output. * * @param main diff --git a/level_3/fss_write/c/embedded_list/main.c b/level_3/fss_write/c/embedded_list/main.c index 2652249..494543a 100644 --- a/level_3/fss_write/c/embedded_list/main.c +++ b/level_3/fss_write/c/embedded_list/main.c @@ -5,11 +5,13 @@ 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.program_name = &fss_write_embedded_list_program_name_s; + setting.program_name_long = &fss_write_embedded_list_program_name_long_s; setting.process_help = &fss_write_embedded_list_process_help; setting.process_pipe = &fss_write_embedded_list_process_pipe; setting.process_normal = &fss_write_embedded_list_process_normal; - setting.program_name = &fss_write_embedded_list_program_name_s; - setting.program_name_long = &fss_write_embedded_list_program_name_long_s; + setting.process_object = &fss_write_embedded_list_process_object; + setting.process_content = &fss_write_embedded_list_process_content; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_write/c/extended/fss_write.c b/level_3/fss_write/c/extended/fss_write.c index e76f0f4..447a899 100644 --- a/level_3/fss_write/c/extended/fss_write.c +++ b/level_3/fss_write/c/extended/fss_write.c @@ -7,10 +7,52 @@ 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 f_string_static_t * const content) { + + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + macro_fss_write_setting(setting)->status = fl_fss_extended_content_write( + *content, + (macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e, + 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_content_write( + *content, + (macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e, + (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_supported_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_extended_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(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"); + + return; + } + } +#endif // _di_fss_write_extended_process_content_ + #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((fss_write_setting_t *) setting, main->message); + fss_write_extended_print_help(macro_fss_write_setting(setting), main->message); } #endif // _di_fss_write_extended_process_help_ @@ -21,6 +63,46 @@ extern "C" { } #endif // _di_fss_write_extended_process_normal_ +#ifndef _di_fss_write_extended_process_object_ + void fss_write_extended_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object) { + + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + macro_fss_write_setting(setting)->status = fl_fss_extended_object_write( + *object, + (macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e, + 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( + *object, + (macro_fss_write_setting(setting)->flag & fss_write_flag_single_e) ? f_fss_quote_type_single_e : f_fss_quote_type_double_e, + (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_supported_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_extended_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(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"); + } + } +#endif // _di_fss_write_extended_process_object_ + #ifndef _di_fss_write_extended_process_pipe_ void fss_write_extended_process_pipe(fll_program_data_t * const main, void * const setting) { diff --git a/level_3/fss_write/c/extended/fss_write.h b/level_3/fss_write/c/extended/fss_write.h index 0b7e9f4..74fd129 100644 --- a/level_3/fss_write/c/extended/fss_write.h +++ b/level_3/fss_write/c/extended/fss_write.h @@ -39,7 +39,6 @@ // FLL-2 includes. #include -#include #include #include @@ -52,6 +51,25 @@ #ifdef __cplusplus extern "C" { #endif + +/** + * Process a single Content, printing the FSS-0001 (Extended) if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * Must be of type (fss_write_setting_t *). + * + * This alters setting.status. + * This uses and alters setting.buffer. + * @param content + * The string representing the Content to write to the buffer. + */ +#ifndef _di_fss_write_extended_process_content_ + extern void fss_write_extended_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content); +#endif // _di_fss_write_extended_process_content_ + /** * Process help for FSS-0001 (Extended). * @@ -91,6 +109,24 @@ extern "C" { #endif // _di_fss_write_extended_process_normal_ /** + * Process a single Object, printing the FSS-0001 (Extended) if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * Must be of type (fss_write_setting_t *). + * + * This alters setting.status. + * This uses and alters setting.buffer. + * @param object + * The string representing the Object to write to the buffer. + */ +#ifndef _di_fss_write_extended_process_object_ + extern void fss_write_extended_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object); +#endif // _di_fss_write_extended_process_object_ + +/** * Process the pipe, reading from the pipe and writing to the output. * * @param main diff --git a/level_3/fss_write/c/extended/main.c b/level_3/fss_write/c/extended/main.c index e4777f3..0da93cc 100644 --- a/level_3/fss_write/c/extended/main.c +++ b/level_3/fss_write/c/extended/main.c @@ -5,11 +5,13 @@ 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.program_name = &fss_write_extended_program_name_s; + setting.program_name_long = &fss_write_extended_program_name_long_s; setting.process_help = &fss_write_extended_process_help; setting.process_pipe = &fss_write_extended_process_pipe; setting.process_normal = &fss_write_extended_process_normal; - setting.program_name = &fss_write_extended_program_name_s; - setting.program_name_long = &fss_write_extended_program_name_long_s; + setting.process_object = &fss_write_exended_process_object; + setting.process_content = &fss_write_exended_process_content; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; 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 f0775dc..2020156 100644 --- a/level_3/fss_write/c/extended_list/fss_write.c +++ b/level_3/fss_write/c/extended_list/fss_write.c @@ -7,10 +7,54 @@ 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 f_string_static_t * const content) { + + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + macro_fss_write_setting(setting)->status = fl_fss_extended_list_content_write( + *content, + f_fss_complete_none_e, + ¯o_fss_write_setting(setting)->prepend, + ¯o_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( + *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, + ¯o_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_supported_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_extended_list_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(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"); + + return; + } + } +#endif // _di_fss_write_extended_list_process_content_ + #ifndef _di_fss_write_extended_list_process_help_ void fss_write_extended_list_process_help(fll_program_data_t * const main, void * const setting) { - fss_write_extended_list_print_help((fss_write_setting_t *) setting, main->message); + fss_write_extended_list_print_help(macro_fss_write_setting(setting), main->message); } #endif // _di_fss_write_extended_list_process_help_ @@ -21,6 +65,44 @@ extern "C" { } #endif // _di_fss_write_extended_list_process_normal_ +#ifndef _di_fss_write_extended_list_process_object_ + void fss_write_extended_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object) { + + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + macro_fss_write_setting(setting)->status = fl_fss_extended_list_object_write( + *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( + *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_supported_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_extended_list_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(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_object_write"); + } + } +#endif // _di_fss_write_extended_list_process_object_ + #ifndef _di_fss_write_extended_list_process_pipe_ void fss_write_extended_list_process_pipe(fll_program_data_t * const main, void * const setting) { diff --git a/level_3/fss_write/c/extended_list/fss_write.h b/level_3/fss_write/c/extended_list/fss_write.h index 5f9d094..0197115 100644 --- a/level_3/fss_write/c/extended_list/fss_write.h +++ b/level_3/fss_write/c/extended_list/fss_write.h @@ -33,13 +33,12 @@ // FLL-1 includes. #include -#include +#include #include #include // FLL-2 includes. #include -#include #include #include @@ -54,6 +53,24 @@ extern "C" { #endif /** + * Process a single Content, printing the FSS-0003 (Extended List) if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * Must be of type (fss_write_setting_t *). + * + * This alters setting.status. + * This uses and alters setting.buffer. + * @param content + * The string representing the Content to write to the buffer. + */ +#ifndef _di_fss_write_extended_list_process_content_ + extern void fss_write_extended_list_process_content(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content); +#endif // _di_fss_write_extended_list_process_content_ + +/** * Process help for FSS-0003 (Extended List). * * @param main @@ -92,6 +109,24 @@ extern "C" { #endif // _di_fss_write_extended_list_process_normal_ /** + * Process a single Object, printing the FSS-0003 (Extended List) if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * Must be of type (fss_write_setting_t *). + * + * This alters setting.status. + * This uses and alters setting.buffer. + * @param object + * The string representing the Object to write to the buffer. + */ +#ifndef _di_fss_write_extended_list_process_object_ + extern void fss_write_extended_list_process_object(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object); +#endif // _di_fss_write_extended_list_process_object_ + +/** * Process the pipe, reading from the pipe and writing to the output. * * @param main diff --git a/level_3/fss_write/c/extended_list/main.c b/level_3/fss_write/c/extended_list/main.c index 20d3dd4..efd2e94 100644 --- a/level_3/fss_write/c/extended_list/main.c +++ b/level_3/fss_write/c/extended_list/main.c @@ -5,11 +5,13 @@ 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.program_name = &fss_write_extended_list_program_name_s; + setting.program_name_long = &fss_write_extended_list_program_name_long_s; setting.process_help = &fss_write_extended_list_process_help; setting.process_pipe = &fss_write_extended_list_process_pipe; setting.process_normal = &fss_write_extended_list_process_normal; - setting.program_name = &fss_write_extended_list_program_name_s; - setting.program_name_long = &fss_write_extended_list_program_name_long_s; + setting.process_object = &fss_write_exended_list_process_object; + setting.process_content = &fss_write_exended_list_process_content; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index db0515f..ab242a4 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -141,11 +141,11 @@ extern "C" { main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; if (main->parameters.array[fss_write_parameter_help_e].result & f_console_result_found_e) { - setting->flag |= fss_write_main_flag_help_e; + setting->flag |= fss_write_flag_help_e; } if (main->parameters.array[fss_write_parameter_version_e].result & f_console_result_found_e) { - setting->flag |= fss_write_main_flag_version_e; + setting->flag |= fss_write_flag_version_e; } if (callback) { @@ -162,7 +162,7 @@ extern "C" { if (main->parameters.array[fss_write_parameter_help_e].result & f_console_result_found_e) return; if (main->parameters.array[fss_write_parameter_version_e].result & f_console_result_found_e) return; - if (main->parameters.array[fss_write_parameter_file_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_file_e].values.used) { + if ((main->parameters.array[fss_write_parameter_file_e].result & f_console_result_value_e) && main->parameters.array[fss_write_parameter_file_e].values.used) { if (main->parameters.array[fss_write_parameter_file_e].values.used > 1) { setting->status = F_status_set_error(F_parameter); @@ -186,7 +186,7 @@ extern "C" { return; } - setting->flag |= fss_write_main_flag_file_to_e; + setting->flag |= fss_write_flag_file_to_e; } else if (main->parameters.array[fss_write_parameter_file_e].result & f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); @@ -221,7 +221,7 @@ extern "C" { setting->objects.array[setting->objects.used++].size = 0; } // for - setting->flag |= fss_write_main_flag_object_e; + setting->flag |= fss_write_flag_object_e; } else if (main->parameters.array[fss_write_parameter_object_e].result & f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); @@ -233,7 +233,7 @@ extern "C" { return; } - 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 ((main->parameters.array[fss_write_parameter_content_e].result & f_console_result_value_e) && main->parameters.array[fss_write_parameter_content_e].values.used) { f_array_lengths_t * const values = &main->parameters.array[fss_write_parameter_content_e].values; setting->contents.used = 0; @@ -256,7 +256,7 @@ extern "C" { setting->contents.array[setting->contents.used++].size = 0; } // for - setting->flag |= fss_write_main_flag_content_e; + setting->flag |= fss_write_flag_content_e; } else if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); @@ -268,7 +268,7 @@ extern "C" { return; } - if (main->parameters.array[fss_write_parameter_prepend_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_prepend_e].values.used) { + if ((main->parameters.array[fss_write_parameter_prepend_e].result & f_console_result_value_e) && main->parameters.array[fss_write_parameter_prepend_e].values.used) { const f_array_length_t index = main->parameters.array[fss_write_parameter_prepend_e].values.array[main->parameters.array[fss_write_parameter_prepend_e].values.used - 1]; setting->prepend.used = 0; @@ -305,7 +305,7 @@ extern "C" { } // for } - setting->flag |= fss_write_main_flag_prepend_e; + setting->flag |= fss_write_flag_prepend_e; } else if (main->parameters.array[fss_write_parameter_prepend_e].result & f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); @@ -317,7 +317,7 @@ extern "C" { return; } - if (main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_ignore_e].values.used) { + if ((main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_value_e) && main->parameters.array[fss_write_parameter_ignore_e].values.used) { if (main->parameters.array[fss_write_parameter_ignore_e].values.used % 2 != 0) { setting->status = F_status_set_error(F_parameter); @@ -380,7 +380,7 @@ extern "C" { ++setting->ignores.used; } // for - setting->flag |= fss_write_main_flag_ignore_e; + setting->flag |= fss_write_flag_ignore_e; } else if (main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); @@ -393,11 +393,11 @@ extern "C" { } if (main->parameters.array[fss_write_parameter_partial_e].result & f_console_result_found_e) { - setting->flag |= fss_write_main_flag_partial_e; + setting->flag |= fss_write_flag_partial_e; } - if (setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e)) { - if (setting->flag & fss_write_main_flag_object_e) { + if (setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e)) { + if (setting->flag & fss_write_flag_object_e) { if (main->parameters.array[fss_write_parameter_object_e].locations.used != main->parameters.array[fss_write_parameter_object_e].values.used) { setting->status = F_status_set_error(F_parameter); @@ -418,7 +418,7 @@ extern "C" { return; } - if (main->parameters.array[fss_write_parameter_object_e].locations.used != main->parameters.array[fss_write_parameter_content_e].locations.used && !(setting->flag & fss_write_main_flag_partial_e)) { + if (main->parameters.array[fss_write_parameter_object_e].locations.used != main->parameters.array[fss_write_parameter_content_e].locations.used && !(setting->flag & fss_write_flag_partial_e)) { setting->status = F_status_set_error(F_parameter); fss_write_print_line_first_locked(setting, main->error); @@ -428,7 +428,7 @@ extern "C" { return; } - if ((setting->flag & fss_write_main_flag_content_e) && (setting->flag & fss_write_main_flag_partial_e)) { + if ((setting->flag & fss_write_flag_content_e) && (setting->flag & fss_write_flag_partial_e)) { if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_value_e) { setting->status = F_status_set_error(F_parameter); @@ -439,31 +439,6 @@ extern "C" { return; } } - - if (setting->flag & fss_write_main_flag_content_e) { - f_array_length_t location_object = 0; - f_array_length_t location_content = 0; - f_array_length_t location_sub_object = 0; - f_array_length_t location_sub_content = 0; - - for (f_array_length_t i = 0; i < main->parameters.array[fss_write_parameter_object_e].locations.used; ++i) { - - location_object = main->parameters.array[fss_write_parameter_object_e].locations.array[i]; - location_content = main->parameters.array[fss_write_parameter_content_e].locations.array[i]; - location_sub_object = main->parameters.array[fss_write_parameter_object_e].locations_sub.array[i]; - location_sub_content = main->parameters.array[fss_write_parameter_content_e].locations_sub.array[i]; - - if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) { - setting->status = F_status_set_error(F_parameter); - - fss_write_print_line_first_locked(setting, main->error); - fss_write_print_error_object_not_before_content(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); - - break; - } - } // for - } } } @@ -481,10 +456,10 @@ extern "C" { } if (main->parameters.array[fss_write_parameter_trim_e].result & f_console_result_found_e) { - setting->flag |= fss_write_main_flag_trim_e; + setting->flag |= fss_write_flag_trim_e; } - if (!(setting->flag & (fll_program_data_pipe_input_e | fss_write_main_flag_content_e | fss_write_parameter_object_e))) { + if (!(setting->flag & (fll_program_data_pipe_input_e | fss_write_flag_content_e | fss_write_parameter_object_e))) { setting->status = F_data_not; } } diff --git a/level_3/fss_write/c/main/common.h b/level_3/fss_write/c/main/common.h index a65ea8e..1e4a824 100644 --- a/level_3/fss_write/c/main/common.h +++ b/level_3/fss_write/c/main/common.h @@ -62,9 +62,21 @@ extern "C" { /** * The program defines. * + * The fss_write_pipe_content_*_s strings are strings rather than characters to allow for wide characters. + * * payload_write_common_allocation_*: * - large: An allocation step used for buffers that are anticipated to have large buffers. * - small: An allocation step used for buffers that are anticipated to have small buffers. + * + * fss_write_pipe_content_*_s: + * - end: The character representing the end of content. + * - ignore: The character representing the start of or end of a set of characters to ignore. + * - start: The character representing the start of content. + * + * macro_fss_write_setting: + * - Used to represent a cast to ((fss_write_setting_t *) setting). + * - Simplifies the number of parenthesis used to make code slightly cleaner. + * - Is wrapped in a parenthesis and not a block. */ #ifndef _di_fss_write_defines_ #define fss_write_signal_check_d 20000 @@ -83,6 +95,8 @@ 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_defines_ /** @@ -225,7 +239,7 @@ extern "C" { /** * Flags used to represent flags passed to the main function. * - * fss_write_main_flag_*_e: + * fss_write_flag_*_e: * - none: No modes in use. * - content: The Content being written is specified. * - double: Operate using double quotes. @@ -235,26 +249,28 @@ extern "C" { * - object: The Object being written is specified. * - partial: Do not write end of Object/Content character. * - prepend: Prepend the given white space characters to the start of each multi-line Content. + * - printed: Designate that the first line has been print for the main output. * - single: Operate using single quotes. * - trim: Trim Object names. * - version: Print version. */ -#ifndef _di_fss_write_main_flag_e_ +#ifndef _di_fss_write_flag_e_ enum { - fss_write_main_flag_none_e = 0x0, - fss_write_main_flag_content_e = 0x1, - fss_write_main_flag_double_e = 0x2, - fss_write_main_flag_file_to_e = 0x4, - fss_write_main_flag_help_e = 0x8, - fss_write_main_flag_ignore_e = 0x10, - fss_write_main_flag_object_e = 0x20, - fss_write_main_flag_partial_e = 0x40, - fss_write_main_flag_prepend_e = 0x80, - fss_write_main_flag_single_e = 0x100, - fss_write_main_flag_trim_e = 0x200, - fss_write_main_flag_version_e = 0x400, + fss_write_flag_none_e = 0x0, + fss_write_flag_content_e = 0x1, + fss_write_flag_double_e = 0x2, + fss_write_flag_file_to_e = 0x4, + fss_write_flag_help_e = 0x8, + fss_write_flag_ignore_e = 0x10, + fss_write_flag_object_e = 0x20, + fss_write_flag_partial_e = 0x40, + fss_write_flag_prepend_e = 0x80, + fss_write_flag_printed_e = 0x100, + fss_write_flag_single_e = 0x200, + fss_write_flag_trim_e = 0x400, + fss_write_flag_version_e = 0x800, }; -#endif // _di_fss_write_main_flag_e_ +#endif // _di_fss_write_flag_e_ /** * The fss payload write main program settings. @@ -320,11 +336,13 @@ extern "C" { void (*process_help)(fll_program_data_t * const main, void * const setting); void (*process_normal)(fll_program_data_t * const main, void * const setting); void (*process_pipe)(fll_program_data_t * const main, void * const setting); + void (*process_object)(fll_program_data_t * const main, void * const setting, const f_string_static_t * const object); + void (*process_content)(fll_program_data_t * const main, void * const setting, const f_string_static_t * const content); } fss_write_setting_t; #define fss_write_setting_t_initialize \ { \ - fss_write_main_flag_none_e, \ + fss_write_flag_none_e, \ F_none, \ macro_f_state_t_initialize(fss_write_common_allocation_large_d, fss_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, 0, 0), \ f_string_range_t_initialize, \ @@ -344,6 +362,8 @@ extern "C" { 0, \ 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 2e7ec1b..1989ec4 100644 --- a/level_3/fss_write/c/main/fss_write.c +++ b/level_3/fss_write/c/main/fss_write.c @@ -13,13 +13,13 @@ extern "C" { setting->status = F_none; - if (setting->flag & fss_write_main_flag_help_e) { + if (setting->flag & fss_write_flag_help_e) { setting->process_help(main, (void *) setting); return; } - if (setting->flag & fss_write_main_flag_version_e) { + if (setting->flag & fss_write_flag_version_e) { fll_program_print_version(main->message, fss_write_program_version_s); return; @@ -32,16 +32,62 @@ extern "C" { if (F_status_is_error(setting->status)) return; } - if (setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e)) { + if (setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e)) { setting->process_normal(main, setting); if (F_status_is_error(setting->status)) return; } - // Ensure a new line is always put at the end of the program execution, unless in quiet mode. + // Ensure a new line is always put at the end of the program execution. fss_write_print_line_last_locked(setting, main->message); } #endif // _di_fss_write_main_ +#ifndef _di_fss_write_process_set_ + void fss_write_process_set(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_string_static_t * const object, const f_string_static_t * const content) { + + setting->buffer.used = 0; + + if (object) { + if (object->used) { + setting->range.start = 0; + setting->range.stop = object->used - 1; + } + else { + setting->range.start = 1; + setting->range.stop = 0; + } + + setting->process_object(main, (void *) setting, object); + if (F_status_is_error(setting->status)) return; + } + + if (content) { + if (content->used) { + setting->range.start = 0; + setting->range.stop = content->used - 1; + } + else { + setting->range.start = 1; + setting->range.stop = 0; + } + + setting->process_content(main, (void *) setting, content); + if (F_status_is_error(setting->status)) return; + } + + if (setting->buffer.used) { + fss_write_print_line_first_locked(setting, main->message); + + f_file_stream_lock(main->output.to); + + f_print_dynamic(setting->buffer, main->output.to); + f_print_dynamic_raw(f_string_eol_s, main->output.to); + + f_file_stream_unlock(main->output.to); + } + } +#endif // _di_fss_write_process_set_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_write/c/main/fss_write.h b/level_3/fss_write/c/main/fss_write.h index 4468f25..a5727a0 100644 --- a/level_3/fss_write/c/main/fss_write.h +++ b/level_3/fss_write/c/main/fss_write.h @@ -77,6 +77,30 @@ extern "C" { extern void fss_write_main(fll_program_data_t * const main, fss_write_setting_t * const setting); #endif // _di_fss_write_main_ +/** + * Process a given Object and Content, printing the assigned FSS format if valid or an error if invalid. + * + * @param main + * The main program data. + * @param setting + * The main program settings. + * + * 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 pointer address to 0 to not use. + * @param content + * The content to escape and print. + * Set pointer address to 0 to not use. + */ +#ifndef _di_fss_write_process_set_ + extern void fss_write_process_set(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_string_static_t * const object, const f_string_static_t * const content); +#endif // _di_fss_write_process_set_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_write/c/main/main.c b/level_3/fss_write/c/main/main.c index b695606..f7ccea3 100644 --- a/level_3/fss_write/c/main/main.c +++ b/level_3/fss_write/c/main/main.c @@ -47,20 +47,22 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { #ifndef _di_fss_write_main_process_help_ void fss_write_main_process_help(fll_program_data_t * const main, void * const setting) { - fss_write_main_print_help((fss_write_setting_t *) setting, main->message); + fss_write_main_print_help(macro_fss_write_setting(setting), main->message); } #endif // _di_fss_write_main_process_help_ #ifndef _di_fss_write_main_setting_load_as_ void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) { - if (!main || !setting || F_status_is_error(setting->status) || (setting->flag & fss_write_main_flag_version_e)) return; + if (!main || !setting || F_status_is_error(setting->status) || (setting->flag & fss_write_flag_version_e)) return; setting->program_name = &fss_write_program_name_s; setting->program_name_long = &fss_write_program_name_long_s; setting->process_help = &fss_write_main_process_help; setting->process_pipe = &fss_write_basic_process_pipe; setting->process_normal = &fss_write_basic_process_normal; + setting->process_object = &fss_write_basic_process_object; + setting->process_content = &fss_write_basic_process_content; 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) { @@ -80,6 +82,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_help = &fss_write_basic_process_help; setting->process_pipe = &fss_write_basic_process_pipe; setting->process_normal = &fss_write_basic_process_normal; + setting->process_object = &fss_write_basic_process_object; + setting->process_content = &fss_write_basic_process_content; } else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0001_s) == F_equal_to || fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0001_s) == F_equal_to || @@ -90,6 +94,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_help = &fss_write_extended_process_help; setting->process_pipe = &fss_write_extended_process_pipe; setting->process_normal = &fss_write_extended_process_normal; + setting->process_object = &fss_write_extended_process_object; + setting->process_content = &fss_write_extended_process_content; } else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0002_s) == F_equal_to || fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0002_s) == F_equal_to || @@ -100,6 +106,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_help = &fss_write_basic_list_process_help; setting->process_pipe = &fss_write_basic_list_process_pipe; setting->process_normal = &fss_write_basic_list_process_normal; + setting->process_object = &fss_write_basic_list_process_object; + setting->process_content = &fss_write_basic_list_process_content; } else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0003_s) == F_equal_to || fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0003_s) == F_equal_to || @@ -110,6 +118,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_help = &fss_write_extended_list_process_help; setting->process_pipe = &fss_write_extended_list_process_pipe; setting->process_normal = &fss_write_extended_list_process_normal; + setting->process_object = &fss_write_extended_list_process_object; + setting->process_content = &fss_write_extended_list_process_content; } else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0008_s) == F_equal_to || fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0008_s) == F_equal_to || @@ -120,6 +130,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_help = &fss_write_embedded_list_process_help; setting->process_pipe = &fss_write_embedded_list_process_pipe; setting->process_normal = &fss_write_embedded_list_process_normal; + setting->process_object = &fss_write_embedded_list_process_object; + setting->process_content = &fss_write_embedded_list_process_content; } else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_000e_s) == F_equal_to || fl_string_dynamic_compare(argv[index], fss_write_format_code_long_000e_s) == F_equal_to || @@ -130,10 +142,11 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_help = &fss_write_payload_process_help; setting->process_pipe = &fss_write_payload_process_pipe; setting->process_normal = &fss_write_payload_process_normal; - + setting->process_object = 0; // Not used by payload. + setting->process_content = 0; // Not used by payload. } else { - if (setting->flag & fss_write_main_flag_help_e) { + if (setting->flag & fss_write_flag_help_e) { setting->status = F_status_set_error(F_parameter); break; @@ -150,7 +163,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { } // for if (F_status_is_error(setting->status)) { - if (setting->flag & fss_write_main_flag_help_e) { + if (setting->flag & fss_write_flag_help_e) { fss_write_main_process_help(main, setting); } else { @@ -163,7 +176,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { else if (main->parameters.array[fss_write_parameter_as_e].result & f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); - if (setting->flag & fss_write_main_flag_help_e) { + if (setting->flag & fss_write_flag_help_e) { fss_write_main_process_help(main, setting); return; diff --git a/level_3/fss_write/c/main/print.c b/level_3/fss_write/c/main/print.c index 10d656e..3cee7a8 100644 --- a/level_3/fss_write/c/main/print.c +++ b/level_3/fss_write/c/main/print.c @@ -31,24 +31,51 @@ extern "C" { } #endif // _di_fss_write_print_error_file_ -#ifndef _di_fss_write_print_error_object_not_before_content_ - f_status_t fss_write_print_error_object_not_before_content(fss_write_setting_t * const setting, const fl_print_t print) { +#ifndef _di_fss_write_print_error_parameter_same_times_ + f_status_t fss_write_print_error_parameter_same_times(fss_write_setting_t * const setting, const fl_print_t print) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); - fl_print_format("%r%[%QEach '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_object_s, print.set->notable); - fl_print_format("%[' parameter must be specified before a '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.set->notable); - fl_print_format("%[' parameter.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fss_write_print_line_first_unlocked(setting, print); + fl_print_format("%[%QMust specify the '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, fss_write_long_object_s, print.notable); + fl_print_format("%[' parameter and the '%]", print.to, print.context, print.context); + fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.notable); + fl_print_format("%[' parameter the same number of times when not specifying the '%]", print.to, print.context, print.context); + fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, fss_write_long_partial_s, print.notable); + fl_print_format("%[' parameter.%]%r", print.to, print.context, print.context, f_string_eol_s); + fss_write_print_line_last_unlocked(setting, print); f_file_stream_unlock(print.to); return F_none; } -#endif // _di_fss_write_print_error_object_not_before_content_ +#endif // _di_fss_write_print_error_parameter_same_times_ + +// @todo replace fss_basic_write_error_parameter_value_missing_print with fll_program_print_error_parameter_missing_value. + +#ifndef _di_fss_write_print_error_parameter_unsupported_eol_object_ + f_status_t fss_write_print_error_parameter_unsupported_eol_object(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + f_file_stream_lock(print.to); + + fss_write_print_line_first_unlocked(setting, print); + fl_print_format("%[%QThe %r standard does not support end of line character '%]", print.to, print.context, print.prefix, standard, print.context); + fl_print_format("%[\\n%]", print.to, print.notable, print.notable); + fl_print_format("%[' (%]", print.to, print.context, print.context); + fl_print_format("%[U+000A%]", print.to, print.notable, print.notable); + fl_print_format("%[) in objects.%]%r", print.to, print.context, print.context, f_string_eol_s); + fss_write_print_line_last_unlocked(setting, print); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fss_write_print_error_parameter_unsupported_eol_object_ #ifndef _di_fss_write_print_error_one_content_only_ f_status_t fss_write_print_error_one_content_only(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard) { @@ -134,9 +161,17 @@ extern "C" { #ifndef _di_fss_write_print_line_first_locked_ f_status_t fss_write_print_line_first_locked(fss_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & fss_write_flag_printed_e) return F_output_not; - if (!F_status_is_error(setting->status)) { + if (F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + } + else { + + // Always set to true to regardless of whether printed actually happened for non-errors. + setting->flag |= fss_write_flag_printed_e; + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } @@ -149,9 +184,17 @@ extern "C" { #ifndef _di_fss_write_print_line_first_unlocked_ f_status_t fss_write_print_line_first_unlocked(fss_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & fss_write_flag_printed_e) return F_output_not; - if (!F_status_is_error(setting->status)) { + if (F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + } + else { + + // Always set to true to regardless of whether printed actually happened for non-errors. + setting->flag |= fss_write_flag_printed_e; + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } @@ -168,7 +211,7 @@ extern "C" { if (!F_status_is_error(setting->status)) { if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - if (setting->flag & fss_write_main_flag_file_to_e) return F_output_not; + if (setting->flag & fss_write_flag_file_to_e) return F_output_not; } fll_print_dynamic_raw(setting->line_last, print.to); @@ -184,7 +227,7 @@ extern "C" { if (!F_status_is_error(setting->status)) { if (print.verbosity == f_console_verbosity_error_e) return F_output_not; - if (setting->flag & fss_write_main_flag_file_to_e) return F_output_not; + if (setting->flag & fss_write_flag_file_to_e) return F_output_not; } f_print_dynamic_raw(setting->line_last, print.to); diff --git a/level_3/fss_write/c/main/print.h b/level_3/fss_write/c/main/print.h index 781b4e0..5740c9c 100644 --- a/level_3/fss_write/c/main/print.h +++ b/level_3/fss_write/c/main/print.h @@ -62,7 +62,7 @@ extern "C" { #endif // _di_fss_write_print_error_file_ /** - * Print error message about each Object parameter not being specified before a Content parameter. + * Print an error message about the object and content parameters not being specified the same number of times. * * @param setting * The main program settings. @@ -74,10 +74,34 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * @see fll_error_print() + */ +#ifndef _di_fss_write_print_error_parameter_same_times_ + extern f_status_t fss_write_print_error_parameter_same_times(fss_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_write_print_error_parameter_same_times_ + +/** + * Print an error message about a parameter a new line character '\n' (U+000A) being unsupported for an Object for the given standard. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param standard + * The string used to communicate the standad that does not support the EOL character. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see fll_error_print() */ -#ifndef _di_fss_write_print_error_object_not_before_content_ - extern f_status_t fss_write_print_error_object_not_before_content(fss_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_write_print_error_object_not_before_content_ +#ifndef _di_fss_write_print_error_parameter_unsupported_eol_object_ + extern f_status_t fss_write_print_error_parameter_unsupported_eol_object(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard); +#endif // _di_fss_write_print_error_parameter_unsupported_eol_object_ /** * Print an message about a multiple Content being unsupported. diff --git a/level_3/fss_write/c/payload/common.c b/level_3/fss_write/c/payload/common.c index 86411d2..1b3494e 100644 --- a/level_3/fss_write/c/payload/common.c +++ b/level_3/fss_write/c/payload/common.c @@ -17,30 +17,6 @@ extern "C" { const f_string_static_t fss_write_format_code_human_000e_s = macro_f_string_static_t_initialize(FSS_WRITE_format_code_human_000e_s, 0, FSS_WRITE_format_code_human_000e_s_length); #endif // _di_fss_write_payload_strings_ -#ifndef _di_fss_write_payload_setting_load_ - void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) { - - if (!main || !setting) return; - - f_array_lengths_t * const values = &main->parameters.array[fss_write_parameter_object_e].values; - f_string_static_t * const argv = main->parameters.arguments.array; - - if ((main->parameters.array[fss_write_parameter_object_e].result & f_console_result_value_e) && values->used) { - - for (f_array_length_t i = 0; i < values->used; ++i) { - - if (fl_string_dynamic_compare(argv[values->array[i]], fss_write_payload_s) == F_equal_to && i + 1 < values->used) { - setting->status = F_status_set_error(F_parameter); - - fss_write_payload_print_error_payload_not_last(setting, main->error); - - return; - } - } // for - } - } -#endif // _di_fss_write_payload_setting_load_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_write/c/payload/common.h b/level_3/fss_write/c/payload/common.h index e3493f4..e34d452 100644 --- a/level_3/fss_write/c/payload/common.h +++ b/level_3/fss_write/c/payload/common.h @@ -54,39 +54,6 @@ extern "C" { extern const f_string_static_t fss_write_format_code_human_000e_s; #endif // _di_fss_write_payload_strings_ -/** - * Perform the payload-specific program setting load process. - * - * This prints error messages as appropriate. - * - * If either main or setting is NULL, then this immediately retuns without doing anything. - * - * @param arguments - * The parameters passed to the process (often referred to as command line arguments). - * @param main - * The main program data. - * @param setting - * The main program settings. - * - * This alters setting.process_help, setting.process_normal, and setting.process_pipe. - * - * 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. - * F_parameter (with error bit) on parameter error. - * - * This alters setting.status: - * F_none on success. - * F_data_not on success but nothing was provided to operate with. - * - * @see fss_write_setting_load() - */ -#ifndef _di_fss_write_payload_setting_load_ - extern void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting); -#endif // _di_fss_write_payload_setting_load_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_write/c/payload/fss_write.c b/level_3/fss_write/c/payload/fss_write.c index 712af00..63b8fee 100644 --- a/level_3/fss_write/c/payload/fss_write.c +++ b/level_3/fss_write/c/payload/fss_write.c @@ -10,33 +10,21 @@ extern "C" { #ifndef _di_fss_write_payload_process_help_ void fss_write_payload_process_help(fll_program_data_t * const main, void * const setting) { - fss_write_payload_print_help((fss_write_setting_t *) setting, main->message); + fss_write_payload_print_help(macro_fss_write_setting(setting), main->message); } #endif // _di_fss_write_payload_process_help_ #ifndef _di_fss_write_payload_process_normal_ - void fss_write_payload_process_normal(fll_program_data_t * const main, void * const void_setting) { + void fss_write_payload_process_normal(fll_program_data_t * const main, void * const setting) { - fss_write_setting_t * const setting = (fss_write_setting_t *) void_setting; - f_string_statics_t *objects = &setting->objects; - f_string_statics_t *contents = &setting->contents; - f_string_statics_t *data = &setting->objects; - - if (setting->flag & fss_write_main_flag_partial_e) { - if (setting->flag & fss_write_main_flag_content_e) { - data = &setting->contents; - objects = 0; - } - else { - contents = 0; - } - } + f_string_statics_t * const data = (macro_fss_write_setting(setting)->flag & fss_write_flag_object_e) ? ¯o_fss_write_setting(setting)->objects : ¯o_fss_write_setting(setting)->contents; for (f_array_length_t i = 0; i < data->used; ++i) { + // @todo replace all signal checks with forked main process that independently checks and assigns main->signal_received. if (!((++main->signal_check) % fss_write_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - setting->status = F_status_set_error(F_interrupt); + macro_fss_write_setting(setting)->status = F_status_set_error(F_interrupt); return; } @@ -44,16 +32,21 @@ extern "C" { main->signal_check = 0; } - fss_write_payload_process_set(main, setting, objects ? &objects->array[i] : 0, contents ? &contents->array[i] : 0); - if (F_status_is_error(setting->status)) return; + fss_write_payload_process_set( + main, + macro_fss_write_setting(setting), + (macro_fss_write_setting(setting)->flag & fss_write_flag_object_e) ? ¯o_fss_write_setting(setting)->objects.array[i] : 0, + (macro_fss_write_setting(setting)->flag & fss_write_flag_content_e) ? ¯o_fss_write_setting(setting)->contents.array[i] : 0 + ); + + if (F_status_is_error(macro_fss_write_setting(setting)->status)) break; } // for } #endif // _di_fss_write_payload_process_normal_ #ifndef _di_fss_write_payload_process_pipe_ - void fss_write_payload_process_pipe(fll_program_data_t * const main, void * const void_setting) { + void fss_write_payload_process_pipe(fll_program_data_t * const main, void * const setting) { - fss_write_setting_t * const setting = (fss_write_setting_t *) void_setting; f_status_t status_pipe = F_none; f_file_t input = f_file_t_initialize; input.id = F_type_descriptor_input_d; @@ -73,9 +66,9 @@ extern "C" { if (!((++main->signal_check) % fss_write_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, macro_fss_write_setting(setting)->line_first, main->signal_received); - setting->status = F_status_set_error(F_interrupt); + macro_fss_write_setting(setting)->status = F_status_set_error(F_interrupt); break; } @@ -86,37 +79,37 @@ extern "C" { if (range.start > range.stop) { if (status_pipe == F_none_eof) break; - setting->block.used = 0; + macro_fss_write_setting(setting)->block.used = 0; - status_pipe = f_file_read_block(input, &setting->block); + status_pipe = f_file_read_block(input, ¯o_fss_write_setting(setting)->block); if (F_status_is_error(status_pipe)) { - fss_write_print_error(setting, main->error, "f_file_read_block"); + fss_write_print_error(macro_fss_write_setting(setting), main->error, "f_file_read_block"); status_pipe = F_status_set_error(F_pipe); break; } - if (!setting->block.used) break; + if (!macro_fss_write_setting(setting)->block.used) break; range.start = 0; - range.stop = setting->block.used - 1; + range.stop = macro_fss_write_setting(setting)->block.used - 1; } if (!state || state == 0x1) { if (!state) { - setting->object.used = 0; - setting->content.used = 0; + macro_fss_write_setting(setting)->object.used = 0; + macro_fss_write_setting(setting)->content.used = 0; state = 0x1; } - if (setting->object.used + setting->block.used > setting->object.size) { - setting->status = f_string_dynamic_increase_by(setting->block.used, &setting->object); + if (macro_fss_write_setting(setting)->object.used + macro_fss_write_setting(setting)->block.used > macro_fss_write_setting(setting)->object.size) { + macro_fss_write_setting(setting)->status = f_string_dynamic_increase_by(macro_fss_write_setting(setting)->block.used, ¯o_fss_write_setting(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(macro_fss_write_setting(setting)->status)) { + fss_write_print_error(macro_fss_write_setting(setting), main->error, "f_string_dynamic_increase_by"); break; } @@ -124,30 +117,30 @@ extern "C" { for (; range.start <= range.stop; ++range.start) { - if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { + if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { state = 0x2; ++range.start; break; } - if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { + if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { state = 0x3; ++range.start; break; } - if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) { + if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) { // This is not used by objects. continue; } - setting->object.string[setting->object.used++] = setting->block.string[range.start]; + macro_fss_write_setting(setting)->object.string[macro_fss_write_setting(setting)->object.used++] = macro_fss_write_setting(setting)->block.string[range.start]; } // for - if (F_status_is_error(setting->status)) break; + if (F_status_is_error(macro_fss_write_setting(setting)->status)) break; // If the start of content was not found, then fetch the next block. if (state == 0x1) continue; @@ -165,19 +158,19 @@ 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_string_payload_s, setting->object) == F_equal_to) { + if (fl_string_dynamic_compare(f_fss_string_payload_s, macro_fss_write_setting(setting)->object) == F_equal_to) { if (total > 1) { - setting->status = f_string_dynamic_increase_by(total, &setting->content); + macro_fss_write_setting(setting)->status = f_string_dynamic_increase_by(total, ¯o_fss_write_setting(setting)->content); - if (F_status_is_error(setting->status)) { - fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); + if (F_status_is_error(macro_fss_write_setting(setting)->status)) { + fss_write_print_error(macro_fss_write_setting(setting), main->error, "f_string_dynamic_increase_by"); break; } - memcpy(setting->content.string, setting->block.string + range.start, sizeof(f_char_t) * total); + memcpy(macro_fss_write_setting(setting)->content.string, macro_fss_write_setting(setting)->block.string + range.start, sizeof(f_char_t) * total); - setting->content.used += total; + macro_fss_write_setting(setting)->content.used += total; } state = 0x4; @@ -191,45 +184,45 @@ extern "C" { } if (total) { - setting->status = f_string_dynamic_increase_by(total, &setting->content); + macro_fss_write_setting(setting)->status = f_string_dynamic_increase_by(total, ¯o_fss_write_setting(setting)->content); - if (F_status_is_error(setting->status)) { - fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); + if (F_status_is_error(macro_fss_write_setting(setting)->status)) { + fss_write_print_error(macro_fss_write_setting(setting), main->error, "f_string_dynamic_increase_by"); break; } 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_supported_not); + if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { + macro_fss_write_setting(setting)->status = F_status_set_error(F_supported_not); if (main->error.verbosity > f_console_verbosity_quiet_e) { - fss_write_print_line_first_locked(setting, main->error); - fss_write_print_error_one_content_only(setting, main->error, fss_write_payload_standard_s); - fss_write_print_line_last_locked(setting, main->error); + fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); + fss_write_print_error_one_content_only(macro_fss_write_setting(setting), main->error, fss_write_payload_standard_s); + fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); } break; } - if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { + if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) { state = 0x3; ++range.start; break; } - if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) { + if (macro_fss_write_setting(setting)->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) { // This is not used by this program. continue; } - setting->content.string[setting->content.used++] = setting->block.string[range.start]; + macro_fss_write_setting(setting)->content.string[macro_fss_write_setting(setting)->content.used++] = macro_fss_write_setting(setting)->block.string[range.start]; } // for - if (F_status_is_error(setting->status)) break; + if (F_status_is_error(macro_fss_write_setting(setting)->status)) break; } else { state = 0x3; @@ -237,19 +230,19 @@ extern "C" { } if (state == 0x3) { - if (setting->flag & fss_write_main_flag_partial_e) { - if (setting->flag & fss_write_main_flag_content_e) { - fss_write_payload_process_set(main, setting, 0, &setting->content); + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + if (macro_fss_write_setting(setting)->flag & fss_write_flag_content_e) { + fss_write_payload_process_set(main, macro_fss_write_setting(setting), 0, ¯o_fss_write_setting(setting)->content); } else { - fss_write_payload_process_set(main, setting, &setting->object, 0); + fss_write_payload_process_set(main, macro_fss_write_setting(setting), ¯o_fss_write_setting(setting)->object, 0); } } else { - fss_write_payload_process_set(main, setting, &setting->object, &setting->content); + fss_write_payload_process_set(main, macro_fss_write_setting(setting), ¯o_fss_write_setting(setting)->object, ¯o_fss_write_setting(setting)->content); } - if (F_status_is_error(setting->status)) break; + if (F_status_is_error(macro_fss_write_setting(setting)->status)) break; state = 0; printed |= 0x1; @@ -258,20 +251,20 @@ extern "C" { } if (state == 0x4) { - if (setting->block.used && range.start <= range.stop) { + if (macro_fss_write_setting(setting)->block.used && range.start <= range.stop) { length = (range.stop - range.start) + 1; - setting->status = f_string_dynamic_increase_by(length + 1, &setting->content); + macro_fss_write_setting(setting)->status = f_string_dynamic_increase_by(length + 1, ¯o_fss_write_setting(setting)->content); - if (F_status_is_error(setting->status)) { - fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by"); + if (F_status_is_error(macro_fss_write_setting(setting)->status)) { + fss_write_print_error(macro_fss_write_setting(setting), main->error, "f_string_dynamic_increase_by"); break; } - memcpy(setting->content.string + range.start, setting->block.string, sizeof(f_char_t) * length); + memcpy(macro_fss_write_setting(setting)->content.string + range.start, macro_fss_write_setting(setting)->block.string, sizeof(f_char_t) * length); - setting->content.used += length; + macro_fss_write_setting(setting)->content.used += length; } // Designate to read next block from pipe. @@ -281,45 +274,45 @@ extern "C" { } // 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_main_flag_partial_e) { - if (setting->flag & fss_write_main_flag_content_e) { - fss_write_payload_process_set(main, setting, 0, &setting->content); + if (F_status_is_error_not(macro_fss_write_setting(setting)->status) && status_pipe == F_none_eof && state) { + if (macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) { + if (macro_fss_write_setting(setting)->flag & fss_write_flag_content_e) { + fss_write_payload_process_set(main, macro_fss_write_setting(setting), 0, ¯o_fss_write_setting(setting)->content); } else { - fss_write_payload_process_set(main, setting, &setting->object, 0); + fss_write_payload_process_set(main, macro_fss_write_setting(setting), ¯o_fss_write_setting(setting)->object, 0); } } else { - fss_write_payload_process_set(main, setting, &setting->object, &setting->content); + fss_write_payload_process_set(main, macro_fss_write_setting(setting), ¯o_fss_write_setting(setting)->object, ¯o_fss_write_setting(setting)->content); } printed |= 0x1; } - setting->block.used = 0; - setting->object.used = 0; - setting->content.used = 0; - setting->buffer.used = 0; + macro_fss_write_setting(setting)->block.used = 0; + macro_fss_write_setting(setting)->object.used = 0; + macro_fss_write_setting(setting)->content.used = 0; + macro_fss_write_setting(setting)->buffer.used = 0; - if (F_status_is_error_not(setting->status)) { + if (F_status_is_error_not(macro_fss_write_setting(setting)->status)) { if (printed & 0x1) { if (printed & 0x2) { - setting->status = F_payload; + macro_fss_write_setting(setting)->status = F_payload; } else { - setting->status = F_none; + macro_fss_write_setting(setting)->status = F_none; } } else { - setting->status = F_data_not; + macro_fss_write_setting(setting)->status = F_data_not; } // Print newline character to separate data printed from pipe. - if ((setting->flag & fss_write_main_flag_partial_e) && setting->objects.used) { + if ((macro_fss_write_setting(setting)->flag & fss_write_flag_partial_e) && macro_fss_write_setting(setting)->objects.used) { fll_print_dynamic(f_string_eol_s, main->output.to); } - else if (setting->contents.used) { + else if (macro_fss_write_setting(setting)->contents.used) { fll_print_dynamic(f_fss_payload_header_close_s, main->output.to); } } @@ -340,7 +333,7 @@ extern "C" { setting->range.stop = 0; } - setting->status = fll_fss_payload_write(*object, *content, setting->flag & fss_write_main_flag_trim_e, setting->flag & fss_write_main_flag_prepend_e ? &setting->prepend : 0, setting->state, &setting->buffer); + setting->status = fll_fss_payload_write(*object, *content, 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_supported_not); @@ -404,7 +397,7 @@ extern "C" { const f_string_static_t *prepend = 0; - if (setting->flag & fss_write_main_flag_prepend_e) { + if (setting->flag & fss_write_flag_prepend_e) { const f_array_length_t index = main->parameters.array[fss_write_parameter_prepend_e].values.array[main->parameters.array[fss_write_parameter_prepend_e].values.used - 1]; prepend = &main->parameters.arguments.array[index]; @@ -436,6 +429,30 @@ extern "C" { } #endif // _di_fss_write_payload_process_set_ +#ifndef _di_fss_write_payload_setting_load_ + void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) { + + if (!main || !setting) return; + + f_array_lengths_t * const values = &main->parameters.array[fss_write_parameter_object_e].values; + f_string_static_t * const argv = main->parameters.arguments.array; + + if ((main->parameters.array[fss_write_parameter_object_e].result & f_console_result_value_e) && values->used) { + + for (f_array_length_t i = 0; i < values->used; ++i) { + + if (fl_string_dynamic_compare(argv[values->array[i]], fss_write_payload_s) == F_equal_to && i + 1 < values->used) { + setting->status = F_status_set_error(F_parameter); + + fss_write_payload_print_error_payload_not_last(setting, main->error); + + return; + } + } // for + } + } +#endif // _di_fss_write_payload_setting_load_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_write/c/payload/fss_write.h b/level_3/fss_write/c/payload/fss_write.h index f956e52..eb342b0 100644 --- a/level_3/fss_write/c/payload/fss_write.h +++ b/level_3/fss_write/c/payload/fss_write.h @@ -136,6 +136,39 @@ extern "C" { extern void fss_write_payload_process_set(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_string_static_t *object, const f_string_static_t *content); #endif // _di_fss_write_payload_process_set_ +/** + * Perform the payload-specific program setting load process. + * + * This prints error messages as appropriate. + * + * If either main or setting is NULL, then this immediately retuns without doing anything. + * + * @param arguments + * The parameters passed to the process (often referred to as command line arguments). + * @param main + * The main program data. + * @param setting + * The main program settings. + * + * This alters setting.process_help, setting.process_normal, and setting.process_pipe. + * + * 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. + * F_parameter (with error bit) on parameter error. + * + * This alters setting.status: + * F_none on success. + * F_data_not on success but nothing was provided to operate with. + * + * @see fss_write_setting_load() + */ +#ifndef _di_fss_write_payload_setting_load_ + extern void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting); +#endif // _di_fss_write_payload_setting_load_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_write/c/payload/main.c b/level_3/fss_write/c/payload/main.c index 430b465..eae873b 100644 --- a/level_3/fss_write/c/payload/main.c +++ b/level_3/fss_write/c/payload/main.c @@ -6,11 +6,13 @@ 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.program_name = &fss_write_payload_program_name_s; + setting.program_name_long = &fss_write_payload_program_name_long_s; setting.process_help = &fss_write_payload_process_help; setting.process_pipe = &fss_write_payload_process_pipe; setting.process_normal = &fss_write_payload_process_normal; - setting.program_name = &fss_write_payload_program_name_s; - setting.program_name_long = &fss_write_payload_program_name_long_s; + setting.process_object = 0; // Not used by payload. + setting.process_content = 0; // Not used by payload. f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_write/data/build/fakefile b/level_3/fss_write/data/build/fakefile index 1830cfc..7bf428a 100644 --- a/level_3/fss_write/data/build/fakefile +++ b/level_3/fss_write/data/build/fakefile @@ -1,12 +1,14 @@ # fss-0005 iki-0002 +# +# Builds the fss_write library and all programs. +# +# An optional "install" is provided as a convience and a sort of documentation. +# This "install" only provides a very basic setup and it is strongly recommended to install manually or through some other means. +# settings: fail exit - compiler gcc - indexer ar - indexer_arguments rcs - environment PATH LD_LIBRARY_PATH main: @@ -34,3 +36,13 @@ using_mode: #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.payload diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index 1433f8a..de96731 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -159,7 +159,7 @@ extern "C" { } } - // Ensure a new line is always put at the end of the program execution, unless in quiet mode. + // Ensure a new line is always put at the end of the program execution. iki_read_print_line_last_locked(setting, main->message); } #endif // _di_iki_read_main_ diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/iki_write.c index 136f7ef..8f09554 100644 --- a/level_3/iki_write/c/iki_write.c +++ b/level_3/iki_write/c/iki_write.c @@ -180,7 +180,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->output.to); } // for - // Ensure a new line is always put at the end of the program execution, unless in quiet mode. + // Ensure a new line is always put at the end of the program execution. iki_write_print_line_last_locked(setting, main->message); } #endif // _di_iki_write_main_ diff --git a/specifications/fss-0000.txt b/specifications/fss-0000.txt index 72304f1..7a56aa8 100644 --- a/specifications/fss-0000.txt +++ b/specifications/fss-0000.txt @@ -25,7 +25,7 @@ Featureless Settings Specification: 0000 - Basic: Key\: code:"\s" = White space, except newline. code:"\b" = Either white space or printable, except newline. - code:"\q" = Non-white space or quoted white space with no white space outside of the quotes. + code:"\q" = Non-white space or quoted white space (and non-whitespace) with no white space outside of the quotes. code:"\n" = Newline. code:"*" = Zero or more occurrences. code:"+" = One or more occurrences. diff --git a/specifications/fss-0001.txt b/specifications/fss-0001.txt index d584c82..deb7124 100644 --- a/specifications/fss-0001.txt +++ b/specifications/fss-0001.txt @@ -23,7 +23,7 @@ Featureless Settings Specification: 0001 - Extended: Key\: code:"\s" = White space, except newline. code:"\b" = Either white space or printable, except newline. - code:"\q" = Non-white space or quoted white space, no white space outside of quotes. + code:"\q" = Non-white space or quoted white space (and non-whitespace) with no white space outside of the quotes. code:"\n" = Newline. code:"*" = Zero or more occurrences. code:"+" = One or more occurrences. diff --git a/specifications/fss-0009.txt b/specifications/fss-0009.txt index 80da739..35df069 100644 --- a/specifications/fss-0009.txt +++ b/specifications/fss-0009.txt @@ -27,7 +27,7 @@ Featureless Settings Specification: 0009 - Reverse Mapping: Key\: code:"\s" = White space, except newline. code:"\b" = Either white space or printable, except newline. - code:"\q" = Non-white space or quoted white space with no white space outside of the quotes. + code:"\q" = Non-white space or quoted white space (and non-whitespace) with no white space outside of the quotes. code:"\n" = Newline. code:"*" = Zero or more occurrences. code:"+" = One or more occurrences. diff --git a/specifications/fss-000a.txt b/specifications/fss-000a.txt index 5d8640b..c15177d 100644 --- a/specifications/fss-000a.txt +++ b/specifications/fss-000a.txt @@ -25,7 +25,7 @@ Featureless Settings Specification: 000A - Extended Reverse Mapping: Key\: code:"\s" = White space, except newline. code:"\b" = Either white space or printable, except newline. - code:"\q" = Non-white space or quoted white space, no white space outside of quotes. + code:"\q" = Non-white space or quoted white space (and non-whitespace) with no white space outside of the quotes. code:"\n" = Newline. code:"*" = Zero or more occurrences. code:"+" = One or more occurrences. -- 1.8.3.1