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 (F_status_set_fine(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) {
+ if (F_status_set_fine(
+ main->callback.print_object_end_content(
+ &main->program.output,
+ 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
+ )
+ ) != F_output_not) {
print_state |= 0x6;
}
}
else {
- if (F_status_set_fine(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) {
+ if (F_status_set_fine(
+ main->callback.print_content(
+ &main->program.output,
+ 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
+ )
+ ) != F_output_not) {
print_state |= 0x2;
}
}
print_state &= ~0x8;
if (print_state & 0x1) {
- if (F_status_set_fine(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)) != F_output_not) {
+ if (F_status_set_fine(
+ 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
+ )
+ ) != F_output_not) {
print_state |= 0x6;
}
}
- else if (F_status_set_fine(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)) != F_output_not) {
+ else if (F_status_set_fine(
+ 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
+ )
+ ) != F_output_not) {
print_state |= 0x2;
}
for (; i < main->setting.contents.array[at].used; ++i) {
if (fss_read_signal_check(main)) return F_status_set_error(F_interrupt);
+ if (main->setting.contents.array[at].array[i].start > main->setting.contents.array[at].array[i].stop) continue;
- 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);
- }
-
- 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);
+ if (main->callback.print_content_next) {
+ main->callback.print_content_next(&main->program.output);
}
+
+ 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
+ );
} // for
}
}
if (main->setting.flag & (fss_read_main_flag_trim_d | fss_read_main_flag_trim_object_d)) {
if (main->setting.flag & fss_read_main_flag_original_d) {
- if (main->setting.quotes_object.array[at]) {
+ if (at < main->setting.quotes_object.used && main->setting.quotes_object.array[at]) {
fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
}
fll_print_trim_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], main->program.output.to);
- if (main->setting.quotes_object.array[at]) {
+ if (at < main->setting.quotes_object.used && main->setting.quotes_object.array[at]) {
fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
}
}
}
else {
if (main->setting.flag & fss_read_main_flag_original_d) {
- if (main->setting.quotes_object.array[at]) {
+ if (at < main->setting.quotes_object.used && main->setting.quotes_object.array[at]) {
fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
}
fll_print_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], main->program.output.to);
- if (main->setting.quotes_object.array[at]) {
+ if (at < main->setting.quotes_object.used && main->setting.quotes_object.array[at]) {
fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
}
}
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], main->setting.quotes_content.array[at].array[i], delimits_content);
+ 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);
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], main->setting.quotes_content.array[at].array[i], delimits_content);
+ 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);
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, main->setting.quotes_content.array[at].array[i], delimits_content);
+ 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);
}
else {
- main->callback.print_content(&main->program.output, main->setting.range, main->setting.quotes_content.array[at].array[i], delimits_content);
+ 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->setting.state.status = F_success;
f_number_unsigned_t total = 0;
f_number_unsigned_t i = 0;
- if (main->setting.flag & fss_read_main_flag_select_d) {
+ if ((main->setting.flag & fss_read_main_flag_select_content_d) == fss_read_main_flag_select_content_d) {
for (; i < main->setting.contents.used; ++i) {
if (!names[i]) continue;
}
} // for
}
- else {
- for (; i < main->setting.objects.used; ++i) {
+ else if (main->setting.flag & fss_read_main_flag_at_d) {
+ for (f_number_unsigned_t at = 0; i < main->setting.objects.used; ++i) {
if (!names[i]) continue;
if (fss_read_signal_check(main)) return;
- if (main->setting.flag & fss_read_main_flag_at_d) {
- if (main->setting.depths.array[0].value_at != i) continue;
+ // @fixme all uses of "depths" may need to be changed so that standards that handle depth and those that don't select the currect structure at places like this.
+ if (at < main->setting.depths.array[0].value_at) {
+ ++at;
+
+ continue;
}
if (!(main->setting.flag & fss_read_main_flag_object_d) && (main->setting.flag & fss_read_main_flag_content_d)) {
if (!(main->setting.contents.array[i].used || (main->setting.flag & fss_read_main_flag_empty_d))) continue;
}
+ total = 1;
+
+ break;
+ } // for
+ }
+ else {
+ for (; i < main->setting.objects.used; ++i) {
+
+ if (!names[i]) continue;
+ if (fss_read_signal_check(main)) return;
+
+ if (!(main->setting.flag & fss_read_main_flag_object_d) && (main->setting.flag & fss_read_main_flag_content_d)) {
+ if (!(main->setting.contents.array[i].used || (main->setting.flag & fss_read_main_flag_empty_d))) continue;
+ }
+
++total;
} // for
}
fss_read_main_t * const main = (fss_read_main_t *) void_main;
f_number_unsigned_t total = 0;
- f_range_t range = f_range_t_initialize;
- f_number_unsigned_t i = 0;
- f_number_unsigned_t j = 0;
- f_number_unsigned_t k = 0;
+ f_number_unsigned_t at = 0;
- for (f_number_unsigned_t at = 0; at < main->setting.contents.used; ++at) {
+ if (main->setting.flag & fss_read_main_flag_content_d) {
+ f_number_unsigned_t i = 0;
+ f_number_unsigned_t j = 0;
+ f_number_unsigned_t k = 0;
- if (!names[at]) continue;
- if (fss_read_signal_check(main)) return;
+ f_range_t range = f_range_t_initialize;
- if (main->setting.flag & fss_read_main_flag_at_d) {
- if (main->setting.depths.array[0].value_at != at) continue;
- }
+ for (; at < main->setting.contents.used; ++at) {
- if (main->setting.flag & fss_read_main_flag_object_d) {
- ++total;
- }
+ if (!names[at]) continue;
+ if (fss_read_signal_check(main)) return;
- if (main->setting.flag & fss_read_main_flag_content_d) {
- if (!main->setting.contents.array[at].used) continue;
+ if (main->setting.flag & fss_read_main_flag_at_d) {
+ if (main->setting.depths.array[0].value_at != at) continue;
+ }
- for (i = 0; i < main->setting.contents.array[at].used; ++i) {
+ if (main->setting.flag & fss_read_main_flag_object_d) {
+ if (!(main->setting.flag & fss_read_main_flag_content_d)) {
+ ++total;
- if (fss_read_signal_check(main)) return;
+ continue;
+ }
- range.start = main->setting.contents.array[at].array[i].start;
- range.stop = main->setting.contents.array[at].array[i].stop;
+ if (main->setting.flag & fss_read_main_flag_object_as_line_d) {
+ ++total;
+ }
+ }
- // 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;
+ if (main->setting.flag & fss_read_main_flag_content_d) {
+ if (!main->setting.contents.array[at].used) continue;
- for (j = range.start; j <= range.stop; ++j) {
+ for (i = 0; i < main->setting.contents.array[at].used; ++i) {
- if (k < main->setting.comments.used) {
- while (k < main->setting.comments.used && main->setting.comments.array[k].stop < j) ++k;
+ if (fss_read_signal_check(main)) return;
+
+ range.start = main->setting.contents.array[at].array[i].start;
+ range.stop = main->setting.contents.array[at].array[i].stop;
+
+ // This content has no data, and so do not even check "include empty" because it cannot be counted as a line.
+ if (range.start > range.stop) continue;
+
+ for (j = range.start; j <= range.stop; ++j) {
if (k < main->setting.comments.used) {
- if (j >= main->setting.comments.array[k].start && j <= main->setting.comments.array[k].stop) {
- j = main->setting.comments.array[k++].stop;
+ while (k < main->setting.comments.used && main->setting.comments.array[k].stop < j) ++k;
- continue;
+ if (k < main->setting.comments.used) {
+ if (j >= main->setting.comments.array[k].start && j <= main->setting.comments.array[k].stop) {
+ j = main->setting.comments.array[k++].stop;
+
+ continue;
+ }
}
}
- }
- if (main->setting.buffer.string[j] == f_string_eol_s.string[0]) ++total;
+ if (main->setting.buffer.string[j] == f_string_eol_s.string[0]) ++total;
+ } // for
} // for
- } // for
- // If Content does not end with a newline, it still must be treated as the last line.
- if ((main->setting.flag & fss_read_main_flag_line_single_d) && i) {
- j = main->setting.contents.array[at].array[i - 1].stop;
+ // Treat Content as the last line even if it does not end with a new line.
+ if ((main->setting.flag & fss_read_main_flag_line_single_d) && 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.buffer.string[j] != f_string_eol_s.string[0]) ++total;
+ if ((main->setting.flag & fss_read_main_flag_object_d) && (main->setting.flag & fss_read_main_flag_content_has_close_d)) {
+ ++total;
+ }
}
+ } // for
+ }
+ else {
+ for (; at < main->setting.objects.used; ++at) {
+
+ if (!names[at]) continue;
+ if (fss_read_signal_check(main)) return;
- if ((main->setting.flag & fss_read_main_flag_object_d) && (main->setting.flag & fss_read_main_flag_content_has_close_d)) {
- ++total;
+ if (main->setting.flag & fss_read_main_flag_at_d) {
+ if (main->setting.depths.array[0].value_at != at) continue;
}
- }
- } // for
+
+ if (!(main->setting.flag & fss_read_main_flag_object_d) && (main->setting.flag & fss_read_main_flag_content_d)) {
+ if (!(main->setting.contents.array[at].used || (main->setting.flag & fss_read_main_flag_empty_d))) continue;
+ }
+
+ ++total;
+ } // for
+ }
fss_read_print_number(
&main->program.output,