The primary focus is on cleaning up the state of the code.
I will at some pointer later resume migrating the code.
}
if (main->parameters.array[byte_dump_parameter_width_e].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[byte_dump_parameter_width_e].values.array[main->parameters.array[byte_dump_parameter_width_e].values.used - 1];
+ const f_array_length_t index = main->parameters.array[byte_dump_parameter_width_e].values.array[main->parameters.array[byte_dump_parameter_width_e].location];
f_number_unsigned_t number = 0;
status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number);
}
if (main->parameters.array[byte_dump_parameter_first_e].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[byte_dump_parameter_first_e].values.array[main->parameters.array[byte_dump_parameter_first_e].values.used - 1];
+ const f_array_length_t index = main->parameters.array[byte_dump_parameter_first_e].values.array[main->parameters.array[byte_dump_parameter_first_e].location];
f_number_unsigned_t number = 0;
status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number);
}
if (main->parameters.array[byte_dump_parameter_last_e].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[byte_dump_parameter_last_e].values.array[main->parameters.array[byte_dump_parameter_last_e].values.used - 1];
+ const f_array_length_t index = main->parameters.array[byte_dump_parameter_last_e].values.array[main->parameters.array[byte_dump_parameter_last_e].location];
f_number_unsigned_t number = 0;
status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number);
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[ids[i]].result & f_console_result_value_e) {
- index = main->parameters.array[ids[i]].values.array[main->parameters.array[ids[i]].values.used - 1];
+ index = main->parameters.array[ids[i]].values.array[main->parameters.array[ids[i]].location];
if (!main->parameters.arguments.array[index].used) {
control_print_error_parameter_value_empty(main, names[i]);
data->cache.small.used = 0;
if (main->parameters.array[control_parameter_settings_e].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[control_parameter_settings_e].values.array[main->parameters.array[control_parameter_settings_e].values.used - 1];
+ const f_array_length_t index = main->parameters.array[control_parameter_settings_e].values.array[main->parameters.array[control_parameter_settings_e].location];
status = f_string_dynamic_append(data->argv[index], &data->cache.small);
}
data->cache.small.used = 0;
if (main->parameters.array[control_parameter_socket_e].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[control_parameter_socket_e].values.array[main->parameters.array[control_parameter_socket_e].values.used - 1];
+ const f_array_length_t index = main->parameters.array[control_parameter_socket_e].values.array[main->parameters.array[control_parameter_socket_e].location];
status = f_string_dynamic_append(data->argv[index], &data->cache.small);
}
for (uint8_t i = 0; i < 3; ++i) {
if (append_ids[i] && main->parameters.array[append_ids[i]].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[append_ids[i]].values.array[main->parameters.array[append_ids[i]].values.used - 1];
+ const f_array_length_t index = main->parameters.array[append_ids[i]].values.array[main->parameters.array[append_ids[i]].location];
status = f_string_dynamic_append(data->argv[index], &data->cache.small);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[controller_parameter_settings_e].locations.used) {
- const f_array_length_t index = main->parameters.array[controller_parameter_settings_e].values.array[main->parameters.array[controller_parameter_settings_e].values.used - 1];
+ const f_array_length_t index = main->parameters.array[controller_parameter_settings_e].values.array[main->parameters.array[controller_parameter_settings_e].location];
status = controller_path_canonical_relative(&setting, argv[index], &setting.path_setting);
else if (main->parameters.array[controller_parameter_pid_e].locations.used) {
setting.path_pid.used = 0;
- const f_array_length_t index = main->parameters.array[controller_parameter_pid_e].values.array[main->parameters.array[controller_parameter_pid_e].values.used - 1];
+ const f_array_length_t index = main->parameters.array[controller_parameter_pid_e].values.array[main->parameters.array[controller_parameter_pid_e].location];
if (argv[index].used) {
status = controller_path_canonical_relative(&setting, argv[index], &setting.path_pid);
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[controller_parameter_cgroup_e].locations.used) {
- const f_array_length_t index = main->parameters.array[controller_parameter_cgroup_e].values.array[main->parameters.array[controller_parameter_cgroup_e].values.used - 1];
+ const f_array_length_t index = main->parameters.array[controller_parameter_cgroup_e].values.array[main->parameters.array[controller_parameter_cgroup_e].location];
if (argv[index].used) {
status = controller_path_canonical_relative(&setting, argv[index], &setting.path_cgroup);
if (f_compare_dynamic_partial_string(options[i].string, source, options[i].used, content) == F_equal_to) {
if (values[i]) {
if (parameters->array[codes[i]].result & f_console_result_value_e) {
- const f_array_length_t index = parameters->array[codes[i]].values.array[parameters->array[codes[i]].values.used - 1];
+ const f_array_length_t index = parameters->array[codes[i]].values.array[parameters->array[codes[i]].location];
status = f_string_dynamic_increase_by(symbols[i].used + expands[i].used + f_string_ascii_space_s.used + argv[index].used + 1, destination);
if (F_status_is_error(status)) return status;
if (f_compare_dynamic_partial_string(buffer.string, source, buffer.used, content) == F_equal_to) {
if (parameters->array[codes[i]].result & f_console_result_value_e) {
- const f_array_length_t index = parameters->array[codes[i]].values.array[parameters->array[codes[i]].values.used - 1];
+ const f_array_length_t index = parameters->array[codes[i]].values.array[parameters->array[codes[i]].location];
status = f_string_dynamic_append(argv[index], destination);
if (F_status_is_error(status)) return status;
}
if (main->program.parameters.array[parameters[i]].result & f_console_result_value_e) {
- index = main->program.parameters.array[parameters[i]].values.array[main->program.parameters.array[parameters[i]].values.used - 1];
+ index = main->program.parameters.array[parameters[i]].values.array[main->program.parameters.array[parameters[i]].location;
if (main->program.parameters.arguments.array[index].used) {
if (parameters[i] == fake_parameter_process_e) {
];
if (parameter->result & f_console_result_value_e) {
- const f_array_length_t index = parameter->values.array[parameter->values.used - 1];
+ const f_array_length_t index = parameter->values.array[parameter->location];
if (f_path_is_absolute(main->program.parameters.arguments.array[index]) == F_true || f_path_is_relative_current(main->program.parameters.arguments.array[index]) == F_true) {
requireds[1] = F_none; // fake_long_data_s
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) {
if (main->parameters.array[parameter].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
+ const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].location];
const f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[index], 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) {
if (main->parameters.array[parameter].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
+ const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].location];
const f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[index], number);
f_number_unsigned_t select = 0;
if (data->main->parameters.array[fss_embedded_list_read_parameter_select_e].result & f_console_result_value_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];
+ 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].location];
status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->main->parameters.arguments.array[index], &select);
f_array_length_t line = 0;
if (data->main->parameters.array[fss_embedded_list_read_parameter_line_e].result & f_console_result_value_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];
+ 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].location];
status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->main->parameters.arguments.array[index], &line);
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) {
if (main->parameters.array[parameter].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
+ const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].location];
const f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[index], number);
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_identify_parameter_line_e].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[fss_identify_parameter_line_e].values.array[main->parameters.array[fss_identify_parameter_line_e].values.used - 1];
+ const f_array_length_t index = main->parameters.array[fss_identify_parameter_line_e].values.array[main->parameters.array[fss_identify_parameter_line_e].location];
status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &data.line);
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_identify_parameter_name_e].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[fss_identify_parameter_name_e].values.array[main->parameters.array[fss_identify_parameter_name_e].values.used - 1];
+ const f_array_length_t index = main->parameters.array[fss_identify_parameter_name_e].values.array[main->parameters.array[fss_identify_parameter_name_e].location];
const f_array_length_t length = data.argv[index].used;
const f_string_range_t range = macro_f_string_range_t_initialize_2(length);
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) {
if (main->parameters.array[parameter].result & f_console_result_value_e) {
- const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
+ const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].location];
const f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[index], number);
*
* F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal.
*
+ * Errors (with error bit) from: f_rip_dynamic().
* Errors (with error bit) from: f_string_append().
* Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect().
- * Errors (with error bit) from: f_rip_dynamic().
*
* Errors (with error bit) from: fss_payload_read_depths_resize().
*
+ * @see f_rip_dynamic()
* @see f_string_append()
* @see fl_conversion_dynamic_partial_to_unsigned_detect()
- * @see f_rip_dynamic()
*
* @see fss_payload_read_depths_resize()
*/
f_string_range_t input = macro_f_string_range_t_initialize_2(main->setting.buffer.used);
- main->setting.delimits.used = 0;
- main->setting.quotes.used = 0;
+ main->setting.delimits_object.used = 0;
+ main->setting.delimits_content.used = 0;
+ main->setting.quotes_object.used = 0;
+ main->setting.quotes_content.used = 0;
- fll_fss_basic_read(main->setting.buffer, &input, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.delimits, 0, &main->setting.state);
+ fll_fss_basic_read(main->setting.buffer, &input, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.state);
- if (F_status_is_error(data.setting.state.status)) {
- if (F_status_set_fine(data.setting.state.status) == F_interrupt) return;
+ if (F_status_is_error(main->setting.state.status)) {
+ if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
fll_error_file_print(
- &main->error,
- F_status_set_fine(data.setting.state.status),
+ &main->program.error,
+ F_status_set_fine(main->setting.state.status),
macro_fss_read_f(fll_fss_basic_read),
fll_error_file_flag_fallback_e,
fss_read_file_identify(input.start, main->setting.files),
return;
}
- if (data.setting.state.status == F_data_not_stop || data.setting.state.status == F_data_not_eos) {
+ if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {
if (!(main->setting.flag & fss_read_main_flag_total_e)) {
- data.setting.state.status = F_status_set_warning(status);
+ main->setting.state.status = F_status_set_warning(main->setting.state.status);
return;
}
}
- data.setting.state.status = F_none;
+ main->setting.state.status = F_none;
}
#endif // _di_fss_read_basic_process_load_
// FLL-2 includes.
#include <fll/level_2/error.h>
+#include <fll/level_2/fss/basic.h>
#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#include <program/fss_read/main/common/string.h>
#include <program/fss_read/main/common/type.h>
#include <program/fss_read/main/common.h>
+#include <program/fss_read/main/print/data.h>
#include <program/fss_read/main/print/error.h>
#include <program/fss_read/main/print/message.h>
#include <program/fss_read/main/process_normal.h>
* @see fss_read_file_identify()
*/
#ifndef _di_fss_read_basic_process_load_
- extern f_status_t fss_read_basic_process_load(fss_read_main_t * const main);
+ extern void fss_read_basic_process_load(fss_read_main_t * const main);
#endif // _di_fss_read_basic_process_load_
#ifdef __cplusplus
#include <program/fss_read/main/common/string.h>
#include <program/fss_read/main/common/type.h>
#include <program/fss_read/main/common.h>
+#include <program/fss_read/main/print/data.h>
#include <program/fss_read/main/print/error.h>
#include <program/fss_read/main/print/message.h>
#include <program/fss_read/main/process_normal.h>
// FLL-2 includes.
#include <fll/level_2/error.h>
+#include <fll/level_2/fss/embedded_list.h>
#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#include <program/fss_read/main/common/string.h>
#include <program/fss_read/main/common/type.h>
#include <program/fss_read/main/common.h>
+#include <program/fss_read/main/print/data.h>
#include <program/fss_read/main/print/error.h>
#include <program/fss_read/main/print/message.h>
#include <program/fss_read/main/process_normal.h>
// FLL-2 includes.
#include <fll/level_2/error.h>
+#include <fll/level_2/fss/extended.h>
#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#include <program/fss_read/main/common/string.h>
#include <program/fss_read/main/common/type.h>
#include <program/fss_read/main/common.h>
+#include <program/fss_read/main/print/data.h>
#include <program/fss_read/main/print/error.h>
#include <program/fss_read/main/print/message.h>
#include <program/fss_read/main/process_normal.h>
// FLL-2 includes.
#include <fll/level_2/error.h>
+#include <fll/level_2/fss/extended_list.h>
#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#include <program/fss_read/main/common/string.h>
#include <program/fss_read/main/common/type.h>
#include <program/fss_read/main/common.h>
+#include <program/fss_read/main/print/data.h>
#include <program/fss_read/main/print/error.h>
#include <program/fss_read/main/print/message.h>
#include <program/fss_read/main/process_normal.h>
fss_read_long_delimit_s,
};
- static const f_string_t message_positive_number = "a positive number";
- static const f_string_t message_string = "a string";
- static const f_string_t message_value = "a value";
+ static const f_string_static_t message_positive_number = macro_f_string_static_t_initialize_1("a positive number", 0, 17);
+ static const f_string_static_t message_string = macro_f_string_static_t_initialize_1("a string", 0, 8);
+ static const f_string_static_t message_value = macro_f_string_static_t_initialize_1("a value", 0, 7);
- static const f_string_t parameter_message[] = {
+ static const f_string_static_t parameter_message[] = {
message_positive_number,
message_positive_number,
message_positive_number,
for (i = 0; i < 6; ++i) {
- if (parameters->array[parameter_code[i]].result & f_console_result_found_e)) {
+ if (parameters->array[parameter_code[i]].result & f_console_result_found_e) {
main->setting.state.status = F_status_set_error(F_parameter);
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fss_read_print_error_parameter_requires_message(&main->error, f_console_symbol_long_normal_s, parameter_name[i], parameter_message[i]);
+ fss_read_print_error_parameter_requires_message(&main->program.error, f_console_symbol_long_normal_s, parameter_name[i], parameter_message[i]);
return;
}
- else if (parameters->array[parameter_code[i]].result & f_console_result_value_e)) {
+ else if (parameters->array[parameter_code[i]].result & f_console_result_value_e) {
main->setting.state.flag |= parameter_flag[i];
if (parameter_value_digit[i]) {
- index = parameters->array[parameter_code[i]].values.array[parameters->array[parameter_code[i]].values.used - 1];
+ index = parameters->array[parameter_code[i]].values.array[parameters->array[parameter_code[i]].location];
- main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, parameters->arguments.array[index], parameter_value_digit_single[i]);
+ main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, parameters->arguments.array[index], parameter_value_digit[i]);
if (F_status_is_error(main->setting.state.status)) {
- fll_error_parameter_integer_print(&main->error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(fl_conversion_dynamic_to_unsigned_detect), F_true, parameter_name[i], parameters->arguments.array[index]);
+ fll_error_parameter_integer_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(fl_conversion_dynamic_to_unsigned_detect), F_true, parameter_name[i], parameters->arguments.array[index]);
return;
}
if (parameters->array[parameter_code[i]].result & parameter_match[i]) {
main->setting.state.status = F_status_set_error(F_parameter);
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_program_print_error_parameter_cannot_use_with(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_read_long_columns_s, parameter_name[i]);
+ fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_read_long_columns_s, parameter_name[i]);
}
return;
if ((parameters->array[fss_read_parameter_total_e].result & f_console_result_found_e) || (parameters->array[fss_read_parameter_total_e].result & f_console_result_found_e)) {
main->setting.state.status = F_status_set_error(F_parameter);
- if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
fll_program_print_error_parameter_cannot_use_with(
- &main->error, f_console_symbol_long_normal_s,
+ &main->program.error, f_console_symbol_long_normal_s,
f_console_symbol_long_normal_s,
fss_read_long_pipe_s,
(parameters->array[fss_read_parameter_total_e].result & f_console_result_found_e)
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_program_print_error_parameter_empty_value(&main->program.error, f_console_symbol_long_normal_s, fss_read_long_file_s);
+ fll_program_print_error_parameter_empty_value(&main->program.error, f_console_symbol_long_normal_s, fss_read_long_delimit_s);
return;
}
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_error_parameter_integer_print(&main->error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(fl_conversion_dynamic_partial_to_unsigned_detect), F_true, fss_read_long_delimit_s, parameters->arguments.array[index]);
+ fll_error_parameter_integer_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(fl_conversion_dynamic_partial_to_unsigned_detect), F_true, fss_read_long_delimit_s, parameters->arguments.array[index]);
return;
}
main->setting.flag |= fss_read_main_flag_trim_e;
}
- main->setting.state.status = fss_read_setting_load_depth(arguments, main, parameters);
+ fss_read_setting_load_depth(arguments, main, parameters);
if (F_status_is_error(main->setting.state.status)) return;
if (parameters->array[fss_read_parameter_select_e].result & f_console_result_found_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_program_print_error_parameter_integer_not_positive(&main->error, f_console_symbol_long_normal_s, fss_read_long_select_s);
+ index = parameters->array[fss_read_parameter_select_e].values.array[i];
+
+ fll_program_print_error_parameter_integer_not_positive(&main->program.error, f_console_symbol_long_normal_s, fss_read_long_select_s, parameters->arguments.array[index]);
return;
}
f_file_t file = f_file_t_initialize;
- if (main->pipe & fll_program_data_pipe_input_e) {
+ if (main->program.pipe & fll_program_data_pipe_input_e) {
file.id = F_type_descriptor_input_d;
file.stream = F_type_input_d;
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_error_file_print(&main->error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_stream_read), fll_error_file_flag_fallback_e, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
+ fll_error_file_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_stream_read), fll_error_file_flag_fallback_e, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
return;
}
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_error_file_print(&main->error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_stream_open), fll_error_file_flag_fallback_e, parameters->arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_stream_open), fll_error_file_flag_fallback_e, parameters->arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e);
break;
}
size_file = 0;
- main->setting.state.status = f_file_size_by_id(file.id, &size_file);
+ main->setting.state.status = f_file_size_by_id(file, &size_file);
if (F_status_is_error(main->setting.state.status)) {
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_error_file_print(&main->error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_size_by_id), fll_error_file_flag_fallback_e, parameters->arguments.array[index], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_size_by_id), fll_error_file_flag_fallback_e, parameters->arguments.array[index], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
if (size_file) {
// Enforce a max block read size to allow for interrupts to be processed between blocks.
- if (size_file > fss_basic_list_read_block_max) {
- file.size_read = fss_basic_list_read_block_read_large;
- size_block = fss_basic_list_read_block_max;
+ if (size_file > fss_read_allocation_block_max_d) {
+ file.size_read = fss_read_allocation_block_read_large_d;
+ size_block = fss_read_allocation_block_max_d;
// Pre-allocate entire file buffer plus space for the terminating NULL.
f_string_dynamic_increase_by(size_file + (size_block - (size_file % size_block)) + 1, &main->setting.buffer);
}
else {
- file.size_read = fss_basic_list_read_block_read_small;
+ file.size_read = fss_read_allocation_block_read_small_d;
size_block = size_file;
// Pre-allocate entire file buffer plus space for the terminating NULL.
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_error_file_print(&main->error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_string_dynamic_increase_by), fll_error_file_flag_fallback_e, parameters->arguments.array[index], f_file_operation_process_s, fll_error_file_type_file_e);
+ fll_error_file_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_string_dynamic_increase_by), fll_error_file_flag_fallback_e, parameters->arguments.array[index], f_file_operation_process_s, fll_error_file_type_file_e);
break;
}
for (size_read = 0; size_read < size_file; size_read += size_block) {
- if (size_file > fss_basic_list_read_block_max && fss_read_signal_check(main)) break;
+ if (size_file > fss_read_allocation_block_max_d && fss_read_signal_check(main)) break;
main->setting.state.status = f_file_stream_read_until(file, size_block, &main->setting.buffer);
if (F_status_is_error(main->setting.state.status)) break;
} // for
if (F_status_is_error(main->setting.state.status)) {
- if (F_status_set_fine(status) != F_interrupt) {
+ if (F_status_set_fine(main->setting.state.status) != F_interrupt) {
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_error_file_print(&main->error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_stream_read_until), fll_error_file_flag_fallback_e, parameters->arguments.array[index], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_file_stream_read_until), fll_error_file_flag_fallback_e, parameters->arguments.array[index], f_file_operation_read_s, fll_error_file_type_file_e);
}
break;
i = parameters->array[fss_read_parameter_depth_e].values.used;
}
- if (i > data->depths.size) {
- main->setting.state.status = fss_read_depths_resize(i, &data->depths);
+ if (i > main->setting.depths.size) {
+ main->setting.state.status = fss_read_depths_resize(i, &main->setting.depths);
if (F_status_is_error(main->setting.state.status)) {
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
}
}
- data->depths.used = depth_size;
+ main->setting.depths.used = i;
f_array_length_t position_depth = 0;
f_array_length_t position_at = 0;
f_array_length_t position_name = 0;
- for (i = 0; i < data->depths.used; ++i) {
+ for (i = 0; i < main->setting.depths.used; ++i) {
if (fss_read_signal_check(main)) return;
- data->depths.array[i].depth = 0;
- data->depths.array[i].index_at = 0;
- data->depths.array[i].index_name = 0;
- data->depths.array[i].value_at = 0;
+ main->setting.depths.array[i].depth = 0;
+ main->setting.depths.array[i].index_at = 0;
+ main->setting.depths.array[i].index_name = 0;
+ main->setting.depths.array[i].value_at = 0;
// This dynamic string is actually a static string, so clear it between loops.
- macro_f_string_dynamic_t_clear(data->depths.array[i].value_name);
+ macro_f_string_dynamic_t_clear(main->setting.depths.array[i].value_name);
if (!parameters->array[fss_read_parameter_depth_e].values.used) {
position_depth = 0;
else {
position_depth = parameters->array[fss_read_parameter_depth_e].values.array[i];
- main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[position_depth], &data->depths.array[i].depth);
+ main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, parameters->arguments.array[position_depth], &main->setting.depths.array[i].depth);
if (F_status_is_error(main->setting.state.status)) {
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_error_parameter_integer_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(fl_conversion_dynamic_to_unsigned_detect), F_true, fss_read_long_depth_s, data->argv[position_depth]);
+ fll_error_parameter_integer_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(fl_conversion_dynamic_to_unsigned_detect), F_true, fss_read_long_depth_s, parameters->arguments.array[position_depth]);
return;
}
continue;
}
- if (i + 1 < data->depths.used && parameters->array[fss_read_parameter_at_e].values.array[position_at] > parameters->array[fss_read_parameter_depth_e].values.array[i + 1]) {
+ if (i + 1 < main->setting.depths.used && parameters->array[fss_read_parameter_at_e].values.array[position_at] > parameters->array[fss_read_parameter_depth_e].values.array[i + 1]) {
break;
}
- data->depths.array[i].index_at = parameters->array[fss_read_parameter_at_e].values.array[position_at];
+ main->setting.depths.array[i].index_at = parameters->array[fss_read_parameter_at_e].values.array[position_at];
- main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->argv[data->depths.array[i].index_at], &data->depths.array[i].value_at);
+ main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, parameters->arguments.array[main->setting.depths.array[i].index_at], &main->setting.depths.array[i].value_at);
if (F_status_is_error(main->setting.state.status)) {
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_error_parameter_integer_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(fl_conversion_dynamic_to_unsigned_detect), F_true, fss_read_long_at_s, data->argv[data->depths.array[i].index_at]);
+ fll_error_parameter_integer_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(fl_conversion_dynamic_to_unsigned_detect), F_true, fss_read_long_at_s, parameters->arguments.array[main->setting.depths.array[i].index_at]);
return;
}
continue;
}
- if (i + 1 < data->depths.used && parameters->array[fss_read_parameter_name_e].values.array[position_name] > parameters->array[fss_read_parameter_depth_e].values.array[i + 1]) {
+ if (i + 1 < main->setting.depths.used && parameters->array[fss_read_parameter_name_e].values.array[position_name] > parameters->array[fss_read_parameter_depth_e].values.array[i + 1]) {
break;
}
- data->depths.array[i].index_name = parameters->array[fss_read_parameter_name_e].values.array[position_name];
+ main->setting.depths.array[i].index_name = parameters->array[fss_read_parameter_name_e].values.array[position_name];
if (parameters->array[fss_read_parameter_trim_e].result & f_console_result_found_e) {
- main->setting.state.status = f_rip_dynamic(data->argv[data->depths.array[i].index_name], &data->depths.array[i].value_name);
+ main->setting.state.status = f_rip_dynamic(parameters->arguments.array[main->setting.depths.array[i].index_name], &main->setting.depths.array[i].value_name);
}
else {
- main->setting.state.status = f_string_dynamic_append(data->argv[data->depths.array[i].index_name], &data->depths.array[i].value_name);
+ main->setting.state.status = f_string_dynamic_append(parameters->arguments.array[main->setting.depths.array[i].index_name], &main->setting.depths.array[i].value_name);
}
if (F_status_is_error(main->setting.state.status)) {
f_array_length_t j = 0;
- for (i = 0; i < data->depths.used; ++i) {
+ for (i = 0; i < main->setting.depths.used; ++i) {
- for (j = i + 1; j < data->depths.used; ++j) {
+ for (j = i + 1; j < main->setting.depths.used; ++j) {
if (fss_read_signal_check(main)) return;
- if (data->depths.array[i].depth == data->depths.array[j].depth) {
+ if (main->setting.depths.array[i].depth == main->setting.depths.array[j].depth) {
main->setting.state.status = F_status_set_error(F_parameter);
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fss_read_print_error_parameter_value_once_only_number(&main->program.error, f_console_symbol_long_normal_s, fss_read_long_depth_s, data->depths.array[i].depth);
+ fss_read_print_error_parameter_value_once_only_number(&main->program.error, f_console_symbol_long_normal_s, fss_read_long_depth_s, main->setting.depths.array[i].depth);
return;
}
- if (data->depths.array[i].depth > data->depths.array[j].depth) {
+ if (main->setting.depths.array[i].depth > main->setting.depths.array[j].depth) {
main->setting.state.status = F_status_set_error(F_parameter);
if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fss_read_print_error_parameter_value_before_value_number(&main->program.error, f_console_symbol_long_normal_s, fss_read_long_depth_s, data->depths.array[i].depth, data->depths.array[j].depth);
+ fss_read_print_error_parameter_value_before_value_number(&main->program.error, f_console_symbol_long_normal_s, fss_read_long_depth_s, main->setting.depths.array[i].depth, main->setting.depths.array[j].depth);
return;
}
#endif // _di_fss_read_allocation_d_
/**
+ * The program allocation block defines.
+ *
+ * fss_payload_read_block_*:
+ * - max: The max block read size before checking for interrupt.
+ * - read_small: The block read size for small files.
+ * - read_large: The block read size for large files.
+ */
+#ifndef _di_fss_read_allocation_d_
+ #define fss_read_allocation_block_max_d 16777216
+ #define fss_read_allocation_block_read_small_d 8192
+ #define fss_read_allocation_block_read_large_d 65536
+#endif // _di_fss_read_allocation_d_
+
+/**
* The program signal defines.
*
* fss_read_signal_*_d:
f_status_t status = F_none;
for (f_array_length_t i = length; i < depths->size; ++i) {
-
- status = private_f_string_ranges_adjust(0, &depths->array[i]);
- if (F_status_is_error(status)) return status;
+ fss_read_depth_delete(&depths->array[i]);
} // for
- status = f_memory_adjust(depths->size, length, sizeof(fss_read_file_t), (void **) & depths->array);
+ status = f_memory_resize(depths->size, length, sizeof(fss_read_file_t), (void **) & depths->array);
if (F_status_is_error(status)) return status;
depths->size = length;
if (!setting) return F_status_set_error(F_parameter);
- f_string_dynamic_resize(0, &setting->escaped);
- f_string_dynamic_resize(0, &setting->block);
- f_string_dynamic_resize(0, &setting->buffer);
- f_string_dynamic_resize(0, &setting->prepend);
-
fss_read_files_resize(0, &setting->files);
fss_read_depths_resize(0, &setting->depths);
+ f_string_dynamic_resize(0, &setting->buffer);
+
f_string_ranges_resize(0, &setting->objects);
f_string_ranges_resize(0, &setting->comments);
f_string_rangess_resize(0, &setting->contents);
* process_last_line: Process printing last line if necessary when loading in a file (or pipe).
* process_load_depth: Process loading of the depth related parameters when loading the settings.
* process_normal: Process normally (data from parameters and files).
+ * process_pipe: Process data piped to the program from standard input (stdin).
*
* process_at: Process at parameter, usually called by the process_normal() callback.
* process_columns: Process columns parameter, usually called by the process_normal() callback.
void (*process_last_line)(void * const main);
void (*process_load_depth)(const f_console_arguments_t arguments, void * const main);
void (*process_normal)(void * const main);
+ void (*process_pipe)(void * const main);
void (*process_at)(void * const main, const bool names[], const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
void (*process_columns)(void * const main, const bool names[]);
void (*print_at)(void * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content);
void (*print_object)(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits);
- void (*print_content)(fl_print_t * const print, const f_array_length_t at, const uint8_t quote, const f_fss_delimits_t delimits);
+ void (*print_content)(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_fss_delimits_t delimits);
void (*print_content_ignore)(fl_print_t * const print);
void (*print_object_end)(fl_print_t * const print);
void (*print_set_end)(fl_print_t * const print);
*
* @param depth
* The depth to deallocate.
+ *
* Must not be NULL.
*/
#ifndef _di_fss_read_depth_delete_
- extern f_status_t fss_read_depth_delete(fss_read_depth_t * const depth);
+ extern void fss_read_depth_delete(fss_read_depth_t * const depth);
#endif // _di_fss_read_depth_delete_
/**
* The new size to use.
* @param depths
* The depths to resize.
+ *
* Must not be NULL.
*
* @return
* The new size to use.
* @param files
* The files to resize.
+ *
* Must not be NULL.
*
* @return
* F_parameter (with error bit) if a parameter is invalid.
*
* Errors (with error bit) from: f_memory_resize().
+ * Errors (with error bit) from: f_string_ranges_resize().
*
* @see f_memory_resize()
+ * @see f_string_ranges_resize()
*/
#ifndef _di_fss_read_files_resize_
extern f_status_t fss_read_files_resize(const f_array_length_t length, fss_read_files_t * const files);
if (!main) return F_false;
- if (main->setting.delimit_mode == fss_read_delimit_mode_none_e) {
- return F_false;
- }
-
- if (main->setting.delimit_mode == fss_read_delimit_mode_all_e) {
- return F_true;
- }
-
- if (depth < main->setting.delimit_depth) {
- return main->setting.delimit_mode == fss_read_delimit_mode_content_lesser_e;
- }
-
- if (depth == main->setting.delimit_depth) {
- return F_true;
- }
+ if (main->setting.delimit_mode == fss_read_delimit_mode_none_e) return F_false;
+ if (main->setting.delimit_mode == fss_read_delimit_mode_all_e) return F_true;
+ if (depth < main->setting.delimit_depth) return main->setting.delimit_mode == fss_read_delimit_mode_content_lesser_e;
+ if (depth == main->setting.delimit_depth) return F_true;
return main->setting.delimit_mode == fss_read_delimit_mode_content_greater_e;
}
}
if (F_status_is_error_not(main->setting.state.status)) {
- if (main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e | fss_read_main_flag_object_open_e | fss_read_main_flag_content_next_e | fss_read_main_flag_content_end_e)) {
+ if (main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e)) {
if (main->callback.process_normal) {
main->callback.process_normal(void_main);
}
fss_read_print_number(&main->program.output, 1);
}
else {
- fss_read_print_content(&main->program.output, range, main->setting.quotes_content.array[at], delimits_content);
+ fss_read_print_content(&main->program.output, range, main->setting.quotes_content.array[at].array[0], delimits_content);
}
main->setting.state.status = F_success;
else {
range.stop = main->setting.contents.array[at].array[0].stop;
- fss_read_print_content(&main->program.output, range, main->setting.quotes_content.array[at], delimits_content);
+ fss_read_print_content(&main->program.output, range, main->setting.quotes_content.array[at].array[0], delimits_content);
f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
}
f_string_static_t fss_read_file_identify(const f_array_length_t at, const fss_read_files_t files) {
for (f_array_length_t i = 0; i < files.used; ++i) {
-
- if (at >= files.array[i].range.start && at <= files.array[i].range.stop) {
- return files.array[i].name;
- }
+ if (at >= files.array[i].range.start && at <= files.array[i].range.stop) return files.array[i].name;
} // for
// When stopped after the end of the buffer, the last file in the list is the correct file.
- if (at > files.array[files.used - 1].range.stop) {
- return files.array[files.used - 1].name;
- }
+ if (at > files.array[files.used - 1].range.stop) return files.array[files.used - 1].name;
return f_string_empty_s;
}
fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
}
- fll_error_file_print(&main->error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_string_dynamic_append_assure), fll_error_file_flag_fallback_e, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
+ fll_error_file_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_fss_read_f(f_string_dynamic_append_assure), fll_error_file_flag_fallback_e, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
}
}
#endif // _di_fss_read_process_last_line_
#include <program/fss_read/main/common/string.h>
#include <program/fss_read/main/common/type.h>
#include <program/fss_read/main/common.h>
+#include <program/fss_read/main/print/data.h>
#include <program/fss_read/main/print/error.h>
#include <program/fss_read/main/print/message.h>
#include <program/fss_read/main/process_normal.h>
* F_false if to not apply delimits (fallback when main is NULL).
*/
#ifndef _di_fss_read_delimit_content_is_
- extern f_status_t fss_read_delimit_content_is(fss_read_main_t * const main, const f_array_length_t depth) F_attribute_visibility_internal_d;
+ extern f_status_t fss_read_delimit_content_is(fss_read_main_t * const main, const f_array_length_t depth);
#endif // _di_fss_read_delimit_content_is_
/**
* F_false if to not apply delimits (fallback when main is NULL).
*/
#ifndef _di_fss_read_delimit_object_is_
- extern f_status_t fss_read_delimit_object_is(fss_read_main_t * const main, const f_array_length_t depth) F_attribute_visibility_internal_d;
+ extern f_status_t fss_read_delimit_object_is(fss_read_main_t * const main, const f_array_length_t depth);
#endif // _di_fss_read_delimit_object_is_
/**
* @param line
* The current line being processed.
* This will be incremented as necessary.
+ *
* Must not be NULL.
*
* @return
* On failure to identify, an empty string is returned.
*/
#ifndef _di_fss_read_file_identify_
- extern f_string_static_t fss_read_file_identify(const f_array_length_t at, const fss_read_files_t files) F_attribute_visibility_internal_d;
+ extern f_string_static_t fss_read_file_identify(const f_array_length_t at, const fss_read_files_t files);
#endif // _di_fss_read_file_identify_
/**
#endif
#ifndef _di_fss_read_print_at_
- void fss_read_print_at(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content) {
+ f_status_t fss_read_print_at(fl_print_t * const print, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content) {
if (!print || !print->custom) return F_status_set_error(F_output_not);
if ((main->setting.flag & fss_read_main_flag_content_e) && main->setting.contents.array[at].used) {
if (main->callback.print_content) {
- main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[0], main->setting.quotes_content.array[at], delimits_content);
+ main->callback.print_content(&main->program.output, main->setting.contents.array[at].array[0], main->setting.quotes_content.array[at].array[0], delimits_content);
}
}
fss_read_main_t * const main = (fss_read_main_t *) print->custom;
- if (data.callback.print_content_ignore) {
- data.callback.print_content_ignore(&main->program.output);
+ if (main->callback.print_content_ignore) {
+ main->callback.print_content_ignore(&main->program.output);
}
if (main->setting.flag & fss_read_main_flag_original_e) {
}
}
- if (data.callback.print_content_ignore) {
- data.callback.print_content_ignore(&main->program.output);
+ if (main->callback.print_content_ignore) {
+ main->callback.print_content_ignore(&main->program.output);
}
return F_none;
}
-#endif _di_fss_read_print_content_
+#endif // _di_fss_read_print_content_
#ifndef _di_fss_read_print_content_ignore_
- void fss_read_print_content_ignore(fl_print_t * const print) {
+ f_status_t fss_read_print_content_ignore(fl_print_t * const print) {
if (!print || !print->custom) return F_status_set_error(F_output_not);
- fss_read_main_t * const main = (fss_read_main_t *) print->custom,
+ fss_read_main_t * const main = (fss_read_main_t *) print->custom;
if (main->setting.flag & fss_read_main_flag_pipe_e) {
fll_print_dynamic_raw(fss_read_pipe_content_ignore_s, print->to);
}
+
+ return F_none;
}
#endif // _di_fss_read_print_content_ignore_
if (!print || !print->custom) return F_status_set_error(F_output_not);
- fss_read_main_t * const main = (fss_read_main_t *) print->custom,
+ fss_read_main_t * const main = (fss_read_main_t *) print->custom;
if (at >= main->setting.objects.used) return F_output_not;
- if (main->setting.flag & fss_read_data_option_trim_d) {
- if (main->setting.flag & fss_read_data_option_original_d) {
- if (main->setting.quotes.array[at]) {
+ if (main->setting.flag & fss_read_main_flag_trim_e) {
+ if (main->setting.flag & fss_read_main_flag_original_e) {
+ if (main->setting.quotes_object.array[at]) {
fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
}
fll_print_trim_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], main->program.output.to);
- if (main->setting.quotes.array[at]) {
+ if (main->setting.quotes_object.array[at]) {
fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
}
}
else {
- fll_print_trim_except_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], delimits_object, main->program.output.to);
+ fll_print_trim_except_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], delimits, main->program.output.to);
}
}
else {
if (main->setting.flag & fss_read_main_flag_original_e) {
- if (main->setting.quotes.array[at]) {
+ if (main->setting.quotes_object.array[at]) {
fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
}
fll_print_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], main->program.output.to);
- if (main->setting.quotes.array[at]) {
+ if (main->setting.quotes_object.array[at]) {
fss_read_print_quote(&main->program.output, main->setting.quotes_object.array[at]);
}
}
else {
- fll_print_except_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], delimits_object, main->program.output.to);
+ fll_print_except_dynamic_partial(main->setting.buffer, main->setting.objects.array[at], delimits, main->program.output.to);
}
}
if (!print || !print->custom) return F_status_set_error(F_output_not);
- fss_read_main_t * const main = (fss_read_main_t *) print->custom,
+ fss_read_main_t * const main = (fss_read_main_t *) print->custom;
if (main->setting.flag & fss_read_main_flag_pipe_e) {
fll_print_dynamic_raw(fss_read_pipe_content_start_s, print->to);
}
*/
}
+
+ return F_none;
}
#endif // _di_fss_read_print_object_end_
if (!print || !print->custom) return F_status_set_error(F_output_not);
- fss_read_main_t * const main = (fss_read_main_t *) print->custom,
+ fss_read_main_t * const main = (fss_read_main_t *) print->custom;
if (main->setting.flag & fss_read_main_flag_pipe_e) {
fll_print_dynamic_raw(fss_read_pipe_content_end_s, print->to);
* @see main.callback.print_set_end()
*/
#ifndef _di_fss_read_print_content_
- extern f_status_t fss_read_print_content(fl_print_t * const print, const f_array_length_t at, const uint8_t quote, const f_fss_delimits_t delimits);
+ extern f_status_t fss_read_print_content(fl_print_t * const print, const f_string_range_t range, const uint8_t quote, const f_fss_delimits_t delimits);
#endif // _di_fss_read_print_content_
/**
}
#endif // _di_fss_read_print_error_file_
-#ifndef _di_fss_read_print_error_parameter_same_times_at_least_
- f_status_t fss_read_print_error_parameter_same_times_at_least(fl_print_t * const print) {
-
- if (!print) return F_status_set_error(F_output_not);
- if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
-
- f_file_stream_lock(print->to);
-
- fl_print_format("%[%QMust specify the '%]", print->to, print->context, print->prefix, print->context);
- fl_print_format("%[%r%r%]", print->to, print->notable, f_console_symbol_long_normal_s, fss_read_long_content_s, print->notable);
- fl_print_format("%[' parameter at least the same number of times as the '%]", print->to, print->context, print->context);
- fl_print_format("%[%r%r%]", print->to, print->notable, f_console_symbol_long_normal_s, fss_read_long_object_s, print->notable);
- fl_print_format("%[' parameter when not specifying the '%]", print->to, print->context, print->context);
- fl_print_format("%[%r%r%]", print->to, print->notable, f_console_symbol_long_normal_s, fss_read_long_partial_s, print->notable);
- fl_print_format("%[' parameter.%]%r", print->to, print->context, print->context, f_string_eol_s);
-
- f_file_stream_unlock(print->to);
-
- return F_none;
- }
-#endif // _di_fss_read_print_error_parameter_same_times_at_least_
-
#ifndef _di_fss_read_print_error_parameter_requires_message_
f_status_t fss_read_print_error_parameter_requires_message(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t message) {
}
#endif // _di_fss_read_print_error_one_content_only_
-#ifndef _fss_read_print_error_prepend_only_whitespace_
- f_status_t fss_read_print_error_prepend_only_whitespace(fl_print_t * const print) {
-
- if (!print) return F_status_set_error(F_output_not);
- if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
-
- f_file_stream_lock(print->to);
-
- fl_print_format("%[%QThe value for the parameter '%]", print->to, print->set->error, print->prefix, print->set->error);
- fl_print_format("%[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, fss_read_long_prepend_s, print->set->notable);
- fl_print_format("%[' must only contain white space.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s);
-
- f_file_stream_unlock(print->to);
-
- return F_none;
- }
-#endif // _fss_read_print_error_prepend_only_whitespace_
-
#ifndef _di_fss_read_print_error_unsupported_eol_
f_status_t fss_read_print_error_unsupported_eol(fl_print_t * const print) {
#endif // _di_fss_read_print_error_file_
/**
- * Print an error message about the object and content parameters not being specified at least the same number of times when partial is not requested.
- *
- * @param print
- * The output structure to print to.
- *
- * The print.custom is expected to be of type fss_read_main_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * @return
- * F_none on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if a parameter is NULL.
- *
- * @see fll_error_print()
- */
-#ifndef _di_fss_read_print_error_parameter_same_times_at_least_
- extern f_status_t fss_read_print_error_parameter_same_times_at_least(fl_print_t * const print);
-#endif // _di_fss_read_print_error_parameter_same_times_at_least_
-
-/**
* Print an error message about the parameter requires something that is explained by the message parameter.
*
* @param print
#endif // _di_fss_read_print_error_one_content_only_
/**
- * Print error when prepend parameter has something other than white space.
- *
- * @param print
- * The output structure to print to.
- *
- * The print.custom is expected to be of type fss_read_main_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * @return
- * F_none on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if a parameter is NULL.
- */
-#ifndef _fss_read_print_error_prepend_only_whitespace_
- extern f_status_t fss_read_print_error_prepend_only_whitespace(fl_print_t * const print);
-#endif // _fss_read_print_error_prepend_only_whitespace_
-
-/**
* Print an error message about a parameter New Line character '\n' (U+000A) being unsupported.
*
* @param print
// For depth, most standards do not support nesting, so any depth greater than 0 can be predicted without processing the buffer.
// For select, most standards do not support multiple select, so any select greater than 0 can be predicted without processing the buffer.
- if (!(main->setting.flag & fss_read_main_flag_depth_multiple_e) && main->setting.depths.array[0].depth || !(main->setting.flag & fss_read_main_flag_content_multiple_e) && ((main->setting.flag & fss_read_main_flag_select_e) && data->select)) {
+ if (!(main->setting.flag & fss_read_main_flag_depth_multiple_e) && main->setting.depths.array[0].depth || !(main->setting.flag & fss_read_main_flag_content_multiple_e) && ((main->setting.flag & fss_read_main_flag_select_e) && main->setting.select)) {
if (main->setting.flag & fss_read_main_flag_total_e) {
fss_read_print_number(&main->program.output, 0);
}
#endif // _di_fss_read_process_normal_
#ifndef _di_fss_read_process_normal_at_
- void fss_read_process_normal_at(void * const main, const bool names[], const f_array_lengths_t delimits_object, f_array_lengths_t delimits_content) {
+ void fss_read_process_normal_at(void * const void_main, const bool names[], const f_array_lengths_t delimits_object, f_array_lengths_t delimits_content) {
if (!void_main) return;
if (main->setting.flag & (fss_read_main_flag_line_e | fss_read_main_flag_line_single_e) == (fss_read_main_flag_line_e | fss_read_main_flag_line_single_e)) {
if (main->setting.line) {
if (main->setting.flag & fss_read_main_flag_total_e) {
- fss_read_print_zero(main);
+ fss_read_print_number(&main->program.output, 0);
}
main->setting.state.status = F_none;
line = 0;
- if (data->option & fss_basic_list_read_data_option_total_d) {
+ if (main->setting.flag & fss_read_main_flag_total_e) {
// Total is always 1 in this case because "line" parameter forces a single line.
fss_read_print_number(&main->program.output, 1);
}
else {
- fss_read_process_at_line(main, data, i, delimits_object, delimits_content, &line);
+ fss_read_process_at_line(main, i, delimits_object, delimits_content, &line);
}
if (main->setting.state.status == F_success) {
}
else if (main->setting.flag & fss_read_main_flag_total_e) {
if (main->setting.flag & fss_read_main_flag_line_single_e) {
- fss_read_print_number(main, main->setting.contents.array[i].used ? 1 : 0);
+ fss_read_print_number(&main->program.output, main->setting.contents.array[i].used ? 1 : 0);
}
else {
total = 0;
#endif // _di_fss_read_process_normal_at_
#ifndef _di_fss_read_process_normal_columns_
- void fss_read_process_normal_columns(void * const main, const bool names[]) {
+ void fss_read_process_normal_columns(void * const void_main, const bool names[]) {
if (!void_main) return;
#endif // _di_fss_read_process_normal_columns_
#ifndef _di_fss_read_process_normal_line_
- void fss_read_process_normal_line(void * const main, const bool names[]) {
+ void fss_read_process_normal_line(void * const void_main, const bool names[]) {
if (!void_main) return;
fss_read_main_t * const main = (fss_read_main_t *) void_main;
- const f_array_lengths_t * const delimits = !(main->setting.flag & fss_read_main_flag_original_e) && fss_read_delimit_object_is(main, 0) ? &main->setting.delimits : &fss_read_except_none_c;
-
f_array_length_t line = 0;
for (f_array_length_t i = 0; i < main->setting.contents.used; ++i) {
if (line == main->setting.line) {
if (main->callback.print_at) {
- main->callback.print_at(main, i, *delimits, fss_read_except_none_c);
+ main->callback.print_at(
+ main,
+ i,
+ !(main->setting.flag & fss_read_main_flag_original_e) && fss_read_delimit_object_is(main, 0)
+ ? main->setting.delimits_object
+ : fss_read_except_none_c,
+ !(main->setting.flag & fss_read_main_flag_original_e) && fss_read_delimit_content_is(main, 0)
+ ? main->setting.delimits_content
+ : fss_read_except_none_c
+ );
}
break;
#endif // _di_fss_read_process_normal_line_
#ifndef _di_fss_read_process_normal_name_
- void fss_read_process_normal_name(void * const main, const bool names[]) {
+ void fss_read_process_normal_name(void * const void_main, bool names[]) {
if (!void_main) return;
if (fss_read_signal_check(main)) return;
- if (f_compare_dynamic_partial_except_trim_dynamic(main->setting.depths.array[0].value_name, main->setting.buffer, main->setting.objects.array[i], fss_read_except_none_c, main->setting.delimits) == F_equal_to) {
+ if (f_compare_dynamic_partial_except_trim_dynamic(main->setting.depths.array[0].value_name, main->setting.buffer, main->setting.objects.array[i], fss_read_except_none_c, main->setting.delimits_object) == F_equal_to) {
names[i] = F_true;
}
} // for
if (fss_read_signal_check(main)) return;
- if (f_compare_dynamic_partial_except_dynamic(main->setting.depths.array[0].value_name, main->setting.buffer, main->setting.objects.array[i], fss_read_except_none_c, main->setting.delimits) == F_equal_to) {
+ if (f_compare_dynamic_partial_except_dynamic(main->setting.depths.array[0].value_name, main->setting.buffer, main->setting.objects.array[i], fss_read_except_none_c, main->setting.delimits_object) == F_equal_to) {
names[i] = F_true;
}
} // for
#endif // _di_fss_read_process_normal_name_
#ifndef _di_fss_read_process_normal_total_
- void fss_read_process_normal_total(void * const main, const bool names[]) {
+ void fss_read_process_normal_total(void * const void_main, const bool names[]) {
if (!void_main) return;
* @see fss_read_signal_check()
*/
#ifndef _di_fss_read_process_normal_name_
- extern void fss_read_process_normal_name(void * const main, const bool names[]);
+ extern void fss_read_process_normal_name(void * const main, bool names[]);
#endif // _di_fss_read_process_normal_name_
/**
f_array_length_t length = 0;
f_string_range_t range = f_string_range_t_initialize;
+ // @todo much of this is copied from fss_write and needs to be updated or removed accordingly.
+
const f_array_length_t used_objects = main->setting.objects.used;
- const f_array_length_t used_contentss = main->setting.contentss.used;
- const f_array_length_t used_ignoress = main->setting.ignoress.used;
+ const f_array_length_t used_contents = main->setting.contents.used;
+ // @fixme really? why am I setting a pointer to the used position, which may not even be allocated? Review this and perhaps first pre-allocate the space so the used is within the size.
main->setting.object = &main->setting.objects.array[used_objects];
- main->setting.contents = &main->setting.contentss.array[used_contentss];
- main->setting.ignores = &main->setting.ignoress.array[used_ignoress];
+ main->setting.contents = &main->setting.contents.array[used_contents];
// 0x0 = nothing printed, 0x1 = something printed, 0x2 = ignore enabled, 0x4 = added Content for Object, 0x8 = "payload" matched.
uint8_t flag = 0;
return;
}
- // This is processed in a single set, so there is only ever one Ignores added.
- main->setting.state.status = f_string_rangess_increase(main->setting.state.step_small, &main->setting.ignoress);
-
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_rangess_increase));
-
- return;
- }
-
// Reset all of the used data before starting the loop.
main->setting.object->used = 0;
main->setting.contents->used = 0;
- main->setting.ignores->used = 0;
for (;;) {
// Reset all of the used data for next set.
main->setting.object->used = 0;
main->setting.contents->used = 0;
- main->setting.ignores->used = 0;
continue;
}
// Reset all of the used data for next set.
main->setting.object->used = 0;
main->setting.contents->used = 0;
- main->setting.ignores->used = 0;
}
} // for
main->setting.buffer.used = 0;
main->setting.object->used = 0;
main->setting.contents->used = 0;
- main->setting.ignores->used = 0;
main->setting.objects.used = used_objects;
- main->setting.contentss.used = used_contentss;
- main->setting.ignoress.used = used_ignoress;
+ main->setting.contentss.used = used_contents;
if (F_status_is_error_not(main->setting.state.status)) {
if (flag & 0x1) {
const f_string_static_t *prepend = 0;
if (main->setting.flag & fss_read_main_flag_prepend_e) {
- const f_array_length_t index = main->program.parameters.array[fss_read_parameter_prepend_e].values.array[main->program.parameters.array[fss_read_parameter_prepend_e].values.used - 1];
+ const f_array_length_t index = main->program.parameters.array[fss_read_parameter_prepend_e].values.array[main->program.parameters.array[fss_read_parameter_prepend_e].location]];
prepend = &main->program.parameters.arguments.array[index];
}
}
if ((main->setting.flag & fss_read_main_flag_partial_e) && !(main->setting.flag & fss_read_main_flag_object_e) || !(main->setting.flag & (fss_read_main_flag_object_e | fss_read_main_flag_content_e))) {
- if (main->setting.flag & fss_read_main_flag_content_end_e) {
- main->setting.state.status = f_string_dynamic_append(f_fss_basic_list_close_s, &main->setting.buffer);
+ main->setting.state.status = f_string_dynamic_append(f_fss_basic_list_close_s, &main->setting.buffer);
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
+ if (F_status_is_error(main->setting.state.status)) {
+ fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
- return;
- }
+ return;
}
}
}
// FLL-2 includes.
#include <fll/level_2/error.h>
+#include <fll/level_2/fss/extended.h>
#include <fll/level_2/fss/payload.h>
#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#include <program/fss_read/main/common/string.h>
#include <program/fss_read/main/common/type.h>
#include <program/fss_read/main/common.h>
+#include <program/fss_read/main/print/data.h>
#include <program/fss_read/main/print/error.h>
#include <program/fss_read/main/print/message.h>
#include <program/fss_read/main/process_normal.h>
data.setting.state.custom = (void *) &data;
data.setting.standard = fss_read_payload_standard_s;
- // @todo see if there needs to be this: data.callback.process_pipe = &fss_read_payload_process_pipe;
+ data.callback.process_pipe = &fss_read_payload_process_pipe;
data.callback.process_help = &fss_read_payload_process_help;
data.callback.process_last_line = &fss_read_process_last_line;
//data.callback.process_load_depth = &fss_read_setting_load_depth;
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
-build_sources_library main/fss_read.c main/common.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/static.c main/common/string.c main/common/type.c main/print/error.c main/print/message.c main/process_normal.c main/signal.c main/thread.c
+build_sources_library main/fss_read.c main/common.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/static.c main/common/string.c main/common/type.c main/print/data.c main/print/error.c main/print/message.c main/process_normal.c main/signal.c main/thread.c
build_sources_library basic/fss_read.c basic/common.c basic/print.c
build_sources_library basic_list/fss_read.c basic_list/common.c basic_list/print.c
build_sources_library embedded_list/fss_read.c embedded_list/common.c embedded_list/print.c
build_sources_library extended_list/fss_read.c extended_list/common.c extended_list/print.c
build_sources_library payload/fss_read.c payload/common.c payload/print.c
-build_sources_headers main/fss_read.h main/common.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/static.h main/common/string.h main/common/type.h main/print/error.h main/print/message.h main/process_normal.h main/signal.h main/thread.h
+build_sources_headers main/fss_read.h main/common.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/static.h main/common/string.h main/common/type.h main/print/data.h main/print/error.h main/print/message.h main/process_normal.h main/signal.h main/thread.h
build_sources_headers basic/fss_read.h basic/common.h basic/print.h basic/private-common.h
build_sources_headers basic_list/fss_read.h basic_list/common.h basic_list/print.h
build_sources_headers embedded_list/fss_read.h embedded_list/common.h embedded_list/print.h
}
if ((main->program.parameters.array[fss_write_parameter_prepend_e].result & f_console_result_value_e) && main->program.parameters.array[fss_write_parameter_prepend_e].values.used) {
- const f_array_length_t index = main->program.parameters.array[fss_write_parameter_prepend_e].values.array[main->program.parameters.array[fss_write_parameter_prepend_e].values.used - 1];
+ const f_array_length_t index = main->program.parameters.array[fss_write_parameter_prepend_e].values.array[main->program.parameters.array[fss_write_parameter_prepend_e].location];
main->setting.prepend.used = 0;
const f_string_static_t *prepend = 0;
if (main->setting.flag & fss_write_main_flag_prepend_e) {
- const f_array_length_t index = main->program.parameters.array[fss_write_parameter_prepend_e].values.array[main->program.parameters.array[fss_write_parameter_prepend_e].values.used - 1];
+ const f_array_length_t index = main->program.parameters.array[fss_write_parameter_prepend_e].values.array[main->program.parameters.array[fss_write_parameter_prepend_e].location];
prepend = &main->program.parameters.arguments.array[index];
}
return;
}
- const f_array_length_t index = main->program.parameters.array[iki_read_parameter_at_e].values.array[main->program.parameters.array[iki_read_parameter_at_e].values.used - 1];
+ const f_array_length_t index = main->program.parameters.array[iki_read_parameter_at_e].values.array[main->program.parameters.array[iki_read_parameter_at_e].location];
main->setting.at = 0;
}
if (main->program.parameters.array[iki_read_parameter_line_e].result & f_console_result_value_e) {
- const f_array_length_t index = main->program.parameters.array[iki_read_parameter_line_e].values.array[main->program.parameters.array[iki_read_parameter_line_e].values.used - 1];
+ const f_array_length_t index = main->program.parameters.array[iki_read_parameter_line_e].values.array[main->program.parameters.array[iki_read_parameter_line_e].location];
main->setting.line = 0;