#endif // _di_fss_embedded_list_read_print_help_
#ifndef _di_fss_embedded_list_read_main_
- f_status_t fss_embedded_list_read_main(fss_embedded_list_read_main_t * const main, const f_console_arguments_t *arguments) {
+ f_status_t fss_embedded_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
f_status_t status = F_none;
- f_console_parameter_t parameters[] = fss_embedded_list_read_console_parameter_t_initialize;
- main->parameters.array = parameters;
- main->parameters.used = fss_embedded_list_read_total_parameters_d;
-
{
f_console_parameter_id_t ids[3] = { fss_embedded_list_read_parameter_no_color_e, fss_embedded_list_read_parameter_light_e, fss_embedded_list_read_parameter_dark_e };
const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
fll_program_parameter_process_empty(&main->context, sets);
}
- if (F_status_is_error(status)) {
- fss_embedded_list_read_main_delete(main);
-
- return F_status_set_error(status);
- }
+ if (F_status_is_error(status)) return status;
}
// Identify priority of verbosity related parameters.
status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
- if (F_status_is_error(status)) {
- fss_embedded_list_read_main_delete(main);
-
- return status;
- }
+ if (F_status_is_error(status)) return status;
if (choice == fss_embedded_list_read_parameter_verbosity_quiet_e) {
main->output.verbosity = f_console_verbosity_quiet_e;
}
}
- f_string_static_t * const argv = main->parameters.arguments.array;
+ fss_embedded_list_read_data_t data = fss_embedded_list_read_data_t_initialize;
+ data.main = main;
+ data.argv = main->parameters.arguments.array;
status = F_none;
if (main->parameters.array[fss_embedded_list_read_parameter_help_e].result == f_console_result_found_e) {
fss_embedded_list_read_print_help(main->output.to, main->context);
- fss_embedded_list_read_main_delete(main);
+ fss_embedded_list_read_data_delete(&data);
return F_none;
}
if (main->parameters.array[fss_embedded_list_read_parameter_version_e].result == f_console_result_found_e) {
fll_program_print_version(main->output.to, fss_embedded_list_read_program_version_s);
- fss_embedded_list_read_main_delete(main);
+ fss_embedded_list_read_data_delete(&data);
return F_none;
}
}
else if (main->parameters.array[fss_embedded_list_read_parameter_delimit_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[fss_embedded_list_read_parameter_delimit_e].values.array[0];
- f_array_length_t length = argv[index].used;
+ f_array_length_t length = data.argv[index].used;
if (!length) {
flockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
- else if (fl_string_dynamic_compare_string(fss_embedded_list_read_delimit_mode_name_none_s.string, argv[index], fss_embedded_list_read_delimit_mode_name_none_s.used) == F_equal_to) {
- main->delimit_mode = fss_embedded_list_read_delimit_mode_none_e;
+ else if (fl_string_dynamic_compare_string(fss_embedded_list_read_delimit_mode_name_none_s.string, data.argv[index], fss_embedded_list_read_delimit_mode_name_none_s.used) == F_equal_to) {
+ data.delimit_mode = fss_embedded_list_read_delimit_mode_none_e;
}
- else if (fl_string_dynamic_compare_string(fss_embedded_list_read_delimit_mode_name_all_s.string, argv[index], fss_embedded_list_read_delimit_mode_name_all_s.used) == F_equal_to) {
- main->delimit_mode = fss_embedded_list_read_delimit_mode_all_e;
+ else if (fl_string_dynamic_compare_string(fss_embedded_list_read_delimit_mode_name_all_s.string, data.argv[index], fss_embedded_list_read_delimit_mode_name_all_s.used) == F_equal_to) {
+ data.delimit_mode = fss_embedded_list_read_delimit_mode_all_e;
}
else {
- main->delimit_mode = fss_embedded_list_read_delimit_mode_depth_e;
+ data.delimit_mode = fss_embedded_list_read_delimit_mode_depth_e;
- if (argv[index].string[length - 1] == fss_embedded_list_read_delimit_mode_name_greater_s.string[0]) {
- main->delimit_mode = fss_embedded_list_read_delimit_mode_depth_greater_e;
+ if (data.argv[index].string[length - 1] == fss_embedded_list_read_delimit_mode_name_greater_s.string[0]) {
+ data.delimit_mode = fss_embedded_list_read_delimit_mode_depth_greater_e;
// Shorten the length to better convert the remainder to a number.
--length;
}
- else if (argv[index].string[length - 1] == fss_embedded_list_read_delimit_mode_name_lesser_s.string[0]) {
- main->delimit_mode = fss_embedded_list_read_delimit_mode_depth_lesser_e;
+ else if (data.argv[index].string[length - 1] == fss_embedded_list_read_delimit_mode_name_lesser_s.string[0]) {
+ data.delimit_mode = fss_embedded_list_read_delimit_mode_depth_lesser_e;
// Shorten the length to better convert the remainder to a number.
--length;
f_string_range_t range = macro_f_string_range_t_initialize2(length);
// Ignore leading plus sign.
- if (argv[index].string[0] == f_string_ascii_plus_s.string[0]) {
+ if (data.argv[index].string[0] == f_string_ascii_plus_s.string[0]) {
++range.start;
}
- status = fl_conversion_dynamic_partial_to_number_unsigned(argv[index], range, &main->delimit_depth);
+ status = fl_conversion_dynamic_partial_to_number_unsigned(data.argv[index], range, &data.delimit_depth);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_embedded_list_read_long_delimit_s, argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_number_unsigned", F_true, fss_embedded_list_read_long_delimit_s, data.argv[index]);
}
}
}
f_fss_delimits_t contents_delimits = f_fss_delimits_t_initialize;
f_fss_comments_t comments = f_fss_comments_t_initialize;
- const f_array_length_t original_size = main->quantity.total;
-
if (F_status_is_error_not(status)) {
- status = fss_embedded_list_read_main_preprocess_depth(main, &depths);
+ status = fss_embedded_list_read_main_preprocess_depth(&data, &depths);
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_preprocess_depth", F_true);
file.id = F_type_descriptor_input_d;
- status = f_file_read(file, &main->buffer);
+ status = f_file_read(file, &data.buffer);
if (F_status_is_error(status)) {
fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
}
else {
- status = fss_embedded_list_read_main_process_file(main, f_string_ascii_minus_s, depths, &objects_delimits, &contents_delimits, &comments);
+ status = fss_embedded_list_read_main_process_file(&data, f_string_ascii_minus_s, depths, &objects_delimits, &contents_delimits, &comments);
if (F_status_is_error(status)) {
fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
}
// Clear buffers before continuing.
- macro_f_fss_nest_t_delete_simple(main->nest);
- f_string_dynamic_resize(0, &main->buffer);
+ macro_f_fss_nest_t_delete_simple(data.nest);
+ f_string_dynamic_resize(0, &data.buffer);
}
if (F_status_is_error_not(status) && main->parameters.remaining.used > 0) {
+ f_array_length_t total = 0;
+
for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) {
if (!((++main->signal_check) % fss_embedded_list_read_signal_check_d)) {
- if (fss_embedded_list_read_signal_received(main)) {
+ if (fss_embedded_list_read_signal_received(&data)) {
status = F_status_set_error(F_interrupt);
break;
f_file_t file = f_file_t_initialize;
- status = f_file_open(argv[main->parameters.remaining.array[i]], 0, &file);
-
- main->quantity.total = original_size;
+ status = f_file_open(data.argv[main->parameters.remaining.array[i]], 0, &file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
break;
}
- if (!main->quantity.total) {
- status = f_file_size_by_id(file.id, &main->quantity.total);
- if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
-
- f_file_stream_close(F_true, &file);
+ total = 0;
- break;
- }
+ status = f_file_size_by_id(file.id, &total);
+ if (F_status_is_error(status)) {
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
- // Skip past empty files.
- if (!main->quantity.total) {
- if (main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
- fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
- }
+ f_file_stream_close(F_true, &file);
- f_file_stream_close(F_true, &file);
+ break;
+ }
- continue;
+ // Skip past empty files.
+ if (!total) {
+ if (main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
+ fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
}
+
+ f_file_stream_close(F_true, &file);
+
+ continue;
}
- status = f_file_read_until(file, main->quantity.total, &main->buffer);
+ status = f_file_read_until(file, total, &data.buffer);
f_file_stream_close(F_true, &file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
- status = fss_embedded_list_read_main_process_file(main, argv[main->parameters.remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments);
+ status = fss_embedded_list_read_main_process_file(&data, data.argv[main->parameters.remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
// Clear buffers before repeating the loop.
- macro_f_fss_nest_t_delete_simple(main->nest);
- f_string_dynamic_resize(0, &main->buffer);
+ macro_f_fss_nest_t_delete_simple(data.nest);
+ data.buffer.used = 0;
} // for
-
- if (F_status_is_error(status)) {
- macro_f_fss_nest_t_delete_simple(main->nest);
- f_string_dynamic_resize(0, &main->buffer);
- }
}
+ macro_f_fss_nest_t_delete_simple(data.nest);
+ f_string_dynamic_resize(0, &data.buffer);
macro_fss_embedded_list_read_depths_t_delete_simple(depths);
macro_f_fss_delimits_t_delete_simple(objects_delimits);
macro_f_fss_delimits_t_delete_simple(contents_delimits);
}
}
- fss_embedded_list_read_main_delete(main);
+ fss_embedded_list_read_data_delete(&data);
return status;
}
#endif
#ifndef _di_fss_embedded_list_read_main_preprocess_depth_
- f_status_t fss_embedded_list_read_main_preprocess_depth(fss_embedded_list_read_main_t * const main, fss_embedded_list_read_depths_t *depths) {
+ f_status_t fss_embedded_list_read_main_preprocess_depth(fss_embedded_list_read_data_t * const data, fss_embedded_list_read_depths_t *depths) {
f_status_t status = F_none;
- const f_array_length_t values_total = main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.used + main->parameters.array[fss_embedded_list_read_parameter_at_e].values.used + main->parameters.array[fss_embedded_list_read_parameter_name_e].values.used;
+ const f_array_length_t values_total = data->main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.used + data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.used + data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.used;
f_array_length_t values_order[values_total];
f_array_length_t values_type[values_total];
f_array_length_t k = 0;
f_array_length_t l = 0;
- for (; j < main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.used; ++j) {
+ for (; j < data->main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.used; ++j) {
- values_order[i] = main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.array[j];
+ values_order[i] = data->main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.array[j];
values_type[i++] = fss_embedded_list_read_parameter_depth_e;
} // for
if (i) {
- for (j = 0; j < main->parameters.array[fss_embedded_list_read_parameter_at_e].values.used; ++j) {
+ for (j = 0; j < data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.used; ++j) {
for (k = 0; k < i; ++k) {
- if (values_order[k] > main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j]) {
+ if (values_order[k] > data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j]) {
for (l = i; l > k; --l) {
values_order[l] = values_order[l - 1];
values_type[l] = values_type[l - 1];
} // for
- values_order[k] = main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j];
+ values_order[k] = data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j];
values_type[k] = fss_embedded_list_read_parameter_at_e;
i++;
} // for
if (k == i) {
- values_order[i] = main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j];
+ values_order[i] = data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j];
values_type[i++] = fss_embedded_list_read_parameter_at_e;
}
} // for
}
else {
- for (; j < main->parameters.array[fss_embedded_list_read_parameter_at_e].values.used; ++j) {
+ for (; j < data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.used; ++j) {
- values_order[i] = main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j];
+ values_order[i] = data->main->parameters.array[fss_embedded_list_read_parameter_at_e].values.array[j];
values_type[i++] = fss_embedded_list_read_parameter_at_e;
} // for
}
if (i) {
- for (j = 0; j < main->parameters.array[fss_embedded_list_read_parameter_name_e].values.used; ++j) {
+ for (j = 0; j < data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.used; ++j) {
for (k = 0; k < i; ++k) {
- if (values_order[k] > main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j]) {
+ if (values_order[k] > data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j]) {
for (l = i; l > k; --l) {
values_order[l] = values_order[l - 1];
values_type[l] = values_type[l - 1];
} // for
- values_order[k] = main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j];
+ values_order[k] = data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j];
values_type[k] = fss_embedded_list_read_parameter_name_e;
i++;
} // for
if (k == i) {
- values_order[i] = main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j];
+ values_order[i] = data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j];
values_type[i++] = fss_embedded_list_read_parameter_name_e;
}
} // for
}
else {
- for (; j < main->parameters.array[fss_embedded_list_read_parameter_name_e].values.used; ++j) {
+ for (; j < data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.used; ++j) {
- values_order[i] = main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j];
+ values_order[i] = data->main->parameters.array[fss_embedded_list_read_parameter_name_e].values.array[j];
values_type[i++] = fss_embedded_list_read_parameter_name_e;
} // for
}
{
i = 1;
- if (main->parameters.array[fss_embedded_list_read_parameter_depth_e].result == f_console_result_additional_e) {
- i = main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.used + 1;
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_depth_e].result == f_console_result_additional_e) {
+ i = data->main->parameters.array[fss_embedded_list_read_parameter_depth_e].values.used + 1;
}
macro_fss_embedded_list_read_depths_t_resize(status, (*depths), i);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_preprocess_depth", F_true);
+ fll_error_print(data->main->error, F_status_set_fine(status), "fss_embedded_list_read_main_preprocess_depth", F_true);
return status;
}
depths->array[0].value_at = 0;
{
- f_string_static_t * const argv = main->parameters.arguments.array;
+ f_string_static_t * const argv = data->main->parameters.arguments.array;
f_number_unsigned_t number = 0;
bool first_depth = F_true;
for (i = 0; i < values_total; ++i) {
- if (!((++main->signal_check) % fss_embedded_list_read_signal_check_d)) {
- if (fss_embedded_list_read_signal_received(main)) {
+ if (!((++data->main->signal_check) % fss_embedded_list_read_signal_check_d)) {
+ if (fss_embedded_list_read_signal_received(data)) {
return F_status_set_error(F_interrupt);
}
- main->signal_check = 0;
+ data->main->signal_check = 0;
}
if (values_type[i] == fss_embedded_list_read_parameter_depth_e || values_type[i] == fss_embedded_list_read_parameter_at_e) {
status = fl_conversion_dynamic_to_number_unsigned(argv[values_order[i]], &number);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_depth_s, argv[values_order[i]]);
+ fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_depth_s, argv[values_order[i]]);
return status;
}
depths->array[depths->used].index_name = values_order[i];
depths->array[depths->used].value_name.used = 0;
- if (main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e) {
status = fl_string_dynamic_rip(argv[values_order[i]], &depths->array[depths->used].value_name);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "fl_string_dynamic_rip", F_true);
+ fll_error_print(data->main->error, F_status_set_fine(status), "fl_string_dynamic_rip", F_true);
return status;
}
status = f_string_dynamic_append(argv[values_order[i]], &depths->array[depths->used].value_name);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
+ fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
return status;
}
for (j = i + 1; j < depths->used; ++j) {
if (depths->array[i].depth == depths->array[j].depth) {
- flockfile(main->error.to.stream);
+ flockfile(data->main->error.to.stream);
- fl_print_format("%r%[%QThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, depths->array[i].depth, main->error.notable);
- fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.notable, main->error.notable);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, main->error.notable);
- fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
+ fl_print_format("%r%[%QThe value '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
+ fl_print_format("%[%ul%]", data->main->error.to.stream, data->main->error.notable, depths->array[i].depth, data->main->error.notable);
+ fl_print_format("%[' may only be specified once for the parameter '%]", data->main->error.to.stream, data->main->error.notable, data->main->error.notable);
+ fl_print_format("%[%r%r%]", data->main->error.to.stream, data->main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, data->main->error.notable);
+ fl_print_format("%['.%]%r", data->main->error.to.stream, data->main->error.context, data->main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ funlockfile(data->main->error.to.stream);
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- flockfile(main->error.to.stream);
+ flockfile(data->main->error.to.stream);
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, main->error.notable);
- fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.notable, main->error.notable);
- fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, depths->array[i].depth, main->error.notable);
- fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.notable, main->error.notable);
- fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, depths->array[j].depth, main->error.notable);
- fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
+ fl_print_format("%r%[%QThe parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
+ fl_print_format("%[%r%r%]", data->main->error.to.stream, data->main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, data->main->error.notable);
+ fl_print_format("%[' may not have the value '%]", data->main->error.to.stream, data->main->error.notable, data->main->error.notable);
+ fl_print_format("%[%ul%]", data->main->error.to.stream, data->main->error.notable, depths->array[i].depth, data->main->error.notable);
+ fl_print_format("%[' before the value '%]", data->main->error.to.stream, data->main->error.notable, data->main->error.notable);
+ fl_print_format("%[%ul%]", data->main->error.to.stream, data->main->error.notable, depths->array[j].depth, data->main->error.notable);
+ fl_print_format("%['.%]%r", data->main->error.to.stream, data->main->error.context, data->main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ funlockfile(data->main->error.to.stream);
return F_status_set_error(F_parameter);
}
#endif // _di_fss_embedded_list_read_main_preprocess_depth_
#ifndef _di_fss_embedded_list_read_main_process_file_
- f_status_t fss_embedded_list_read_main_process_file(fss_embedded_list_read_main_t * const main, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) {
+ f_status_t fss_embedded_list_read_main_process_file(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) {
f_status_t status = F_none;
{
f_state_t state = macro_f_state_t_initialize(fss_embedded_list_read_common_allocation_large_d, fss_embedded_list_read_common_allocation_small_d, 0, 0, 0, 0, 0);
- f_string_range_t input = macro_f_string_range_t_initialize2(main->buffer.used);
+ f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used);
objects_delimits->used = 0;
contents_delimits->used = 0;
comments->used = 0;
- status = fll_fss_embedded_list_read(main->buffer, state, &input, &main->nest, objects_delimits, contents_delimits, comments);
+ status = fll_fss_embedded_list_read(data->buffer, state, &input, &data->nest, objects_delimits, contents_delimits, comments);
if (F_status_is_error(status)) {
// @todo detect and replace fll_error_file_type_file_e with fll_error_file_type_pipe_e as appropriate.
- fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_embedded_list_read", F_true, filename, f_file_operation_process_s, fll_error_file_type_file_e);
+ fll_error_file_print(data->main->error, F_status_set_fine(status), "fll_fss_embedded_list_read", F_true, filename, f_file_operation_process_s, fll_error_file_type_file_e);
}
else if (status == F_data_not_stop || status == F_data_not_eos) {
- macro_f_fss_nest_t_delete_simple(main->nest);
- f_string_dynamic_resize(0, &main->buffer);
+ macro_f_fss_nest_t_delete_simple(data->nest);
+ f_string_dynamic_resize(0, &data->buffer);
- if (main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
- fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
+ fll_print_format("%r%r", data->main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
return F_none;
}
}
if (F_status_is_error(status)) {
- macro_f_fss_nest_t_delete_simple(main->nest);
- f_string_dynamic_resize(0, &main->buffer);
+ macro_f_fss_nest_t_delete_simple(data->nest);
+ f_string_dynamic_resize(0, &data->buffer);
return status;
}
for (; i < comments->used; ++i) {
for (j = comments->array[i].start; j <= comments->array[i].stop; ++j) {
- main->buffer.string[j] = f_fss_delimit_placeholder_s.string[0];
+ data->buffer.string[j] = f_fss_delimit_placeholder_s.string[0];
} // for
} // for
}
// Requested depths cannot be greater than contents depth.
- if (depths.used > main->nest.used) {
- if (main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
- fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
+ if (depths.used > data->nest.used) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
+ fll_print_format("%r%r", data->main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
return F_none;
}
{
f_number_unsigned_t select = 0;
- if (main->parameters.array[fss_embedded_list_read_parameter_select_e].result == f_console_result_additional_e) {
- const f_array_length_t index = main->parameters.array[fss_embedded_list_read_parameter_select_e].values.array[main->parameters.array[fss_embedded_list_read_parameter_select_e].values.used - 1];
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_select_e].result == f_console_result_additional_e) {
+ const f_array_length_t index = data->main->parameters.array[fss_embedded_list_read_parameter_select_e].values.array[data->main->parameters.array[fss_embedded_list_read_parameter_select_e].values.used - 1];
- status = fl_conversion_dynamic_to_number_unsigned(main->parameters.arguments.array[index], &select);
+ status = fl_conversion_dynamic_to_number_unsigned(data->main->parameters.arguments.array[index], &select);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_select_s, main->parameters.arguments.array[index]);
+ fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_select_s, data->main->parameters.arguments.array[index]);
return status;
}
f_array_length_t line = 0;
- if (main->parameters.array[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) {
- const f_array_length_t index = main->parameters.array[fss_embedded_list_read_parameter_line_e].values.array[main->parameters.array[fss_embedded_list_read_parameter_line_e].values.used - 1];
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) {
+ const f_array_length_t index = data->main->parameters.array[fss_embedded_list_read_parameter_line_e].values.array[data->main->parameters.array[fss_embedded_list_read_parameter_line_e].values.used - 1];
- status = fl_conversion_dynamic_to_number_unsigned(main->parameters.arguments.array[index], &line);
+ status = fl_conversion_dynamic_to_number_unsigned(data->main->parameters.arguments.array[index], &line);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_line_s, main->parameters.arguments.array[index]);
+ fll_error_parameter_integer_print(data->main->error, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true, fss_embedded_list_read_long_line_s, data->main->parameters.arguments.array[index]);
return status;
}
}
- fss_embedded_list_read_process_delimits(main, objects_delimits, contents_delimits);
+ fss_embedded_list_read_process_delimits(data, objects_delimits, contents_delimits);
const fss_embedded_list_read_skip_t parents = fss_embedded_list_read_skip_t_initialize;
- if (main->parameters.array[fss_embedded_list_read_parameter_raw_e].result == f_console_result_found_e) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_raw_e].result == f_console_result_found_e) {
f_fss_delimits_t except_none = f_fss_delimits_t_initialize;
- return fss_embedded_list_read_main_process_for_depth(main, filename, depths, 0, line, parents, &except_none, &except_none);
+ return fss_embedded_list_read_main_process_for_depth(data, filename, depths, 0, line, parents, &except_none, &except_none);
}
- return fss_embedded_list_read_main_process_for_depth(main, filename, depths, 0, line, parents, objects_delimits, contents_delimits);
+ return fss_embedded_list_read_main_process_for_depth(data, filename, depths, 0, line, parents, objects_delimits, contents_delimits);
}
#endif // _di_fss_embedded_list_read_main_process_file_
#ifndef _di_fss_embedded_list_read_main_process_for_depth_
- f_status_t fss_embedded_list_read_main_process_for_depth(fss_embedded_list_read_main_t * const main, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, const f_array_length_t depths_index, const f_array_length_t line, const fss_embedded_list_read_skip_t parents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) {
+ f_status_t fss_embedded_list_read_main_process_for_depth(fss_embedded_list_read_data_t * const data, const f_string_static_t filename, const fss_embedded_list_read_depths_t depths, const f_array_length_t depths_index, const f_array_length_t line, const fss_embedded_list_read_skip_t parents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) {
- f_fss_items_t *items = &main->nest.depth[depths.array[depths_index].depth];
+ f_fss_items_t *items = &data->nest.depth[depths.array[depths_index].depth];
bool skip[items->used];
if (!depths.array[depths_index].index_name || (depths.array[depths_index].index_at && depths.array[depths_index].index_at < depths.array[depths_index].index_name)) {
- // all other non-"at" parameters must be FALSE.
+ // All other non-"at" parameters must be FALSE.
for (; i < items->used; ++i) {
if (skip[i]) continue;
if (depths.array[depths_index].value_at < items->used && !skip[depths.array[depths_index].value_at]) {
if (depths.array[depths_index].index_name) {
- if (main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e) {
- if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[depths_index].value_name, main->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) {
+ if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) {
skip[depths.array[depths_index].value_at] = F_true;
}
}
else {
- if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[depths_index].value_name, main->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) {
+ if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[depths.array[depths_index].value_at].object, except_none, *objects_delimits) != F_equal_to) {
skip[depths.array[depths_index].value_at] = F_true;
}
}
}
}
else {
- if (main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e) {
for (i = 0; i < items->used; ++i) {
if (skip[i]) continue;
- if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[depths_index].value_name, main->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) {
+ if (fl_string_dynamic_partial_compare_except_trim_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) {
skip[i] = F_true;
}
} // for
if (skip[i]) continue;
- if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[depths_index].value_name, main->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) {
+ if (fl_string_dynamic_partial_compare_except_dynamic(depths.array[depths_index].value_name, data->buffer, items->array[i].object, except_none, *objects_delimits) != F_equal_to) {
skip[i] = F_true;
}
} // for
// If the current depth is not the final depth, then recurse into the next depth.
if (depths_index + 1 < depths.used) {
- bool skip_next[main->nest.depth[depths.array[depths_index + 1].depth - 1].used];
+ bool skip_next[data->nest.depth[depths.array[depths_index + 1].depth - 1].used];
fss_embedded_list_read_skip_t parents_next = fss_embedded_list_read_skip_t_initialize;
const f_array_length_t depth_next = depths.array[depths_index + 1].depth;
parents_next.skip = skip_next;
- parents_next.used = main->nest.depth[parents_depth].used;
+ parents_next.used = data->nest.depth[parents_depth].used;
memset(skip_next, F_true, sizeof(skip_next) * parents_next.used);
- f_fss_items_t *items_next = &main->nest.depth[depth_next];
+ f_fss_items_t *items_next = &data->nest.depth[depth_next];
f_fss_items_t *items_previous = 0;
f_fss_item_t *item_previous = 0;
j = depth_next;
item_previous = &items_next->array[i];
- items_previous = &main->nest.depth[--j];
+ items_previous = &data->nest.depth[--j];
while (j > depths.array[depths_index].depth) {
item_previous = &items_previous->array[item_previous->parent];
- items_previous = &main->nest.depth[--j];
+ items_previous = &data->nest.depth[--j];
} // while
if (skip[item_previous->parent]) {
} // for
}
- return fss_embedded_list_read_main_process_for_depth(main, filename, depths, depths_index + 1, line, parents_next, objects_delimits, contents_delimits);
+ return fss_embedded_list_read_main_process_for_depth(data, filename, depths, depths_index + 1, line, parents_next, objects_delimits, contents_delimits);
}
// Process objects.
f_array_length_t i = 0;
f_array_length_t j = 0;
- if (main->parameters.array[fss_embedded_list_read_parameter_object_e].result == f_console_result_found_e) {
- if (main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_object_e].result == f_console_result_found_e) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
f_array_length_t total = 0;
for (i = 0; i < items->used; ++i) {
++total;
} // for
- fll_print_format("%ul%r", main->output.to.stream, total, f_string_eol_s);
+ fll_print_format("%ul%r", data->main->output.to.stream, total, f_string_eol_s);
return F_none;
}
f_status_t (*print_object)(const f_string_static_t, const f_string_range_t, const f_array_lengths_t, FILE *) = &f_print_except_dynamic_partial;
- if (main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e) {
print_object = &fl_print_trim_except_dynamic_partial;
}
- flockfile(main->output.to.stream);
+ flockfile(data->main->output.to.stream);
for (i = 0; i < items->used; ++i) {
if (skip[i]) continue;
- print_object(main->buffer, items->array[i].object, *objects_delimits, main->output.to.stream);
+ print_object(data->buffer, items->array[i].object, *objects_delimits, data->main->output.to.stream);
- if (main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) {
- fss_embedded_list_read_print_object_end(main);
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) {
+ fss_embedded_list_read_print_object_end(data);
if (items->array[i].content.used) {
- f_print_except_dynamic_partial(main->buffer, items->array[i].content.array[0], *contents_delimits, main->output.to.stream);
+ f_print_except_dynamic_partial(data->buffer, items->array[i].content.array[0], *contents_delimits, data->main->output.to.stream);
}
}
- fss_embedded_list_read_print_set_end(main);
+ fss_embedded_list_read_print_set_end(data);
} // for
- funlockfile(main->output.to.stream);
+ funlockfile(data->main->output.to.stream);
return F_none;
}
// Process contents.
bool include_empty = 0;
- if (main->parameters.array[fss_embedded_list_read_parameter_empty_e].result == f_console_result_found_e) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_empty_e].result == f_console_result_found_e) {
include_empty = 1;
}
- if (main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
f_array_length_t total = 0;
for (i = 0; i < items->used; ++i) {
if (skip[i]) continue;
- if (!((++main->signal_check) % fss_embedded_list_read_signal_check_d)) {
- if (fss_embedded_list_read_signal_received(main)) {
+ if (!((++data->main->signal_check) % fss_embedded_list_read_signal_check_d)) {
+ if (fss_embedded_list_read_signal_received(data)) {
return F_status_set_error(F_interrupt);
}
- main->signal_check = 0;
+ data->main->signal_check = 0;
}
if (!items->array[i].content.used) {
for (j = items->array[i].content.array[0].start; j <= items->array[i].content.array[0].stop; ++j) {
- if (!main->buffer.string[j]) continue;
+ if (!data->buffer.string[j]) continue;
- if (main->buffer.string[j] == f_string_eol_s.string[0]) {
+ if (data->buffer.string[j] == f_string_eol_s.string[0]) {
++total;
}
} // for
} // for
- fll_print_format("%ul%r", main->output.to.stream, total, f_string_eol_s);
+ fll_print_format("%ul%r", data->main->output.to.stream, total, f_string_eol_s);
return F_none;
}
- if (main->parameters.array[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) {
f_array_length_t line_current = 0;
- flockfile(main->output.to.stream);
+ flockfile(data->main->output.to.stream);
for (; i < items->used; ++i) {
if (!items->array[i].content.used) {
if (include_empty) {
if (line_current == line) {
- fss_embedded_list_read_print_set_end(main);
+ fss_embedded_list_read_print_set_end(data);
break;
}
if (line_current != line) {
for (; j <= items->array[i].content.array[0].stop; ++j) {
- if (main->buffer.string[j] == f_string_eol_s.string[0]) {
+ if (data->buffer.string[j] == f_string_eol_s.string[0]) {
++line_current;
if (line_current == line) {
for (; j <= items->array[i].content.array[0].stop; ++j) {
- if (!main->buffer.string[j]) continue;
+ if (!data->buffer.string[j]) continue;
- if (main->buffer.string[j] == f_string_eol_s.string[0]) {
- f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+ if (data->buffer.string[j] == f_string_eol_s.string[0]) {
+ f_print_dynamic_raw(f_string_eol_s, data->main->output.to.stream);
break;
}
- f_print_character(main->buffer.string[j], main->output.to.stream);
+ f_print_character(data->buffer.string[j], data->main->output.to.stream);
} // for
break;
}
} // for
- funlockfile(main->output.to.stream);
+ funlockfile(data->main->output.to.stream);
return F_none;
}
- flockfile(main->output.to.stream);
+ flockfile(data->main->output.to.stream);
for (i = 0; i < items->used; ++i) {
if (!items->array[i].content.used) {
if (include_empty) {
- fss_embedded_list_read_print_set_end(main);
+ fss_embedded_list_read_print_set_end(data);
}
continue;
}
- f_print_except_dynamic_partial(main->buffer, items->array[i].content.array[0], *contents_delimits, main->output.to.stream);
+ f_print_except_dynamic_partial(data->buffer, items->array[i].content.array[0], *contents_delimits, data->main->output.to.stream);
- if (main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result == f_console_result_found_e) {
- f_print_dynamic_raw(fss_embedded_list_read_pipe_content_end_s, main->output.to.stream);
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result == f_console_result_found_e) {
+ f_print_dynamic_raw(fss_embedded_list_read_pipe_content_end_s, data->main->output.to.stream);
}
} // for
- funlockfile(main->output.to.stream);
+ funlockfile(data->main->output.to.stream);
return F_none;
}
#endif // _di_fss_embedded_list_read_main_process_for_depth_
#ifndef _di_fss_embedded_list_read_process_delimits_
- void fss_embedded_list_read_process_delimits(fss_embedded_list_read_main_t * const main, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) {
+ void fss_embedded_list_read_process_delimits(fss_embedded_list_read_data_t * const data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) {
- if (!main->nest.used) return;
+ if (!data->nest.used) return;
- if ((!objects_delimits->used && !contents_delimits->used) || main->delimit_mode == fss_embedded_list_read_delimit_mode_all_e) return;
+ if ((!objects_delimits->used && !contents_delimits->used) || data->delimit_mode == fss_embedded_list_read_delimit_mode_all_e) return;
- if (main->delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser_e && main->nest.used < main->delimit_depth) return;
- if (main->delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater_e && main->delimit_depth == 0) return;
+ if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser_e && data->nest.used < data->delimit_depth) return;
+ if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater_e && data->delimit_depth == 0) return;
- if (main->delimit_mode == fss_embedded_list_read_delimit_mode_none_e) {
+ if (data->delimit_mode == fss_embedded_list_read_delimit_mode_none_e) {
objects_delimits->used = 0;
contents_delimits->used = 0;
return;
}
- if (main->delimit_mode == fss_embedded_list_read_delimit_mode_depth_e || main->delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater_e) {
- if (main->delimit_depth >= main->nest.used) {
+ if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_e || data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater_e) {
+ if (data->delimit_depth >= data->nest.used) {
objects_delimits->used = 0;
contents_delimits->used = 0;
objects_delimits->used = 0;
contents_delimits->used = 0;
- if (main->delimit_mode == fss_embedded_list_read_delimit_mode_depth_e) {
+ if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_e) {
// Only depth 0 objects are stored in objects_delimits.
- if (main->delimit_depth) {
- fss_embedded_list_read_process_delimits_objects(main, main->delimit_depth, original_contents_delimits, original_contents_used, contents_delimits);
+ if (data->delimit_depth) {
+ fss_embedded_list_read_process_delimits_objects(data, data->delimit_depth, original_contents_delimits, original_contents_used, contents_delimits);
}
else {
- fss_embedded_list_read_process_delimits_objects(main, main->delimit_depth, original_objects_delimits, original_objects_used, objects_delimits);
+ fss_embedded_list_read_process_delimits_objects(data, data->delimit_depth, original_objects_delimits, original_objects_used, objects_delimits);
}
- fss_embedded_list_read_process_delimits_contents(main, main->delimit_depth, original_contents_delimits, original_contents_used, contents_delimits);
+ fss_embedded_list_read_process_delimits_contents(data, data->delimit_depth, original_contents_delimits, original_contents_used, contents_delimits);
}
else {
- if (main->delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser_e) {
+ if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser_e) {
- // only depth 0 objects are stored in objects_delimits.
- fss_embedded_list_read_process_delimits_objects(main, 0, original_objects_delimits, original_objects_used, objects_delimits);
- fss_embedded_list_read_process_delimits_contents(main, 0, original_contents_delimits, original_contents_used, contents_delimits);
+ // Only depth 0 objects are stored in objects_delimits.
+ fss_embedded_list_read_process_delimits_objects(data, 0, original_objects_delimits, original_objects_used, objects_delimits);
+ fss_embedded_list_read_process_delimits_contents(data, 0, original_contents_delimits, original_contents_used, contents_delimits);
- for (f_array_length_t i = 1; i <= main->delimit_depth && i < main->nest.used; ++i) {
+ for (f_array_length_t i = 1; i <= data->delimit_depth && i < data->nest.used; ++i) {
- fss_embedded_list_read_process_delimits_objects(main, i, original_contents_delimits, original_contents_used, contents_delimits);
- fss_embedded_list_read_process_delimits_contents(main, i, original_contents_delimits, original_contents_used, contents_delimits);
+ fss_embedded_list_read_process_delimits_objects(data, i, original_contents_delimits, original_contents_used, contents_delimits);
+ fss_embedded_list_read_process_delimits_contents(data, i, original_contents_delimits, original_contents_used, contents_delimits);
} // for
}
- else if (main->delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater_e) {
- for (f_array_length_t i = main->delimit_depth; i < main->nest.used; ++i) {
+ else if (data->delimit_mode == fss_embedded_list_read_delimit_mode_depth_greater_e) {
+ for (f_array_length_t i = data->delimit_depth; i < data->nest.used; ++i) {
- fss_embedded_list_read_process_delimits_objects(main, i, original_contents_delimits, original_contents_used, contents_delimits);
- fss_embedded_list_read_process_delimits_contents(main, i, original_contents_delimits, original_contents_used, contents_delimits);
+ fss_embedded_list_read_process_delimits_objects(data, i, original_contents_delimits, original_contents_used, contents_delimits);
+ fss_embedded_list_read_process_delimits_contents(data, i, original_contents_delimits, original_contents_used, contents_delimits);
} // for
}
}
#endif // _di_fss_embedded_list_read_process_delimits_
#ifndef _di_fss_embedded_list_read_process_delimits_contents_
- void fss_embedded_list_read_process_delimits_contents(fss_embedded_list_read_main_t * const main, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) {
+ void fss_embedded_list_read_process_delimits_contents(fss_embedded_list_read_data_t * const data, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) {
if (!original_used) return;
- f_fss_items_t *items = &main->nest.depth[depth];
+ f_fss_items_t *items = &data->nest.depth[depth];
if (!items->used) return;
delimits->array[m] = delimits->array[m - 1];
} // for
- if (fss_embedded_list_read_process_delimits_within_greater(main, depth, original_delimits[j]) == F_false) {
+ if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) {
delimits->array[l] = original_delimits[j];
++delimits->used;
}
break;
} // for
}
- else if (fss_embedded_list_read_process_delimits_within_greater(main, depth, original_delimits[j]) == F_false) {
+ else if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) {
delimits->array[0] = original_delimits[j];
delimits->used = 1;
}
#endif // _di_fss_embedded_list_read_process_delimits_contents_
#ifndef _di_fss_embedded_list_read_process_delimits_objects_
- void fss_embedded_list_read_process_delimits_objects(fss_embedded_list_read_main_t * const main, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) {
+ void fss_embedded_list_read_process_delimits_objects(fss_embedded_list_read_data_t * const data, const f_array_length_t depth, const f_array_length_t original_delimits[], const f_array_length_t original_used, f_fss_delimits_t *delimits) {
if (!original_used) return;
- f_fss_items_t *items = &main->nest.depth[depth];
+ f_fss_items_t *items = &data->nest.depth[depth];
if (!items->used) return;
if (original_delimits[j] >= items->array[i].object.start && original_delimits[j] <= items->array[i].object.stop) {
- // preserve linear order when adding back delimits.
+ // Preserve linear order when adding back delimits.
if (delimits->used) {
for (k = 0; k < delimits->used; ++k) {
delimits->array[l] = delimits->array[l - 1];
} // for
- if (fss_embedded_list_read_process_delimits_within_greater(main, depth, original_delimits[j]) == F_false) {
+ if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) {
delimits->array[k] = original_delimits[j];
++delimits->used;
}
break;
} // for
}
- else if (fss_embedded_list_read_process_delimits_within_greater(main, depth, original_delimits[j]) == F_false) {
+ else if (fss_embedded_list_read_process_delimits_within_greater(data, depth, original_delimits[j]) == F_false) {
delimits->array[0] = original_delimits[j];
delimits->used = 1;
}
#endif // _di_fss_embedded_list_read_process_delimits_objects_
#ifndef _di_fss_embedded_list_read_process_delimits_within_greater_
- f_status_t fss_embedded_list_read_process_delimits_within_greater(fss_embedded_list_read_main_t * const main, const f_array_length_t depth, const f_array_length_t location) {
+ f_status_t fss_embedded_list_read_process_delimits_within_greater(fss_embedded_list_read_data_t * const data, const f_array_length_t depth, const f_array_length_t location) {
- if (depth + 1 >= main->nest.used) return F_false;
+ if (depth + 1 >= data->nest.used) return F_false;
f_fss_items_t *items = 0;
f_array_length_t i = 0;
f_array_length_t j = 0;
- for (f_array_length_t d = depth + 1; d < main->nest.used; ++d) {
- items = &main->nest.depth[d];
+ for (f_array_length_t d = depth + 1; d < data->nest.used; ++d) {
+ items = &data->nest.depth[d];
for (i = 0; i < items->used; ++i) {