More runtime tests now pass.
The Extended List tests still fail in some cases.
I noticed that the Extended List line count is not handling the closing brace.
The count is inaccurate.
This is a bug in the 0.6.x branch and needs to be fixed there.
The fix is in place for this branch but the tests currently fail because they generated expect files are incorrect in this case.
There are other similar problems in different FSS read programs regarding --total and parameters like --at or --line that need to be fixed in the 0.6.x branch as well.
The Embedded List and Payload need special handling and are not addressed here.
Other things regarding fss_read not done:
- The help printing needs to be updated for each program.
- Any remaining todo and fixme.
- The pipe input and output.
There is likely a lot of room for improvement but I am going to ignore such things for now as my priorities are elsewhere.
data.callback.print_at = &fss_read_print_at;
data.callback.print_content = &fss_read_print_content;
- data.callback.print_content_next = 0;
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_set_end = &fss_read_print_set_end;
data.program.output.custom = (void *) &data;
data.program.warning.custom = (void *) &data;
- data.setting.flag |= fss_read_main_flag_object_as_line_e;
+ data.setting.flag |= fss_read_main_flag_object_as_line_e | fss_read_main_flag_object_trim_e;
data.setting.state.custom = (void *) &data;
data.setting.standard = fss_read_basic_list_standard_s;
data.callback.print_at = &fss_read_print_at;
data.callback.print_content = &fss_read_print_content;
- data.callback.print_content_next = 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_object_end;
data.callback.print_set_end = &fss_read_print_set_end_no_eol;
data.program.output.custom = (void *) &data;
data.program.warning.custom = (void *) &data;
- data.setting.flag |= fss_read_main_flag_object_as_line_e;
+ data.setting.flag |= fss_read_main_flag_object_as_line_e | fss_read_main_flag_content_has_close_e | fss_read_main_flag_object_trim_e;
data.setting.flag |= fss_read_main_flag_depth_multiple_e;
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_next = 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_object_end;
data.callback.print_set_end = &fss_read_print_set_end;
}
#endif // _di_fss_read_embedded_list_print_object_end_
+#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_e) && main->setting.flag & fss_read_main_flag_content_e) {
+ 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);
+ }
+
+ return F_none;
+ }
+#endif // _di_fss_read_embedded_list_print_set_end_
+
#ifdef __cplusplus
} // extern "C"
#endif
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/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_none 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()
+ */
+#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_
+
#ifdef __cplusplus
} // extern "C"
#endif
data.program.output.custom = (void *) &data;
data.program.warning.custom = (void *) &data;
- data.setting.flag |= fss_read_main_flag_object_as_line_e;
+ data.setting.flag |= fss_read_main_flag_object_as_line_e | fss_read_main_flag_content_has_close_e | fss_read_main_flag_object_trim_e;
data.setting.state.custom = (void *) &data;
data.setting.standard = fss_read_extended_list_standard_s;
data.callback.print_at = &fss_read_print_at;
data.callback.print_content = &fss_read_print_content;
- data.callback.print_content_next = 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_object_end;
data.callback.print_set_end = &fss_read_extended_list_print_set_end;
fss_read_main_t * const main = (fss_read_main_t *) print->custom;
- // @todo
- //fll_print_dynamic_raw((main->setting.flag & fss_read_main_flag_pipe_e) ? fss_read_pipe_content_end_s : f_string_eol_s, print->to);
+ if ((main->setting.flag & fss_read_main_flag_object_e) && main->setting.flag & fss_read_main_flag_content_e) {
+ 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);
+ }
return F_none;
}
* Errors (with error bit) from: fll_program_parameter_process_context().
* Errors (with error bit) from: fll_program_parameter_process_verbosity().
*
- * Errors (with error bit) from: fss_read_setting_load_depth(). @todo fss_read_depths_resize() is to be relocated to "callback".
+ * Errors (with error bit) from: fss_read_setting_load_depth().
* Errors (with error bit) from: fss_read_signal_check()
* @param callback
* (optional) Designate a function to call after performing the initial processing, but before printing help.
* @see fll_program_parameter_process_context()
* @see fll_program_parameter_process_verbosity()
*
- * @see fss_read_setting_load_depth() @todo fss_read_depths_resize() is to be relocated to "callback".
+ * @see fss_read_setting_load_depth()
* @see fss_read_signal_check()
*/
#ifndef _di_fss_read_setting_load_
* Flags passed to the main function or program.
*
* fss_read_main_flag_*_e:
- * - none: No flags set.
- * - 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_multiple: Designate that multiple Content is allowed for an Object for this standard rather than a single Content per Object.
- * - copyright: Print copyright.
- * - delimit: How delimits are to be handled is designated.
- * - depth: The depth is specified at least once.
- * - depth_multiple: Designate that multiple depths are allowed within Content rather than being single depth Content.
- * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
- * - help: Print help.
- * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
- * - line_single: Designate that only a single line for Content is allowed for an Object for this standard rather than allowing multiple lines per Content per Object.
- * - name: A specific Object name has been requested.
- * - object: The Object is to be printed.
- * - object_as_line: The Object is counted as its own line for the purpose of -l/--line or any other similar behavior.
- * - original: Enable original printing, where the quotes are printed and no delimits are applied.
- * - pipe: Print using the special pipe format.
- * - print_first: When set, print new line to message output on program begin after loading settings.
- * - print_last: When set, print new line to message output on program end.
- * - quote_content: Designate that the standard supports quotes on Content.
- * - quote_object: Designate that the standard supports quotes on Objects.
- * - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
- * - total: The total lines found and selected is printed instead of the Content.
- * - trim: Empty space before and after Objects and Content will not be printed (They will be trimmed).
- * - trim_object: Empty space before and after Objects (but not Content) will not be printed (They will be trimmed).
- * - version: Print version.
+ * - none: No flags set.
+ * - 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_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.
+ * - delimit: How delimits are to be handled is designated.
+ * - depth: The depth is specified at least once.
+ * - depth_multiple: Designate that multiple depths are allowed within Content rather than being single depth Content.
+ * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
+ * - help: Print help.
+ * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
+ * - line_single: Designate that only a single line for Content is allowed for an Object for this standard rather than allowing multiple lines per Content per Object.
+ * - name: A specific Object name has been requested.
+ * - object: The Object is to be printed.
+ * - object_as_line: The Object is counted as its own line for the purpose of -l/--line or any other similar behavior.
+ * - object_trim: Empty space before an after Objects are ignored while processing without affecting printing behavior.
+ * - original: Enable original printing, where the quotes are printed and no delimits are applied.
+ * - pipe: Print using the special pipe format.
+ * - print_first: When set, print new line to message output on program begin after loading settings.
+ * - print_last: When set, print new line to message output on program end.
+ * - quote_content: Designate that the standard supports quotes on Content.
+ * - quote_object: Designate that the standard supports quotes on Objects.
+ * - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
+ * - total: The total lines found and selected is printed instead of the Content.
+ * - trim: Empty space before and after Objects and Content will not be printed (They will be trimmed).
+ * - trim_object: Empty space before and after Objects (but not Content) will not be printed (They will be trimmed).
+ * - version: Print version.
*/
#ifndef _di_fss_read_main_flag_e_
enum {
- fss_read_main_flag_none_e = 0x0,
- fss_read_main_flag_at_e = 0x1,
- fss_read_main_flag_columns_e = 0x2,
- fss_read_main_flag_content_e = 0x4,
- fss_read_main_flag_content_multiple_e = 0x8,
- fss_read_main_flag_copyright_e = 0x10,
- fss_read_main_flag_delimit_e = 0x20,
- fss_read_main_flag_depth_e = 0x40,
- fss_read_main_flag_depth_multiple_e = 0x80,
- fss_read_main_flag_empty_e = 0x100,
- fss_read_main_flag_help_e = 0x200,
- fss_read_main_flag_line_e = 0x400,
- fss_read_main_flag_line_single_e = 0x800,
- fss_read_main_flag_name_e = 0x1000,
- fss_read_main_flag_object_e = 0x2000,
- fss_read_main_flag_object_as_line_e = 0x4000,
- fss_read_main_flag_original_e = 0x8000,
- fss_read_main_flag_pipe_e = 0x10000,
- fss_read_main_flag_print_first_e = 0x20000,
- fss_read_main_flag_print_last_e = 0x40000,
- fss_read_main_flag_quote_content_e = 0x80000,
- fss_read_main_flag_quote_object_e = 0x100000,
- fss_read_main_flag_select_e = 0x200000,
- fss_read_main_flag_total_e = 0x400000,
- fss_read_main_flag_trim_e = 0x800000,
- fss_read_main_flag_trim_object_e = 0x1000000,
- fss_read_main_flag_version_e = 0x2000000,
+ fss_read_main_flag_none_e = 0x0,
+ fss_read_main_flag_at_e = 0x1,
+ fss_read_main_flag_columns_e = 0x2,
+ fss_read_main_flag_content_e = 0x4,
+ fss_read_main_flag_content_has_close_e = 0x8,
+ fss_read_main_flag_content_multiple_e = 0x10,
+ fss_read_main_flag_copyright_e = 0x20,
+ fss_read_main_flag_delimit_e = 0x40,
+ fss_read_main_flag_depth_e = 0x80,
+ fss_read_main_flag_depth_multiple_e = 0x100,
+ fss_read_main_flag_empty_e = 0x200,
+ fss_read_main_flag_help_e = 0x400,
+ fss_read_main_flag_line_e = 0x800,
+ fss_read_main_flag_line_single_e = 0x1000,
+ fss_read_main_flag_name_e = 0x2000,
+ fss_read_main_flag_object_e = 0x4000,
+ fss_read_main_flag_object_as_line_e = 0x8000,
+ fss_read_main_flag_object_trim_e = 0x10000,
+ fss_read_main_flag_original_e = 0x20000,
+ fss_read_main_flag_pipe_e = 0x40000,
+ fss_read_main_flag_print_first_e = 0x80000,
+ fss_read_main_flag_print_last_e = 0x100000,
+ fss_read_main_flag_quote_content_e = 0x200000,
+ fss_read_main_flag_quote_object_e = 0x400000,
+ fss_read_main_flag_select_e = 0x800000,
+ fss_read_main_flag_total_e = 0x1000000,
+ fss_read_main_flag_trim_e = 0x2000000,
+ fss_read_main_flag_trim_object_e = 0x4000000,
+ fss_read_main_flag_version_e = 0x8000000,
}; // enum
#endif // _di_fss_read_main_flag_e_
main->setting.standard = fss_read_basic_standard_s;
// Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_content_has_close_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_object_as_line_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_object_trim_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_trim_object_e;
main->setting.flag |= fss_read_main_flag_line_single_e;
main->setting.standard = fss_read_extended_standard_s;
// Remove flags not supported for this standard.
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_content_has_close_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_object_as_line_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_object_trim_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_trim_object_e;
main->setting.flag |= fss_read_main_flag_line_single_e | fss_read_main_flag_content_multiple_e;
main->setting.standard = fss_read_basic_list_standard_s;
// Remove flags not supported for this standard.
- main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_content_has_close_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
- main->setting.flag |= fss_read_main_flag_object_as_line_e;
+ main->setting.flag |= fss_read_main_flag_object_as_line_e | fss_read_main_flag_object_trim_e;
main->callback.process_help = &fss_read_basic_list_process_help;
main->callback.process_load = &fss_read_basic_list_process_load;
main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
- main->setting.flag |= fss_read_main_flag_object_as_line_e;
+ main->setting.flag |= fss_read_main_flag_content_has_close_e;
+ main->setting.flag |= fss_read_main_flag_object_as_line_e | fss_read_main_flag_object_trim_e;
main->callback.process_help = &fss_read_extended_list_process_help;
main->callback.process_load = &fss_read_extended_list_process_load;
main->callback.print_content_next = 0;
main->callback.print_object_end = &fss_read_extended_list_print_object_end;
- main->callback.print_set_end = &fss_read_print_set_end;
+ main->callback.print_set_end = &fss_read_extended_list_print_set_end;
}
else if (f_compare_dynamic(argv[index], fss_read_format_code_short_0008_s) == F_equal_to ||
f_compare_dynamic(argv[index], 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 -= main->setting.flag & fss_read_main_flag_content_has_close_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
- main->setting.flag |= fss_read_main_flag_content_multiple_e | fss_read_main_flag_depth_multiple_e;
- main->setting.flag |= fss_read_main_flag_object_as_line_e;
+ main->setting.flag |= fss_read_main_flag_content_has_close_e | fss_read_main_flag_content_multiple_e;
+ main->setting.flag |= fss_read_main_flag_depth_multiple_e;
+ main->setting.flag |= fss_read_main_flag_object_as_line_e | fss_read_main_flag_object_trim_e;
main->callback.process_help = &fss_read_embedded_list_process_help;
main->callback.process_load = &fss_read_embedded_list_process_load;
main->callback.print_content_next = 0;
main->callback.print_object_end = &fss_read_embedded_list_print_object_end;
- main->callback.print_set_end = &fss_read_print_set_end;
+ main->callback.print_set_end = &fss_read_embedded_list_print_set_end;
}
else if (f_compare_dynamic(argv[index], fss_read_format_code_short_000e_s) == F_equal_to ||
f_compare_dynamic(argv[index], 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 -= main->setting.flag & fss_read_main_flag_line_single_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_content_has_close_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_content_multiple_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_depth_multiple_e;
+ main->setting.flag -= main->setting.flag & fss_read_main_flag_line_single_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_content_e;
main->setting.flag -= main->setting.flag & fss_read_main_flag_quote_object_e;
- main->setting.flag |= fss_read_main_flag_object_as_line_e;
+ main->setting.flag |= fss_read_main_flag_object_as_line_e | fss_read_main_flag_object_trim_e;
main->callback.process_help = &fss_read_payload_process_help;
main->callback.process_load = &fss_read_payload_process_load;
main->callback.print_content_next = 0;
main->callback.print_object_end = &fss_read_payload_print_object_end;
- main->callback.print_set_end = &fss_read_print_set_end;
+ main->callback.print_set_end = &fss_read_print_set_end_no_eol;
}
else {
if (main->setting.flag & fss_read_main_flag_help_e) {
memset(names, F_true, sizeof(bool) * main->setting.objects.used);
}
- if (main->setting.flag & fss_read_main_flag_at_e) {
+ if (main->setting.flag & fss_read_main_flag_total_e) {
+ if (main->callback.process_total) {
+ main->callback.process_total(main, names);
+ }
+ }
+ else if (main->setting.flag & fss_read_main_flag_at_e) {
if (main->callback.process_at) {
main->callback.process_at(main, names, *delimits_object, *delimits_content);
}
main->callback.process_columns(main, names);
}
}
- else if (main->setting.flag & fss_read_main_flag_total_e) {
- if (main->callback.process_total) {
- main->callback.process_total(main, names);
- }
- }
else {
f_array_length_t i = 0;
// If the standard only has one line per Content, then any line value greater than 0 equates to no line to print.
if ((main->setting.flag & fss_read_main_flag_line_e) && (main->setting.flag & fss_read_main_flag_line_single_e)) {
if (main->setting.line) {
- if (main->setting.flag & fss_read_main_flag_total_e) {
- fss_read_print_number(&main->program.output, 0);
- }
-
main->setting.state.status = F_none;
return;
// If using "--at" for standards that only support one line per Object, then the only valid line is line 0.
if ((main->setting.flag & fss_read_main_flag_line_single_e) && !at) break;
- if (main->setting.flag & fss_read_main_flag_total_e) {
- f_array_length_t total = 0;
- f_array_length_t j = 0;
- f_array_length_t k = 0;
- f_array_length_t l = 0;
-
- for (; j < main->setting.contents.array[i].used; ++j) {
-
- if (main->setting.contents.array[i].array[j].start > main->setting.contents.array[i].array[j].stop) continue;
-
- if (l < main->setting.comments.used) {
- while (main->setting.comments.array[l].stop < k) ++l;
-
- if (k >= main->setting.comments.array[l].start && k <= main->setting.comments.array[l].stop) {
- k = main->setting.comments.array[l++].stop;
-
- continue;
- }
- }
-
- total = 1;
-
- break;
- } // for
-
- fss_read_print_number(&main->program.output, total);
- }
- else if (main->callback.process_at_line) {
+ if (main->callback.process_at_line) {
f_array_length_t line = 0;
main->callback.process_at_line(void_main, i, delimits_object, delimits_content, &line);
else if (main->setting.flag & fss_read_main_flag_columns_e) {
fss_read_print_number(&main->program.output, main->setting.contents.array[i].used);
}
- else if (main->setting.flag & fss_read_main_flag_total_e) {
- if (main->setting.flag & fss_read_main_flag_line_single_e) {
- fss_read_print_number(&main->program.output, main->setting.contents.array[i].used ? 1 : 0);
- }
- else {
- f_array_length_t total = 0;
- f_string_range_t range = f_string_range_t_initialize;
- f_array_length_t j = 0;
- f_array_length_t k = 0;
- f_array_length_t l = 0;
-
- for (; j < main->setting.contents.array[i].used; ++j) {
-
- range.start = main->setting.contents.array[i].array[j].start;
- range.stop = main->setting.contents.array[i].array[j].stop;
-
- // This content has no data, do not even check "include empty" because it cannot be counted as a line.
- if (range.start > range.stop) continue;
-
- for (k = range.start; k <= range.stop; ++k) {
-
- if (l < main->setting.comments.used) {
- while (main->setting.comments.array[l].stop < k) ++l;
-
- if (k >= main->setting.comments.array[l].start && k <= main->setting.comments.array[l].stop) {
- k = main->setting.comments.array[l++].stop;
-
- continue;
- }
- }
-
- if (main->setting.buffer.string[k] == f_string_eol_s.string[0]) ++total;
- } // for
- } // for
-
- // If there are no newline characters but there is data, then this represents a single line.
- if (main->setting.contents.array[i].used && !total) {
- total = 1;
- }
-
- fss_read_print_number(&main->program.output, total);
- }
- }
else if (main->callback.print_at) {
main->callback.print_at(&main->program.output, i, delimits_object, delimits_content);
}
main->callback.print_object(&main->program.output, at, delimits_object);
}
- if (main->callback.print_object_end) { // @todo need to handle object end only if content is not being printed or object end is not white space.
+ if (main->callback.print_object_end) {
main->callback.print_object_end(&main->program.output);
}
if (!(main->setting.flag & fss_read_main_flag_content_e)) {
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
+ if (!(main->setting.flag & fss_read_main_flag_object_as_line_e)) {
+ f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
+ }
main->setting.state.status = F_success;
while (main->setting.comments.array[k].stop < j) ++k;
if (j >= main->setting.comments.array[k].start && j <= main->setting.comments.array[k].stop) {
- j = main->setting.comments.array[k++].stop;
+ j = main->setting.comments.array[k++].stop + 1;
if (j > main->setting.range.stop) break;
}
} // for
// If Content does not end with a newline, it still must be treated as the last line.
- if (*line == line_original) {
- //if (main->setting.buffer.string[main->setting.range.stop] != f_string_eol_s.string[0]) {
+ if ((main->setting.flag & fss_read_main_flag_line_single_e) && *line == line_original) {
++(*line);
if (*line == main->setting.line) {
}
} // 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).
+ if ((main->setting.flag & fss_read_main_flag_object_e) && (main->setting.flag & fss_read_main_flag_content_has_close_e)) {
+ if (*line == main->setting.line) {
+ if (main->callback.print_set_end) {
+ main->callback.print_set_end(&main->program.output);
+ }
+
+ main->setting.state.status = F_success;
+
+ return;
+ }
+
+ ++(*line);
+ }
}
main->setting.state.status = F_none;
memset(names, F_false, sizeof(bool) * main->setting.objects.used);
- if (main->setting.flag & (fss_read_main_flag_trim_e | fss_read_main_flag_trim_object_e)) {
+ if (main->setting.flag & (fss_read_main_flag_trim_e | fss_read_main_flag_trim_object_e | fss_read_main_flag_object_trim_e)) {
for (i = 0; i < main->setting.objects.used; ++i) {
if (fss_read_signal_check(main)) return;
if (!names[i]) continue;
if (fss_read_signal_check(main)) return;
+ if (main->setting.flag & fss_read_main_flag_at_e) {
+ if (main->setting.depths.array[0].value_at != i) continue;
+ }
+
if (main->setting.select < main->setting.contents.array[i].used && main->setting.contents.array[i].array[main->setting.select].start <= main->setting.contents.array[i].array[main->setting.select].stop) {
++total;
}
if (!names[i]) continue;
if (fss_read_signal_check(main)) return;
+ if (main->setting.flag & fss_read_main_flag_at_e) {
+ if (main->setting.depths.array[0].value_at != i) continue;
+ }
+
if (!(main->setting.flag & fss_read_main_flag_object_e) && (main->setting.flag & fss_read_main_flag_content_e)) {
if (!(main->setting.contents.array[i].used || (main->setting.flag & fss_read_main_flag_empty_e))) continue;
}
if (!names[at]) continue;
if (fss_read_signal_check(main)) return;
+ if (main->setting.flag & fss_read_main_flag_at_e) {
+ if (main->setting.depths.array[0].value_at != at) continue;
+ }
+
if (main->setting.flag & fss_read_main_flag_object_e) {
++total;
}
} // for
// If Content does not end with a newline, it still must be treated as the last line.
- if (i) {
+ if ((main->setting.flag & fss_read_main_flag_line_single_e) && i) {
j = main->setting.contents.array[at].array[i - 1].stop;
if (main->setting.buffer.string[j] != f_string_eol_s.string[0]) ++total;
}
+
+ if ((main->setting.flag & fss_read_main_flag_object_e) && (main->setting.flag & fss_read_main_flag_content_has_close_e)) {
+ ++total;
+ }
}
} // for
data.program.output.custom = (void *) &data;
data.program.warning.custom = (void *) &data;
- data.setting.flag |= fss_read_main_flag_object_as_line_e;
+ data.setting.flag |= fss_read_main_flag_object_as_line_e | fss_read_main_flag_object_trim_e;
data.setting.state.custom = (void *) &data;
data.setting.standard = fss_read_payload_standard_s;
data.callback.print_at = &fss_read_print_at;
data.callback.print_content = &fss_read_print_content;
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_object_end;
- data.callback.print_set_end = &fss_read_print_set_end;
+ data.callback.print_set_end = &fss_read_print_set_end_no_eol;
f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize;
data.program.parameters.array = parameters;