fll_fss_basic_read(main->setting.buffer, &main->setting.range, &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(main->setting.state.status)) {
- if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
-
- // Handle knownable errors with more user-friendly messages.
- switch (F_status_set_fine(main->setting.state.status)) {
- case F_end_not_eos:
- case F_end_not_group_eos:
- case F_end_not_group_stop:
- case F_end_not_nest_eos:
- case F_end_not_nest_stop:
- case F_end_not_stop:
- fss_read_print_error_fss_end_early(&main->program.error, fss_read_file_identify(main->setting.range.start, main->setting.files));
-
- break;
-
- default:
- fll_error_file_print(
- &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(main->setting.range.start, main->setting.files),
- f_file_operation_process_s,
- fll_error_file_type_file_e
- );
- }
+ fss_read_print_error_fss_read(&main->program.error, macro_fss_read_f(fll_fss_basic_read));
return;
}
fll_fss_basic_list_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
- if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
-
- // Handle knownable errors with more user-friendly messages.
- switch (F_status_set_fine(main->setting.state.status)) {
- case F_end_not_eos:
- case F_end_not_group_eos:
- case F_end_not_group_stop:
- case F_end_not_nest_eos:
- case F_end_not_nest_stop:
- case F_end_not_stop:
- fss_read_print_error_fss_end_early(&main->program.error, fss_read_file_identify(main->setting.range.start, main->setting.files));
-
- break;
-
- default:
- fll_error_file_print(
- &main->program.error,
- F_status_set_fine(main->setting.state.status),
- macro_fss_read_f(fll_fss_basic_list_read),
- fll_error_file_flag_fallback_e,
- fss_read_file_identify(main->setting.range.start, main->setting.files),
- f_file_operation_process_s,
- fll_error_file_type_file_e
- );
- }
+ fss_read_print_error_fss_read(&main->program.error, macro_fss_read_f(fll_fss_basic_list_read));
return;
}
}
if (F_status_is_error(main->setting.state.status)) {
- if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
-
- // Handle knownable errors with more user-friendly messages.
- switch (F_status_set_fine(main->setting.state.status)) {
- case F_end_not_eos:
- case F_end_not_group_eos:
- case F_end_not_group_stop:
- case F_end_not_nest_eos:
- case F_end_not_nest_stop:
- case F_end_not_stop:
- fss_read_print_error_fss_end_early(&main->program.error, fss_read_file_identify(main->setting.range.start, main->setting.files));
-
- break;
-
- default:
- fll_error_file_print(
- &main->program.error,
- F_status_set_fine(main->setting.state.status),
- macro_fss_read_f(fll_fss_embedded_list_read),
- fll_error_file_flag_fallback_e,
- fss_read_file_identify(main->setting.range.start, main->setting.files),
- f_file_operation_process_s,
- fll_error_file_type_file_e
- );
- }
+ fss_read_print_error_fss_read(&main->program.error, macro_fss_read_f(fll_fss_embedded_list_read));
return;
}
fll_fss_extended_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.quotes_content, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
- if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
-
- // Handle knownable errors with more user-friendly messages.
- switch (F_status_set_fine(main->setting.state.status)) {
- case F_end_not_eos:
- case F_end_not_group_eos:
- case F_end_not_group_stop:
- case F_end_not_nest_eos:
- case F_end_not_nest_stop:
- case F_end_not_stop:
- fss_read_print_error_fss_end_early(&main->program.error, fss_read_file_identify(main->setting.range.start, main->setting.files));
-
- break;
-
- default:
- fll_error_file_print(
- &main->program.error,
- F_status_set_fine(main->setting.state.status),
- macro_fss_read_f(fll_fss_extended_read),
- fll_error_file_flag_fallback_e,
- fss_read_file_identify(main->setting.range.start, main->setting.files),
- f_file_operation_process_s,
- fll_error_file_type_file_e
- );
- }
+ fss_read_print_error_fss_read(&main->program.error, macro_fss_read_f(fll_fss_extended_read));
return;
}
fll_fss_extended_list_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.closes, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
- if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
-
- // Handle knownable errors with more user-friendly messages.
- switch (F_status_set_fine(main->setting.state.status)) {
- case F_end_not_eos:
- case F_end_not_group_eos:
- case F_end_not_group_stop:
- case F_end_not_nest_eos:
- case F_end_not_nest_stop:
- case F_end_not_stop:
- fss_read_print_error_fss_end_early(&main->program.error, fss_read_file_identify(main->setting.range.start, main->setting.files));
-
- break;
-
- default:
- fll_error_file_print(
- &main->program.error,
- F_status_set_fine(main->setting.state.status),
- macro_fss_read_f(fll_fss_extended_list_read),
- fll_error_file_flag_fallback_e,
- fss_read_file_identify(main->setting.range.start, main->setting.files),
- f_file_operation_process_s,
- fll_error_file_type_file_e
- );
- }
+ fss_read_print_error_fss_read(&main->program.error, macro_fss_read_f(fll_fss_extended_list_read));
return;
}
}
#endif // _di_fss_read_print_error_fss_end_early_
+#ifndef _di_fss_read_print_error_fss_read_
+ f_status_t fss_read_print_error_fss_read(fl_print_t * const print, const f_string_t function) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ fss_read_main_t * const main = (fss_read_main_t *) print->custom;
+
+ switch (F_status_set_fine(main->setting.state.status)) {
+ case F_interrupt:
+ return F_output_not;
+
+ case F_end_not_eos:
+ case F_end_not_group_eos:
+ case F_end_not_group_stop:
+ case F_end_not_nest_eos:
+ case F_end_not_nest_stop:
+ case F_end_not_stop:
+ return fss_read_print_error_fss_end_early(&main->program.error, fss_read_file_identify(main->setting.range.start, main->setting.files));
+ }
+
+ return fll_error_file_print(
+ &main->program.error,
+ F_status_set_fine(main->setting.state.status),
+ function,
+ fll_error_file_flag_fallback_e,
+ fss_read_file_identify(main->setting.range.start, main->setting.files),
+ f_file_operation_process_s,
+ fll_error_file_type_file_e
+ );
+ }
+#endif // _di_fss_read_print_error_fss_read_
+
#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_fss_end_early_
/**
+ * Print FSS read error messages, handling known errors.
+ *
+ * This is intended to be called to handle errors from the various FSS read functions, such as fll_fss_basic_read().
+ *
+ * @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.
+ * @param function
+ * (optional) The name of the function where the error happened.
+ *
+ * Set to NULL to disable.
+ *
+ * @return
+ * F_okay 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_file_print()
+ */
+#ifndef _di_fss_read_print_error_fss_read_
+ extern f_status_t fss_read_print_error_fss_read(fl_print_t * const print, const f_string_t function);
+#endif // _di_fss_read_print_error_fss_read_
+
+/**
* Print an error message about the parameter requires something that is explained by the message parameter.
*
* @param print
fll_fss_payload_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
- if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
+ switch (F_status_set_fine(main->setting.state.status)) {
+ case F_okay_stop:
+ case F_okay_eos:
+ if (main->setting.flag & fss_read_main_flag_payload_error_d) {
+ fss_read_payload_print_problem_payload_missing(&main->program.error);
- if (main->setting.state.status == F_status_set_error(F_okay_stop) || main->setting.state.status == F_status_set_error(F_okay_eos)) {
- if (main->setting.flag & fss_read_main_flag_payload_error_d) {
- fss_read_payload_print_problem_payload_missing(&main->program.error);
-
- return;
- }
-
- if (main->setting.flag & (fss_read_main_flag_payload_error_d | fss_read_main_flag_payload_warn_d)) {
- if (main->program.warning.verbosity > f_console_verbosity_normal_e) {
- fss_read_payload_print_problem_payload_missing(&main->program.warning);
+ break;
}
- main->setting.state.status = F_okay;
- }
- else if (main->setting.flag & fss_read_main_flag_payload_create_d) {
- main->setting.state.status = f_string_dynamic_append_assure(f_string_eol_s, &main->setting.buffer);
+ if (main->setting.flag & (fss_read_main_flag_payload_error_d | fss_read_main_flag_payload_warn_d)) {
+ if (main->program.warning.verbosity > f_console_verbosity_normal_e) {
+ fss_read_payload_print_problem_payload_missing(&main->program.warning);
+ }
- if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append_assure));
+ main->setting.state.status = F_okay;
}
- else {
- main->setting.state.status = f_memory_array_increase(main->setting.state.step_small, sizeof(f_range_t), (void **) &main->setting.objects.array, &main->setting.objects.used, &main->setting.objects.size);
-
- if (F_status_is_error_not(main->setting.state.status)) {
- main->setting.state.status = f_memory_array_increase(main->setting.state.step_small, sizeof(f_ranges_t), (void **) &main->setting.contents.array, &main->setting.contents.used, &main->setting.contents.size);
- }
+ else if (main->setting.flag & fss_read_main_flag_payload_create_d) {
+ main->setting.state.status = f_string_dynamic_append_assure(f_string_eol_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_memory_array_increase));
+ fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append_assure));
}
else {
- main->setting.objects.array[main->setting.objects.used].start = main->setting.buffer.used;
-
- main->setting.state.status = f_string_dynamic_append(f_fss_payload_s, &main->setting.buffer);
-
- if (F_status_is_error_not(main->setting.state.status)) {
- main->setting.state.status = f_string_dynamic_append(f_fss_payload_list_open_s, &main->setting.buffer);
- }
+ main->setting.state.status = f_memory_array_increase(main->setting.state.step_small, sizeof(f_range_t), (void **) &main->setting.objects.array, &main->setting.objects.used, &main->setting.objects.size);
if (F_status_is_error_not(main->setting.state.status)) {
- main->setting.state.status = f_string_dynamic_append(f_fss_payload_list_open_end_s, &main->setting.buffer);
+ main->setting.state.status = f_memory_array_increase(main->setting.state.step_small, sizeof(f_ranges_t), (void **) &main->setting.contents.array, &main->setting.contents.used, &main->setting.contents.size);
}
if (F_status_is_error(main->setting.state.status)) {
- fss_read_print_error(&main->program.error, macro_fss_read_f(f_string_dynamic_append));
+ fss_read_print_error(&main->program.error, macro_fss_read_f(f_memory_array_increase));
}
else {
- main->setting.objects.array[main->setting.objects.used].stop = main->setting.objects.array[main->setting.objects.used].start + f_fss_payload_s.used - 1;
- main->setting.contents.array[main->setting.contents.used++].used = 0;
- ++main->setting.objects.used;
+ main->setting.objects.array[main->setting.objects.used].start = main->setting.buffer.used;
+
+ main->setting.state.status = f_string_dynamic_append(f_fss_payload_s, &main->setting.buffer);
+
+ if (F_status_is_error_not(main->setting.state.status)) {
+ main->setting.state.status = f_string_dynamic_append(f_fss_payload_list_open_s, &main->setting.buffer);
+ }
+
+ if (F_status_is_error_not(main->setting.state.status)) {
+ main->setting.state.status = f_string_dynamic_append(f_fss_payload_list_open_end_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));
+ }
+ else {
+ main->setting.objects.array[main->setting.objects.used].stop = main->setting.objects.array[main->setting.objects.used].start + f_fss_payload_s.used - 1;
+ main->setting.contents.array[main->setting.contents.used++].used = 0;
+ ++main->setting.objects.used;
- main->setting.state.status = F_okay;
+ main->setting.state.status = F_okay;
+ }
}
}
}
+
+ break;
+
+ default:
+ fss_read_print_error_fss_read(&main->program.error, macro_fss_read_f(fll_fss_payload_read));
}
- }
- else {
- fll_error_file_print(
- &main->program.error,
- F_status_set_fine(main->setting.state.status),
- macro_fss_read_f(fll_fss_payload_read),
- fll_error_file_flag_fallback_e,
- fss_read_file_identify(main->setting.range.start, main->setting.files),
- f_file_operation_process_s,
- fll_error_file_type_file_e
- );
return;
- }
}
if (main->setting.state.status == F_data_not_stop || main->setting.state.status == F_data_not_eos) {