From: Kevin Day Date: Sun, 18 Aug 2024 01:09:30 +0000 (-0500) Subject: Update: Improve FSS Read function correctness based on runtime unit tests. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=c5d4d6c327027b89e970ec99f8bb2989ba5bcfb1;p=fll Update: Improve FSS Read function correctness based on runtime unit tests. This improves the runtime unit tests to be more correct as per the standard. The standard allows for spaces after an Object. There is no reason to print these extra spaces. Add additional logic to better handle this behavior. The FSS Basic Read and FSS Extended Read should not print this extra space after the Object when there is no Content to be printed. The pipe mode should wrap empty Content with the start and end pipe characters. This pope mode is still not well tested (or reviewed) and will eventually need further review and runtime tests. The handling of `--empty` should only apply to when there is empty Content and not when there is no Content at all. This adds new callback and flags to better handle these situations. Update the `verify.sh` script (and associated `testfile`) to print the test name. Update the `generate.sh` and `verify.sh` scripts to safely pass arguments with spaces using `"$@"`. --- diff --git a/level_3/fss_read/c/basic/main.c b/level_3/fss_read/c/basic/main.c index 3ffefea..b99860f 100644 --- a/level_3/fss_read/c/basic/main.c +++ b/level_3/fss_read/c/basic/main.c @@ -17,7 +17,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.program.output.custom = (void *) &data; data.program.warning.custom = (void *) &data; - data.setting.flag |= fss_read_main_flag_line_single_d; + data.setting.flag |= fss_read_main_flag_line_single_d | fss_read_main_flag_content_end_d; data.setting.flag |= fss_read_main_flag_quote_content_d | fss_read_main_flag_quote_object_d; data.setting.state.custom = (void *) &data; @@ -36,11 +36,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.callback.print_at = &fss_read_print_at; data.callback.print_content = &fss_read_print_content; - data.callback.print_content_empty_set = &fss_read_print_content_empty_set_end; data.callback.print_content_ignore = 0; data.callback.print_content_next = 0; data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_basic_print_data_object_end; + data.callback.print_object_end = &fss_read_basic_print_object_end; + data.callback.print_object_end_content = &fss_read_basic_print_object_end_content; + data.callback.print_object_end_empty = &fss_read_print_content_empty; data.callback.print_set_end = &fss_read_print_set_end; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; diff --git a/level_3/fss_read/c/basic/print.c b/level_3/fss_read/c/basic/print.c index 51cdd75..f7dfd20 100644 --- a/level_3/fss_read/c/basic/print.c +++ b/level_3/fss_read/c/basic/print.c @@ -4,25 +4,35 @@ extern "C" { #endif -#ifndef _di_fss_read_basic_print_data_object_end_ - f_status_t fss_read_basic_print_data_object_end(fl_print_t * const print) { +#ifndef _di_fss_read_basic_print_object_end_ + f_status_t fss_read_basic_print_object_end(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); fss_read_main_t * const main = (fss_read_main_t *) print->custom; if (main->setting.flag & fss_read_main_flag_content_d) { - if (main->setting.flag & fss_read_main_flag_pipe_format_d) { - fll_print_dynamic_raw(fss_read_pipe_content_start_s, print->to); - } - else { - fll_print_dynamic_raw(f_fss_basic_open_s, print->to); - } + fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_format_d) ? fss_read_pipe_content_start_s : f_fss_basic_open_s, print->to); + } + else { + return F_output_not; } return F_okay; } -#endif // _di_fss_read_basic_print_data_object_end_ +#endif // _di_fss_read_basic_print_object_end_ + +#ifndef _di_fss_read_basic_print_object_end_content_ + f_status_t fss_read_basic_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits) { + + { + const f_status_t status = fss_read_basic_print_object_end(print); + if (F_status_is_error(status) || status == F_output_not) return status; + } + + return fss_read_print_content(print, range, quote, delimits); + } +#endif // _di_fss_read_basic_print_object_end_content_ #ifndef _di_fss_read_basic_print_message_help_ f_status_t fss_read_basic_print_message_help(fl_print_t * const print) { diff --git a/level_3/fss_read/c/basic/print.h b/level_3/fss_read/c/basic/print.h index e738351..8e6b095 100644 --- a/level_3/fss_read/c/basic/print.h +++ b/level_3/fss_read/c/basic/print.h @@ -29,12 +29,41 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. + */ +#ifndef _di_fss_read_basic_print_object_end_ + extern f_status_t fss_read_basic_print_object_end(fl_print_t * const print); +#endif // _di_fss_read_basic_print_object_end_ + +/** + * Print the end of an Object (which is often the start of Content) and the Content. + * + * This locks, uses, and unlocks the file stream. + * + * This processes single Content range. + * This does not print a new line after the Content. + * + * @param print + * The output structure to print to. * - * @see fll_print_dynamic_raw() + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * @param range + * The range within the buffer representing the Content to print. + * @param quote + * The quote type representing the character to use (from the f_fss_quote_type_*_e). + * @param delimits + * The delimits array representing a delimited Content. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. */ -#ifndef _di_fss_read_basic_print_data_object_end_ - extern f_status_t fss_read_basic_print_data_object_end(fl_print_t * const print); -#endif // _di_fss_read_basic_print_data_object_end_ +#ifndef _di_fss_read_basic_print_object_end_content_ + extern f_status_t fss_read_basic_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); +#endif // _di_fss_read_basic_print_object_end_content_ /** * Print help for FSS-0000 (Basic). diff --git a/level_3/fss_read/c/basic_list/main.c b/level_3/fss_read/c/basic_list/main.c index 7141d93..b76d60d 100644 --- a/level_3/fss_read/c/basic_list/main.c +++ b/level_3/fss_read/c/basic_list/main.c @@ -35,11 +35,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.callback.print_at = &fss_read_print_at; data.callback.print_content = &fss_read_print_content; - data.callback.print_content_empty_set = 0; data.callback.print_content_ignore = &fss_read_print_content_ignore; data.callback.print_content_next = 0; data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_basic_list_print_data_object_end; + data.callback.print_object_end = &fss_read_basic_list_print_object_end; + data.callback.print_object_end_content = &fss_read_basic_list_print_object_end_content; + data.callback.print_object_end_empty = &fss_read_basic_list_print_object_end_empty; data.callback.print_set_end = &fss_read_print_set_end_no_eol; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; diff --git a/level_3/fss_read/c/basic_list/print.c b/level_3/fss_read/c/basic_list/print.c index 2ed28ee..8ee1d00 100644 --- a/level_3/fss_read/c/basic_list/print.c +++ b/level_3/fss_read/c/basic_list/print.c @@ -4,8 +4,8 @@ extern "C" { #endif -#ifndef _di_fss_read_basic_list_print_data_object_end_ - f_status_t fss_read_basic_list_print_data_object_end(fl_print_t * const print) { +#ifndef _di_fss_read_basic_list_print_object_end_ + f_status_t fss_read_basic_list_print_object_end(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); @@ -16,21 +16,46 @@ extern "C" { if (main->setting.flag & fss_read_main_flag_pipe_format_d) { f_print_dynamic_raw(fss_read_pipe_content_start_s, print->to); } + else if (main->setting.flag & fss_read_main_flag_content_d) { + f_print_dynamic_raw(f_fss_basic_list_open_s, print->to); + f_print_dynamic_raw(f_fss_basic_list_open_end_s, print->to); + } else { - if (main->setting.flag & fss_read_main_flag_content_d) { - f_print_dynamic_raw(f_fss_basic_list_open_s, print->to); - f_print_dynamic_raw(f_fss_basic_list_open_end_s, print->to); - } - else { - f_print_dynamic_raw(f_fss_eol_s, print->to); - } + f_print_dynamic_raw(f_fss_eol_s, print->to); } f_file_stream_unlock(print->to); return F_okay; } -#endif // _di_fss_read_basic_list_print_data_object_end_ +#endif // _di_fss_read_basic_list_print_object_end_ + +#ifndef _di_fss_read_basic_list_print_object_end_content_ + f_status_t fss_read_basic_list_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits) { + + { + const f_status_t status = fss_read_basic_list_print_object_end(print); + if (F_status_is_error(status) || status == F_output_not) return status; + } + + return fss_read_print_content(print, range, quote, delimits); + } +#endif // _di_fss_read_basic_list_print_object_end_content_ + +#ifndef _di_fss_read_basic_list_print_object_end_empty_ + f_status_t fss_read_basic_list_print_object_end_empty(fl_print_t * const print) { + + if (!print) return F_status_set_error(F_output_not); + + const f_status_t status_1 = fss_read_basic_list_print_object_end(print); + const f_status_t status_2 = fss_read_print_content_empty(print); + + if (F_status_is_error(status_1)) return status_1; + if (F_status_is_error(status_2)) return status_2; + + return (status_1 == F_okay || status_2 == F_okay) ? F_okay: F_output_not; + } +#endif // _di_fss_read_basic_list_print_object_end_empty_ #ifndef _di_fss_read_basic_list_print_message_help_ f_status_t fss_read_basic_list_print_message_help(fl_print_t * const print) { diff --git a/level_3/fss_read/c/basic_list/print.h b/level_3/fss_read/c/basic_list/print.h index 2a7ffa9..6232420 100644 --- a/level_3/fss_read/c/basic_list/print.h +++ b/level_3/fss_read/c/basic_list/print.h @@ -29,14 +29,65 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. + */ +#ifndef _di_fss_read_basic_list_print_object_end_ + extern f_status_t fss_read_basic_list_print_object_end(fl_print_t * const print); +#endif // _di_fss_read_basic_list_print_object_end_ + +/** + * Print the end of an Object (which is often the start of Content) and the Content. + * + * This locks, uses, and unlocks the file stream. + * + * This processes single Content range. + * This does not print a new line after the Content. + * + * @param print + * The output structure to print to. + * + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * @param range + * The range within the buffer representing the Content to print. + * @param quote + * The quote type representing the character to use (from the f_fss_quote_type_*_e). + * @param delimits + * The delimits array representing a delimited Content. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. + */ +#ifndef _di_fss_read_basic_list_print_object_end_content_ + extern f_status_t fss_read_basic_list_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); +#endif // _di_fss_read_basic_list_print_object_end_content_ + +/** + * Print the end of an Object (which is often the start of Content) and the end of the Content when no Content. + * + * This locks, uses, and unlocks the file stream. + * + * @param print + * The output structure to print to. + * + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. * - * @see f_file_stream_lock() - * @see f_file_stream_unlock() - * @see f_print_dynamic_raw() + * @see fss_read_print_content_empty() */ -#ifndef _di_fss_read_basic_list_print_data_object_end_ - extern f_status_t fss_read_basic_list_print_data_object_end(fl_print_t * const print); -#endif // _di_fss_read_basic_list_print_data_object_end_ +#ifndef _di_fss_read_basic_list_print_object_end_empty_ + extern f_status_t fss_read_basic_list_print_object_end_empty(fl_print_t * const print); +#endif // _di_fss_read_basic_list_print_object_end_empty_ /** * Print help for FSS-0002 (Basic List). diff --git a/level_3/fss_read/c/embedded_list/main.c b/level_3/fss_read/c/embedded_list/main.c index 488bad7..4157326 100644 --- a/level_3/fss_read/c/embedded_list/main.c +++ b/level_3/fss_read/c/embedded_list/main.c @@ -36,11 +36,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.callback.print_at = &fss_read_print_at; data.callback.print_content = &fss_read_print_content; - data.callback.print_content_empty_set = 0; data.callback.print_content_ignore = &fss_read_print_content_ignore; data.callback.print_content_next = 0; data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_embedded_list_print_data_object_end; + data.callback.print_object_end = &fss_read_embedded_list_print_object_end; + data.callback.print_object_end_content = &fss_read_embedded_list_print_object_end_content; + data.callback.print_object_end_empty = &fss_read_embedded_list_print_object_end_empty; data.callback.print_set_end = &fss_read_print_set_end; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; diff --git a/level_3/fss_read/c/embedded_list/print.c b/level_3/fss_read/c/embedded_list/print.c index ae2b29f..dc5e6aa 100644 --- a/level_3/fss_read/c/embedded_list/print.c +++ b/level_3/fss_read/c/embedded_list/print.c @@ -4,8 +4,8 @@ extern "C" { #endif -#ifndef _di_fss_read_embedded_list_print_data_object_end_ - f_status_t fss_read_embedded_list_print_data_object_end(fl_print_t * const print) { +#ifndef _di_fss_read_embedded_list_print_object_end_ + f_status_t fss_read_embedded_list_print_object_end(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); @@ -16,37 +16,69 @@ extern "C" { if (main->setting.flag & fss_read_main_flag_pipe_format_d) { f_print_dynamic_raw(fss_read_pipe_content_start_s, print->to); } + else if (main->setting.flag & fss_read_main_flag_content_d) { + f_print_dynamic_raw(f_fss_embedded_list_open_s, print->to); + f_print_dynamic_raw(f_fss_embedded_list_open_end_s, print->to); + } else { - if (main->setting.flag & fss_read_main_flag_content_d) { - f_print_dynamic_raw(f_fss_embedded_list_open_s, print->to); - f_print_dynamic_raw(f_fss_embedded_list_open_end_s, print->to); - } - else { - f_print_dynamic_raw(f_fss_eol_s, print->to); - } + f_print_dynamic_raw(f_fss_eol_s, print->to); } f_file_stream_unlock(print->to); return F_okay; } -#endif // _di_fss_read_embedded_list_print_data_object_end_ +#endif // _di_fss_read_embedded_list_print_object_end_ + +#ifndef _di_fss_read_embedded_list_print_object_end_content_ + f_status_t fss_read_embedded_list_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits) { + + { + const f_status_t status = fss_read_embedded_list_print_object_end(print); + if (F_status_is_error(status) || status == F_output_not) return status; + } + + return fss_read_print_content(print, range, quote, delimits); + } +#endif // _di_fss_read_embedded_list_print_object_end_content_ + +#ifndef _di_fss_read_embedded_list_print_object_end_empty_ + f_status_t fss_read_embedded_list_print_object_end_empty(fl_print_t * const print) { + + if (!print) return F_status_set_error(F_output_not); -#ifndef _di_fss_read_embedded_list_print_data_set_end_ - f_status_t fss_read_embedded_list_print_data_set_end(fl_print_t * const print) { + const f_status_t status_1 = fss_read_embedded_list_print_object_end(print); + const f_status_t status_2 = fss_read_print_content_empty(print); + + if (F_status_is_error(status_1)) return status_1; + if (F_status_is_error(status_2)) return status_2; + + return (status_1 == F_okay || status_2 == F_okay) ? F_okay: F_output_not; + } +#endif // _di_fss_read_embedded_list_print_object_end_empty_ + +#ifndef _di_fss_read_embedded_list_print_set_end_ + f_status_t fss_read_embedded_list_print_set_end(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); fss_read_main_t * const main = (fss_read_main_t *) print->custom; - if ((main->setting.flag & fss_read_main_flag_object_d) && main->setting.flag & fss_read_main_flag_content_d) { + if ((main->setting.flag & fss_read_main_flag_object_d) && (main->setting.flag & fss_read_main_flag_content_d)) { + f_file_stream_lock(print->to); + f_print_dynamic_raw(f_fss_embedded_list_close_s, print->to); f_print_dynamic_raw(f_fss_embedded_list_close_end_s, print->to); + + f_file_stream_unlock(print->to); + } + else { + return F_output_not; } return F_okay; } -#endif // _di_fss_read_embedded_list_print_data_set_end_ +#endif // _di_fss_read_embedded_list_print_set_end_ #ifndef _di_fss_read_embedded_list_print_message_help_ f_status_t fss_read_embedded_list_print_message_help(fl_print_t * const print) { diff --git a/level_3/fss_read/c/embedded_list/print.h b/level_3/fss_read/c/embedded_list/print.h index 3afa41c..406e0d2 100644 --- a/level_3/fss_read/c/embedded_list/print.h +++ b/level_3/fss_read/c/embedded_list/print.h @@ -29,17 +29,44 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. + */ +#ifndef _di_fss_read_embedded_list_print_object_end_ + extern f_status_t fss_read_embedded_list_print_object_end(fl_print_t * const print); +#endif // _di_fss_read_embedded_list_print_object_end_ + +/** + * Print the end of an Object (which is often the start of Content) and the Content. + * + * This locks, uses, and unlocks the file stream. * - * @see f_file_stream_lock() - * @see f_file_stream_unlock() - * @see f_print_dynamic_raw() + * This processes single Content range. + * This does not print a new line after the Content. + * + * @param print + * The output structure to print to. + * + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * @param range + * The range within the buffer representing the Content to print. + * @param quote + * The quote type representing the character to use (from the f_fss_quote_type_*_e). + * @param delimits + * The delimits array representing a delimited Content. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. */ -#ifndef _di_fss_read_embedded_list_print_data_object_end_ - extern f_status_t fss_read_embedded_list_print_data_object_end(fl_print_t * const print); -#endif // _di_fss_read_embedded_list_print_data_object_end_ +#ifndef _di_fss_read_embedded_list_print_object_end_content_ + extern f_status_t fss_read_embedded_list_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); +#endif // _di_fss_read_embedded_list_print_object_end_content_ /** - * Print the end of an Object/Content set. + * Print the end of an Object (which is often the start of Content) and the end of the Content when no Content. * * This locks, uses, and unlocks the file stream. * @@ -56,13 +83,33 @@ extern "C" { * * F_output_not (with error bit) if a parameter is NULL. * - * @see f_file_stream_lock() - * @see f_file_stream_unlock() - * @see f_print_dynamic_raw() + * @see fss_read_print_content_empty() + */ +#ifndef _di_fss_read_embedded_list_print_object_end_empty_ + extern f_status_t fss_read_embedded_list_print_object_end_empty(fl_print_t * const print); +#endif // _di_fss_read_embedded_list_print_object_end_empty_ + +/** + * Print the end of an Object/Content set. + * + * This locks, uses, and unlocks the file stream. + * + * @param print + * The output structure to print to. + * + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. */ -#ifndef _di_fss_read_embedded_list_print_data_set_end_ - extern f_status_t fss_read_embedded_list_print_data_set_end(fl_print_t * const print); -#endif // _di_fss_read_embedded_list_print_data_set_end_ +#ifndef _di_fss_read_embedded_list_print_set_end_ + extern f_status_t fss_read_embedded_list_print_set_end(fl_print_t * const print); +#endif // _di_fss_read_embedded_list_print_set_end_ /** * Print help for FSS-0008 (Embedded List). diff --git a/level_3/fss_read/c/extended/main.c b/level_3/fss_read/c/extended/main.c index bdfb48c..178c85d 100644 --- a/level_3/fss_read/c/extended/main.c +++ b/level_3/fss_read/c/extended/main.c @@ -17,7 +17,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.program.output.custom = (void *) &data; data.program.warning.custom = (void *) &data; - data.setting.flag |= fss_read_main_flag_line_single_d | fss_read_main_flag_content_multiple_d; + data.setting.flag |= fss_read_main_flag_line_single_d | fss_read_main_flag_content_multiple_d | fss_read_main_flag_content_end_d; data.setting.flag |= fss_read_main_flag_quote_content_d | fss_read_main_flag_quote_object_d; data.setting.state.custom = (void *) &data; @@ -36,11 +36,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.callback.print_at = &fss_read_print_at; data.callback.print_content = &fss_read_print_content; - data.callback.print_content_empty_set = &fss_read_print_content_empty_set_end; data.callback.print_content_ignore = &fss_read_print_content_ignore; - data.callback.print_content_next = &fss_read_extended_print_data_content_next; + data.callback.print_content_next = &fss_read_extended_print_content_next; data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_extended_print_data_object_end; + data.callback.print_object_end = &fss_read_extended_print_object_end; + data.callback.print_object_end_content = &fss_read_extended_print_object_end_content; + data.callback.print_object_end_empty = &fss_read_print_content_empty; data.callback.print_set_end = &fss_read_print_set_end; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; diff --git a/level_3/fss_read/c/extended/print.c b/level_3/fss_read/c/extended/print.c index 234021c..98d0730 100644 --- a/level_3/fss_read/c/extended/print.c +++ b/level_3/fss_read/c/extended/print.c @@ -4,8 +4,8 @@ extern "C" { #endif -#ifndef _di_fss_read_extended_print_data_content_next_ - f_status_t fss_read_extended_print_data_content_next(fl_print_t * const print) { +#ifndef _di_fss_read_extended_print_content_next_ + f_status_t fss_read_extended_print_content_next(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); @@ -14,30 +14,43 @@ extern "C" { if (main->setting.flag & fss_read_main_flag_content_d) { fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_format_d) ? fss_read_pipe_content_start_s : f_fss_extended_next_s, print->to); } + else { + return F_output_not; + } return F_okay; } -#endif // _di_fss_read_extended_print_data_content_next_ +#endif // _di_fss_read_extended_print_content_next_ -#ifndef _di_fss_read_extended_print_data_object_end_ - f_status_t fss_read_extended_print_data_object_end(fl_print_t * const print) { +#ifndef _di_fss_read_extended_print_object_end_ + f_status_t fss_read_extended_print_object_end(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); fss_read_main_t * const main = (fss_read_main_t *) print->custom; if (main->setting.flag & fss_read_main_flag_content_d) { - if (main->setting.flag & fss_read_main_flag_pipe_format_d) { - fll_print_dynamic_raw(fss_read_pipe_content_start_s, print->to); - } - else { - fll_print_dynamic_raw(f_fss_extended_open_s, print->to); - } + fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_format_d) ? fss_read_pipe_content_start_s : f_fss_extended_open_s, print->to); + } + else { + return F_output_not; } return F_okay; } -#endif // _di_fss_read_extended_print_data_object_end_ +#endif // _di_fss_read_extended_print_object_end_ + +#ifndef _di_fss_read_extended_print_object_end_content_ + f_status_t fss_read_extended_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits) { + + { + const f_status_t status = fss_read_extended_print_object_end(print); + if (F_status_is_error(status) || status == F_output_not) return status; + } + + return fss_read_print_content(print, range, quote, delimits); + } +#endif // _di_fss_read_extended_print_object_end_content_ #ifndef _di_fss_read_extended_print_message_help_ f_status_t fss_read_extended_print_message_help(fl_print_t * const print) { diff --git a/level_3/fss_read/c/extended/print.h b/level_3/fss_read/c/extended/print.h index e9b5197..5c02ffb 100644 --- a/level_3/fss_read/c/extended/print.h +++ b/level_3/fss_read/c/extended/print.h @@ -31,12 +31,10 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. - * - * @see fll_print_dynamic_raw() */ -#ifndef _di_fss_read_extended_print_data_content_next_ - extern f_status_t fss_read_extended_print_data_content_next(fl_print_t * const print); -#endif // _di_fss_read_extended_print_data_content_next_ +#ifndef _di_fss_read_extended_print_content_next_ + extern f_status_t fss_read_extended_print_content_next(fl_print_t * const print); +#endif // _di_fss_read_extended_print_content_next_ /** * Print the end of an Object (which is often the start of Content). @@ -55,12 +53,41 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. + */ +#ifndef _di_fss_read_extended_print_object_end_ + extern f_status_t fss_read_extended_print_object_end(fl_print_t * const print); +#endif // _di_fss_read_extended_print_object_end_ + +/** + * Print the end of an Object (which is often the start of Content) and the Content. + * + * This locks, uses, and unlocks the file stream. + * + * This processes single Content range. + * This does not print a new line after the Content. + * + * @param print + * The output structure to print to. * - * @see fll_print_dynamic_raw() + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * @param range + * The range within the buffer representing the Content to print. + * @param quote + * The quote type representing the character to use (from the f_fss_quote_type_*_e). + * @param delimits + * The delimits array representing a delimited Content. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. */ -#ifndef _di_fss_read_extended_print_data_object_end_ - extern f_status_t fss_read_extended_print_data_object_end(fl_print_t * const print); -#endif // _di_fss_read_extended_print_data_object_end_ +#ifndef _di_fss_read_extended_print_object_end_content_ + extern f_status_t fss_read_extended_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); +#endif // _di_fss_read_extended_print_object_end_content_ /** * Print help for FSS-0001 (Extended). diff --git a/level_3/fss_read/c/extended_list/main.c b/level_3/fss_read/c/extended_list/main.c index a60f176..1b093f7 100644 --- a/level_3/fss_read/c/extended_list/main.c +++ b/level_3/fss_read/c/extended_list/main.c @@ -35,12 +35,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.callback.print_at = &fss_read_print_at; data.callback.print_content = &fss_read_print_content; - data.callback.print_content_empty_set = 0; data.callback.print_content_ignore = &fss_read_print_content_ignore; data.callback.print_content_next = 0; data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_extended_list_print_data_object_end; - data.callback.print_set_end = &fss_read_extended_list_print_data_set_end; + data.callback.print_object_end = &fss_read_extended_list_print_object_end; + data.callback.print_object_end_content = &fss_read_extended_list_print_object_end_content; + data.callback.print_object_end_empty = &fss_read_extended_list_print_object_end; + data.callback.print_set_end = &fss_read_extended_list_print_set_end; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_read/c/extended_list/print.c b/level_3/fss_read/c/extended_list/print.c index 3dd8c64..82c3a87 100644 --- a/level_3/fss_read/c/extended_list/print.c +++ b/level_3/fss_read/c/extended_list/print.c @@ -4,8 +4,8 @@ extern "C" { #endif -#ifndef _di_fss_read_extended_list_print_data_object_end_ - f_status_t fss_read_extended_list_print_data_object_end(fl_print_t * const print) { +#ifndef _di_fss_read_extended_list_print_object_end_ + f_status_t fss_read_extended_list_print_object_end(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); @@ -16,37 +16,69 @@ extern "C" { if (main->setting.flag & fss_read_main_flag_pipe_format_d) { f_print_dynamic_raw(fss_read_pipe_content_start_s, print->to); } + else if (main->setting.flag & fss_read_main_flag_content_d) { + f_print_dynamic_raw(f_fss_extended_list_open_s, print->to); + f_print_dynamic_raw(f_fss_extended_list_open_end_s, print->to); + } else { - if (main->setting.flag & fss_read_main_flag_content_d) { - f_print_dynamic_raw(f_fss_extended_list_open_s, print->to); - f_print_dynamic_raw(f_fss_extended_list_open_end_s, print->to); - } - else { - f_print_dynamic_raw(f_fss_eol_s, print->to); - } + f_print_dynamic_raw(f_fss_eol_s, print->to); } f_file_stream_unlock(print->to); return F_okay; } -#endif // _di_fss_read_extended_list_print_data_object_end_ +#endif // _di_fss_read_extended_list_print_object_end_ + +#ifndef _di_fss_read_extended_list_print_object_end_empty_ + f_status_t fss_read_extended_list_print_object_end_empty(fl_print_t * const print) { + + if (!print) return F_status_set_error(F_output_not); + + const f_status_t status_1 = fss_read_extended_list_print_object_end(print); + const f_status_t status_2 = fss_read_print_content_empty(print); -#ifndef _di_fss_read_extended_list_print_data_set_end_ - f_status_t fss_read_extended_list_print_data_set_end(fl_print_t * const print) { + if (F_status_is_error(status_1)) return status_1; + if (F_status_is_error(status_2)) return status_2; + + return (status_1 == F_okay || status_2 == F_okay) ? F_okay: F_output_not; + } +#endif // _di_fss_read_extended_list_print_object_end_empty_ + +#ifndef _di_fss_read_extended_list_print_object_end_content_ + f_status_t fss_read_extended_list_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits) { + + { + const f_status_t status = fss_read_extended_list_print_object_end(print); + if (F_status_is_error(status) || status == F_output_not) return status; + } + + return fss_read_print_content(print, range, quote, delimits); + } +#endif // _di_fss_read_extended_list_print_object_end_content_ + +#ifndef _di_fss_read_extended_list_print_set_end_ + f_status_t fss_read_extended_list_print_set_end(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); fss_read_main_t * const main = (fss_read_main_t *) print->custom; if ((main->setting.flag & fss_read_main_flag_object_d) && main->setting.flag & fss_read_main_flag_content_d) { + f_file_stream_lock(print->to); + f_print_dynamic_raw(f_fss_extended_list_close_s, print->to); f_print_dynamic_raw(f_fss_extended_list_close_end_s, print->to); + + f_file_stream_unlock(print->to); + } + else { + return F_output_not; } return F_okay; } -#endif // _di_fss_read_extended_list_print_data_set_end_ +#endif // _di_fss_read_extended_list_print_set_end_ #ifndef _di_fss_read_extended_list_print_message_help_ f_status_t fss_read_extended_list_print_message_help(fl_print_t * const print) { diff --git a/level_3/fss_read/c/extended_list/print.h b/level_3/fss_read/c/extended_list/print.h index 8aa3b0d..bcc5a09 100644 --- a/level_3/fss_read/c/extended_list/print.h +++ b/level_3/fss_read/c/extended_list/print.h @@ -29,15 +29,44 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. + */ +#ifndef _di_fss_read_extended_list_print_object_end_ + extern f_status_t fss_read_extended_list_print_object_end(fl_print_t * const print); +#endif // _di_fss_read_extended_list_print_object_end_ + +/** + * Print the end of an Object (which is often the start of Content) and the Content. + * + * This locks, uses, and unlocks the file stream. * - * @see fll_print_dynamic_raw() + * This processes single Content range. + * This does not print a new line after the Content. + * + * @param print + * The output structure to print to. + * + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * @param range + * The range within the buffer representing the Content to print. + * @param quote + * The quote type representing the character to use (from the f_fss_quote_type_*_e). + * @param delimits + * The delimits array representing a delimited Content. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. */ -#ifndef _di_fss_read_extended_list_print_data_object_end_ - extern f_status_t fss_read_extended_list_print_data_object_end(fl_print_t * const print); -#endif // _di_fss_read_extended_list_print_data_object_end_ +#ifndef _di_fss_read_extended_list_print_object_end_content_ + extern f_status_t fss_read_extended_list_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); +#endif // _di_fss_read_extended_list_print_object_end_content_ /** - * Print the end of an Object/Content set. + * Print the end of an Object (which is often the start of Content) and the end of the Content when no Content. * * This locks, uses, and unlocks the file stream. * @@ -54,13 +83,34 @@ extern "C" { * * F_output_not (with error bit) if a parameter is NULL. * - * @see f_file_stream_lock() - * @see f_file_stream_unlock() - * @see f_print_dynamic_raw() + * @see fss_read_extended_list_print_object_end() + * @see fss_read_print_content_empty() + */ +#ifndef _di_fss_read_extended_list_print_object_end_empty_ + extern f_status_t fss_read_extended_list_print_object_end_empty(fl_print_t * const print); +#endif // _di_fss_read_extended_list_print_object_end_empty_ + +/** + * Print the end of an Object/Content set. + * + * This locks, uses, and unlocks the file stream. + * + * @param print + * The output structure to print to. + * + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. */ -#ifndef _di_fss_read_extended_list_print_data_set_end_ - extern f_status_t fss_read_extended_list_print_data_set_end(fl_print_t * const print); -#endif // _di_fss_read_extended_list_print_data_set_end_ +#ifndef _di_fss_read_extended_list_print_set_end_ + extern f_status_t fss_read_extended_list_print_set_end(fl_print_t * const print); +#endif // _di_fss_read_extended_list_print_set_end_ /** * Print help for FSS-0003 (Extended List). diff --git a/level_3/fss_read/c/main/common/define.h b/level_3/fss_read/c/main/common/define.h index 56cbbc7..4ed94e6 100644 --- a/level_3/fss_read/c/main/common/define.h +++ b/level_3/fss_read/c/main/common/define.h @@ -54,6 +54,7 @@ extern "C" { * - at: The object at the given position is being selected (Think of this as select a row for some Object). * - columns: The total columns found and selected is printed instead of the Content. * - content: The Content is to be printed. + * - content_end: Print the Content end set even if there is no Content (some standards like FSS-0000 and FSS-0001 require this). * - content_has_close: The Content has a closing character which needs to be counted and handled when processing both Object and Content, but is otherwise not processed or printed. * - content_multiple: Designate that multiple Content is allowed for an Object for this standard rather than a single Content per Object. * - copyright: Print copyright. @@ -88,34 +89,35 @@ extern "C" { #define fss_read_main_flag_at_d 0x1 #define fss_read_main_flag_columns_d 0x2 #define fss_read_main_flag_content_d 0x4 - #define fss_read_main_flag_content_has_close_d 0x8 - #define fss_read_main_flag_content_multiple_d 0x10 - #define fss_read_main_flag_copyright_d 0x20 - #define fss_read_main_flag_delimit_d 0x40 - #define fss_read_main_flag_depth_d 0x80 - #define fss_read_main_flag_depth_multiple_d 0x100 - #define fss_read_main_flag_empty_d 0x200 - #define fss_read_main_flag_help_d 0x400 - #define fss_read_main_flag_line_d 0x800 - #define fss_read_main_flag_line_single_d 0x1000 - #define fss_read_main_flag_name_d 0x2000 - #define fss_read_main_flag_object_d 0x4000 - #define fss_read_main_flag_object_as_line_d 0x8000 - #define fss_read_main_flag_object_trim_d 0x10000 - #define fss_read_main_flag_original_d 0x20000 - #define fss_read_main_flag_payload_create_d 0x40000 - #define fss_read_main_flag_payload_error_d 0x80000 - #define fss_read_main_flag_payload_warn_d 0x100000 - #define fss_read_main_flag_pipe_d 0x200000 - #define fss_read_main_flag_pipe_format_d 0x400000 - #define fss_read_main_flag_quote_content_d 0x800000 - #define fss_read_main_flag_quote_object_d 0x1000000 - #define fss_read_main_flag_select_d 0x2000000 - #define fss_read_main_flag_total_d 0x4000000 - #define fss_read_main_flag_trim_d 0x8000000 - #define fss_read_main_flag_trim_object_d 0x10000000 - #define fss_read_main_flag_version_d 0x20000000 - #define fss_read_main_flag_version_copyright_help_d 0x20000420 + #define fss_read_main_flag_content_end_d 0x8 + #define fss_read_main_flag_content_has_close_d 0x10 + #define fss_read_main_flag_content_multiple_d 0x20 + #define fss_read_main_flag_copyright_d 0x40 + #define fss_read_main_flag_delimit_d 0x80 + #define fss_read_main_flag_depth_d 0x100 + #define fss_read_main_flag_depth_multiple_d 0x200 + #define fss_read_main_flag_empty_d 0x400 + #define fss_read_main_flag_help_d 0x800 + #define fss_read_main_flag_line_d 0x1000 + #define fss_read_main_flag_line_single_d 0x2000 + #define fss_read_main_flag_name_d 0x4000 + #define fss_read_main_flag_object_d 0x8000 + #define fss_read_main_flag_object_as_line_d 0x10000 + #define fss_read_main_flag_object_trim_d 0x20000 + #define fss_read_main_flag_original_d 0x40000 + #define fss_read_main_flag_payload_create_d 0x80000 + #define fss_read_main_flag_payload_error_d 0x100000 + #define fss_read_main_flag_payload_warn_d 0x200000 + #define fss_read_main_flag_pipe_d 0x400000 + #define fss_read_main_flag_pipe_format_d 0x800000 + #define fss_read_main_flag_quote_content_d 0x1000000 + #define fss_read_main_flag_quote_object_d 0x2000000 + #define fss_read_main_flag_select_d 0x4000000 + #define fss_read_main_flag_total_d 0x8000000 + #define fss_read_main_flag_trim_d 0x10000000 + #define fss_read_main_flag_trim_object_d 0x20000000 + #define fss_read_main_flag_version_d 0x40000000 + #define fss_read_main_flag_version_copyright_help_d 0x40000840 #endif // _di_fss_read_main_flag_d_ /** diff --git a/level_3/fss_read/c/main/common/type.h b/level_3/fss_read/c/main/common/type.h index 4c48614..b444883 100644 --- a/level_3/fss_read/c/main/common/type.h +++ b/level_3/fss_read/c/main/common/type.h @@ -128,14 +128,16 @@ extern "C" { * process_name: Process name parameter, usually called by the process_normal() callback. * process_total: Process total parameter, usually called by the process_normal() callback. * - * print_at: Print at the given location, usually called by the process_normal() callback. - * print_object: Print the Object, usually called by the process_normal() callback. - * print_content: Print the Content, usually called by the process_normal() callback. - * print_content_empty_set: Print something when the entire Content set is empty for the entire Content set. - * print_content_ignore: Print the Content ignore character, usually called by several callbacks within the process_normal() callback for a pipe. - * print_content_next: Print the Content next (content separator), usually called by several callbacks within the process_normal() callback. - * print_object_end: Print the Object end, usually called by several callbacks within the process_normal() callback. - * print_set_end: Print the Content set end, usually called by several callbacks within the process_normal() callback. + * print_at: Print at the given location, usually called by the process_normal() callback. + * print_object: Print the Object, usually called by the process_normal() callback. + * print_content: Print the Content, usually called by the process_normal() callback. + * print_content_ignore: Print the Content ignore character, usually called by several callbacks within the process_normal() callback for a pipe. + * print_content_next: Print the Content next (content separator), usually called by several callbacks within the process_normal() callback. + * print_object_end: Print the Object end, usually called by several callbacks within the process_normal() callback. + * print_object_end_content: Print both the Object end and the Content. + * print_object_end_empty: Print the Object end when there is no Content, some standards print this and other standards print nothing (This also handles the Object end pipe). + * print_set_end: Print the Content set end, usually called by several callbacks within the process_normal() callback. + * print_set_end_empty: Print set end for cases where the Content is empty and only something like a closing new line is required. */ #ifndef _di_fss_read_callback_t_ typedef struct { @@ -152,12 +154,14 @@ extern "C" { f_status_t (*print_at)(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); f_status_t (*print_object)(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits); + f_status_t (*print_object_end_content)(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); f_status_t (*print_content)(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); - f_status_t (*print_content_empty_set)(fl_print_t * const print); f_status_t (*print_content_ignore)(fl_print_t * const print); f_status_t (*print_content_next)(fl_print_t * const print); f_status_t (*print_object_end)(fl_print_t * const print); + f_status_t (*print_object_end_empty)(fl_print_t * const print); f_status_t (*print_set_end)(fl_print_t * const print); + f_status_t (*print_set_end_empty)(fl_print_t * const print); } fss_read_callback_t; #define fss_read_callback_t_initialize \ @@ -179,6 +183,8 @@ extern "C" { 0, \ 0, \ 0, \ + 0, \ + 0, \ } #endif // _di_fss_read_callback_t_ diff --git a/level_3/fss_read/c/main/main.c b/level_3/fss_read/c/main/main.c index e780591..173355f 100644 --- a/level_3/fss_read/c/main/main.c +++ b/level_3/fss_read/c/main/main.c @@ -111,11 +111,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->callback.print_at = &fss_read_print_at; main->callback.print_content = &fss_read_print_content; - main->callback.print_content_empty_set = &fss_read_print_content_empty_set_end; main->callback.print_content_ignore = 0; main->callback.print_content_next = 0; main->callback.print_object = &fss_read_print_object; - main->callback.print_object_end = &fss_read_basic_print_data_object_end; + main->callback.print_object_end = &fss_read_basic_print_object_end; + main->callback.print_object_end_content = &fss_read_basic_print_object_end_content; + main->callback.print_object_end_empty = &fss_read_print_content_empty; main->callback.print_set_end = &fss_read_print_set_end; main->setting.standard = fss_read_basic_standard_s; @@ -129,7 +130,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.flag &= ~fss_read_main_flag_payload_warn_d; main->setting.flag &= ~fss_read_main_flag_trim_object_d; - main->setting.flag |= fss_read_main_flag_line_single_d; + main->setting.flag |= fss_read_main_flag_line_single_d | fss_read_main_flag_content_end_d; main->setting.flag |= fss_read_main_flag_quote_content_d | fss_read_main_flag_quote_object_d; if (main->program.parameters.array[fss_read_parameter_as_e].result & f_console_result_value_e && main->program.parameters.array[fss_read_parameter_as_e].values.used) { @@ -153,7 +154,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.flag &= ~fss_read_main_flag_payload_warn_d; main->setting.flag &= ~fss_read_main_flag_trim_object_d; - main->setting.flag |= fss_read_main_flag_line_single_d; + main->setting.flag |= fss_read_main_flag_line_single_d | fss_read_main_flag_content_end_d; main->setting.flag |= fss_read_main_flag_quote_content_d | fss_read_main_flag_quote_object_d; main->program.parameters.array[fss_read_parameter_payload_e].flag |= f_console_flag_disable_e; @@ -162,12 +163,11 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->callback.process_load = &fss_read_basic_process_load; main->callback.process_total = &fss_read_process_normal_total; - main->callback.print_content = &fss_read_print_content; - main->callback.print_content_empty_set = &fss_read_print_content_empty_set_end; main->callback.print_content_ignore = 0; main->callback.print_content_next = 0; - main->callback.print_object = &fss_read_print_object; - main->callback.print_object_end = &fss_read_basic_print_data_object_end; + main->callback.print_object_end = &fss_read_basic_print_object_end; + main->callback.print_object_end_content = &fss_read_basic_print_object_end_content; + main->callback.print_object_end_empty = &fss_read_print_content_empty; main->callback.print_set_end = &fss_read_print_set_end; } else if (f_compare_dynamic(as, fss_read_format_code_short_0001_s) == F_equal_to || @@ -186,7 +186,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.flag &= ~fss_read_main_flag_payload_warn_d; main->setting.flag &= ~fss_read_main_flag_trim_object_d; - main->setting.flag |= fss_read_main_flag_line_single_d | fss_read_main_flag_content_multiple_d; + main->setting.flag |= fss_read_main_flag_line_single_d | fss_read_main_flag_content_multiple_d | fss_read_main_flag_content_end_d; main->setting.flag |= fss_read_main_flag_quote_content_d | fss_read_main_flag_quote_object_d; main->program.parameters.array[fss_read_parameter_payload_e].flag |= f_console_flag_disable_e; @@ -195,9 +195,10 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->callback.process_load = &fss_read_extended_process_load; main->callback.process_total = &fss_read_process_normal_total; - main->callback.print_content_empty_set = &fss_read_print_content_empty_set_end; - main->callback.print_content_next = &fss_read_extended_print_data_content_next; - main->callback.print_object_end = &fss_read_extended_print_data_object_end; + main->callback.print_content_next = &fss_read_extended_print_content_next; + main->callback.print_object_end = &fss_read_extended_print_object_end; + main->callback.print_object_end_content = &fss_read_extended_print_object_end_content; + main->callback.print_object_end_empty = &fss_read_print_content_empty; main->callback.print_set_end = &fss_read_print_set_end; } else if (f_compare_dynamic(as, fss_read_format_code_short_0002_s) == F_equal_to || @@ -208,6 +209,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.standard = fss_read_basic_list_standard_s; // Remove flags not supported for this standard. + main->setting.flag &= ~fss_read_main_flag_content_end_d; main->setting.flag &= ~fss_read_main_flag_content_has_close_d; main->setting.flag &= ~fss_read_main_flag_content_multiple_d; main->setting.flag &= ~fss_read_main_flag_depth_multiple_d; @@ -225,9 +227,10 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->callback.process_load = &fss_read_basic_list_process_load; main->callback.process_total = &fss_read_process_normal_total_multiple; - main->callback.print_content_empty_set = 0; main->callback.print_content_next = 0; - main->callback.print_object_end = &fss_read_basic_list_print_data_object_end; + main->callback.print_object_end = &fss_read_basic_list_print_object_end; + main->callback.print_object_end_content = &fss_read_basic_list_print_object_end_content; + main->callback.print_object_end_empty = &fss_read_basic_list_print_object_end_empty; main->callback.print_set_end = &fss_read_print_set_end_no_eol; } else if (f_compare_dynamic(as, fss_read_format_code_short_0003_s) == F_equal_to || @@ -239,6 +242,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { // Remove flags not supported for this standard. main->setting.flag &= ~fss_read_main_flag_line_single_d; + main->setting.flag &= ~fss_read_main_flag_content_end_d; main->setting.flag &= ~fss_read_main_flag_content_multiple_d; main->setting.flag &= ~fss_read_main_flag_depth_multiple_d; main->setting.flag &= ~fss_read_main_flag_payload_error_d; @@ -255,10 +259,11 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->callback.process_load = &fss_read_extended_list_process_load; main->callback.process_total = &fss_read_process_normal_total_multiple; - main->callback.print_content_empty_set = 0; main->callback.print_content_next = 0; - main->callback.print_object_end = &fss_read_extended_list_print_data_object_end; - main->callback.print_set_end = &fss_read_extended_list_print_data_set_end; + main->callback.print_object_end = &fss_read_extended_list_print_object_end; + main->callback.print_object_end_content = &fss_read_extended_list_print_object_end_content; + main->callback.print_object_end_empty = &fss_read_extended_list_print_object_end_empty; + main->callback.print_set_end = &fss_read_extended_list_print_set_end; } else if (f_compare_dynamic(as, fss_read_format_code_short_0008_s) == F_equal_to || f_compare_dynamic(as, fss_read_format_code_long_0008_s) == F_equal_to || @@ -268,6 +273,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.standard = fss_read_embedded_list_standard_s; // Remove flags not supported for this standard. + main->setting.flag &= ~fss_read_main_flag_content_end_d; main->setting.flag &= ~fss_read_main_flag_content_has_close_d; main->setting.flag &= ~fss_read_main_flag_line_single_d; main->setting.flag &= ~fss_read_main_flag_payload_error_d; @@ -285,10 +291,11 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->callback.process_load = &fss_read_embedded_list_process_load; main->callback.process_total = &fss_read_process_normal_total_multiple; - main->callback.print_content_empty_set = 0; main->callback.print_content_next = 0; - main->callback.print_object_end = &fss_read_embedded_list_print_data_object_end; - main->callback.print_set_end = &fss_read_embedded_list_print_data_set_end; + main->callback.print_object_end = &fss_read_embedded_list_print_object_end; + main->callback.print_object_end_content = &fss_read_embedded_list_print_object_end_content; + main->callback.print_object_end_empty = &fss_read_embedded_list_print_object_end_empty; + main->callback.print_set_end = &fss_read_embedded_list_print_set_end; } else if (f_compare_dynamic(as, fss_read_format_code_short_000e_s) == F_equal_to || f_compare_dynamic(as, fss_read_format_code_long_000e_s) == F_equal_to || @@ -298,6 +305,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.standard = fss_read_payload_standard_s; // Remove flags not supported for this standard. + main->setting.flag &= ~fss_read_main_flag_content_end_d; main->setting.flag &= ~fss_read_main_flag_content_has_close_d; main->setting.flag &= ~fss_read_main_flag_content_multiple_d; main->setting.flag &= ~fss_read_main_flag_depth_multiple_d; @@ -314,9 +322,10 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->callback.process_load = &fss_read_payload_process_load; main->callback.process_total = &fss_read_process_normal_total_multiple; - main->callback.print_content_empty_set = 0; main->callback.print_content_next = 0; - main->callback.print_object_end = &fss_read_payload_print_data_object_end; + main->callback.print_object_end = &fss_read_payload_print_object_end; + main->callback.print_object_end_content = &fss_read_payload_print_object_end_content; + main->callback.print_object_end_empty = &fss_read_payload_print_object_end_empty; main->callback.print_set_end = &fss_read_print_set_end_no_eol; } else { diff --git a/level_3/fss_read/c/main/print/data.c b/level_3/fss_read/c/main/print/data.c index bea80aa..7f8cf20 100644 --- a/level_3/fss_read/c/main/print/data.c +++ b/level_3/fss_read/c/main/print/data.c @@ -13,61 +13,116 @@ extern "C" { if (at >= main->setting.contents.used) return F_output_not; - bool print_set_end = F_false; + if (!(main->setting.flag & fss_read_main_flag_object_d)) { + if (!(main->setting.flag & fss_read_main_flag_content_d) || (!main->setting.contents.array[at].used && !(main->setting.flag & fss_read_main_flag_empty_d))) { + return F_okay; + } + } - if ((main->setting.flag & fss_read_main_flag_object_d) || (main->setting.flag & fss_read_main_flag_content_d) && (main->setting.contents.array[at].used || (main->setting.flag & fss_read_main_flag_empty_d))) { - if (main->setting.flag & fss_read_main_flag_object_d) { - if (main->callback.print_object) { - main->callback.print_object(&main->program.output, at, delimits_object); - } + // 0x1 = object printed, 0x2 = content printed, 0x4 = object end printed, 0x8 = content is empty, 0x10 = select is out of range. + uint8_t print_state = 0x0; - if (main->callback.print_object_end) { - main->callback.print_object_end(&main->program.output); - } + if (main->setting.flag & fss_read_main_flag_object_d) { + if (main->callback.print_object) { + print_state = 0x1; - print_set_end = F_true; + main->callback.print_object(&main->program.output, at, delimits_object); } + } - if (main->setting.flag & fss_read_main_flag_content_d) { - if (main->setting.flag & fss_read_main_flag_select_d) { - if (main->setting.contents.array[at].used) { - if (main->setting.select < main->setting.contents.array[at].used) { - if (main->setting.contents.array[at].array[main->setting.select].start <= main->setting.contents.array[at].array[main->setting.select].stop) { - print_set_end = F_true; - - if (main->callback.print_content) { - main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[main->setting.select], main->setting.quotes_content.array[at].used ? main->setting.quotes_content.array[at].array[main->setting.select] : 0, delimits_content); - } + if (main->setting.flag & fss_read_main_flag_content_d) { + if (main->setting.flag & fss_read_main_flag_select_d) { + if (main->setting.select < main->setting.contents.array[at].used && main->setting.contents.array[at].array[main->setting.select].start <= main->setting.contents.array[at].array[main->setting.select].stop) { + if (main->callback.print_content && main->callback.print_object_end_content) { + if (print_state & 0x1) { + if (main->callback.print_object_end_content(&main->program.output, main->setting.contents.array[at].array[main->setting.select], main->setting.quotes_content.array[at].used ? main->setting.quotes_content.array[at].array[main->setting.select] : 0, delimits_content) != F_output_not) { + print_state |= 0x6; } - else { - print_set_end = F_true; + } + else { + if (main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[main->setting.select], main->setting.quotes_content.array[at].used ? main->setting.quotes_content.array[at].array[main->setting.select] : 0, delimits_content) != F_output_not) { + print_state |= 0x2; } } } - else if (main->callback.print_content_empty_set && !main->setting.select) { - main->callback.print_content_empty_set(&main->program.output); - } } - else if (main->setting.contents.array[at].used) { - print_set_end = F_true; + else { + print_state |= (main->setting.select < main->setting.contents.array[at].used) ? 0x8 : 0x18; + } + } + else if (main->setting.contents.array[at].used) { + if (main->callback.print_content && main->callback.print_object_end_content) { + f_number_unsigned_t i = 0; - if (main->callback.print_content) { - for (f_number_unsigned_t i = 0; i < main->setting.contents.array[at].used; ++i) { + // Loop through with conditionals only when necessary for performance reasons. + for (print_state |= 0x8; i < main->setting.contents.array[at].used; ++i) { - main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[i], main->setting.quotes_content.array[at].used ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content); + if (main->setting.contents.array[at].array[i].start <= main->setting.contents.array[at].array[i].stop) { + print_state &= ~0x8; - if (main->callback.print_content_next && i + 1 < main->setting.contents.array[at].used) { + if (print_state & 0x1) { + if (main->callback.print_object_end_content(&main->program.output, main->setting.contents.array[at].array[i], main->setting.quotes_content.array[at].used ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content) != F_output_not) { + print_state |= 0x6; + } + } + else {if (main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[i], main->setting.quotes_content.array[at].used ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content) != F_output_not) { + print_state |= 0x2; + } + } + + ++i; + + break; + } + } // for + + for (; i < main->setting.contents.array[at].used; ++i) { + + if (main->setting.contents.array[at].array[i].start <= main->setting.contents.array[at].array[i].stop) { + if (main->callback.print_content_next) { main->callback.print_content_next(&main->program.output); } - } // for + + main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[i], main->setting.quotes_content.array[at].used ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content); + } + } // for + } + } + else { + print_state |= 0x8; + } + + if (print_state & 0x8) { + if (print_state & 0x1) { + if (!(print_state & 0x4) && main->callback.print_object_end_empty) { + main->callback.print_object_end_empty(&main->program.output); } } - else if (main->callback.print_content_empty_set) { - main->callback.print_content_empty_set(&main->program.output); + + if ((print_state & 0x1) || !(print_state & 0x10)) { + if (main->callback.print_set_end) { + main->callback.print_set_end(&main->program.output); + } } } + else { + if ((print_state & 0x3) != 0x3 && (print_state & 0x1)) { + if (!(print_state & 0x4) && main->callback.print_object_end) { + main->callback.print_object_end(&main->program.output); + } + } - if (print_set_end && main->callback.print_set_end) { + if (main->callback.print_set_end) { + main->callback.print_set_end(&main->program.output); + } + } + } + else if (print_state & 0x1) { + if (main->callback.print_object_end_empty) { + main->callback.print_object_end_empty(&main->program.output); + } + + if (main->callback.print_set_end) { main->callback.print_set_end(&main->program.output); } } @@ -109,31 +164,35 @@ extern "C" { } #endif // _di_fss_read_print_content_ -#ifndef _di_fss_read_print_content_empty_set_end_ - f_status_t fss_read_print_content_empty_set_end(fl_print_t * const print) { +#ifndef _di_fss_read_print_content_empty_ + f_status_t fss_read_print_content_empty(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); fss_read_main_t * const main = (fss_read_main_t *) print->custom; - if (main->callback.print_set_end && (main->setting.flag & fss_read_main_flag_empty_d)) { - main->callback.print_set_end(print); + if ((main->setting.flag & fss_read_main_flag_content_d) && (main->setting.flag & fss_read_main_flag_pipe_format_d)) { + fll_print_dynamic_raw(fss_read_pipe_content_start_s, print->to); + } + else { + return F_output_not; } return F_okay; } -#endif // _di_fss_read_print_content_empty_set_end_ +#endif // _di_fss_read_print_content_empty_ #ifndef _di_fss_read_print_content_ignore_ f_status_t fss_read_print_content_ignore(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); - fss_read_main_t * const main = (fss_read_main_t *) print->custom; - - if (main->setting.flag & fss_read_main_flag_pipe_format_d) { + if (((fss_read_main_t *) print->custom)->setting.flag & fss_read_main_flag_pipe_format_d) { fll_print_dynamic_raw(fss_read_pipe_content_ignore_s, print->to); } + else { + return F_output_not; + } return F_okay; } @@ -196,6 +255,18 @@ extern "C" { } #endif // _di_fss_read_print_object_ +#ifndef _di_fss_read_print_object_content_ + f_status_t fss_read_print_object_content(fl_print_t * const print, const f_number_unsigned_t at, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content) { + + { + const f_status_t status = fss_read_print_object(print, at, delimits_object); + if (F_status_is_error(status) || status == F_output_not) return status; + } + + return fss_read_print_content(print, range, quote, delimits_content); + } +#endif // _di_fss_read_print_object_content_ + #ifndef _di_fss_read_print_quote_ f_status_t fss_read_print_quote(fl_print_t * const print, const uint8_t type) { @@ -211,6 +282,9 @@ extern "C" { print->to ); } + else { + return F_output_not; + } return F_okay; } @@ -221,9 +295,7 @@ extern "C" { if (!print || !print->custom) return F_status_set_error(F_output_not); - fss_read_main_t * const main = (fss_read_main_t *) print->custom; - - fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_format_d) ? fss_read_pipe_content_end_s : f_string_eol_s, print->to); + fll_print_dynamic_raw((((fss_read_main_t *) print->custom)->setting.flag & fss_read_main_flag_pipe_format_d) ? fss_read_pipe_content_end_s : f_string_eol_s, print->to); return F_okay; } @@ -234,11 +306,12 @@ extern "C" { if (!print || !print->custom) return F_status_set_error(F_output_not); - fss_read_main_t * const main = (fss_read_main_t *) print->custom; - - if (main->setting.flag & fss_read_main_flag_pipe_format_d) { + if (((fss_read_main_t *) print->custom)->setting.flag & fss_read_main_flag_pipe_format_d) { fll_print_dynamic_raw(fss_read_pipe_content_end_s, print->to); } + else { + return F_output_not; + } return F_okay; } diff --git a/level_3/fss_read/c/main/print/data.h b/level_3/fss_read/c/main/print/data.h index aa24aa3..35ee330 100644 --- a/level_3/fss_read/c/main/print/data.h +++ b/level_3/fss_read/c/main/print/data.h @@ -44,11 +44,6 @@ extern "C" { * * F_output_not (with error bit) if a parameter is NULL. * - * @see fll_print_dynamic_partial() - * @see fll_print_except_dynamic_partial() - * @see fll_print_trim_dynamic_partial() - * @see fll_print_trim_except_dynamic_partial() - * * @see main.callback.print_content() * @see main.callback.print_object() * @see main.callback.print_object_end() @@ -85,7 +80,6 @@ extern "C" { * * F_output_not (with error bit) if a parameter is NULL. * - * @see fll_print_except_in_dynamic_partial() * @see main.callback.print_content() * @see main.callback.print_object_end() * @see main.callback.print_set_end() @@ -95,10 +89,15 @@ extern "C" { #endif // _di_fss_read_print_content_ /** - * Print the set end via the set end callback when Content is empty and the empty flag is set. + * Print the "empty" Content. * * This locks, uses, and unlocks the file stream. * + * This only prints the end Content start pipe character. + * This does not print the Content end pipe character to avoid conflicting with the calls to the set end function. + * + * This does not print the Content set end. + * * @param print * The output structure to print to. * @@ -111,12 +110,10 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. - * - * @see fll_print_dynamic_raw() */ -#ifndef _di_fss_read_print_content_empty_set_end_ - extern f_status_t fss_read_print_content_empty_set_end(fl_print_t * const print); -#endif // _di_fss_read_print_content_empty_set_end_ +#ifndef _di_fss_read_print_content_empty_ + extern f_status_t fss_read_print_content_empty(fl_print_t * const print); +#endif // _di_fss_read_print_content_empty_ /** * Print the ignore character for Content. @@ -161,8 +158,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. - * - * @see fll_print_format() */ #ifndef _di_fss_read_print_number_ extern f_status_t fss_read_print_number(fl_print_t * const print, const f_number_unsigned_t number); @@ -192,19 +187,47 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. - * - * @see fll_print_dynamic_partial() - * @see fll_print_except_dynamic_partial() - * @see fll_print_trim_dynamic_partial() - * @see fll_print_trim_except_dynamic_partial() - * - * @see fss_read_print_quote() */ #ifndef _di_fss_read_print_object_ extern f_status_t fss_read_print_object(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits); #endif // _di_fss_read_print_object_ /** + * Print the Object at the given Object index position and the Content. + * + * This locks, uses, and unlocks the file stream. + * + * Different standards may want to call this before they perform their final printing. + * + * @param print + * The output structure to print to. + * + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * @param at + * The Object index to be printed. + * @param range + * The range within the buffer representing the Content to print. + * @param quote + * The quote type representing the character to use (from the f_fss_quote_type_*_e). + * @param delimits_object + * The delimits array representing a delimited Object. + * This represents the positions within the current Object at the "at" position. + * @param delimits_content + * The delimits array representing a delimited Content. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. + */ +#ifndef _di_fss_read_print_object_content_ + extern f_status_t fss_read_print_object_content(fl_print_t * const print, const f_number_unsigned_t at, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); +#endif // _di_fss_read_print_object_content_ + +/** * Print the Object at the given Object index position. * * This locks, uses, and unlocks the file stream. @@ -226,8 +249,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. - * - * @see fll_print_dynamic_raw() */ #ifndef _di_fss_read_print_quote_ extern f_status_t fss_read_print_quote(fl_print_t * const print, const uint8_t type); @@ -250,8 +271,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. - * - * @see fll_print_dynamic_raw() */ #ifndef _di_fss_read_print_set_end_ extern f_status_t fss_read_print_set_end(fl_print_t * const print); @@ -276,8 +295,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. - * - * @see fll_print_dynamic_raw() */ #ifndef _di_fss_read_print_set_end_no_eol_ extern f_status_t fss_read_print_set_end_no_eol(fl_print_t * const print); diff --git a/level_3/fss_read/c/main/process_normal.c b/level_3/fss_read/c/main/process_normal.c index 1d82c71..6f6561b 100644 --- a/level_3/fss_read/c/main/process_normal.c +++ b/level_3/fss_read/c/main/process_normal.c @@ -11,8 +11,6 @@ extern "C" { fss_read_main_t * const main = (fss_read_main_t *) void_main; - // @todo note that embedded list will probably need to implement its own version of this function (aka: fss_read_process_embedded). - // For depth, most standards do not support nesting, so any depth greater than 0 can be predicted without processing the buffer. // For select, most standards do not support multiple select, so any select greater than 0 can be predicted without processing the buffer. if (!(main->setting.flag & fss_read_main_flag_depth_multiple_d) && main->setting.depths.array[0].depth || !(main->setting.flag & fss_read_main_flag_content_multiple_d) && ((main->setting.flag & fss_read_main_flag_select_d) && main->setting.select)) { @@ -71,6 +69,7 @@ extern "C" { } else if (main->setting.flag & fss_read_main_flag_at_d) { if (main->callback.process_at) { + main->callback.process_at(main, names, *delimits_object, *delimits_content); } } @@ -224,7 +223,7 @@ extern "C" { if (main->setting.flag & fss_read_main_flag_content_d) { if (!main->setting.contents.array[at].used) { - // Must process/count line when both Object and Content share the same line but Content is empty for single line Content. + // Must process/count line when both Object and Content share the same line and Content is empty for single line Content. if ((main->setting.flag & fss_read_main_flag_line_single_d)) { if (main->setting.flag & fss_read_main_flag_object_d) { if (!(main->setting.flag & fss_read_main_flag_object_as_line_d)) { @@ -243,8 +242,8 @@ extern "C" { } else if (main->setting.flag & fss_read_main_flag_empty_d) { if (*line == main->setting.line) { - if (main->callback.print_content_empty_set) { - main->callback.print_content_empty_set(&main->program.output); + if (main->callback.print_set_end) { + main->callback.print_set_end(&main->program.output); } main->setting.state.status = F_success; @@ -256,9 +255,11 @@ extern "C" { } } else { - if (main->callback.print_content_empty_set) { + if (main->setting.flag & fss_read_main_flag_empty_d) { if (*line == main->setting.line) { - main->callback.print_content_empty_set(&main->program.output); + if (main->callback.print_set_end) { + main->callback.print_set_end(&main->program.output); + } main->setting.state.status = F_success; @@ -278,18 +279,20 @@ extern "C" { if (main->setting.flag & fss_read_main_flag_line_single_d) { if (*line == main->setting.line) { - while (main->setting.contents.array[at].used) { + if (main->setting.contents.array[at].used) { + for (;;) { - if (main->callback.print_content) { - main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[i], main->setting.quotes_content.array[at].array[i], delimits_content); - } + if (main->callback.print_content) { + main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[i], main->setting.quotes_content.array[at].array[i], delimits_content); + } - if (++i >= main->setting.contents.array[at].used) break; + if (++i >= main->setting.contents.array[at].used) break; - if (main->callback.print_content_next) { - main->callback.print_content_next(&main->program.output); - } - } // while + if (main->callback.print_content_next) { + main->callback.print_content_next(&main->program.output); + } + } // for + } if (main->callback.print_set_end) { main->callback.print_set_end(&main->program.output); @@ -352,8 +355,7 @@ extern "C" { } // for } - // @fixme The fll_fss_*_read functions do not have a store of the set closing ranges but should. - // Simulate the ending by printing, but the original range should ideally be used (add new features to accomplish this). + // Simulate the ending by printing. if ((main->setting.flag & fss_read_main_flag_object_d) && (main->setting.flag & fss_read_main_flag_content_has_close_d)) { if (*line == main->setting.line) { if (main->callback.print_set_end) { diff --git a/level_3/fss_read/c/payload/main.c b/level_3/fss_read/c/payload/main.c index bad567d..55e72f1 100644 --- a/level_3/fss_read/c/payload/main.c +++ b/level_3/fss_read/c/payload/main.c @@ -35,11 +35,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.callback.print_at = &fss_read_print_at; data.callback.print_content = &fss_read_print_content; - data.callback.print_content_empty_set = 0; data.callback.print_content_ignore = &fss_read_print_content_ignore; data.callback.print_content_next = 0; data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_payload_print_data_object_end; + data.callback.print_object_end = &fss_read_payload_print_object_end; + data.callback.print_object_end_content = &fss_read_payload_print_object_end_content; + data.callback.print_object_end_empty = &fss_read_payload_print_object_end_empty; data.callback.print_set_end = &fss_read_print_set_end_no_eol; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; diff --git a/level_3/fss_read/c/payload/print.c b/level_3/fss_read/c/payload/print.c index 91a39ac..e171fd1 100644 --- a/level_3/fss_read/c/payload/print.c +++ b/level_3/fss_read/c/payload/print.c @@ -4,8 +4,8 @@ extern "C" { #endif -#ifndef _di_fss_read_payload_print_data_object_end_ - f_status_t fss_read_payload_print_data_object_end(fl_print_t * const print) { +#ifndef _di_fss_read_payload_print_object_end_ + f_status_t fss_read_payload_print_object_end(fl_print_t * const print) { if (!print || !print->custom) return F_status_set_error(F_output_not); @@ -16,21 +16,46 @@ extern "C" { if (main->setting.flag & fss_read_main_flag_pipe_format_d) { f_print_dynamic_raw(fss_read_pipe_content_start_s, print->to); } + else if (main->setting.flag & fss_read_main_flag_content_d) { + f_print_dynamic_raw(f_fss_payload_list_open_s, print->to); + f_print_dynamic_raw(f_fss_payload_list_open_end_s, print->to); + } else { - if (main->setting.flag & fss_read_main_flag_content_d) { - f_print_dynamic_raw(f_fss_payload_list_open_s, print->to); - f_print_dynamic_raw(f_fss_payload_list_open_end_s, print->to); - } - else { - f_print_dynamic_raw(f_fss_eol_s, print->to); - } + f_print_dynamic_raw(f_fss_eol_s, print->to); } f_file_stream_unlock(print->to); return F_okay; } -#endif // _di_fss_read_payload_print_data_object_end_ +#endif // _di_fss_read_payload_print_object_end_ + +#ifndef _di_fss_read_payload_print_object_end_content_ + f_status_t fss_read_payload_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits) { + + { + const f_status_t status = fss_read_payload_print_object_end(print); + if (F_status_is_error(status) || status == F_output_not) return status; + } + + return fss_read_print_content(print, range, quote, delimits); + } +#endif // _di_fss_read_payload_print_object_end_content_ + +#ifndef _di_fss_read_payload_print_object_end_empty_ + f_status_t fss_read_payload_print_object_end_empty(fl_print_t * const print) { + + if (!print) return F_status_set_error(F_output_not); + + const f_status_t status_1 = fss_read_payload_print_object_end(print); + const f_status_t status_2 = fss_read_print_content_empty(print); + + if (F_status_is_error(status_1)) return status_1; + if (F_status_is_error(status_2)) return status_2; + + return (status_1 == F_okay || status_2 == F_okay) ? F_okay: F_output_not; + } +#endif // _di_fss_read_payload_print_object_end_empty_ #ifndef _di_fss_read_payload_print_error_parameter_value_payload_ f_status_t fss_read_payload_print_error_parameter_value_payload(fl_print_t * const print, const f_string_static_t value) { diff --git a/level_3/fss_read/c/payload/print.h b/level_3/fss_read/c/payload/print.h index 4d5c4df..b759675 100644 --- a/level_3/fss_read/c/payload/print.h +++ b/level_3/fss_read/c/payload/print.h @@ -29,14 +29,66 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. + */ +#ifndef _di_fss_read_payload_print_object_end_ + extern f_status_t fss_read_payload_print_object_end(fl_print_t * const print); +#endif // _di_fss_read_payload_print_object_end_ + +/** + * Print the end of an Object (which is often the start of Content) and the Content. + * + * This locks, uses, and unlocks the file stream. + * + * This processes single Content range. + * This does not print a new line after the Content. + * + * @param print + * The output structure to print to. + * + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * @param range + * The range within the buffer representing the Content to print. + * @param quote + * The quote type representing the character to use (from the f_fss_quote_type_*_e). + * @param delimits + * The delimits array representing a delimited Content. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. + */ +#ifndef _di_fss_readpayload_print_data_object_end_content_ + extern f_status_t fss_read_payload_print_object_end_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); +#endif // _di_fss_read_payload_print_object_end_content_ + +/** + * Print the end of an Object (which is often the start of Content) and the end of the Content when no Content. + * + * This locks, uses, and unlocks the file stream. + * + * @param print + * The output structure to print to. + * + * The print.custom is expected to be of type fss_read_main_t. * - * @see f_file_stream_lock() - * @see f_file_stream_unlock() - * @see f_print_dynamic_raw() + * This does not alter print.custom.setting.state.status. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. + * + * @see fss_read_payload_print_object_end() + * @see fss_read_print_content_empty() */ -#ifndef _di_fss_read_payload_print_data_object_end_ - extern f_status_t fss_read_payload_print_data_object_end(fl_print_t * const print); -#endif // _di_fss_read_payload_print_data_object_end_ +#ifndef _di_fss_read_payload_print_object_end_empty_ + extern f_status_t fss_read_payload_print_object_end_empty(fl_print_t * const print); +#endif // _di_fss_read_payload_print_object_end_empty_ /** * Print an error message about the payload parameter not having a valid value. @@ -127,8 +179,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() */ #ifndef _di_fss_read_payload_print_problem_payload_missing_ extern f_status_t fss_read_payload_print_problem_payload_missing(fl_print_t * const print); diff --git a/level_3/fss_read/data/build/testfile b/level_3/fss_read/data/build/testfile index ec131e8..c1ee9e1 100644 --- a/level_3/fss_read/data/build/testfile +++ b/level_3/fss_read/data/build/testfile @@ -129,32 +129,32 @@ verify_process: print print Verifying Tests for Basic (FSS-0000). print - run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_0000/ tests/runtime/fss_0000/expect/ + run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_0000/ tests/runtime/fss_0000/expect/ "Basic (FSS-0000)" print print Verifying Tests for Extended (FSS-0001). print - run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_0001/ tests/runtime/fss_0001/expect/ + run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_0001/ tests/runtime/fss_0001/expect/ "Extended (FSS-0001)" print print Verifying Tests for Basic List (FSS-0002). print - run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_0002/ tests/runtime/fss_0002/expect/ + run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_0002/ tests/runtime/fss_0002/expect/ "Basic List (FSS-0002)" print print Verifying Tests for Extended List (FSS-0003). print - run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_0003/ tests/runtime/fss_0003/expect/ + run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_0003/ tests/runtime/fss_0003/expect/ "Extended List (FSS-0003)" print print Verifying Tests for Embedded List (FSS-0008). print - run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_0008/ tests/runtime/fss_0008/expect/ + run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_0008/ tests/runtime/fss_0008/expect/ "Embedded List (FSS-0008)" print print Verifying Tests for Payload (FSS-000E). print - run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_000e/ tests/runtime/fss_000e/expect/ + run parameter:"script" ./tests/runtime/script/verify.sh build/test/fss_000e/ tests/runtime/fss_000e/expect/ "Payload (FSS-000E)" build_path: parameter build_path build/ diff --git a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-content-name-hi-select-0-empty.expect b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-content-name-hi-select-0-empty.expect index 8b13789..e69de29 100644 --- a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-content-name-hi-select-0-empty.expect +++ b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-content-name-hi-select-0-empty.expect @@ -1 +0,0 @@ - diff --git a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-at-6.expect b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-at-6.expect index 0b5d6ed..45b983b 100644 --- a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-at-6.expect +++ b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-at-6.expect @@ -1 +1 @@ -hi +hi diff --git a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi-select-0-empty.expect b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi-select-0-empty.expect index 34c9d2c..45b983b 100644 --- a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi-select-0-empty.expect +++ b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi-select-0-empty.expect @@ -1,2 +1 @@ -hi - +hi diff --git a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi-select-0.expect b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi-select-0.expect index 0b5d6ed..45b983b 100644 --- a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi-select-0.expect +++ b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi-select-0.expect @@ -1 +1 @@ -hi +hi diff --git a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi.expect b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi.expect index 0b5d6ed..45b983b 100644 --- a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi.expect +++ b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-name-hi.expect @@ -1 +1 @@ -hi +hi diff --git a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-original.expect b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-original.expect index a476db9..8b3f61b 100644 --- a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-original.expect +++ b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-original.expect @@ -4,7 +4,7 @@ c d zero​width мир e␠ spaced out UTF space! <-- should have the word 'space!' -hi +hi a line܀܀܀with some random text a 偐 ぐ a b c d e f ሴ䌡 diff --git a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-select-0.expect b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-select-0.expect index e078c77..f16d422 100644 --- a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-select-0.expect +++ b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-select-0.expect @@ -4,7 +4,7 @@ c d zero​width мир e␠ spaced out UTF space! <-- should have the word 'space!' -hi +hi a line܀܀܀with some random text a 偐 ぐ a b c d e f ሴ䌡 diff --git a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-trim.expect b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-trim.expect index e078c77..f16d422 100644 --- a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-trim.expect +++ b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content-trim.expect @@ -4,7 +4,7 @@ c d zero​width мир e␠ spaced out UTF space! <-- should have the word 'space!' -hi +hi a line܀܀܀with some random text a 偐 ぐ a b c d e f ሴ䌡 diff --git a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content.expect b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content.expect index e078c77..f16d422 100644 --- a/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content.expect +++ b/level_3/fss_read/tests/runtime/fss_0000/expect/test-0001-unicode-object_and_content.expect @@ -4,7 +4,7 @@ c d zero​width мир e␠ spaced out UTF space! <-- should have the word 'space!' -hi +hi a line܀܀܀with some random text a 偐 ぐ a b c d e f ሴ䌡 diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name--select-1.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name--select-1.expect index 71dfa00..e7edf5c 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name--select-1.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name--select-1.expect @@ -1,2 +1,2 @@ - + zero diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-100.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-100.expect index 149ad90..16f18f3 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-100.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-100.expect @@ -1,3 +1,3 @@ -a -a -a +a +a +a diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-2.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-2.expect index 4e24429..7baff5a 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-2.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-2.expect @@ -1,3 +1,3 @@ a text -a +a a 'e diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-5.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-5.expect index 149ad90..16f18f3 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-5.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-5.expect @@ -1,3 +1,3 @@ -a -a -a +a +a +a diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-6.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-6.expect index 149ad90..16f18f3 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-6.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-name-a-select-6.expect @@ -1,3 +1,3 @@ -a -a -a +a +a +a diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-1.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-1.expect index 289d8f7..9469ba0 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-1.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-1.expect @@ -1,15 +1,15 @@ -Hi -\\hi +Hi +\\hi \\\\\"Hello you." \\" quoted stuff. so - + "" b -" +" "" d " f -\\" sss -\\"\" xx -\\"\\\" +\\" sss +\\"\" xx +\\"\\\" zero #not comment...should have \#not comment diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-100.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-100.expect index 53d59f9..c1e8d1a 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-100.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-100.expect @@ -1,21 +1,21 @@ -Hi -\\hi -\\\\\"Hello -\\" quoted stuff. - -"" +Hi +\\hi +\\\\\"Hello +\\" quoted stuff. + +"" +" +"" " -"" -" -\\" sss -\\"\" xx -\\"\\\" - -#not -\#not -\\#not -a -a -a -мир -привет has space +\\" sss +\\"\" xx +\\"\\\" + +#not +\#not +\\#not +a +a +a +мир +привет has space diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-5.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-5.expect index 53d59f9..c1e8d1a 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-5.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-5.expect @@ -1,21 +1,21 @@ -Hi -\\hi -\\\\\"Hello -\\" quoted stuff. - -"" +Hi +\\hi +\\\\\"Hello +\\" quoted stuff. + +"" +" +"" " -"" -" -\\" sss -\\"\" xx -\\"\\\" - -#not -\#not -\\#not -a -a -a -мир -привет has space +\\" sss +\\"\" xx +\\"\\\" + +#not +\#not +\\#not +a +a +a +мир +привет has space diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-6.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-6.expect index 53d59f9..c1e8d1a 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-6.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0000-quotes_and_escapes-object_and_content-select-6.expect @@ -1,21 +1,21 @@ -Hi -\\hi -\\\\\"Hello -\\" quoted stuff. - -"" +Hi +\\hi +\\\\\"Hello +\\" quoted stuff. + +"" +" +"" " -"" -" -\\" sss -\\"\" xx -\\"\\\" - -#not -\#not -\\#not -a -a -a -мир -привет has space +\\" sss +\\"\" xx +\\"\\\" + +#not +\#not +\\#not +a +a +a +мир +привет has space diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-content-name-hi-select-0-empty.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-content-name-hi-select-0-empty.expect index 8b13789..e69de29 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-content-name-hi-select-0-empty.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-content-name-hi-select-0-empty.expect @@ -1 +0,0 @@ - diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-at-6.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-at-6.expect index 0b5d6ed..45b983b 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-at-6.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-at-6.expect @@ -1 +1 @@ -hi +hi diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-100.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-100.expect index 7eab509..32c34d0 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-100.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-100.expect @@ -1,4 +1,4 @@ -a -a -a -a +a +a +a +a diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-2.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-2.expect index d4a286f..5b84c5e 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-2.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-2.expect @@ -1,4 +1,4 @@ a d3a a random -a +a a d diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-5.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-5.expect index 8d802de..84bfb3b 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-5.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-5.expect @@ -1,4 +1,4 @@ -a -a -a +a +a +a a ሴ䌡 diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-6.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-6.expect index 7eab509..32c34d0 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-6.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-a-select-6.expect @@ -1,4 +1,4 @@ -a -a -a -a +a +a +a +a diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-0-empty.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-0-empty.expect index 34c9d2c..45b983b 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-0-empty.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-0-empty.expect @@ -1,2 +1 @@ -hi - +hi diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-0.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-0.expect index 0b5d6ed..45b983b 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-0.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-0.expect @@ -1 +1 @@ -hi +hi diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-1-empty.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-1-empty.expect index 0b5d6ed..45b983b 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-1-empty.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-1-empty.expect @@ -1 +1 @@ -hi +hi diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-1.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-1.expect index 0b5d6ed..45b983b 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-1.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi-select-1.expect @@ -1 +1 @@ -hi +hi diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi.expect index 0b5d6ed..45b983b 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-hi.expect @@ -1 +1 @@ -hi +hi diff --git "a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-\320\274\320\270\321\200-select-1.expect" "b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-\320\274\320\270\321\200-select-1.expect" index ddc7758..ab88779 100644 --- "a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-\320\274\320\270\321\200-select-1.expect" +++ "b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-name-\320\274\320\270\321\200-select-1.expect" @@ -1 +1 @@ -мир +мир diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-original.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-original.expect index 893daaa..ca70693 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-original.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-original.expect @@ -4,7 +4,7 @@ c d zero​width мир e␠ spaced out UTF space! <-- should have the word 'space!' -hi +hi a line܀܀܀with some random text a 偐 ぐ a b c d e f ሴ䌡 diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-0.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-0.expect index 7927b33..e35a1cd 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-0.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-0.expect @@ -4,7 +4,7 @@ c d мир e␠ spaced out UTF space! -hi +hi a line܀܀܀with a 偐 a b diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-1.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-1.expect index d7490a7..7c0a81e 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-1.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-1.expect @@ -1,10 +1,10 @@ a k c zero​width привет h -мир -spaced +мир +spaced UTF <-- -hi +hi a some a ぐ a c diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-100.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-100.expect index e092619..4732397 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-100.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-100.expect @@ -1,11 +1,11 @@ -a -c -привет -мир -spaced -UTF -hi -a -a -a -привет has space +a +c +привет +мир +spaced +UTF +hi +a +a +a +привет has space diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-5.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-5.expect index 4344cde..2e60888 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-5.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-5.expect @@ -1,11 +1,11 @@ -a -c -привет -мир -spaced +a +c +привет +мир +spaced UTF word -hi -a -a +hi +a +a a ሴ䌡 -привет has space +привет has space diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-6.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-6.expect index ce58a18..c561697 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-6.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-select-6.expect @@ -1,11 +1,11 @@ -a -c -привет -мир -spaced +a +c +привет +мир +spaced UTF space! -hi -a -a -a -привет has space +hi +a +a +a +привет has space diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-trim.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-trim.expect index 8f71132..8e9469c 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-trim.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content-trim.expect @@ -4,7 +4,7 @@ c d zero​width мир e␠ spaced out UTF space! <-- should have the word space! -hi +hi a line܀܀܀with some random text a 偐 ぐ a b c d e f ሴ䌡 diff --git a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content.expect b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content.expect index 8f71132..8e9469c 100644 --- a/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content.expect +++ b/level_3/fss_read/tests/runtime/fss_0001/expect/test-0001-unicode-object_and_content.expect @@ -4,7 +4,7 @@ c d zero​width мир e␠ spaced out UTF space! <-- should have the word space! -hi +hi a line܀܀܀with some random text a 偐 ぐ a b c d e f ሴ䌡 diff --git a/level_3/fss_read/tests/runtime/script/generate.sh b/level_3/fss_read/tests/runtime/script/generate.sh index bf43a1a..6be3bb5 100644 --- a/level_3/fss_read/tests/runtime/script/generate.sh +++ b/level_3/fss_read/tests/runtime/script/generate.sh @@ -1687,4 +1687,4 @@ generate_cleanup() { unset generate_cleanup } -generate_main $* +generate_main "$@" diff --git a/level_3/fss_read/tests/runtime/script/verify.sh b/level_3/fss_read/tests/runtime/script/verify.sh index b985356..f80c235 100644 --- a/level_3/fss_read/tests/runtime/script/verify.sh +++ b/level_3/fss_read/tests/runtime/script/verify.sh @@ -12,6 +12,7 @@ verify_main() { local path_build="${1}" local path_expect="${2}" + local test_name="${3}" local failure=0 local basename_file= local hash_build= @@ -44,6 +45,10 @@ verify_main() { return 1 fi + if [[ $test_name != "" ]] ; then + test_name=" for ${test_name}" + fi + verify_operate_test_standard if [[ ${failure} -eq 1 ]] ; then @@ -54,6 +59,9 @@ verify_main() { } verify_operate_test_standard() { + let -i fail=0 + let -i success=0 + let message="(Did not run tests)" for i in ${path_build}* ; do @@ -91,20 +99,27 @@ verify_operate_test_standard() { if [[ $hash_build == $hash_expect ]] ; then echo "[ Success ] ${basename_file}." + + let success++ else echo "[ Failure ] ${basename_file}." let failure=1 + let fail++ fi done + if [[ $fail -gt 0 || $success -gt 0 ]] ; then + message=" (Success: $success, Fail: $fail)" + fi + echo if [[ $failure -eq 1 ]] ; then - echo "Failure! Some or all tests failed." + echo "Failure! Some or all tests failed${message}${test_name}." else - echo "Success! All tests passed." + echo "Success! All tests passed${message}${test_name}." fi return $failure @@ -117,4 +132,4 @@ verify_cleanup() { unset verify_cleanup } -verify_main $* +verify_main "$@"