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 `"$@"`.
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;
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;
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) {
* 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).
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;
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);
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) {
* 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).
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;
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);
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) {
* 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.
*
*
* 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).
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;
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;
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);
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) {
* 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).
* 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).
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;
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);
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) {
* 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.
*
*
* 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).
* - 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.
#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_
/**
* 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 {
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 \
0, \
0, \
0, \
+ 0, \
+ 0, \
}
#endif // _di_fss_read_callback_t_
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;
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) {
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;
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 ||
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;
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 ||
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;
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 ||
// 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;
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 ||
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;
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 ||
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;
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 {
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);
}
}
}
#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;
}
}
#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) {
print->to
);
}
+ else {
+ return F_output_not;
+ }
return F_okay;
}
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;
}
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;
}
*
* 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()
*
* 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()
#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.
*
* 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.
* 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);
* 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.
* 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);
* 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);
* 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);
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)) {
}
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);
}
}
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)) {
}
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;
}
}
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;
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);
} // 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) {
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;
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);
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) {
* 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.
* 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);
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/
мир 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 ሴ䌡
мир 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 ሴ䌡
мир 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 ሴ䌡
мир 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 ሴ䌡
-Hi
-\\hi
+Hi
+\\hi
\\\\\"Hello you."
\\" quoted stuff. so
-
+
"" b
-"
+"
"" d
" f
-\\" sss
-\\"\" xx
-\\"\\\"
+\\" sss
+\\"\" xx
+\\"\\\"
zero
#not comment...should have
\#not comment
-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
-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
-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
мир 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 ሴ䌡
мир e␠
spaced out
UTF space!
-hi
+hi
a line܀܀܀with
a 偐
a b
a k
c zerowidth
привет h
-мир
-spaced
+мир
+spaced
UTF <--
-hi
+hi
a some
a ぐ
a c
-a
-c
-привет
-мир
-spaced
-UTF
-hi
-a
-a
-a
-привет has space
+a
+c
+привет
+мир
+spaced
+UTF
+hi
+a
+a
+a
+привет has space
-a
-c
-привет
-мир
-spaced
+a
+c
+привет
+мир
+spaced
UTF word
-hi
-a
-a
+hi
+a
+a
a ሴ䌡
-привет has space
+привет has space
-a
-c
-привет
-мир
-spaced
+a
+c
+привет
+мир
+spaced
UTF space!
-hi
-a
-a
-a
-привет has space
+hi
+a
+a
+a
+привет has space
мир 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 ሴ䌡
мир 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 ሴ䌡
unset generate_cleanup
}
-generate_main $*
+generate_main "$@"
verify_main() {
local path_build="${1}"
local path_expect="${2}"
+ local test_name="${3}"
local failure=0
local basename_file=
local hash_build=
return 1
fi
+ if [[ $test_name != "" ]] ; then
+ test_name=" for ${test_name}"
+ fi
+
verify_operate_test_standard
if [[ ${failure} -eq 1 ]] ; then
}
verify_operate_test_standard() {
+ let -i fail=0
+ let -i success=0
+ let message="(Did not run tests)"
for i in ${path_build}* ; do
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
unset verify_cleanup
}
-verify_main $*
+verify_main "$@"