Special handling is needed to process the `payload` section.
The content functions all need to have the `at` position to determine this.
Update the callbacks to allow for this.
The function `fss_read_print_content_empty()` is defined and used but it is used only for the `print_object_end_empty()` callback.
Add a `print_content_empty()` callback to provide this.
These changes allow for removing redundant functions.
data.callback.print_at = &fss_read_print_at;
data.callback.print_content = &fss_read_print_content;
+ data.callback.print_content_empty = &fss_read_print_content_empty;
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_object_end;
- data.callback.print_object_end_content = &fss_read_basic_print_object_end_content;
+ data.callback.print_object_end_content = &fss_read_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;
}
#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) {
#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.
- *
- * 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_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).
*
* @param print
data.callback.print_content_next = 0;
data.callback.print_object = &fss_read_print_object;
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_object_end_content = &fss_read_print_object_end_content;
+ data.callback.print_object_end_empty = &fss_read_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;
}
#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) {
#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 fss_read_print_content_empty()
- */
-#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).
*
* @param print
data.callback.print_content_next = 0;
data.callback.print_object = &fss_read_print_object;
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_object_end_content = &fss_read_print_object_end_content;
+ data.callback.print_object_end_empty = &fss_read_print_object_end_empty;
data.callback.print_set_end = &fss_read_embedded_list_print_set_end;
f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
}
#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);
-
- 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, const f_number_unsigned_t close) {
#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.
- *
- * 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_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 (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 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.
data.callback.print_at = &fss_read_print_at;
data.callback.print_content = &fss_read_print_content;
+ data.callback.print_content_empty = &fss_read_print_content_empty;
data.callback.print_content_ignore = &fss_read_print_content_ignore;
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_object_end;
- data.callback.print_object_end_content = &fss_read_extended_print_object_end_content;
+ data.callback.print_object_end_content = &fss_read_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;
}
#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) {
#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.
- *
- * 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_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).
*
* @param print
data.callback.print_content_next = 0;
data.callback.print_object = &fss_read_print_object;
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_empty;
+ data.callback.print_object_end_content = &fss_read_print_object_end_content;
+ data.callback.print_object_end_empty = &fss_read_print_object_end_empty;
data.callback.print_set_end = &fss_read_extended_list_print_set_end;
f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
}
#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);
-
- 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, const f_number_unsigned_t close) {
#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.
- *
- * 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_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 (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 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.
* 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: Print when there is no 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.
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_object_end_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);
+ f_status_t (*print_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);
+ f_status_t (*print_content_empty)(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);
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 = &fss_read_print_content_empty;
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_object_end;
- main->callback.print_object_end_content = &fss_read_basic_print_object_end_content;
+ main->callback.print_object_end_content = &fss_read_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->callback.process_normal = &fss_read_process_normal;
main->callback.process_total = &fss_read_process_normal_total;
+ main->callback.print_content = &fss_read_print_content;
main->callback.print_content_ignore = 0;
main->callback.print_content_next = 0;
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_content = &fss_read_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->callback.process_normal = &fss_read_process_normal;
main->callback.process_total = &fss_read_process_normal_total;
+ main->callback.print_content = &fss_read_print_content;
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_content = &fss_read_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->callback.process_normal = &fss_read_process_normal;
main->callback.process_total = &fss_read_process_normal_total_multiple;
+ main->callback.print_content = &fss_read_print_content;
main->callback.print_content_next = 0;
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_object_end_content = &fss_read_print_object_end_content;
+ main->callback.print_object_end_empty = &fss_read_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 ||
main->program.parameters.array[fss_read_parameter_payload_e].flag |= f_console_flag_disable_e;
-
main->callback.process_at = &fss_read_process_normal_at;
main->callback.process_at_line = &fss_read_process_normal_at_line;
main->callback.process_columns = &fss_read_process_normal_columns;
main->callback.process_normal = &fss_read_process_normal;
main->callback.process_total = &fss_read_process_normal_total_multiple;
+ main->callback.print_content = &fss_read_print_content;
main->callback.print_content_next = 0;
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_object_end_content = &fss_read_print_object_end_content;
+ main->callback.print_object_end_empty = &fss_read_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 ||
main->callback.process_normal = &fss_read_embedded_list_process_normal;
main->callback.process_total = &fss_read_process_normal_total_multiple;
+ main->callback.print_content = &fss_read_print_content;
main->callback.print_content_next = 0;
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_object_end_content = &fss_read_print_object_end_content;
+ main->callback.print_object_end_empty = &fss_read_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 ||
main->program.parameters.array[fss_read_parameter_payload_e].flag &= ~f_console_flag_disable_e;
-
main->callback.process_at = &fss_read_process_normal_at;
main->callback.process_at_line = &fss_read_process_normal_at_line;
main->callback.process_columns = &fss_read_process_normal_columns;
main->callback.process_normal = &fss_read_process_normal;
main->callback.process_total = &fss_read_process_normal_total_multiple;
+ main->callback.print_content = &fss_read_payload_print_content;
main->callback.print_content_next = 0;
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_object_end_content = &fss_read_print_object_end_content;
+ main->callback.print_object_end_empty = &fss_read_print_object_end_empty;
main->callback.print_set_end = &fss_read_print_set_end_no_eol;
}
else {
if (F_status_set_fine(
main->callback.print_object_end_content(
&main->program.output,
+ at,
main->setting.contents.array[at].array[main->setting.select],
(at < main->setting.quotes_content.used && main->setting.select < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[main->setting.select] : 0,
delimits_content
if (F_status_set_fine(
main->callback.print_content(
&main->program.output,
+ at,
main->setting.contents.array[at].array[main->setting.select],
(at < main->setting.quotes_content.used && main->setting.select < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[main->setting.select] : 0,
delimits_content
if (F_status_set_fine(
main->callback.print_object_end_content(
&main->program.output,
+ at,
main->setting.contents.array[at].array[i],
(at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0,
delimits_content
else if (F_status_set_fine(
main->callback.print_content(
&main->program.output,
+ at,
main->setting.contents.array[at].array[i],
(at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0,
delimits_content
main->callback.print_content(
&main->program.output,
+ at,
main->setting.contents.array[at].array[i],
(at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0,
delimits_content
#endif // _di_fss_read_print_at_
#ifndef _di_fss_read_print_content_
- f_status_t fss_read_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 fss_read_print_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) {
if (!print || !print->custom) return F_status_set_error(F_output_not);
}
#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) {
+#ifndef _di_fss_read_print_object_end_content_
+ f_status_t fss_read_print_object_end_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) {
- {
- const f_status_t status = fss_read_print_object(print, at, delimits_object);
+ 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_object_end) {
+ const f_status_t status = main->callback.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_content);
+ if (main->callback.print_content) {
+ return main->callback.print_content(print, at, range, quote, delimits);
+ }
+
+ return main->callback.print_object_end ? F_okay : F_output_not;
+ }
+#endif // _di_fss_read_print_object_end_content_
+
+#ifndef _di_fss_read_print_object_end_empty_
+ f_status_t fss_read_print_object_end_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;
+
+ const f_status_t status_1 = (main->callback.print_object_end) ? main->callback.print_object_end(print) : F_output_not;
+ const f_status_t status_2 = (main->callback.print_content_empty) ? main->callback.print_content_empty(print) : F_output_not;
+
+ 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_print_object_content_
+#endif // _di_fss_read_print_object_end_empty_
#ifndef _di_fss_read_print_quote_
f_status_t fss_read_print_quote(fl_print_t * const print, const uint8_t type) {
* 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
* @see main.callback.print_set_end()
*/
#ifndef _di_fss_read_print_content_
- extern f_status_t fss_read_print_content(fl_print_t * const print, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits);
+ extern f_status_t fss_read_print_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);
#endif // _di_fss_read_print_content_
/**
#endif // _di_fss_read_print_object_
/**
- * Print the Object at the given Object index position and the Content.
+ * Print the end of an Object (which is often the start of Content) and the Content.
*
* This locks, uses, and unlocks the file stream.
*
- * Different standards may want to call this before they perform their final printing.
+ * This processes single Content range.
+ * This does not print a new line after the Content.
*
* @param print
* The output structure to print to.
*
* This does not alter print.custom.setting.state.status.
* @param at
- * The Object index to be printed.
+ * The Object index position to be processed.
* @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
+ * @param delimits
* The delimits array representing a delimited Content.
*
* @return
*
* 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_
+#ifndef _di_fss_read_print_object_end_content_
+ extern f_status_t fss_read_print_object_end_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);
+#endif // _di_fss_read_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.
+ */
+#ifndef _di_fss_read_print_object_end_empty_
+ extern f_status_t fss_read_print_object_end_empty(fl_print_t * const print);
+#endif // _di_fss_read_print_object_end_empty_
/**
* Print the Object at the given Object index position.
if (main->setting.contents.array[at].array[i].start <= main->setting.contents.array[at].array[i].stop) {
if ((print_state & 0x1) && !(print_state & 0x4)) {
- printed = main->callback.print_object_end_content(&main->program.output, main->setting.contents.array[at].array[i], (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content);
+ printed = main->callback.print_object_end_content(&main->program.output, at, main->setting.contents.array[at].array[i], (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content);
if (F_status_set_fine(printed) != F_output_not) {
print_state |= 0x6;
}
}
else {
- printed = main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[i], (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content);
+ printed = main->callback.print_content(&main->program.output, at, main->setting.contents.array[at].array[i], (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content);
if (F_status_set_fine(printed) != F_output_not) {
print_state |= 0x2;
main->setting.range.stop = j;
if ((print_state & 0x1) && !(print_state & 0x4)) {
- main->callback.print_object_end_content(&main->program.output, main->setting.range, (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content);
+ main->callback.print_object_end_content(&main->program.output, at, main->setting.range, (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content);
}
else {
- main->callback.print_content(&main->program.output, main->setting.range, (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content);
+ main->callback.print_content(&main->program.output, at, main->setting.range, (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content);
}
main->setting.state.status = F_success;
data.callback.process_total = &fss_read_process_normal_total_multiple;
data.callback.print_at = &fss_read_print_at;
- data.callback.print_content = &fss_read_print_content;
+ data.callback.print_content = &fss_read_payload_print_content;
+ data.callback.print_content_empty = &fss_read_print_content_empty;
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 = &fss_read_payload_print_object;
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;
extern "C" {
#endif
+#ifndef _di_fss_read_payload_print_content_
+ f_status_t fss_read_payload_print_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) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+ fss_read_main_t * const main = (fss_read_main_t *) print->custom;
+
+ // The payload Content is printed raw.
+ if (main->setting.objects.used && at == main->setting.objects.used - 1) {
+ return fll_print_dynamic_partial_raw(main->setting.buffer, range, print->to);
+ }
+
+ if (main->callback.print_content_ignore) {
+ main->callback.print_content_ignore(&main->program.output);
+ }
+
+ if (main->setting.flag & fss_read_main_flag_original_d) {
+ if (main->setting.feature & fss_read_feature_flag_quote_content_d) {
+ fss_read_print_quote(&main->program.output, quote);
+ }
+ }
+
+ fll_print_except_in_dynamic_partial(main->setting.buffer, range, delimits, main->setting.comments, print->to);
+
+ if (main->setting.flag & fss_read_main_flag_original_d) {
+ if (main->setting.feature & fss_read_feature_flag_quote_content_d) {
+ fss_read_print_quote(&main->program.output, quote);
+ }
+ }
+
+ if (main->callback.print_content_ignore) {
+ main->callback.print_content_ignore(&main->program.output);
+ }
+
+ return F_okay;
+ }
+#endif // _di_fss_read_payload_print_content_
+
#ifndef _di_fss_read_payload_print_object_end_
f_status_t fss_read_payload_print_object_end(fl_print_t * const print) {
}
#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) {
#endif
/**
- * Print the end of an Object (which is often the start of 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.
- */
-#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.
+ * (FSS Payload specific) Print the Content.
*
* This locks, uses, and unlocks the file stream.
*
* 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 position to be processed.
* @param range
* The range within the buffer representing the Content to print.
* @param quote
* F_output_not on success, but no printing is performed.
*
* F_output_not (with error bit) if a parameter is NULL.
+ *
+ * @see main.callback.print_content()
+ * @see main.callback.print_object_end()
+ * @see main.callback.print_set_end()
*/
-#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_
+#ifndef _di_fss_read_payload_print_content_
+ extern f_status_t fss_read_payload_print_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);
+#endif // _di_fss_read_payload_print_content_
/**
- * Print the end of an Object (which is often the start of Content) and the end of the Content when no Content.
+ * Print the end of an Object (which is often the start of Content).
*
* 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 fss_read_payload_print_object_end()
- * @see fss_read_print_content_empty()
*/
-#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_
+#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 an error message about the payload parameter not having a valid value.