Working on the 0.7 FSS Read programs resulted in me noticing an oversight regarding the `--select` with the `--object`.
The `--object` will always result in showing things even if the `--select` number is infinitely large.
This is a back port of those changes.
I decided to also copy over a lot of the FSS Read code for this from 0.7.
Doing this should help make maintaining both the 0.6 nd 0.7 easier.
I still have work for the FSS Embedded Read program in the 0.7 branch and so I decided to withhold any 0.6 changes for FSS Embedded Read until I finish my changes in 0.7.
This updates the relevant runtime tests.
* The data structure for FSS Basic Read.
*
* fss_basic_list_read_data_option_*:
- * - 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.
- * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
- * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
- * - name: A specific Object name has been requested.
- * - object: The Object is to be printed.
- * - original: Enable original printing, where the quotes are printed and no delimits are applied.
- * - 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).
+ * - 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.
+ * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
+ * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
+ * - name: A specific Object name has been requested.
+ * - object: The Object is to be printed.
+ * - original: Enable original printing, where the quotes are printed and no delimits are applied.
+ * - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
+ * - select_content: A helper flag representing select and content flag bits being set.
+ * - 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).
*
* argv: The argument structure in the progam data parameters for simplifying syntax.
* options: Bitwise flags representing parameters.
* delimits_content: The positions within the buffer representing Content character delimits.
*/
#ifndef _di_fss_basic_list_read_data_t_
- #define fss_basic_list_read_data_option_at_d 0x1
- #define fss_basic_list_read_data_option_columns_d 0x2
- #define fss_basic_list_read_data_option_content_d 0x4
- #define fss_basic_list_read_data_option_empty_d 0x8
- #define fss_basic_list_read_data_option_line_d 0x10
- #define fss_basic_list_read_data_option_name_d 0x20
- #define fss_basic_list_read_data_option_object_d 0x40
- #define fss_basic_list_read_data_option_original_d 0x80
- #define fss_basic_list_read_data_option_select_d 0x100
- #define fss_basic_list_read_data_option_total_d 0x200
- #define fss_basic_list_read_data_option_trim_d 0x400
+ #define fss_basic_list_read_data_option_at_d 0x1
+ #define fss_basic_list_read_data_option_columns_d 0x2
+ #define fss_basic_list_read_data_option_content_d 0x4
+ #define fss_basic_list_read_data_option_empty_d 0x8
+ #define fss_basic_list_read_data_option_line_d 0x10
+ #define fss_basic_list_read_data_option_name_d 0x20
+ #define fss_basic_list_read_data_option_object_d 0x40
+ #define fss_basic_list_read_data_option_original_d 0x80
+ #define fss_basic_list_read_data_option_select_d 0x100
+ #define fss_basic_list_read_data_option_select_content_d 0x104
+ #define fss_basic_list_read_data_option_total_d 0x200
+ #define fss_basic_list_read_data_option_trim_d 0x400
typedef struct {
uint16_t option;
#endif // _di_fss_basic_list_read_load_
#ifndef _di_fss_basic_list_read_load_number_
- f_status_t fss_basic_list_read_load_number(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_number_unsigned_t *number) {
+ f_status_t fss_basic_list_read_load_number(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_array_length_t *number) {
if (main->parameters.array[parameter].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
}
} // for
- // If Content does not end with a newline, it still must be treated as the last line.
+ // Treat Content as the last line even if it does not end with a new line.
if (data->buffer.string[range.stop] != f_string_eol_s.string[0]) {
++(*line);
f_status_t fss_basic_list_read_process_total(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, bool names[]) {
f_array_length_t total = 0;
- f_string_range_t range = f_string_range_t_initialize;
- f_array_length_t i = 0;
- f_array_length_t j = 0;
+ f_array_length_t at = 0;
- for (f_array_length_t at = 0; at < data->contents.used; ++at) {
+ if (data->option & fss_basic_list_read_data_option_content_d) {
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+ f_array_length_t k = 0;
- if (!names[at]) continue;
+ f_string_range_t range = f_string_range_t_initialize;
- if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fss_basic_list_read_print_signal_received(main);
+ for (; at < data->contents.used; ++at) {
- return F_status_set_error(F_interrupt);
- }
+ if (!names[at]) continue;
- main->signal_check = 0;
- }
+ if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_basic_list_read_print_signal_received(main);
- if (data->option & fss_basic_list_read_data_option_object_d) {
- ++total;
- }
+ return F_status_set_error(F_interrupt);
+ }
+
+ main->signal_check = 0;
+ }
+
+ if (data->option & fss_basic_list_read_data_option_at_d) {
+ if (data->depths.array[0].value_at != at) continue;
+ }
- // There is only a single Content column for this standard.
- if (data->option & fss_basic_list_read_data_option_content_d) {
- if (!data->contents.array[at].used) continue;
+ if (data->option & fss_basic_list_read_data_option_object_d) {
+ ++total;
- range.start = data->contents.array[at].array[0].start;
- range.stop = data->contents.array[at].array[0].stop;
+ if (!(data->option & fss_basic_list_read_data_option_content_d)) continue;
+ }
- // 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 (data->option & fss_basic_list_read_data_option_content_d) {
+ if (!data->contents.array[at].used) continue;
- for (i = range.start; i <= range.stop; ++i) {
+ for (i = 0; i < data->contents.array[at].used; ++i) {
- if (j < data->comments.used) {
- while (j < data->comments.used && data->comments.array[j].stop < i) ++j;
+ if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_basic_list_read_print_signal_received(main);
- if (j < data->comments.used && i >= data->comments.array[j].start && i <= data->comments.array[j].stop) {
- i = data->comments.array[j++].stop;
+ return F_status_set_error(F_interrupt);
+ }
- continue;
+ main->signal_check = 0;
}
- }
- if (data->buffer.string[i] == f_string_eol_s.string[0]) {
- range.start = i + 1;
+ range.start = data->contents.array[at].array[i].start;
+ range.stop = data->contents.array[at].array[i].stop;
- if (i <= range.stop) {
- ++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;
+
+ for (j = range.start; j <= range.stop; ++j) {
+
+ if (k < data->comments.used) {
+ while (k < data->comments.used && data->comments.array[k].stop < j) ++k;
+
+ if (k < data->comments.used) {
+ if (j >= data->comments.array[k].start && j <= data->comments.array[k].stop) {
+ j = data->comments.array[k++].stop;
+
+ continue;
+ }
+ }
+ }
+
+ if (data->buffer.string[j] == f_string_eol_s.string[0]) ++total;
+ } // for
+ } // for
+ }
+ } // for
+ }
+ else {
+ for (; at < data->objects.used; ++at) {
+
+ if (!names[at]) continue;
+
+ if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_basic_list_read_print_signal_received(main);
+
+ return F_status_set_error(F_interrupt);
}
- } // for
- // If Content does not end with a newline, it still must be treated as the last line.
- if (data->buffer.string[range.stop] != f_string_eol_s.string[0]) {
- ++total;
+ main->signal_check = 0;
}
- }
- } // for
+
+ if (data->option & fss_basic_list_read_data_option_at_d) {
+ if (data->depths.array[0].value_at != at) continue;
+ }
+
+ if (!(data->option & fss_basic_list_read_data_option_object_d) && (data->option & fss_basic_list_read_data_option_content_d)) {
+ if (!(data->contents.array[at].used || (data->option & fss_basic_list_read_data_option_empty_d))) continue;
+ }
+
+ ++total;
+ } // for
+ }
flockfile(main->output.to.stream);
* The data structure for FSS Basic Read.
*
* fss_basic_read_data_option_*:
- * - 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.
- * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
- * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
- * - name: A specific Object name has been requested.
- * - object: The Object is to be printed.
- * - original: Enable original printing, where the quotes are printed and no delimits are applied.
- * - 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).
+ * - 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.
+ * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
+ * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
+ * - name: A specific Object name has been requested.
+ * - object: The Object is to be printed.
+ * - original: Enable original printing, where the quotes are printed and no delimits are applied.
+ * - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
+ * - select_content: A helper flag representing select and content flag bits being set.
+ * - 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).
*
- * argv: The argument structure in the progam data parameters for simplifying syntax.
- * options: Bitwise flags representing parameters.
- * delimit_mode: The delimit mode.
- * delimit_depth: The delimit depth.
- * select: The Content to select (column number).
- * line: The Content to select (row number).
- * files: A statically allocated array of files for designating where in the buffer a file is represented.
- * depths: The array of parameters for each given depth.
- * buffer: The buffer containing all loaded files (and STDIN pipe).
- * objects: The positions within the buffer representing Objects.
- * contents: The positions within the buffer representing Contents.
- * delimits: The positions within the buffer representing character delimits.
+ * argv: The argument structure in the progam data parameters for simplifying syntax.
+ * options: Bitwise flags representing parameters.
+ * delimit_mode: The delimit mode.
+ * delimit_depth: The delimit depth.
+ * select: The Content to select (column number).
+ * line: The Content to select (row number).
+ * files: A statically allocated array of files for designating where in the buffer a file is represented.
+ * depths: The array of parameters for each given depth.
+ * buffer: The buffer containing all loaded files (and STDIN pipe).
+ * objects: The positions within the buffer representing Objects.
+ * contents: The positions within the buffer representing Contents.
+ * delimits: The positions within the buffer representing character delimits.
*/
#ifndef _di_fss_basic_read_data_t_
- #define fss_basic_read_data_option_at_d 0x1
- #define fss_basic_read_data_option_columns_d 0x2
- #define fss_basic_read_data_option_content_d 0x4
- #define fss_basic_read_data_option_empty_d 0x8
- #define fss_basic_read_data_option_line_d 0x10
- #define fss_basic_read_data_option_name_d 0x20
- #define fss_basic_read_data_option_object_d 0x40
- #define fss_basic_read_data_option_original_d 0x80
- #define fss_basic_read_data_option_select_d 0x100
- #define fss_basic_read_data_option_total_d 0x200
- #define fss_basic_read_data_option_trim_d 0x400
+ #define fss_basic_read_data_option_at_d 0x1
+ #define fss_basic_read_data_option_columns_d 0x2
+ #define fss_basic_read_data_option_content_d 0x4
+ #define fss_basic_read_data_option_empty_d 0x8
+ #define fss_basic_read_data_option_line_d 0x10
+ #define fss_basic_read_data_option_name_d 0x20
+ #define fss_basic_read_data_option_object_d 0x40
+ #define fss_basic_read_data_option_original_d 0x80
+ #define fss_basic_read_data_option_select_d 0x100
+ #define fss_basic_read_data_option_select_content_d 0x104
+ #define fss_basic_read_data_option_total_d 0x200
+ #define fss_basic_read_data_option_trim_d 0x400
typedef struct {
uint16_t option;
#endif // _di_fss_basic_read_load_
#ifndef _di_fss_basic_read_load_number_
- f_status_t fss_basic_read_load_number(fll_program_data_t * const main, fss_basic_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_number_unsigned_t *number) {
+ f_status_t fss_basic_read_load_number(fll_program_data_t * const main, fss_basic_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_array_length_t *number) {
if (main->parameters.array[parameter].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
f_array_length_t total = 0;
f_array_length_t i = 0;
- if (data->option & fss_basic_read_data_option_select_d) {
- if (!data->select) {
- for (; i < data->contents.used; ++i) {
+ if ((data->option & fss_basic_read_data_option_select_content_d) == fss_basic_read_data_option_select_content_d) {
+ for (; i < data->contents.used; ++i) {
- if (!names[i]) continue;
+ if (!names[i]) continue;
- if (!((++main->signal_check) % fss_basic_read_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fss_basic_read_print_signal_received(main);
+ if (!((++main->signal_check) % fss_basic_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_basic_read_print_signal_received(main);
- return F_status_set_error(F_interrupt);
- }
+ return F_status_set_error(F_interrupt);
+ }
+
+ main->signal_check = 0;
+ }
- main->signal_check = 0;
+ if (data->contents.array[i].used) {
+ if (data->select < data->contents.array[i].used) {
+ if ((data->option & fss_basic_read_data_option_empty_d) || data->contents.array[i].array[data->select].start <= data->contents.array[i].array[data->select].stop) {
+ ++total;
+ }
}
+ }
+ else if (!data->select && (data->option & fss_basic_read_data_option_empty_d)) {
+ ++total;
+ }
+ } // for
+ }
+ else if (data->option & fss_basic_read_data_option_at_d) {
+ for (f_array_length_t at = 0; i < data->objects.used; ++i) {
- if ((data->option & fss_basic_read_data_option_empty_d) || data->contents.array[i].used && data->contents.array[i].array[0].start <= data->contents.array[i].array[0].stop) {
- ++total;
+ if (!names[i]) continue;
+
+ if (!((++main->signal_check) % fss_basic_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_basic_read_print_signal_received(main);
+
+ return F_status_set_error(F_interrupt);
}
- } // for
- }
+
+ main->signal_check = 0;
+ }
+
+ if (at < data->depths.array[0].value_at) {
+ ++at;
+
+ continue;
+ }
+
+ if (!(data->option & fss_basic_read_data_option_object_d) && (data->option & fss_basic_read_data_option_content_d)) {
+ if (!(data->contents.array[i].used || (data->option & fss_basic_read_data_option_empty_d))) continue;
+ }
+
+ total = 1;
+
+ break;
+ } // for
}
else {
for (; i < data->objects.used; ++i) {
main->signal_check = 0;
}
- if (!(data->option & fss_basic_read_data_option_object_d) && data->option & fss_basic_read_data_option_content_d) {
- if (!(data->contents.array[i].used || (data->option & fss_basic_read_data_option_empty_d))) {
- continue;
- }
+ if (!(data->option & fss_basic_read_data_option_object_d) && (data->option & fss_basic_read_data_option_content_d)) {
+ if (!(data->contents.array[i].used || (data->option & fss_basic_read_data_option_empty_d))) continue;
}
++total;
* The data structure for FSS Basic Read.
*
* fss_extended_list_read_data_option_*:
- * - 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.
- * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
- * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
- * - name: A specific Object name has been requested.
- * - object: The Object is to be printed.
- * - original: Enable original printing, where the quotes are printed and no delimits are applied.
- * - 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).
+ * - 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.
+ * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
+ * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
+ * - name: A specific Object name has been requested.
+ * - object: The Object is to be printed.
+ * - original: Enable original printing, where the quotes are printed and no delimits are applied.
+ * - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
+ * - select_content: A helper flag representing select and content flag bits being set.
+ * - 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).
*
* argv: The argument structure in the progam data parameters for simplifying syntax.
* options: Bitwise flags representing parameters.
* delimits_content: The positions within the buffer representing Content character delimits.
*/
#ifndef _di_fss_extended_list_read_data_t_
- #define fss_extended_list_read_data_option_at_d 0x1
- #define fss_extended_list_read_data_option_columns_d 0x2
- #define fss_extended_list_read_data_option_content_d 0x4
- #define fss_extended_list_read_data_option_empty_d 0x8
- #define fss_extended_list_read_data_option_line_d 0x10
- #define fss_extended_list_read_data_option_name_d 0x20
- #define fss_extended_list_read_data_option_object_d 0x40
- #define fss_extended_list_read_data_option_original_d 0x80
- #define fss_extended_list_read_data_option_select_d 0x100
- #define fss_extended_list_read_data_option_total_d 0x200
- #define fss_extended_list_read_data_option_trim_d 0x400
+ #define fss_extended_list_read_data_option_at_d 0x1
+ #define fss_extended_list_read_data_option_columns_d 0x2
+ #define fss_extended_list_read_data_option_content_d 0x4
+ #define fss_extended_list_read_data_option_empty_d 0x8
+ #define fss_extended_list_read_data_option_line_d 0x10
+ #define fss_extended_list_read_data_option_name_d 0x20
+ #define fss_extended_list_read_data_option_object_d 0x40
+ #define fss_extended_list_read_data_option_original_d 0x80
+ #define fss_extended_list_read_data_option_select_d 0x100
+ #define fss_extended_list_read_data_option_select_content_d 0x104
+ #define fss_extended_list_read_data_option_total_d 0x200
+ #define fss_extended_list_read_data_option_trim_d 0x400
typedef struct {
uint16_t option;
#endif // _di_fss_extended_list_read_load_
#ifndef _di_fss_extended_list_read_load_number_
- f_status_t fss_extended_list_read_load_number(fll_program_data_t * const main, fss_extended_list_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_number_unsigned_t *number) {
+ f_status_t fss_extended_list_read_load_number(fll_program_data_t * const main, fss_extended_list_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_array_length_t *number) {
if (main->parameters.array[parameter].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
}
} // for
- // If Content does not end with a newline, it still must be treated as the last line.
+ // Treat Content as the last line even if it does not end with a new line.
if (data->buffer.string[range.stop] != f_string_eol_s.string[0]) {
++(*line);
f_status_t fss_extended_list_read_process_total(fll_program_data_t * const main, fss_extended_list_read_data_t * const data, bool names[]) {
f_array_length_t total = 0;
- f_string_range_t range = f_string_range_t_initialize;
- f_array_length_t i = 0;
- f_array_length_t j = 0;
+ f_array_length_t at = 0;
- for (f_array_length_t at = 0; at < data->contents.used; ++at) {
+ if (data->option & fss_extended_list_read_data_option_content_d) {
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+ f_array_length_t k = 0;
- if (!names[at]) continue;
+ f_string_range_t range = f_string_range_t_initialize;
- if (data->option & fss_extended_list_read_data_option_object_d) {
- ++total;
+ for (; at < data->contents.used; ++at) {
- // Include the closing brace in the total count.
- if (data->option & fss_extended_list_read_data_option_content_d) {
- ++total;
+ if (!names[at]) continue;
+
+ if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_extended_list_read_print_signal_received(main);
+
+ return F_status_set_error(F_interrupt);
+ }
+
+ main->signal_check = 0;
}
- }
- // There is only a single Content column for this standard.
- if (data->option & fss_extended_list_read_data_option_content_d) {
+ if (data->option & fss_extended_list_read_data_option_at_d) {
+ if (data->depths.array[0].value_at != at) continue;
+ }
- if (!data->contents.array[at].used) continue;
+ if (data->option & fss_extended_list_read_data_option_object_d) {
+ ++total;
- range.start = data->contents.array[at].array[0].start;
- range.stop = data->contents.array[at].array[0].stop;
+ if (!(data->option & fss_extended_list_read_data_option_content_d)) continue;
+ }
- // 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 (data->option & fss_extended_list_read_data_option_content_d) {
+ if (!data->contents.array[at].used) continue;
- for (i = range.start; i <= range.stop; ++i) {
+ for (i = 0; i < data->contents.array[at].used; ++i) {
- if (j < data->comments.used) {
- while (j < data->comments.used && data->comments.array[j].stop < i) ++j;
+ if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_extended_list_read_print_signal_received(main);
- if (j < data->comments.used && i >= data->comments.array[j].start && i <= data->comments.array[j].stop) {
- i = data->comments.array[j++].stop;
+ return F_status_set_error(F_interrupt);
+ }
- continue;
+ main->signal_check = 0;
}
+
+ range.start = data->contents.array[at].array[i].start;
+ range.stop = data->contents.array[at].array[i].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 (j = range.start; j <= range.stop; ++j) {
+
+ if (k < data->comments.used) {
+ while (k < data->comments.used && data->comments.array[k].stop < j) ++k;
+
+ if (k < data->comments.used) {
+ if (j >= data->comments.array[k].start && j <= data->comments.array[k].stop) {
+ j = data->comments.array[k++].stop;
+
+ continue;
+ }
+ }
+ }
+
+ if (data->buffer.string[j] == f_string_eol_s.string[0]) ++total;
+ } // for
+ } // for
+
+ if (data->option & fss_extended_list_read_data_option_object_d) {
+ ++total;
}
+ }
+ } // for
+ }
+ else {
+ for (; at < data->objects.used; ++at) {
- if (data->buffer.string[i] == f_string_eol_s.string[0]) {
- range.start = i + 1;
+ if (!names[at]) continue;
- if (i <= range.stop) {
- ++total;
- }
+ if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_extended_list_read_print_signal_received(main);
+
+ return F_status_set_error(F_interrupt);
}
- } // for
- // If Content does not end with a newline, it still must be treated as the last line.
- if (data->buffer.string[range.stop] != f_string_eol_s.string[0]) {
- ++total;
+ main->signal_check = 0;
}
- }
- } // for
+
+ if (data->option & fss_extended_list_read_data_option_at_d) {
+ if (data->depths.array[0].value_at != at) continue;
+ }
+
+ if (!(data->option & fss_extended_list_read_data_option_object_d) && (data->option & fss_extended_list_read_data_option_content_d)) {
+ if (!(data->contents.array[at].used || (data->option & fss_extended_list_read_data_option_empty_d))) continue;
+ }
+
+ ++total;
+ } // for
+ }
flockfile(main->output.to.stream);
* The data structure for FSS Basic Read.
*
* fss_extended_read_data_option_*:
- * - 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.
- * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
- * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
- * - name: A specific Object name has been requested.
- * - object: The Object is to be printed.
- * - original: Enable original printing, where the quotes are printed and no delimits are applied.
- * - 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).
+ * - 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.
+ * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
+ * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
+ * - name: A specific Object name has been requested.
+ * - object: The Object is to be printed.
+ * - original: Enable original printing, where the quotes are printed and no delimits are applied.
+ * - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
+ * - select_content: A helper flag representing select and content flag bits being set.
+ * - 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).
*
* argv: The argument structure in the progam data parameters for simplifying syntax.
* options: Bitwise flags representing parameters.
* delimits_content: The positions within the buffer representing Content character delimits.
*/
#ifndef _di_fss_extended_read_data_t_
- #define fss_extended_read_data_option_at_d 0x1
- #define fss_extended_read_data_option_columns_d 0x2
- #define fss_extended_read_data_option_content_d 0x4
- #define fss_extended_read_data_option_empty_d 0x8
- #define fss_extended_read_data_option_line_d 0x10
- #define fss_extended_read_data_option_name_d 0x20
- #define fss_extended_read_data_option_object_d 0x40
- #define fss_extended_read_data_option_original_d 0x80
- #define fss_extended_read_data_option_select_d 0x100
- #define fss_extended_read_data_option_total_d 0x200
- #define fss_extended_read_data_option_trim_d 0x400
+ #define fss_extended_read_data_option_at_d 0x1
+ #define fss_extended_read_data_option_columns_d 0x2
+ #define fss_extended_read_data_option_content_d 0x4
+ #define fss_extended_read_data_option_empty_d 0x8
+ #define fss_extended_read_data_option_line_d 0x10
+ #define fss_extended_read_data_option_name_d 0x20
+ #define fss_extended_read_data_option_object_d 0x40
+ #define fss_extended_read_data_option_original_d 0x80
+ #define fss_extended_read_data_option_select_d 0x100
+ #define fss_extended_read_data_option_select_content_d 0x104
+ #define fss_extended_read_data_option_total_d 0x200
+ #define fss_extended_read_data_option_trim_d 0x400
typedef struct {
uint16_t option;
#endif // _di_fss_extended_read_load_
#ifndef _di_fss_extended_read_load_number_
- f_status_t fss_extended_read_load_number(fll_program_data_t * const main, fss_extended_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_number_unsigned_t *number) {
+ f_status_t fss_extended_read_load_number(fll_program_data_t * const main, fss_extended_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_array_length_t *number) {
if (main->parameters.array[parameter].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
f_array_length_t total = 0;
f_array_length_t i = 0;
- if (data->option & fss_extended_read_data_option_select_d) {
+ if ((data->option & fss_extended_read_data_option_select_content_d) == fss_extended_read_data_option_select_content_d) {
for (; i < data->contents.used; ++i) {
if (!names[i]) continue;
}
} // for
}
- else {
-
- // This standard only has one Content per line, however it has multiple Contents within that line.
- if ((data->option & fss_extended_read_data_option_object_d) || (data->option & fss_extended_read_data_option_content_d) && (data->option & fss_extended_read_data_option_empty_d)) {
- for (; i < data->objects.used; ++i) {
-
- if (!names[i]) continue;
+ else if (data->option & fss_extended_read_data_option_at_d) {
+ for (f_array_length_t at = 0; i < data->objects.used; ++i) {
- if (!((++main->signal_check) % fss_extended_read_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fss_extended_read_print_signal_received(main);
+ if (!names[i]) continue;
- return F_status_set_error(F_interrupt);
- }
+ if (!((++main->signal_check) % fss_extended_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_extended_read_print_signal_received(main);
- main->signal_check = 0;
+ return F_status_set_error(F_interrupt);
}
- ++total;
- } // for
- }
- else {
- for (f_array_length_t j = 0; i < data->contents.used; ++i) {
+ main->signal_check = 0;
+ }
- if (!names[i]) continue;
- if (!data->contents.array[i].used) continue;
+ if (at < data->depths.array[0].value_at) {
+ ++at;
- if (!((++main->signal_check) % fss_extended_read_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fss_extended_read_print_signal_received(main);
+ continue;
+ }
- return F_status_set_error(F_interrupt);
- }
+ if (!(data->option & fss_extended_read_data_option_object_d) && (data->option & fss_extended_read_data_option_content_d)) {
+ if (!(data->contents.array[i].used || (data->option & fss_extended_read_data_option_empty_d))) continue;
+ }
- main->signal_check = 0;
- }
+ total = 1;
- if (data->option & fss_extended_read_data_option_select_d) {
- if (data->select < data->contents.array[i].used) {
- if (data->contents.array[i].array[data->select].start <= data->contents.array[data->select].array[j].stop) {
- ++total;
- }
- }
- }
- else {
- for (j = 0; j < data->contents.array[i].used; ++j) {
+ break;
+ } // for
+ }
+ else {
+ for (; i < data->objects.used; ++i) {
+
+ if (!names[i]) continue;
- if (!((++main->signal_check) % fss_extended_read_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fss_extended_read_print_signal_received(main);
+ if (!((++main->signal_check) % fss_extended_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_extended_read_print_signal_received(main);
- return F_status_set_error(F_interrupt);
- }
+ return F_status_set_error(F_interrupt);
+ }
- main->signal_check = 0;
- }
+ main->signal_check = 0;
+ }
- if (data->contents.array[i].array[j].start <= data->contents.array[i].array[j].stop) {
- ++total;
+ if (!(data->option & fss_extended_read_data_option_object_d) && (data->option & fss_extended_read_data_option_content_d)) {
+ if (!(data->contents.array[i].used || (data->option & fss_extended_read_data_option_empty_d))) continue;
+ }
- break;
- }
- } // for
- }
- } // for
- }
+ ++total;
+ } // for
}
flockfile(main->output.to.stream);
* The data structure for FSS Basic Read.
*
* fss_payload_read_data_option_*:
- * - 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.
- * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
- * - extended: Based on the depth, the extended list is to be processed.
- * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
- * - name: A specific Object name has been requested.
- * - object: The Object is to be printed.
- * - original: Enable original printing, where the quotes are printed and no delimits are applied.
- * - 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).
+ * - 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.
+ * - empty: Empty Content will be printed (Objects that have no Content will have their empty Content printed).
+ * - extended: Based on the depth, the extended list is to be processed.
+ * - line: A specific Content at a given line is to be selected (Think of this as select a row for some Content).
+ * - name: A specific Object name has been requested.
+ * - object: The Object is to be printed.
+ * - original: Enable original printing, where the quotes are printed and no delimits are applied.
+ * - select: A specific Content at a given position is to be selected (Think of this as select a column for some Content).
+ * - select_content: A helper flag representing select and content flag bits being set.
+ * - 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).
*
* argv: The argument structure in the progam data parameters for simplifying syntax.
* options: Bitwise flags representing parameters.
* delimits_content_header: The positions within the buffer representing header Content character delimits.
*/
#ifndef _di_fss_payload_read_data_t_
- #define fss_payload_read_data_option_at_d 0x1
- #define fss_payload_read_data_option_columns_d 0x2
- #define fss_payload_read_data_option_content_d 0x4
- #define fss_payload_read_data_option_empty_d 0x8
- #define fss_payload_read_data_option_extended_d 0x10
- #define fss_payload_read_data_option_line_d 0x20
- #define fss_payload_read_data_option_name_d 0x40
- #define fss_payload_read_data_option_object_d 0x80
- #define fss_payload_read_data_option_original_d 0x100
- #define fss_payload_read_data_option_select_d 0x200
- #define fss_payload_read_data_option_total_d 0x400
- #define fss_payload_read_data_option_trim_d 0x800
+ #define fss_payload_read_data_option_at_d 0x1
+ #define fss_payload_read_data_option_columns_d 0x2
+ #define fss_payload_read_data_option_content_d 0x4
+ #define fss_payload_read_data_option_empty_d 0x8
+ #define fss_payload_read_data_option_extended_d 0x10
+ #define fss_payload_read_data_option_line_d 0x20
+ #define fss_payload_read_data_option_name_d 0x40
+ #define fss_payload_read_data_option_object_d 0x80
+ #define fss_payload_read_data_option_original_d 0x100
+ #define fss_payload_read_data_option_select_d 0x200
+ #define fss_payload_read_data_option_select_content_d 0x204
+ #define fss_payload_read_data_option_total_d 0x400
+ #define fss_payload_read_data_option_trim_d 0x800
typedef struct {
uint16_t option;
#endif // _di_fss_payload_read_load_
#ifndef _di_fss_payload_read_load_number_
- f_status_t fss_payload_read_load_number(fll_program_data_t * const main, fss_payload_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_number_unsigned_t *number) {
+ f_status_t fss_payload_read_load_number(fll_program_data_t * const main, fss_payload_read_data_t * const data, const f_array_length_t parameter, const f_string_static_t name, f_array_length_t *number) {
if (main->parameters.array[parameter].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
}
} // for
- // If Content does not end with a newline, it still must be treated as the last line.
+ // Treat Content as the last line even if it does not end with a new line.
if (data->buffer.string[range.stop] != f_string_eol_s.string[0]) {
++(*line);
f_status_t fss_payload_read_process_total(fll_program_data_t * const main, fss_payload_read_data_t * const data, bool names[]) {
f_array_length_t total = 0;
- f_string_range_t range = f_string_range_t_initialize;
- f_array_length_t i = 0;
- f_array_length_t j = 0;
+ f_array_length_t at = 0;
- for (f_array_length_t at = 0; at < data->contents.used; ++at) {
+ if (data->option & fss_payload_read_data_option_content_d) {
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+ f_array_length_t k = 0;
- if (!names[at]) continue;
+ f_string_range_t range = f_string_range_t_initialize;
- if (!((++main->signal_check) % fss_payload_read_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fss_payload_read_print_signal_received(main);
+ for (; at < data->contents.used; ++at) {
- return F_status_set_error(F_interrupt);
- }
+ if (!names[at]) continue;
- main->signal_check = 0;
- }
+ if (!((++main->signal_check) % fss_payload_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_payload_read_print_signal_received(main);
- if (data->option & fss_payload_read_data_option_object_d) {
- ++total;
- }
+ return F_status_set_error(F_interrupt);
+ }
- // There is only a single Content column for this standard.
- if (data->option & fss_payload_read_data_option_content_d) {
- if (!data->contents.array[at].used) continue;
+ main->signal_check = 0;
+ }
+
+ if (data->option & fss_payload_read_data_option_at_d) {
+ if (data->depths.array[0].value_at != at) continue;
+ }
- range.start = data->contents.array[at].array[0].start;
- range.stop = data->contents.array[at].array[0].stop;
+ if (data->option & fss_payload_read_data_option_object_d) {
+ ++total;
+
+ if (!(data->option & fss_payload_read_data_option_content_d)) continue;
+ }
- // 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 (data->option & fss_payload_read_data_option_content_d) {
+ if (!data->contents.array[at].used) continue;
- for (i = range.start; i <= range.stop; ++i) {
+ for (i = 0; i < data->contents.array[at].used; ++i) {
- if (j < data->comments.used) {
- while (j < data->comments.used && data->comments.array[j].stop < i) ++j;
+ if (!((++main->signal_check) % fss_payload_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_payload_read_print_signal_received(main);
- if (j < data->comments.used && i >= data->comments.array[j].start && i <= data->comments.array[j].stop) {
- i = data->comments.array[j++].stop;
+ return F_status_set_error(F_interrupt);
+ }
- continue;
+ main->signal_check = 0;
}
+
+ range.start = data->contents.array[at].array[i].start;
+ range.stop = data->contents.array[at].array[i].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 (j = range.start; j <= range.stop; ++j) {
+
+ if (k < data->comments.used) {
+ while (k < data->comments.used && data->comments.array[k].stop < j) ++k;
+
+ if (k < data->comments.used) {
+ if (j >= data->comments.array[k].start && j <= data->comments.array[k].stop) {
+ j = data->comments.array[k++].stop;
+
+ continue;
+ }
+ }
+ }
+
+ if (data->buffer.string[j] == f_string_eol_s.string[0]) ++total;
+ } // for
+ } // for
+ }
+ } // for
+ }
+ else {
+ for (; at < data->objects.used; ++at) {
+
+ if (!names[at]) continue;
+
+ if (!((++main->signal_check) % fss_payload_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_payload_read_print_signal_received(main);
+
+ return F_status_set_error(F_interrupt);
}
- if (data->buffer.string[i] == f_string_eol_s.string[0]) {
- range.start = i + 1;
+ main->signal_check = 0;
+ }
- if (i <= range.stop) {
- ++total;
- }
+ if (data->option & fss_payload_read_data_option_at_d) {
+ if (data->depths.array[0].value_at != at) continue;
+ }
+
+ if (!(data->option & fss_payload_read_data_option_object_d) && (data->option & fss_payload_read_data_option_content_d)) {
+ if (!(data->contents.array[at].used || (data->option & fss_payload_read_data_option_empty_d))) continue;
+ }
+
+ ++total;
+ } // for
+ }
+/*
+ f_array_length_t total = 0;
+ f_string_range_t range = f_string_range_t_initialize;
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+
+ if ((data->option & fss_payload_read_data_option_select_content_d) == fss_payload_read_data_option_select_content_d) {
+ for (f_array_length_t at = 0; at < data->contents.used; ++at) {
+
+ if (!names[at]) continue;
+
+ if (!((++main->signal_check) % fss_payload_read_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fss_payload_read_print_signal_received(main);
+
+ return F_status_set_error(F_interrupt);
}
- } // for
- // If Content does not end with a newline, it still must be treated as the last line.
- if (data->buffer.string[range.stop] != f_string_eol_s.string[0]) {
+ main->signal_check = 0;
+ }
+
+ if (data->option & fss_payload_read_data_option_object_d) {
++total;
}
- }
- } // for
+ // There is only a single Content column for this standard.
+ if (data->option & fss_payload_read_data_option_content_d) {
+ if (!data->contents.array[at].used) continue;
+
+ range.start = data->contents.array[at].array[0].start;
+ range.stop = data->contents.array[at].array[0].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 (i = range.start; i <= range.stop; ++i) {
+
+ if (j < data->comments.used) {
+ while (j < data->comments.used && data->comments.array[j].stop < i) ++j;
+
+ if (j < data->comments.used && i >= data->comments.array[j].start && i <= data->comments.array[j].stop) {
+ i = data->comments.array[j++].stop;
+
+ continue;
+ }
+ }
+
+ if (data->buffer.string[i] == f_string_eol_s.string[0]) {
+ range.start = i + 1;
+
+ if (i <= range.stop) {
+ ++total;
+ }
+ }
+ } // for
+
+ // Treat Content as the last line even if it does not end with a new line.
+ if (data->buffer.string[range.stop] != f_string_eol_s.string[0]) {
+ ++total;
+ }
+ }
+ } // for
+ }
+*/
flockfile(main->output.to.stream);
if (data->option & fss_payload_read_data_option_line_d) {