This focuses mostly on utf8.
Do some file restructuring.
Perform the new f_state_t and f_status_t related changes.
build_sources_program fll/level_2/print.c
build_sources_program fll/level_2/program.c fll/level_2/program/common.c fll/level_2/program/print.c fll/level_2/private-program.c
-build_sources_program program/utf8/common.c program/utf8/print.c program/utf8/utf8.c
-build_sources_program program/utf8/private-common.c program/utf8/private-utf8.c program/utf8/private-utf8_bytesequence.c program/utf8/private-utf8_codepoint.c
+build_sources_program program/utf8/common.c program/utf8/bytesequence.c program/utf8/codepoint.c program/utf8/print.c program/utf8/process.c program/utf8/utf8.c
build_sources_program program/utf8/main.c
if (as.id_groups) {
if (setgroups(as.id_groups->used, (const gid_t *) as.id_groups->array) == -1) {
-
if (parameter && parameter->option & FL_execute_parameter_option_exit_d) {
exit(F_execute_group);
}
int descriptors[2] = { -1, -1 };
if (as) {
- if (pipe(descriptors) == -1) {
- return F_status_set_error(F_pipe);
- }
+ if (pipe(descriptors) == -1) return F_status_set_error(F_pipe);
}
const pid_t id_process = fork();
// Close the write pipe for the parent when finished writing.
close(descriptors[1]);
- if (F_status_is_error(status)) {
- return status;
- }
+ if (F_status_is_error(status)) return status;
}
}
// This must explicitly check for 0 (as opposed to checking (!result)).
if (result != 0) {
- if (WIFEXITED(*((int *) result))) {
- return F_none;
- }
+ if (WIFEXITED(*((int *) result))) return F_none;
return F_status_set_error(F_failure);
}
int descriptors[2] = { -1, -1 };
- if (pipe(descriptors) == -1) {
- return F_status_set_error(F_pipe);
- }
+ if (pipe(descriptors) == -1) return F_status_set_error(F_pipe);
const pid_t id_process = fork();
// Close the write pipe for the parent when finished writing.
close(descriptors[1]);
- if (F_status_is_error(status)) {
- return status;
- }
+ if (F_status_is_error(status)) return status;
}
if (parameter && parameter->option & FL_execute_parameter_option_return_d) {
// This must explicitly check for 0 (as opposed to checking (!result)).
if (result != 0) {
- if (WIFEXITED(*((int *) result))) {
- return F_none;
- }
+ if (WIFEXITED(*((int *) result))) return F_none;
return F_status_set_error(F_failure);
}
status = f_directory_is(path);
if (F_status_is_error(status)) return status;
- if (status == F_false) {
- return f_file_mode_set(path, mode);
- }
+ if (status == F_false) return f_file_mode_set(path, mode);
f_directory_listing_t listing = f_directory_listing_t_initialize;
status = f_directory_is(path);
if (F_status_is_error(status)) return status;
- if (status == F_false) {
- return f_file_role_change(path, uid, gid, dereference);
- }
+ if (status == F_false) return f_file_role_change(path, uid, gid, dereference);
f_directory_listing_t listing = f_directory_listing_t_initialize;
if (buffer.string[range->start]) break;
}
- if (range->start > range->stop) {
- return F_data_not;
- }
+ if (range->start > range->stop) return F_data_not;
// The first character must be a '#'.
if (buffer.string[range->start] != f_fss_pound_s.string[0]) {
f_status_t status = f_utf_is_whitespace(buffer.string + range->start, (range->stop - range->start) + 1, F_false);
- if (F_status_is_error(status)) {
- if (F_status_set_fine(status) == F_maybe) {
- return F_status_set_error(F_complete_not_utf);
- }
-
- return status;
- }
+ if (F_status_is_error(status)) return (F_status_set_fine(status) == F_maybe) ? F_status_set_error(F_complete_not_utf) : status;
if (status == F_false) {
} while (range->start <= range->stop);
if (ids) {
- if (ids->used) {
- if (found_fss) {
- return F_found;
- }
-
- return F_maybe;
- }
- }
- else if (id.used) {
- if (found_fss) {
- return F_found;
- }
-
- return F_maybe;
+ if (ids->used) return found_fss ? F_found : F_maybe;
}
+ else if (id.used) return found_fss ? F_found : F_maybe;
return F_found_not;
}
if (status == F_equal_to) {
matched = F_true;
+
break;
}
} // for
f_status_t status = F_none;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_byte_dump_setting_load_
- extern void byte_dump_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, byte_dump_setting_t * const setting, f_state_t * const state);
+ extern void byte_dump_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, byte_dump_setting_t * const setting);
#endif // _di_byte_dump_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
#endif // _di_byte_dump_setting_delete_
#ifndef _di_byte_dump_setting_load_
- void byte_dump_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, byte_dump_setting_t * const setting) {
+ void byte_dump_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, byte_dump_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
byte_dump_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
byte_dump_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
byte_dump_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
byte_dump_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
byte_dump_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
byte_dump_print_line_last_locked(setting, main->error);
return;
#define byte_dump_setting_t_initialize \
{ \
byte_dump_main_flag_none_e, \
- f_state_initialize_t, \
+ f_state_t_initialize, \
f_string_static_t_initialize, \
f_string_static_t_initialize, \
}
#endif // _di_byte_dump_setting_t_
+/**
+ * Perform the standard program setting load process.
+ *
+ * This prints error messages as appropriate.
+ *
+ * If either main or setting is NULL, then this immediately returns without doing anything.
+ *
+ * @param arguments
+ * The parameters passed to the process (often referred to as command line arguments).
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
+ *
+ * This alters setting.state.status:
+ * F_none on success.
+ *
+ * Errors (with error bit) from: f_console_parameter_process().
+ * Errors (with error bit) from: f_file_stream_open().
+ * Errors (with error bit) from: f_string_dynamics_resize().
+ * Errors (with error bit) from: fll_program_parameter_process_context().
+ * Errors (with error bit) from: fll_program_parameter_process_verbosity().
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
+ *
+ * @see f_console_parameter_process()
+ * @see f_file_stream_open()
+ * @see f_string_dynamics_resize()
+ * @see fll_program_parameter_process_context()
+ * @see fll_program_parameter_process_verbosity()
+ */
+#ifndef _di_byte_dump_setting_load_
+ extern void byte_dump_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, byte_dump_setting_t * const setting);
+#endif // _di_byte_dump_setting_load_
+
#ifdef __cplusplus
} // extern "C"
#endif
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- byte_dump_setting_load(arguments, state, &data, &setting);
+ byte_dump_setting_load(arguments, &data, &setting);
}
byte_dump_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & byte_dump_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & byte_dump_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & byte_dump_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & byte_dump_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param output
* The file to print to.
* @param context
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
#endif // _di_control_setting_delete_
#ifndef _di_control_setting_load_
- void control_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, control_setting_t * const setting) {
+ void control_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, control_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
control_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
control_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
control_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
control_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
control_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
control_print_line_last_locked(setting, main->error);
return;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_control_setting_load_
- extern void control_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, control_setting_t * const setting, f_state_t * const state);
+ extern void control_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, control_setting_t * const setting);
#endif // _di_control_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
f_status_t status = F_none;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- control_setting_load(arguments, state, &data, &setting);
+ control_setting_load(arguments, &data, &setting);
}
control_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & control_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & control_main_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & control_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & control_main_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & control_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & control_main_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & control_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & control_main_flag_file_to_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
#endif // _di_controller_setting_delete_
#ifndef _di_controller_setting_load_
- void controller_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, controller_setting_t * const setting) {
+ void controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, controller_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
controller_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
controller_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
controller_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
controller_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
controller_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
controller_print_line_last_locked(setting, main->error);
return;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_controller_setting_load_
- extern void controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, controller_setting_t * const setting, f_state_t * const state);
+ extern void controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, controller_setting_t * const setting);
#endif // _di_controller_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
f_status_t status = F_none;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- controller_setting_load(arguments, state, &data, &setting);
+ controller_setting_load(arguments, &data, &setting);
}
controller_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & controller_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & controller_main_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & controller_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & controller_main_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & controller_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & controller_main_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & controller_main_flag_verify_e) return;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & controller_main_flag_file_to_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param name
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param mode
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param directory
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param symbol_1
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param name
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param name_1
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param name
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param name_1
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param name
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param from
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
#endif // _di_fake_setting_delete_
#ifndef _di_fake_setting_load_
- void fake_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, fake_setting_t * const setting) {
+ void fake_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fake_setting_t * const setting) {
if (!main || !setting) return;
data.main = main;
data.setting = setting;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, state, (void *) &data);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, (void *) &data);
}
- if (F_status_is_error(setting->status)) {
- fake_print_error(setting, main->error, setting->status, macro_fake_f(f_console_parameter_process));
+ if (F_status_is_error(setting->state.status)) {
+ fake_print_error(setting, main->error, setting->state.status, macro_fake_f(f_console_parameter_process));
return;
}
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
- fake_print_error(setting, main->error, setting->status, macro_fake_f(fll_program_parameter_process_context));
+ if (F_status_is_error(setting->state.status)) {
+ fake_print_error(setting, main->error, setting->state.status, macro_fake_f(fll_program_parameter_process_context));
return;
}
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
- fake_print_error(setting, main->error, setting->status, macro_fake_f(fll_program_parameter_process_verbosity));
+ if (F_status_is_error(setting->state.status)) {
+ fake_print_error(setting, main->error, setting->state.status, macro_fake_f(fll_program_parameter_process_verbosity));
return;
}
for (i = 0; i < 9; ++i) {
if ((main->parameters.array[parameters[i]].result & f_console_result_found_e) && !(main->parameters.array[parameters[i]].result & f_console_result_value_e)) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
if (main->error.verbosity > f_console_verbosity_quiet_e) {
fake_print_line_first_locked(setting, main->error);
if (parameters[i] == fake_parameter_process_e) {
for (j = 0; j < main->parameters.arguments.array[index].used; ++j) {
- setting->status = f_utf_is_word_dash_plus(main->parameters.arguments.array[index].string + j, main->parameters.arguments.array[index].used - j, F_false);
+ setting->state.status = f_utf_is_word_dash_plus(main->parameters.arguments.array[index].string + j, main->parameters.arguments.array[index].used - j, F_false);
// @todo fix this to print an error about the actual invalid character so that it can be investigated.
- if (F_status_is_error(setting->status)) {
- if (fake_print_error_fallback(setting, main->error, setting->status, macro_fake_f(f_utf_is_word_dash_plus)) == F_false) {
+ if (F_status_is_error(setting->state.status)) {
+ if (fake_print_error_fallback(setting, main->error, setting->state.status, macro_fake_f(f_utf_is_word_dash_plus)) == F_false) {
fll_program_print_error_parameter_process(main->error, f_console_symbol_long_normal_s, names[i]);
}
return;
}
- if (setting->status == F_false) {
- setting->status = F_status_set_error(F_parameter);
+ if (setting->state.status == F_false) {
+ setting->state.status = F_status_set_error(F_parameter);
fake_print_error_parameter_not_word(setting, main->error, f_console_symbol_long_normal_s, names[i], main->parameters.arguments.array[index]);
}
if (cleanups[i]) {
- setting->status = f_path_directory_cleanup(main->parameters.arguments.array[index], variable[i]);
+ setting->state.status = f_path_directory_cleanup(main->parameters.arguments.array[index], variable[i]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
fake_print_line_first_locked(setting, main->error);
- if (fake_print_error_fallback(setting, main->error, setting->status, macro_fake_f(f_path_directory_cleanup)) == F_false) {
+ if (fake_print_error_fallback(setting, main->error, setting->state.status, macro_fake_f(f_path_directory_cleanup)) == F_false) {
fll_program_print_error_parameter_process(main->error, f_console_symbol_long_normal_s, names[i]);
}
}
// De-allocate memory before replacing it with a statically allocated string.
if (variable[i]->size) {
- setting->status = f_string_dynamic_resize(0, variable[i]);
+ setting->state.status = f_string_dynamic_resize(0, variable[i]);
- if (F_status_is_error(setting->status)) {
- fake_print_error(setting, main->error, setting->status, macro_fake_f(f_string_dynamic_resize));
+ if (F_status_is_error(setting->state.status)) {
+ fake_print_error(setting, main->error, setting->state.status, macro_fake_f(f_string_dynamic_resize));
return;
}
}
if (!variable[i]->used) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fake_print_error_parameter_not_empty(setting, main->error, f_console_symbol_long_normal_s, names[i], main->parameters.arguments.array[index]);
return;
}
- setting->status = F_none;
+ setting->state.status = F_none;
}
}
else {
// De-allocate memory before replacing it with a statically allocated string.
if (variable[i]->size) {
- setting->status = f_string_dynamic_resize(0, variable[i]);
+ setting->state.status = f_string_dynamic_resize(0, variable[i]);
- if (F_status_is_error(setting->status)) {
- fake_print_error(setting, main->error, setting->status, macro_fake_f(f_string_dynamic_resize));
+ if (F_status_is_error(setting->state.status)) {
+ fake_print_error(setting, main->error, setting->state.status, macro_fake_f(f_string_dynamic_resize));
return;
}
for (i = 0; i < 2; ++i) {
if ((main->parameters.array[parameters[i]].result & f_console_result_found_e) && !(main->parameters.array[parameters[i]].result & f_console_result_value_e)) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
if (main->error.verbosity > f_console_verbosity_quiet_e) {
fake_print_line_first_locked(setting, main->error);
}
if (main->parameters.array[parameters[i]].result & f_console_result_value_e) {
- setting->status = fll_program_parameter_additional_rip(main->parameters.arguments.array, main->parameters.array[parameters[i]].values, variable[i]);
+ setting->state.status = fll_program_parameter_additional_rip(main->parameters.arguments.array, main->parameters.array[parameters[i]].values, variable[i]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
if (main->error.verbosity > f_console_verbosity_quiet_e) {
fake_print_line_first_locked(setting, main->error);
- if (fake_print_error_fallback(setting, main->error, setting->status, macro_fake_f(fll_program_parameter_additional_rip)) == F_false) {
+ if (fake_print_error_fallback(setting, main->error, setting->state.status, macro_fake_f(fll_program_parameter_additional_rip)) == F_false) {
fll_program_print_error_parameter_process(main->error, f_console_symbol_long_normal_s, names[i]);
}
}
width_max = main->parameters.arguments.array[i].used - j;
- setting->status = f_utf_is_word_dash_plus(main->parameters.arguments.array[i].string + j, width_max, F_false);
+ setting->state.status = f_utf_is_word_dash_plus(main->parameters.arguments.array[i].string + j, width_max, F_false);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
// @todo fix this to print an error about the actual invalid character so that it can be investigated.
- if (fake_print_error_fallback(setting, main->error, setting->status, macro_fake_f(f_utf_is_word_dash_plus)) == F_false) {
+ if (fake_print_error_fallback(setting, main->error, setting->state.status, macro_fake_f(f_utf_is_word_dash_plus)) == F_false) {
fll_program_print_error_parameter_process(main->error, f_console_symbol_long_normal_s, names[i]);
}
return;
}
- if (setting->status == F_false) {
- setting->status = F_status_set_error(F_parameter);
+ if (setting->state.status == F_false) {
+ setting->state.status = F_status_set_error(F_parameter);
fake_print_error_parameter_not_word(setting, main->error, f_console_symbol_long_normal_s, names[i], main->parameters.arguments.array[i]);
setting->flag |= fake_main_flag_operation_make_e;
setting->flag -= setting->flag & fake_main_flag_operation_e;
- setting->status = f_uint8s_increase_by(1, &setting->operations);
+ setting->state.status = f_uint8s_increase_by(1, &setting->operations);
- if (F_status_is_error(setting->status)) {
- fake_print_error(setting, main->error, setting->status, macro_fake_f(f_uint8s_increase_by));
+ if (F_status_is_error(setting->state.status)) {
+ fake_print_error(setting, main->error, setting->state.status, macro_fake_f(f_uint8s_increase_by));
return;
}
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fake_setting_load_
- extern void fake_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fake_setting_t * const setting, f_state_t * const state);
+ extern void fake_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fake_setting_t * const setting);
#endif // _di_fake_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
if (!main || !setting) return;
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fake_print_line_last_locked(setting, main->error);
return;
}
- setting->status = F_none;
+ setting->state.status = F_none;
if (setting->flag & fake_main_flag_help_e) {
fake_print_help(setting, main->message);
}
if ((setting->flag & fake_main_flag_operation_build_e) && (setting->flag & fake_main_flag_operation_make_e)) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fake_print_error_parameter_operation_not_with(setting, main->error, fake_other_operation_build_s, fake_other_operation_make_s);
data.main = main;
data.setting = setting;
- setting->status = fake_path_generate(&data);
+ setting->state.status = fake_path_generate(&data);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fake_data_delete(&data);
return;
if ((main->pipe & fll_program_data_pipe_input_e) && !(data.setting->flag & fake_main_flag_operation_e)) {
data.file_data_build_fakefile.used = 0;
- setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &data.file_data_build_fakefile);
+ setting->state.status = f_string_dynamic_append(f_string_ascii_minus_s, &data.file_data_build_fakefile);
- if (F_status_is_error(setting->status)) {
- fake_print_error(setting, main->error, setting->status, macro_fake_f(f_string_dynamic_append));
+ if (F_status_is_error(setting->state.status)) {
+ fake_print_error(setting, main->error, setting->state.status, macro_fake_f(f_string_dynamic_append));
}
else {
setting->fakefile.used = 0;
- setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &setting->fakefile);
+ setting->state.status = f_string_dynamic_append(f_string_ascii_minus_s, &setting->fakefile);
}
}
if (has_clean) {
data.operation = setting->operations.array[i];
- setting->status = fake_validate_parameter_paths(&data);
+ setting->state.status = fake_validate_parameter_paths(&data);
- if (F_status_is_error_not(setting->status) && !(main->pipe & fll_program_data_pipe_input_e)) {
- setting->status = f_file_is(
+ if (F_status_is_error_not(setting->state.status) && !(main->pipe & fll_program_data_pipe_input_e)) {
+ setting->state.status = f_file_is(
setting->operations.array[i] == fake_operation_build_e
? data.file_data_build_settings
: data.file_data_build_fakefile,
F_file_type_regular_d, F_false
);
- if (setting->status == F_false) {
- setting->status = F_status_set_error(F_file_not);
+ if (setting->state.status == F_false) {
+ setting->state.status = F_status_set_error(F_file_not);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fake_print_error_file(
setting,
main->error,
- F_status_set_fine(setting->status),
+ F_status_set_fine(setting->state.status),
macro_fake_f(f_file_is),
setting->operations.array[i] == fake_operation_build_e
? data.file_data_build_settings
if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
if (data.operation == fake_operation_build_e) {
if (check_paths) {
- setting->status = fake_validate_parameter_paths(&data);
+ setting->state.status = fake_validate_parameter_paths(&data);
check_paths = F_false;
}
- if (F_status_is_error_not(setting->status)) {
- setting->status = fake_build_operate(&data, 0, main->pipe & fll_program_data_pipe_input_e);
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = fake_build_operate(&data, 0, main->pipe & fll_program_data_pipe_input_e);
}
}
else if (data.operation == fake_operation_clean_e) {
- setting->status = fake_clean_operate(&data);
+ setting->state.status = fake_clean_operate(&data);
// Reset in case next operation needs files.
check_paths = F_true;
}
else if (data.operation == fake_operation_make_e) {
if (check_paths) {
- setting->status = fake_validate_parameter_paths(&data);
+ setting->state.status = fake_validate_parameter_paths(&data);
check_paths = F_false;
}
- if (F_status_is_error_not(setting->status)) {
- setting->status = fake_make_operate(&data);
- if (setting->status == F_child) break;
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = fake_make_operate(&data);
+ if (setting->state.status == F_child) break;
}
}
else if (data.operation == fake_operation_skeleton_e) {
- setting->status = fake_skeleton_operate(&data);
+ setting->state.status = fake_skeleton_operate(&data);
// Skeleton is supposed to guarantee these.
check_paths = F_false;
}
- if (setting->status == F_child) break;
+ if (setting->state.status == F_child) break;
if (!((++main->signal_check) % fake_signal_check_short_d)) {
if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
main->signal_check = 0;
}
- if (F_status_is_error(setting->status)) break;
+ if (F_status_is_error(setting->state.status)) break;
} // for
}
}
- if (F_status_is_error(setting->status)) {
- if (F_status_set_fine(setting->status) == F_interrupt) {
+ if (F_status_is_error(setting->state.status)) {
+ if (F_status_set_fine(setting->state.status) == F_interrupt) {
fake_print_operation_cancelled(setting, main->message, data.operation);
}
else {
fake_print_line_last_locked(setting, main->error);
}
- else if (setting->status != F_child) {
- if (F_status_is_error_not(setting->status)) {
+ else if (setting->state.status != F_child) {
+ if (F_status_is_error_not(setting->state.status)) {
fake_print_operation_all_complete(setting, main->message);
}
- if (setting->status != F_interrupt) {
+ if (setting->state.status != F_interrupt) {
fake_print_line_last_locked(setting, main->message);
}
}
*
* This is used by the main thread and should not be modified within individual threads.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_child if this is a child process returning.
*
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- fake_setting_load(arguments, state, &data, &setting);
+ fake_setting_load(arguments, &data, &setting);
}
fake_main(&data, &setting);
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param name
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param action
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param name
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param fakefile
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param content
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param type
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param action
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param message
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param operation
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param buffer
* The buffer containing the range to use.
* @param range
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param name
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param number
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param return_code
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param program
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param name
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param number
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param type
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param arguments
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param clone
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param variable
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param path
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param arguments
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param is_directory
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param program
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param fail
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param path
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param path
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param what
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param source
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param path
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param path
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param name
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param name
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param fakefile
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param file
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param fakefile
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param fakefile
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param fakefile
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param fakefile
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param fakefile
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param buffer
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param status
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param index
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param status
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param before
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param operation
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param operation
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param script
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param status
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param status
* The status to use.
* This is provided, ignoring setting.status, for thread-safety reasons.
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param status
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param status
* The status to use.
* This is provided, ignoring setting.status, for thread-safety reasons.
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param status
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param status
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param group
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param mode
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param number
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param symbol
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param symbol
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param operation_1
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param user
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param source
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param source
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param source
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param path
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param message
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param before
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param before
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param before
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param before
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param before
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param before
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param message
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param operation
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param message
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param message
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param before
* The main program settings.
* (Must be of type fake_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
* @param before
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
+ setting->state.status = f_console_parameter_process(state, arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
firewall_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
firewall_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
firewall_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
firewall_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
firewall_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
firewall_print_line_last_locked(setting, main->error);
return;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_firewall_setting_load_
- extern void firewall_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, firewall_setting_t * const setting, f_state_t * const state);
+ extern void firewall_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, firewall_setting_t * const setting);
#endif // _di_firewall_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
main->child = 0;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- firewall_setting_load(arguments, state, &data, &setting);
+ firewall_setting_load(arguments, &data, &setting);
}
firewall_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
#endif // _di_fss_basic_list_read_setting_delete_
#ifndef _di_fss_basic_list_read_setting_load_
- void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting) {
+ void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_basic_list_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
fss_basic_list_read_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_basic_list_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
fss_basic_list_read_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_basic_list_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
fss_basic_list_read_print_line_last_locked(setting, main->error);
return;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_basic_list_read_setting_load_
- extern void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting, f_state_t * const state);
+ extern void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting);
#endif // _di_fss_basic_list_read_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
f_status_t status = F_none;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- fss_basic_list_read_setting_load(arguments, state, &data, &setting);
+ fss_basic_list_read_setting_load(arguments, &data, &setting);
}
fss_basic_list_read_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
#endif // _di_fss_basic_read_setting_delete_
#ifndef _di_fss_basic_read_setting_load_
- void fss_basic_read_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, fss_basic_read_setting_t * const setting) {
+ void fss_basic_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_basic_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
fss_basic_read_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_basic_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
fss_basic_read_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_basic_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
fss_basic_read_print_line_last_locked(setting, main->error);
return;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_basic_read_setting_load_
- extern void fss_basic_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_read_setting_t * const setting, f_state_t * const state);
+ extern void fss_basic_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_read_setting_t * const setting);
#endif // _di_fss_basic_read_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
f_status_t status = F_none;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_true on success when performing verification and verify passed.
* F_false on success when performing verification and verify failed.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- fss_basic_read_setting_load(arguments, state, &data, &setting);
+ fss_basic_read_setting_load(arguments, &data, &setting);
}
fss_basic_read_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
#endif // _di_fss_embedded_list_read_setting_delete_
#ifndef _di_fss_embedded_list_read_setting_load_
- void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting) {
+ void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_embedded_list_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
fss_embedded_list_read_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_embedded_list_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
fss_embedded_list_read_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_embedded_list_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
fss_embedded_list_read_print_line_last_locked(setting, main->error);
return;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_embedded_list_read_setting_load_
- extern void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting, f_state_t * const state);
+ extern void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting);
#endif // _di_fss_embedded_list_read_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
f_status_t status = F_none;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_true on success when performing verification and verify passed.
* F_false on success when performing verification and verify failed.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- fss_embedded_list_read_setting_load(arguments, state, &data, &setting);
+ fss_embedded_list_read_setting_load(arguments, &data, &setting);
}
fss_embedded_list_read_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
#endif // _di_fss_extended_list_read_setting_delete_
#ifndef _di_fss_extended_list_read_setting_load_
- void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting) {
+ void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_extended_list_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
fss_extended_list_read_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_extended_list_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
fss_extended_list_read_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_extended_list_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
fss_extended_list_read_print_line_last_locked(setting, main->error);
return;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_extended_list_read_setting_load_
- extern void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting);
+ extern void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting);
#endif // _di_fss_extended_list_read_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
f_status_t status = F_none;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_true on success when performing verification and verify passed.
* F_false on success when performing verification and verify failed.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- fss_extended_list_read_setting_load(arguments, state, &data, &setting);
+ fss_extended_list_read_setting_load(arguments, &data, &setting);
}
fss_extended_list_read_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
- if (!F_status_is_error(setting->status)) {
+ if (!F_status_is_error(setting->state.status)) {
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & (fss_extended_list_read_main_flag_verify_e | fss_extended_list_read_main_flag_file_to_e)) return F_output_not;
}
if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
- if (!F_status_is_error(setting->status)) {
+ if (!F_status_is_error(setting->state.status)) {
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & (fss_extended_list_read_main_flag_verify_e | fss_extended_list_read_main_flag_file_to_e)) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
#endif // _di_fss_extended_read_setting_delete_
#ifndef _di_fss_extended_read_setting_load_
- void fss_extended_read_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, fss_extended_read_setting_t * const setting) {
+ void fss_extended_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_extended_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
fss_extended_read_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_extended_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
fss_extended_read_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_extended_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
fss_extended_read_print_line_last_locked(setting, main->error);
return;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_extended_read_setting_load_
- extern void fss_extended_read_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, fss_extended_read_setting_t * const setting);
+ extern void fss_extended_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_read_setting_t * const setting);
#endif // _di_fss_extended_read_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
f_status_t status = F_none;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- fss_extended_read_setting_load(arguments, state, &data, &setting);
+ fss_extended_read_setting_load(arguments, &data, &setting);
}
fss_extended_read_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & (fss_extended_read_main_flag_verify_e | fss_extended_read_main_flag_file_to_e)) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & (fss_extended_read_main_flag_verify_e | fss_extended_read_main_flag_file_to_e)) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
#endif // _di_fss_identify_setting_delete_
#ifndef _di_fss_identify_setting_load_
- void fss_identify_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_identify_setting_t * const setting, f_state_t * const state) {
+ void fss_identify_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_identify_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_identify_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
fss_identify_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_identify_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
fss_identify_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_identify_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
fss_identify_print_line_last_locked(setting, main->error);
return;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_identify_setting_load_
- extern void fss_identify_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, fss_identify_setting_t * const setting);
+ extern void fss_identify_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_identify_setting_t * const setting);
#endif // _di_fss_identify_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
f_status_t status = F_none;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_true on success when performing verification and verify passed.
* F_false on success when performing verification and verify failed.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- fss_identify_setting_load(arguments, state, &data, &setting);
+ fss_identify_setting_load(arguments, &data, &setting);
}
fss_identify_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & (fss_identify_main_flag_verify_e | fss_identify_main_flag_file_to_e)) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & (fss_identify_main_flag_verify_e | fss_identify_main_flag_file_to_e)) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
#endif // _di_fss_payload_read_setting_delete_
#ifndef _di_fss_payload_read_setting_load_
- void fss_payload_read_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, fss_payload_read_setting_t * const setting) {
+ void fss_payload_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_payload_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_payload_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e);
fss_payload_read_print_line_last_locked(setting, main->error);
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_payload_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e);
fss_payload_read_print_line_last_locked(setting, main->error);
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_payload_read_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e);
fss_payload_read_print_line_last_locked(setting, main->error);
return;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_payload_read_setting_load_
- extern void fss_payload_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_payload_read_setting_t * const setting, f_state_t * const state);
+ extern void fss_payload_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_payload_read_setting_t * const setting);
#endif // _di_fss_payload_read_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
f_status_t status = F_none;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters, 0);
+ status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
if (F_status_is_error(status)) return;
{
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- fss_payload_read_setting_load(arguments, state, &data, &setting);
+ fss_payload_read_setting_load(arguments, &data, &setting);
}
fss_payload_read_main(&data, &setting);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & (fss_payload_read_main_flag_verify_e | fss_payload_read_main_flag_file_to_e)) return F_output_not;
}
if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & (fss_payload_read_main_flag_verify_e | fss_payload_read_main_flag_file_to_e)) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
if (setting->content) {
- setting->status = fl_fss_basic_content_write(
+ setting->state.status = fl_fss_basic_content_write(
*setting->content,
(setting->flag & fss_write_flag_partial_e)
? f_fss_complete_partial_e
setting->state
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_basic_content_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_content_end_e) {
- setting->status = f_string_dynamic_append(f_fss_basic_close_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_basic_close_s, &setting->buffer);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
if (setting->object) {
- setting->status = fl_fss_basic_object_write(
+ setting->state.status = fl_fss_basic_object_write(
*setting->object,
setting->quote.used
? setting->quote.string[0]
&setting->buffer
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_basic_object_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_object_open_e) {
- setting->status = f_string_dynamic_append(f_fss_basic_open_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_basic_open_s, &setting->buffer);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
if (setting->content) {
- setting->status = fl_fss_basic_list_content_write(
+ setting->state.status = fl_fss_basic_list_content_write(
*setting->content,
(setting->flag & fss_write_flag_partial_e)
? f_fss_complete_partial_e
&setting->buffer
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_basic_list_content_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_content_end_e) {
- setting->status = f_string_dynamic_append(f_fss_basic_list_close_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_basic_list_close_s, &setting->buffer);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
if (setting->object) {
- setting->status = fl_fss_basic_list_object_write(
+ setting->state.status = fl_fss_basic_list_object_write(
*setting->object,
(setting->flag & fss_write_flag_partial_e)
? (setting->flag & fss_write_flag_trim_e)
&setting->buffer
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_basic_list_object_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_object_open_e) {
- setting->status = f_string_dynamic_append(f_fss_basic_list_open_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_basic_list_open_s, &setting->buffer);
- if (F_status_is_error_not(setting->status)) {
- setting->status = f_string_dynamic_append(f_fss_basic_list_open_end_s, &setting->buffer);
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = f_string_dynamic_append(f_fss_basic_list_open_end_s, &setting->buffer);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
fss_write_setting_load(arguments, state, &data, &setting, 0);
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
if (setting->content) {
- setting->status = fl_fss_embedded_list_content_write(
+ setting->state.status = fl_fss_embedded_list_content_write(
*setting->content,
(setting->flag & fss_write_flag_partial_e)
? f_fss_complete_partial_e
&setting->buffer
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_embedded_list_content_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_content_end_e) {
- setting->status = f_string_dynamic_append(f_fss_embedded_list_close_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_embedded_list_close_s, &setting->buffer);
- if (F_status_is_error_not(setting->status)) {
- setting->status = f_string_dynamic_append(f_fss_embedded_list_close_end_s, &setting->buffer);
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = f_string_dynamic_append(f_fss_embedded_list_close_end_s, &setting->buffer);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
if (setting->object) {
- setting->status = fl_fss_embedded_list_object_write(
+ setting->state.status = fl_fss_embedded_list_object_write(
*setting->object,
(setting->flag & fss_write_flag_partial_e)
? (setting->flag & fss_write_flag_trim_e)
&setting->buffer
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_embedded_list_object_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_object_open_e) {
- setting->status = f_string_dynamic_append(f_fss_embedded_list_open_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_embedded_list_open_s, &setting->buffer);
- if (F_status_is_error_not(setting->status)) {
- setting->status = f_string_dynamic_append(f_fss_embedded_list_open_end_s, &setting->buffer);
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = f_string_dynamic_append(f_fss_embedded_list_open_end_s, &setting->buffer);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
fss_write_setting_load(arguments, state, &data, &setting, 0);
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
if (setting->content) {
- setting->status = fl_fss_extended_content_write(
+ setting->state.status = fl_fss_extended_content_write(
*setting->content,
setting->quote.used
? setting->quote.string[0]
&setting->buffer
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_extended_content_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_content_end_e) {
- setting->status = f_string_dynamic_append(f_fss_extended_close_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_extended_close_s, &setting->buffer);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
else if (setting->flag & fss_write_flag_content_next_e) {
- setting->status = f_string_dynamic_append(f_fss_extended_next_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_extended_next_s, &setting->buffer);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
if (setting->object) {
- setting->status = fl_fss_extended_object_write(
+ setting->state.status = fl_fss_extended_object_write(
*setting->object,
setting->quote.used
? setting->quote.string[0]
&setting->buffer
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_extended_object_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_object_open_e) {
- setting->status = f_string_dynamic_append(f_fss_extended_open_s, &setting->buffer);
- if (F_status_is_error(setting->status)) {
+ setting->state.status = f_string_dynamic_append(f_fss_extended_open_s, &setting->buffer);
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
fss_write_setting_load(arguments, state, &data, &setting, 0);
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
if (setting->content) {
- setting->status = fl_fss_extended_list_content_write(
+ setting->state.status = fl_fss_extended_list_content_write(
*setting->content,
(setting->flag & fss_write_flag_partial_e)
? last
&setting->buffer
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_extended_list_content_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_content_end_e) {
- setting->status = f_string_dynamic_append(f_fss_extended_list_close_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_extended_list_close_s, &setting->buffer);
- if (F_status_is_error_not(setting->status)) {
- setting->status = f_string_dynamic_append(f_fss_extended_list_close_end_s, &setting->buffer);
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = f_string_dynamic_append(f_fss_extended_list_close_end_s, &setting->buffer);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
fss_write_setting_t * const setting = macro_fss_write_setting(void_setting);
if (setting->object) {
- setting->status = fl_fss_extended_list_object_write(
+ setting->state.status = fl_fss_extended_list_object_write(
*setting->object,
(setting->flag & fss_write_flag_partial_e)
? (setting->flag & fss_write_flag_trim_e)
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_object_open_e) {
- setting->status = f_string_dynamic_append(f_fss_extended_list_open_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_extended_list_open_s, &setting->buffer);
- if (F_status_is_error_not(setting->status)) {
- setting->status = f_string_dynamic_append(f_fss_extended_list_open_end_s, &setting->buffer);
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = f_string_dynamic_append(f_fss_extended_list_open_end_s, &setting->buffer);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
}
}
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
fss_write_setting_load(arguments, state, &data, &setting, 0);
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
if (!main || !setting) return;
- // Load parameters.
- setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_console_parameter_process));
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fll_program_parameter_process_context));
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fll_program_parameter_process_verbosity));
return;
if (callback) {
callback(arguments, main, setting);
- if (F_status_is_error(setting->status)) return;
+ if (F_status_is_error(setting->state.status)) return;
- if (setting->status == F_done) {
- setting->status = F_none;
+ if (setting->state.status == F_done) {
+ setting->state.status = F_none;
return;
}
if ((main->parameters.array[fss_write_parameter_file_e].result & f_console_result_value_e) && main->parameters.array[fss_write_parameter_file_e].values.used) {
if (main->parameters.array[fss_write_parameter_file_e].values.used > 1) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s);
main->output.to.id = -1;
main->output.to.stream = 0;
- setting->status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &main->output.to);
+ setting->state.status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &main->output.to);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error_file(setting, main->error, macro_fss_write_f(f_file_stream_open), main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e);
return;
setting->flag |= fss_write_flag_file_to_e;
}
else if (main->parameters.array[fss_write_parameter_file_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s);
setting->objects.used = 0;
- setting->status = f_string_dynamics_resize(values->used, &setting->objects);
+ setting->state.status = f_string_dynamics_resize(values->used, &setting->objects);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_resize));
return;
setting->flag |= fss_write_flag_object_e;
}
else if (main->parameters.array[fss_write_parameter_object_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_object_s);
if (setting->flag & fss_write_flag_object_e) {
if (!(setting->flag & fss_write_flag_content_multiple_e)) {
if (main->parameters.array[fss_write_parameter_content_e].values.used > main->parameters.array[fss_write_parameter_object_e].values.used) {
- setting->status = F_status_set_error(F_support_not);
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_error_one_content_only(setting, main->error);
setting->contentss.used = 0;
- setting->status = f_string_dynamicss_increase_by(values_object->used, &setting->contentss);
+ setting->state.status = f_string_dynamicss_increase_by(values_object->used, &setting->contentss);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamicss_increase_by));
return;
break;
}
- setting->status = f_string_dynamics_increase_by(total, &setting->contentss.array[j]);
+ setting->state.status = f_string_dynamics_increase_by(total, &setting->contentss.array[j]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase_by));
return;
setting->flag |= fss_write_flag_content_e;
}
else if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_content_s);
setting->prepend.used = 0;
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->prepend);
+ setting->state.status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->prepend);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append_nulless));
return;
for (; range.start < main->parameters.arguments.array[index].used; range.start++) {
- setting->status = f_fss_is_space(main->parameters.arguments.array[index], range, state);
+ setting->state.status = f_fss_is_space(main->parameters.arguments.array[index], range, state);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_fss_is_space));
return;
}
- if (setting->status == F_false) {
- setting->status = F_status_set_error(F_parameter);
+ if (setting->state.status == F_false) {
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_error_prepend_only_whitespace(setting, main->error);
setting->flag |= fss_write_flag_prepend_e;
}
else if (main->parameters.array[fss_write_parameter_prepend_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_prepend_s);
if ((main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_value_e) && main->parameters.array[fss_write_parameter_ignore_e].values.used) {
if (main->parameters.array[fss_write_parameter_ignore_e].values.used % 2 != 0) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, fss_write_string_two_s);
setting->ignoress.used = 0;
- setting->status = f_string_rangess_increase_by(values_data->used, &setting->ignoress);
+ setting->state.status = f_string_rangess_increase_by(values_data->used, &setting->ignoress);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_rangess_increase_by));
return;
break;
}
- setting->status = f_string_ranges_increase_by(total, &setting->ignoress.array[j]);
+ setting->state.status = f_string_ranges_increase_by(total, &setting->ignoress.array[j]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_ranges_increase_by));
return;
index = values_ignore->array[i++];
- setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignoress.array[j].array[setting->ignoress.array[j].used].start);
+ setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignoress.array[j].array[setting->ignoress.array[j].used].start);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
index = values_ignore->array[i++];
- setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignoress.array[j].array[setting->ignoress.array[j].used].stop);
+ setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignoress.array[j].array[setting->ignoress.array[j].used].stop);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
}
if (setting->ignoress.array[j].array[setting->ignoress.array[j].used].stop > setting->ignoress.array[j].array[setting->ignoress.array[j].used].start) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_range_start_before_stop(
index = main->parameters.array[fss_write_parameter_ignore_e].values.array[i++];
- setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &number.start);
+ setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &number.start);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
index = main->parameters.array[fss_write_parameter_ignore_e].values.array[i++];
- setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &number.stop);
+ setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &number.stop);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
}
if (number.start > number.stop) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_range_start_before_stop(
}
}
else if (main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s);
if (main->parameters.array[has[i]].result & f_console_result_found_e) {
if (setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e)) {
if (!(setting->flag & fss_write_flag_partial_e)) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
}
if (main->parameters.array[has_cannots[i][0]].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][0]);
}
if (main->parameters.array[has_cannots[i][1]].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][1]);
if (setting->flag & fss_write_flag_object_e) {
if (setting->flag & fss_write_flag_content_multiple_e) {
if (main->parameters.array[fss_write_parameter_object_e].locations_sub.used > main->parameters.array[fss_write_parameter_content_e].locations_sub.used && !(setting->flag & fss_write_flag_partial_e)) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_error_parameter_same_times_at_least(setting, main->error);
if ((setting->flag & fss_write_flag_content_e) && (setting->flag & fss_write_flag_partial_e)) {
if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_value_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_cannot_use_with_xor(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_write_long_partial_s, fss_write_long_object_s, fss_write_long_content_s);
}
if (!(setting->flag & (fll_program_data_pipe_input_e | fss_write_flag_content_e | fss_write_parameter_object_e))) {
- setting->status = F_data_not;
+ setting->state.status = F_data_not;
}
}
#endif // _di_fss_write_setting_load_
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_data_not on success but nothing was provided to operate with.
*
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
if (!main || !setting) return;
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_line_last_locked(setting, main->error);
return;
}
- setting->status = F_none;
+ setting->state.status = F_none;
if (setting->flag & fss_write_flag_help_e) {
if (setting->process_help) {
}
}
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e | fss_write_flag_object_open_e | fss_write_flag_content_next_e | fss_write_flag_content_end_e)) {
if (setting->process_normal) {
setting->process_normal(main, (void *) setting);
}
}
- if (F_status_is_error(setting->status)) {
- fss_write_print_line_last_locked(setting, main->error);
- }
- else if (setting->status != F_interrupt) {
- fss_write_print_line_last_locked(setting, main->message);
+ if (F_status_is_error(setting->state.status)) {
+ fss_write_print_line_last_locked(setting, F_status_set_fine(setting->state.status) == F_interrupt ? main->message : main->error);
}
}
#endif // _di_fss_write_main_
// @todo replace all signal checks with forked main process that independently checks and assigns main->signal_received.
if (!((++main->signal_check) % fss_write_signal_check_d)) {
if (fll_program_standard_signal_received(main)) {
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
return;
}
}
setting->process_set(main, setting);
- if (F_status_is_error(setting->status)) break;
+ if (F_status_is_error(setting->state.status)) break;
} // for
}
else {
uint8_t state = 0;
// This is processed in a single set, so there is only ever one Object added.
- setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->objects);
+ setting->state.status = f_string_dynamics_increase(setting->state.step_small, &setting->objects);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
return;
}
// This is processed in a single set, so there is only ever one Content added.
- setting->status = f_string_dynamicss_increase(setting->state.step_small, &setting->contentss);
+ setting->state.status = f_string_dynamicss_increase(setting->state.step_small, &setting->contentss);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamicss_increase));
return;
}
- setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
+ setting->state.status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
return;
}
// This is processed in a single set, so there is only ever one Ignores added.
- setting->status = f_string_rangess_increase(setting->state.step_small, &setting->ignoress);
+ setting->state.status = f_string_rangess_increase(setting->state.step_small, &setting->ignoress);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_rangess_increase));
return;
if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
flag -= flag | 0x4;
setting->contents->used = 0;
- setting->status = f_string_dynamic_increase_by(setting->block.used, setting->object);
+ setting->state.status = f_string_dynamic_increase_by(setting->block.used, setting->object);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
break;
setting->object->string[setting->object->used++] = setting->block.string[range.start];
} // for
- if (F_status_is_error(setting->status)) break;
+ if (F_status_is_error(setting->state.status)) break;
// If the start of Content is not found, then fetch the next block.
if (state == 0x1) continue;
// Check to see if the Content supports multiple Content per Object.
if (flag & 0x4) {
if (!(setting->flag & fss_write_flag_content_multiple_e)) {
- setting->status = F_status_set_error(F_support_not);
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_error_one_content_only(setting, main->error);
break;
}
- setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
+ setting->state.status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
break;
}
if (total) {
- setting->status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]);
+ setting->state.status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
break;
if (!(flag & 0x2)) {
if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) {
if (!(setting->flag & fss_write_flag_content_multiple_e)) {
- setting->status = F_status_set_error(F_support_not);
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_error_one_content_only(setting, main->error);
// Ignore is enabled.
if (flag & 0x2) {
- setting->status = f_string_ranges_increase(setting->state.step_small, setting->ignores);
+ setting->state.status = f_string_ranges_increase(setting->state.step_small, setting->ignores);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_ranges_increase));
break;
setting->contents->array[setting->contents->used].string[setting->contents->array[setting->contents->used].used++] = setting->block.string[range.start];
} // for
- if (F_status_is_error(setting->status)) break;
+ if (F_status_is_error(setting->state.status)) break;
++setting->contents->used;
flag |= 0x4;
// End Object or Content set.
if (state == 0x3) {
setting->process_set(main, void_setting);
- if (F_status_is_error(setting->status)) break;
+ if (F_status_is_error(setting->state.status)) break;
state = 0;
flag |= 0x1;
} // for
// If the pipe ended before finishing, then attempt to wrap up.
- if (F_status_is_error_not(setting->status) && status_pipe == F_none_eof && state) {
+ if (F_status_is_error_not(setting->state.status) && status_pipe == F_none_eof && state) {
setting->process_set(main, void_setting);
flag |= 0x1;
setting->objects.used = used_objects;
setting->contentss.used = used_contentss;
- if (F_status_is_error_not(setting->status)) {
- setting->status = (flag & 0x1) ? F_none : F_data_not;
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = (flag & 0x1) ? F_none : F_data_not;
}
}
#endif // _di_fss_write_process_pipe_
if (setting->process_object) {
setting->process_object(main, void_setting);
- if (F_status_is_error(setting->status)) return;
+ if (F_status_is_error(setting->state.status)) return;
}
}
setting->content = &setting->contents->array[i];
setting->process_content(main, void_setting, i + 1 == setting->contents->used);
- if (F_status_is_error(setting->status)) return;
+ if (F_status_is_error(setting->state.status)) return;
} // for
}
else {
setting->content = 0;
setting->process_content(main, void_setting, F_true);
- if (F_status_is_error(setting->status)) return;
+ if (F_status_is_error(setting->state.status)) return;
}
}
}
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_true on success when performing verification and verify passed.
* F_false on success when performing verification and verify failed.
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This alters setting.status:
+ * This alters setting.state.status:
* status from fss_write_process_normal_data().
*
* Errors (with error bit) from fss_write_process_normal_data().
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_interrupt on (exit) signal received.
*
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_data_not on success but pipe contained no relevant data.
* F_basic on success and the basic has been printed.
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_interrupt on (exit) signal received.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param value
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
fss_write_setting_load(arguments, state, &data, &setting, &fss_write_main_setting_load_as);
}
#ifndef _di_fss_write_main_setting_load_as_
void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, f_state_t * const state) {
- if (!main || !setting || F_status_is_error(setting->status) || (setting->flag & fss_write_flag_version_e)) return;
+ if (!main || !setting || F_status_is_error(setting->state.status) || (setting->flag & fss_write_flag_version_e)) return;
setting->standard = fss_write_basic_standard_s;
setting->process_content = &fss_write_basic_process_content;
}
else {
if (setting->flag & fss_write_flag_help_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
break;
}
- if (setting->status != F_status_set_error(F_parameter)) {
+ if (setting->state.status != F_status_set_error(F_parameter)) {
fss_write_print_line_first_locked(setting, main->error);
}
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_main_print_error_format_unknown(main->error, argv[index]);
}
} // for
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
if (setting->flag & fss_write_flag_help_e) {
fss_write_main_process_help(main, setting);
}
}
}
else if (main->parameters.array[fss_write_parameter_as_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
if (setting->flag & fss_write_flag_help_e) {
fss_write_main_process_help(main, setting);
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
*
* This alters setting.process_help, setting.process_normal, and setting.process_pipe.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_interrupt on (exit) signal received.
*
* F_parameter (with error bit) if main is NULL or setting is NULL.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_data_not on success but nothing was provided to operate with.
*
* Errors (with error bit) from: f_string_dynamics_resize().
* Errors (with error bit) from: fll_program_parameter_process_context().
* Errors (with error bit) from: fll_program_parameter_process_verbosity().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see f_file_stream_open()
* @see fss_write_setting_load()
*/
#ifndef _di_fss_write_main_setting_load_as_
- extern void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, f_state_t * const state);
+ extern void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting);
#endif // _di_fss_write_main_setting_load_as_
#ifdef __cplusplus
if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
fss_write_print_line_first_locked(setting, print);
- fll_error_print(print, F_status_set_fine(setting->status), function, fll_error_file_flag_fallback_e);
+ fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
return F_none;
}
if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
fss_write_print_line_first_locked(setting, print);
- fll_error_file_print(print, F_status_set_fine(setting->status), function, fll_error_file_flag_fallback_e, name, operation, type);
+ fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type);
return F_none;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & fss_write_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & fss_write_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & fss_write_flag_file_to_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & fss_write_flag_file_to_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
* @param function
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*/
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*/
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*/
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
uint8_t state = 0;
// This is processed in a single set, so there is only ever one Object added.
- setting->status = f_string_dynamics_increase(setting->state.step_small, &setting->objects);
+ setting->state.status = f_string_dynamics_increase(setting->state.step_small, &setting->objects);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
return;
}
// This is processed in a single set, so there is only ever one Content added.
- setting->status = f_string_dynamicss_increase(setting->state.step_small, &setting->contentss);
+ setting->state.status = f_string_dynamicss_increase(setting->state.step_small, &setting->contentss);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamicss_increase));
return;
}
- setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
+ setting->state.status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
return;
}
// This is processed in a single set, so there is only ever one Ignores added.
- setting->status = f_string_rangess_increase(setting->state.step_small, &setting->ignoress);
+ setting->state.status = f_string_rangess_increase(setting->state.step_small, &setting->ignoress);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_rangess_increase));
return;
if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
flag -= flag | 0x4;
setting->contents->used = 0;
- setting->status = f_string_dynamic_increase_by(setting->block.used, setting->object);
+ setting->state.status = f_string_dynamic_increase_by(setting->block.used, setting->object);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
break;
setting->object->string[setting->object->used++] = setting->block.string[range.start];
} // for
- if (F_status_is_error(setting->status)) break;
+ if (F_status_is_error(setting->state.status)) break;
// If the start of Content was not found, then fetch the next block.
if (state == 0x1) continue;
// Check to see if the Content supports multiple Content per Object.
if (flag & 0x4) {
if (!(setting->flag & fss_write_flag_content_multiple_e)) {
- setting->status = F_status_set_error(F_support_not);
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_error_one_content_only(setting, main->error);
break;
}
- setting->status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
+ setting->state.status = f_string_dynamics_increase(setting->state.step_small, setting->contents);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase));
break;
// When payload is provided, all data at this point is part of the payload until the end of the pipe.
if (fl_string_dynamic_compare(f_fss_payload_s, *setting->object) == F_equal_to) {
if (total > 1) {
- setting->status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]);
+ setting->state.status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
break;
}
if (total) {
- setting->status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]);
+ setting->state.status = f_string_dynamic_increase_by(total, &setting->contents->array[setting->contents->used]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
break;
// Do not handle start/end while inside an ignore set.
if (!(flag & 0x2)) {
if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) {
- setting->status = F_status_set_error(F_support_not);
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_error_one_content_only(setting, main->error);
setting->contents->array[setting->contents->used].string[setting->contents->array[setting->contents->used].used++] = setting->block.string[range.start];
} // for
- if (F_status_is_error(setting->status)) break;
+ if (F_status_is_error(setting->state.status)) break;
++setting->contents->used;
flag |= 0x4;
// End Object or Content set.
if (state == 0x3) {
fss_write_payload_process_set(main, void_setting);
- if (F_status_is_error(setting->status)) break;
+ if (F_status_is_error(setting->state.status)) break;
state = 0;
flag |= 0x1;
if (setting->block.used && range.start <= range.stop) {
length = (range.stop - range.start) + 1;
- setting->status = f_string_dynamic_increase_by(length + 1, &setting->contents->array[setting->contents->used]);
+ setting->state.status = f_string_dynamic_increase_by(length + 1, &setting->contents->array[setting->contents->used]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_increase_by));
break;
} // for
// If the pipe ended before finishing, then attempt to wrap up.
- if (F_status_is_error_not(setting->status) && status_pipe == F_none_eof && state) {
+ if (F_status_is_error_not(setting->state.status) && status_pipe == F_none_eof && state) {
fss_write_payload_process_set(main, void_setting);
flag |= 0x1;
setting->contentss.used = used_contentss;
setting->ignoress.used = used_ignoress;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (flag & 0x1) {
if (flag & 0x8) {
- setting->status = F_payload;
+ setting->state.status = F_payload;
}
else {
- setting->status = F_none;
+ setting->state.status = F_none;
}
}
else {
- setting->status = F_data_not;
+ setting->state.status = F_data_not;
}
// Payload.
setting->range.stop = 0;
}
- setting->status = fll_fss_payload_write(
+ setting->state.status = fll_fss_payload_write(
*setting->object,
setting->contents->array[0],
(setting->flag & fss_write_flag_trim_e),
&setting->buffer
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fll_fss_payload_write));
return;
setting->range.stop = 0;
}
- setting->status = fl_fss_basic_list_object_write(
+ setting->state.status = fl_fss_basic_list_object_write(
*setting->object,
(setting->flag & fss_write_flag_partial_e)
? (setting->flag & fss_write_flag_trim_e)
&setting->buffer
);
- if (F_status_set_fine(setting->status) == F_none_eol) {
- setting->status = F_status_set_error(F_support_not);
+ if (F_status_set_fine(setting->state.status) == F_none_eol) {
+ setting->state.status = F_status_set_error(F_support_not);
fss_write_print_line_first_locked(setting, main->error);
fss_write_print_error_unsupported_eol(setting, main->error);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_basic_list_object_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_object_open_e) {
- setting->status = f_string_dynamic_append(f_fss_basic_list_open_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_basic_list_open_s, &setting->buffer);
- if (F_status_is_error_not(setting->status)) {
- setting->status = f_string_dynamic_append(f_fss_basic_list_open_end_s, &setting->buffer);
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = f_string_dynamic_append(f_fss_basic_list_open_end_s, &setting->buffer);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
return;
prepend = &main->parameters.arguments.array[index];
}
- setting->status = fl_fss_basic_list_content_write(
+ setting->state.status = fl_fss_basic_list_content_write(
setting->contents->array[0],
setting->object
? f_fss_complete_full_e
&setting->buffer
);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(fl_fss_payload_content_write));
return;
if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) {
if (setting->flag & fss_write_flag_content_end_e) {
- setting->status = f_string_dynamic_append(f_fss_basic_list_close_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_fss_basic_list_close_s, &setting->buffer);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
return;
}
if (!setting->object || !(setting->contents && setting->contents->used)) {
- setting->status = f_string_dynamic_append(f_string_eol_s, &setting->buffer);
+ setting->state.status = f_string_dynamic_append(f_string_eol_s, &setting->buffer);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append));
return;
fll_print_dynamic(setting->buffer, main->output.to);
setting->buffer.used = 0;
- setting->status = F_none;
+ setting->state.status = F_none;
}
#endif // _di_fss_write_payload_process_set_
for (f_array_length_t i = 0; i < values->used; ++i) {
if (fl_string_dynamic_compare(argv[values->array[i]], fss_write_payload_s) == F_equal_to && i + 1 < values->used) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
fss_write_payload_print_error_payload_not_last(setting, main->error);
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_data_not on success but pipe contained no relevant data.
* F_payload on success and the payload has been printed.
* The main program settings.
* Must be of type (fss_write_setting_t *).
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_interrupt on (exit) signal received.
*
*
* This alters setting.process_help, setting.process_normal, and setting.process_pipe.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_interrupt on (exit) signal received.
*
* F_parameter (with error bit) if main is NULL or setting is NULL.
* F_parameter (with error bit) on parameter error.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_data_not on success but nothing was provided to operate with.
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see fss_write_setting_load()
*/
#ifndef _di_fss_write_payload_setting_load_
- extern void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, f_state_t * const state);
+ extern void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting);
#endif // _di_fss_write_payload_setting_load_
#ifdef __cplusplus
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
fss_write_setting_load(arguments, state, &data, &setting, &fss_write_payload_setting_load);
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
#endif // _di_iki_read_setting_delete_
#ifndef _di_iki_read_setting_load_
- void iki_read_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, iki_read_setting_t * const setting) {
+ void iki_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_console_parameter_process));
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(fll_program_parameter_process_context));
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(fll_program_parameter_process_verbosity));
return;
}
if (!(main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e))) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_missing_file(main->error);
if (main->parameters.array[iki_read_parameter_at_e].result & f_console_result_value_e) {
if (main->parameters.array[iki_read_parameter_whole_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_at_s, iki_read_long_whole_s);
setting->at = 0;
- setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->at);
+ setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->at);
- if (F_status_is_error(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
+ if (F_status_is_error(setting->state.status)) {
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, iki_read_long_at_s, main->parameters.arguments.array[index]);
setting->flag |= iki_read_main_flag_at_e;
}
else if (main->parameters.array[iki_read_parameter_at_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_at_s);
setting->line = 0;
- setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->line);
+ setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->line);
- if (F_status_is_error(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
+ if (F_status_is_error(setting->state.status)) {
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, iki_read_long_line_s, main->parameters.arguments.array[index]);
setting->flag |= iki_read_main_flag_line_e;
}
else if (main->parameters.array[iki_read_parameter_line_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_line_s);
if (main->parameters.array[iki_read_parameter_name_e].result & f_console_result_value_e) {
setting->names.used = 0;
- setting->status = f_string_dynamics_increase_by(main->parameters.array[iki_read_parameter_name_e].values.used, &setting->names);
+ setting->state.status = f_string_dynamics_increase_by(main->parameters.array[iki_read_parameter_name_e].values.used, &setting->names);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamics_increase_by));
return;
setting->names.array[setting->names.used].used = 0;
if (main->parameters.arguments.array[values->array[i]].used) {
- setting->status = f_string_dynamics_append(main->parameters.arguments.array[values->array[i]], &setting->names);
- if (F_status_is_error(setting->status)) break;
+ setting->state.status = f_string_dynamics_append(main->parameters.arguments.array[values->array[i]], &setting->names);
+ if (F_status_is_error(setting->state.status)) break;
}
else {
- setting->status = f_string_dynamics_append(f_string_empty_s, &setting->names);
- if (F_status_is_error(setting->status)) break;
+ setting->state.status = f_string_dynamics_append(f_string_empty_s, &setting->names);
+ if (F_status_is_error(setting->state.status)) break;
}
} // for
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamics_append));
return;
setting->flag |= iki_read_main_flag_name_e;
}
else if (main->parameters.array[iki_read_parameter_name_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_name_s);
if (main->parameters.array[iki_read_parameter_replace_e].result != f_console_result_none_e) {
if ((main->parameters.array[iki_read_parameter_replace_e].result & f_console_result_found_e) || main->parameters.array[iki_read_parameter_replace_e].values.used % 2 != 0) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, iki_read_long_replace_s, iki_read_string_two_s);
setting->replace.used = 0;
- setting->status = f_string_maps_increase_by(main->parameters.array[iki_read_parameter_replace_e].values.used / 2, &setting->replace);
+ setting->state.status = f_string_maps_increase_by(main->parameters.array[iki_read_parameter_replace_e].values.used / 2, &setting->replace);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_maps_increase_by));
return;
// Static strings are being used, so if a dynamic string exists (size > 0), then de-allocate it.
if (setting->replace.array[at].name.size) {
- setting->status = f_string_dynamic_resize(0, &setting->replace.array[at].name);
+ setting->state.status = f_string_dynamic_resize(0, &setting->replace.array[at].name);
}
- if (F_status_is_error_not(setting->status) && setting->replace.array[at].value.size) {
- setting->status = f_string_dynamic_resize(0, &setting->replace.array[at].value);
+ if (F_status_is_error_not(setting->state.status) && setting->replace.array[at].value.size) {
+ setting->state.status = f_string_dynamic_resize(0, &setting->replace.array[at].value);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize));
return;
setting->flag |= iki_read_main_flag_reassign_e;
}
- if (F_status_is_error(setting->status)) return;
+ if (F_status_is_error(setting->state.status)) return;
if (iki_read_setting_load_parameter_substitution(main, setting, main->parameters.array[iki_read_parameter_substitute_e], iki_read_long_substitute_s, &setting->substitute)) {
setting->flag |= iki_read_main_flag_substitute_e;
}
- if (F_status_is_error(setting->status)) return;
+ if (F_status_is_error(setting->state.status)) return;
if (main->parameters.array[iki_read_parameter_wrap_e].result != f_console_result_none_e) {
if ((main->parameters.array[iki_read_parameter_wrap_e].result & f_console_result_found_e) || main->parameters.array[iki_read_parameter_wrap_e].values.used % 3 != 0) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, iki_read_long_wrap_s, iki_read_string_three_s);
setting->wrap.used = 0;
- setting->status = f_string_triples_increase_by(main->parameters.array[iki_read_parameter_wrap_e].values.used / 3, &setting->wrap);
+ setting->state.status = f_string_triples_increase_by(main->parameters.array[iki_read_parameter_wrap_e].values.used / 3, &setting->wrap);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_triples_increase_by));
return;
// Static strings are being used, so if a dynamic string exists (size > 0), then de-allocate it.
if (setting->wrap.array[at].a.size) {
- setting->status = f_string_dynamic_resize(0, &setting->wrap.array[at].a);
+ setting->state.status = f_string_dynamic_resize(0, &setting->wrap.array[at].a);
}
- if (F_status_is_error_not(setting->status) && setting->wrap.array[at].b.size) {
- setting->status = f_string_dynamic_resize(0, &setting->wrap.array[at].b);
+ if (F_status_is_error_not(setting->state.status) && setting->wrap.array[at].b.size) {
+ setting->state.status = f_string_dynamic_resize(0, &setting->wrap.array[at].b);
}
- if (F_status_is_error_not(setting->status) && setting->wrap.array[at].c.size) {
- setting->status = f_string_dynamic_resize(0, &setting->wrap.array[at].c);
+ if (F_status_is_error_not(setting->state.status) && setting->wrap.array[at].c.size) {
+ setting->state.status = f_string_dynamic_resize(0, &setting->wrap.array[at].c);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize));
return;
for (uint8_t i = 0; i < 3; ++i) {
if (main->parameters.array[ids[i]].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_literal_s, names[i]);
for (uint8_t i = 0; i < 2; ++i) {
if (main->parameters.array[ids[i]].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_object_s, names[i]);
}
else if (main->parameters.array[iki_read_parameter_content_e].result & f_console_result_found_e) {
if (main->parameters.array[iki_read_parameter_total_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_content_s, iki_read_long_total_s);
}
else if (main->parameters.array[iki_read_parameter_total_e].result & f_console_result_found_e) {
if (main->parameters.array[iki_read_parameter_whole_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_total_s, iki_read_long_wrap_s);
if (main->parameters.remaining.used) {
setting->files.used = 0;
- setting->status = f_string_dynamics_resize(main->parameters.remaining.used, &setting->files);
+ setting->state.status = f_string_dynamics_resize(main->parameters.remaining.used, &setting->files);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamics_resize));
return;
// Static strings are being used, so if a dynamic string exists (size > 0), then de-allocate it.
if (setting->files.array[setting->files.used].size) {
- setting->status = f_string_dynamic_resize(0, &setting->files.array[setting->files.used]);
+ setting->state.status = f_string_dynamic_resize(0, &setting->files.array[setting->files.used]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize));
return;
setting->files.array[setting->files.used].used = main->parameters.arguments.array[index].used;
setting->files.array[setting->files.used].size = 0;
- setting->status = f_file_exists(setting->files.array[setting->files.used], F_true);
+ setting->state.status = f_file_exists(setting->files.array[setting->files.used], F_true);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_line_first_locked(setting, main->error);
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_exists", fll_error_file_flag_fallback_e, setting->files.array[setting->files.used], f_file_operation_verify_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(setting->state.status), "f_file_exists", fll_error_file_flag_fallback_e, setting->files.array[setting->files.used], f_file_operation_verify_s, fll_error_file_type_file_e);
return;
}
if (!(parameter.result & f_console_result_found_e)) return F_false;
if ((parameter.result & f_console_result_found_e) || parameter.values.used % 3 != 0) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_read_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, name, iki_read_string_three_s);
triple->used = 0;
- setting->status = f_string_triples_increase_by(parameter.values.used / 3, triple);
+ setting->state.status = f_string_triples_increase_by(parameter.values.used / 3, triple);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_triples_increase_by));
return F_false;
// Static strings are being used, so if a dynamic string exists (size > 0), then de-allocate it.
if (triple->array[at].a.size) {
- setting->status = f_string_dynamic_resize(0, &triple->array[at].a);
+ setting->state.status = f_string_dynamic_resize(0, &triple->array[at].a);
}
- if (F_status_is_error_not(setting->status) && triple->array[at].b.size) {
- setting->status = f_string_dynamic_resize(0, &triple->array[at].b);
+ if (F_status_is_error_not(setting->state.status) && triple->array[at].b.size) {
+ setting->state.status = f_string_dynamic_resize(0, &triple->array[at].b);
}
- if (F_status_is_error_not(setting->status) && triple->array[at].c.size) {
- setting->status = f_string_dynamic_resize(0, &triple->array[at].c);
+ if (F_status_is_error_not(setting->state.status) && triple->array[at].c.size) {
+ setting->state.status = f_string_dynamic_resize(0, &triple->array[at].c);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize));
return F_false;
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* @see fll_program_parameter_process_verbosity()
*/
#ifndef _di_iki_read_setting_load_
- extern void iki_read_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, iki_read_setting_t * const setting);
+ extern void iki_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_read_setting_t * const setting);
#endif // _di_iki_read_setting_load_
/**
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_string_dynamic_resize().
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
if (!main || !setting) return;
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_line_last_locked(setting, main->error);
return;
}
- setting->status = F_none;
+ setting->state.status = F_none;
if (setting->flag & iki_read_main_flag_help_e) {
iki_read_print_help(setting, main->message);
setting->buffer.used = 0;
- setting->status = f_file_read(file, &setting->buffer);
+ setting->state.status = f_file_read(file, &setting->buffer);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_read), f_string_ascii_minus_s, f_file_operation_process_s, fll_error_file_type_file_e);
}
else {
}
}
- if (F_status_is_error_not(setting->status) && setting->files.used) {
+ if (F_status_is_error_not(setting->state.status) && setting->files.used) {
f_file_t file = f_file_t_initialize;
off_t size_block = 0;
off_t size_file = 0;
if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
file.stream = 0;
file.id = -1;
- setting->status = f_file_stream_open(setting->files.array[i], f_string_empty_s, &file);
+ setting->state.status = f_file_stream_open(setting->files.array[i], f_string_empty_s, &file);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_stream_open), setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
break;
}
- setting->status = f_file_descriptor(&file);
+ setting->state.status = f_file_descriptor(&file);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_descriptor), setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
break;
size_file = 0;
- setting->status = f_file_size_by_id(file, &size_file);
+ setting->state.status = f_file_size_by_id(file, &size_file);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_size_by_id), setting->files.array[i], f_file_operation_analyze_s, fll_error_file_type_file_e);
break;
}
// Pre-allocate entire file buffer plus space for the terminating NULL.
- setting->status = f_string_dynamic_increase_by(size_file + 1, &setting->buffer);
+ setting->state.status = f_string_dynamic_increase_by(size_file + 1, &setting->buffer);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_string_dynamic_increase_by), setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
break;
if (size_file > iki_read_block_max && fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
- setting->status = f_file_stream_read_until(file, size_block, &setting->buffer);
- if (F_status_is_error(setting->status)) break;
+ setting->state.status = f_file_stream_read_until(file, size_block, &setting->buffer);
+ if (F_status_is_error(setting->state.status)) break;
} // for
- if (F_status_is_error(setting->status)) {
- if (F_status_set_fine(setting->status) != F_interrupt) {
+ if (F_status_is_error(setting->state.status)) {
+ if (F_status_set_fine(setting->state.status) != F_interrupt) {
iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_stream_read_until), setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
}
f_file_stream_close(&file);
iki_read_process_buffer(main, setting);
- if (F_status_is_error(setting->status)) break;
+ if (F_status_is_error(setting->state.status)) break;
setting->buffer.used = 0;
} // for
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
f_file_stream_flush(file);
f_file_stream_close(&file);
}
}
- if (F_status_is_error(setting->status)) {
- iki_read_print_line_last_locked(setting, main->error);
- }
- else if (setting->status != F_interrupt) {
- iki_read_print_line_last_locked(setting, main->message);
+ if (F_status_is_error(setting->state.status)) {
+ iki_read_print_line_last_locked(setting, F_status_set_fine(setting->state.status) == F_interrupt ? main->message : main->error);
}
}
#endif // _di_iki_read_main_
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_true on success when performing verification and verify passed.
* F_false on success when performing verification and verify failed.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- iki_read_setting_load(arguments, state, &data, &setting);
+ iki_read_setting_load(arguments, &data, &setting);
}
iki_read_main(&data, &setting);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
iki_read_print_line_first_locked(setting, print);
- fll_error_print(print, F_status_set_fine(setting->status), function, fll_error_file_flag_fallback_e);
+ fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
return F_none;
}
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
iki_read_print_line_first_locked(setting, print);
- fll_error_file_print(print, F_status_set_fine(setting->status), function, fll_error_file_flag_fallback_e, name, operation, type);
+ fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type);
return F_none;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
* @param function
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* The setting.map_wraps is expected to be defined as a valid pointer to an array.
* The setting.map_replaces is expected to be defined as a valid pointer to an array.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param index
* The index used to identify the desired range in variable, content, and ranges.
*/
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param index
* The index within the setting->map_wraps array to print.
*/
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param index
* The index within the setting->map_wraps array to print.
*/
void iki_read_process_line(fll_program_data_t * const main, iki_read_setting_t * const setting, f_string_range_t *range) {
if (!(setting->flag & iki_read_main_flag_line_e)) {
- setting->status = F_false;
+ setting->state.status = F_false;
return;
}
if (setting->buffer.string[range->stop] == f_string_eol_s.string[0]) break;
} // for
- setting->status = F_true;
+ setting->state.status = F_true;
}
else {
- setting->status = F_data_not;
+ setting->state.status = F_data_not;
}
}
#endif // _di_iki_read_process_line_
if (setting->flag & iki_read_main_flag_total_e) {
iki_read_process_buffer_total(main, setting);
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_none;
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = F_none;
}
return;
iki_read_process_line(main, setting, &buffer_range);
- if (setting->status == F_true) {
+ if (setting->state.status == F_true) {
if (buffer_range.start > setting->buffer.used) {
- setting->status = F_data_not;
+ setting->state.status = F_data_not;
return;
}
}
- else if (setting->status == F_data_not) {
- setting->status = F_data_not;
+ else if (setting->state.status == F_data_not) {
+ setting->state.status = F_data_not;
return;
}
iki_read_process_buffer_ranges(main, setting, &buffer_range);
}
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_none;
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = F_none;
}
}
#endif // _di_iki_read_process_buffer_
{
const f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
- setting->status = fl_iki_read(&setting->buffer, buffer_range, &setting->data, state);
+ setting->state.status = fl_iki_read(&setting->buffer, buffer_range, &setting->data, state);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(fl_iki_read));
return;
f_file_stream_unlock(main->output.to);
if (unmatched) {
- setting->status = F_data_not;
+ setting->state.status = F_data_not;
}
else {
- setting->status = F_none;
+ setting->state.status = F_none;
}
}
else {
f_file_stream_unlock(main->output.to);
- setting->status = F_none;
+ setting->state.status = F_none;
}
else {
- setting->status = F_data_not;
+ setting->state.status = F_data_not;
}
}
else {
f_file_stream_unlock(main->output.to);
- setting->status = F_none;
+ setting->state.status = F_none;
}
}
else {
- setting->status = F_data_not;
+ setting->state.status = F_data_not;
}
}
}
{
const f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
- setting->status = fl_iki_read(&setting->buffer, &range, &setting->data, state);
+ setting->state.status = fl_iki_read(&setting->buffer, &range, &setting->data, state);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(fl_iki_read));
return;
if (!setting->data.variable.used) {
fll_print_dynamic_partial(setting->buffer, buffer_range, main->output.to);
- setting->status = F_none;
+ setting->state.status = F_none;
return;
}
f_file_stream_unlock(main->output.to);
}
- setting->status = F_none;
+ setting->state.status = F_none;
}
#endif // _di_iki_read_process_buffer_ranges_whole_
iki_read_process_line(main, setting, &range);
- if (setting->status == F_true) {
+ if (setting->state.status == F_true) {
if (range.start > setting->buffer.used) {
fll_print_format("%r%r", main->output.to, f_string_ascii_0_s, f_string_eol_s);
- setting->status = F_none;
+ setting->state.status = F_none;
return;
}
}
- else if (setting->status == F_data_not) {
+ else if (setting->state.status == F_data_not) {
fll_print_format("%r%r", main->output.to, f_string_ascii_0_s, f_string_eol_s);
- setting->status = F_none;
+ setting->state.status = F_none;
return;
}
{
f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0);
- setting->status = fl_iki_read(&setting->buffer, &range, &setting->data, state);
+ setting->state.status = fl_iki_read(&setting->buffer, &range, &setting->data, state);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(fl_iki_read));
return;
f_string_dynamic_resize(0, &name);
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
return;
}
index = main->parameters.array[iki_read_parameter_name_e].values.array[i];
name.used = 0;
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &name);
+ setting->state.status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &name);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_append_nulless));
f_string_dynamic_resize(0, &name);
for (j = 0; j < setting->data.vocabulary.used; ++j) {
- setting->status = fl_string_dynamic_partial_compare(name, setting->buffer, range, setting->data.vocabulary.array[j]);
+ setting->state.status = fl_string_dynamic_partial_compare(name, setting->buffer, range, setting->data.vocabulary.array[j]);
- if (setting->status == F_equal_to) ++total;
+ if (setting->state.status == F_equal_to) ++total;
} // for
} // for
fll_print_format("%ul%r", main->output.to, total, f_string_eol_s);
- setting->status = F_none;
+ setting->state.status = F_none;
}
#endif // _di_iki_read_process_buffer_total_
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_true is returned if the range is processed.
* F_false is returned if the range is not processed.
* F_data_not if the range is processed, but the requested line is out of range.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_data_not on success, but nothing done.
*
#endif // _di_iki_write_setting_delete_
#ifndef _di_iki_write_setting_load_
- void iki_write_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, iki_write_setting_t * const setting) {
+ void iki_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_write_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(f_console_parameter_process));
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(fll_program_parameter_process_context));
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(fll_program_parameter_process_verbosity));
return;
if (main->parameters.array[iki_write_parameter_file_e].result & f_console_result_value_e && main->parameters.array[iki_write_parameter_file_e].values.used) {
if (main->parameters.array[iki_write_parameter_file_e].values.used > 1) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, iki_write_long_file_s);
main->output.to.id = -1;
main->output.to.stream = 0;
- setting->status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &main->output.to);
+ setting->state.status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &main->output.to);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_line_first_locked(setting, main->error);
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", fll_error_file_flag_fallback_e, main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(setting->state.status), "f_file_stream_open", fll_error_file_flag_fallback_e, main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e);
return;
}
setting->flag |= iki_write_main_flag_file_to_e;
}
else if (main->parameters.array[iki_write_parameter_file_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_file_s);
setting->objects.used = 0;
- setting->status = f_string_dynamics_resize(values->used, &setting->objects);
+ setting->state.status = f_string_dynamics_resize(values->used, &setting->objects);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamics_resize));
return;
setting->flag |= iki_write_main_flag_object_e;
}
else if (main->parameters.array[iki_write_parameter_object_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_object_s);
setting->contents.used = 0;
- setting->status = f_string_dynamics_resize(values->used, &setting->contents);
+ setting->state.status = f_string_dynamics_resize(values->used, &setting->contents);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamics_resize));
return;
setting->flag |= iki_write_main_flag_content_e;
}
else if (main->parameters.array[iki_write_parameter_content_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_write_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_content_s);
}
if (!(main->pipe & fll_program_data_pipe_input_e) && !(setting->flag & (iki_write_main_flag_content_e | iki_write_parameter_object_e))) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_write_print_line_first_locked(setting, main->error);
iki_write_print_error_main_missing(setting, main->error);
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: f_string_dynamics_resize().
* Errors (with error bit) from: fll_program_parameter_process_context().
* Errors (with error bit) from: fll_program_parameter_process_verbosity().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see f_file_stream_open()
* @see fll_program_parameter_process_verbosity()
*/
#ifndef _di_iki_write_setting_load_
- extern void iki_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_write_setting_t * const setting, f_state_t * const state);
+ extern void iki_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_write_setting_t * const setting);
#endif // _di_iki_write_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
if (!main || !setting) return;
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_line_last_locked(setting, main->error);
return;
}
- setting->status = F_none;
+ setting->state.status = F_none;
if (setting->flag & iki_write_main_flag_help_e) {
iki_write_print_help(setting, main->message);
do {
if (!((++main->signal_check) % iki_write_signal_check_d)) {
if (fll_program_standard_signal_received(main)) {
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
return;
}
status = f_file_read(pipe, &setting->buffer);
if (F_status_is_error(status)) {
- setting->status = F_status_set_error(F_pipe);
+ setting->state.status = F_status_set_error(F_pipe);
iki_write_print_error_file(setting, main->error, macro_iki_write_f(f_file_read), f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
}
if (!setting->buffer.used) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_write_print_line_first_locked(setting, main->error);
fll_program_print_error_pipe_missing_content(main->error);
}
previous = range.start;
- setting->status = f_string_dynamic_seek_to(setting->buffer, f_string_ascii_feed_form_s.string[0], &range);
+ setting->state.status = f_string_dynamic_seek_to(setting->buffer, f_string_ascii_feed_form_s.string[0], &range);
- if (setting->status == F_data_not_stop) {
- setting->status = F_status_set_error(F_parameter);
+ if (setting->state.status == F_data_not_stop) {
+ setting->state.status = F_status_set_error(F_parameter);
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamic_seek_to));
return;
}
if (object_ended && previous == range.start) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_write_print_line_first_locked(setting, main->error);
fll_program_print_error_pipe_invalid_form_feed(main->error);
setting->content.used = 0;
if (setting->buffer.used) {
- setting->status = f_string_dynamic_partial_append_nulless(setting->buffer, range, &setting->content);
+ setting->state.status = f_string_dynamic_partial_append_nulless(setting->buffer, range, &setting->content);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamic_partial_append_nulless));
return;
}
iki_write_process(main, setting, setting->object, setting->content);
- if (F_status_is_error(setting->status)) return;
+ if (F_status_is_error(setting->state.status)) return;
fll_print_dynamic_raw(f_string_eol_s, main->output.to);
else {
setting->object.used = 0;
- setting->status = f_string_dynamic_partial_append_nulless(setting->buffer, range, &setting->object);
+ setting->state.status = f_string_dynamic_partial_append_nulless(setting->buffer, range, &setting->object);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamic_partial_append_nulless));
return;
} while (status != F_none_eof || setting->buffer.used || object_ended);
if (object_ended) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
iki_write_print_line_first_locked(setting, main->error);
fll_program_print_error_pipe_object_without_content(main->error);
if (!((++main->signal_check) % iki_write_signal_check_d)) {
if (fll_program_standard_signal_received(main)) {
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
}
iki_write_process(main, setting, setting->objects.array[i], setting->contents.array[i]);
- if (F_status_is_error(setting->status)) break;
+ if (F_status_is_error(setting->state.status)) break;
fll_print_dynamic_raw(f_string_eol_s, main->output.to);
} // for
- if (F_status_is_error(setting->status)) {
- iki_write_print_line_last_locked(setting, main->error);
- }
- else if (setting->status != F_interrupt) {
- iki_write_print_line_last_locked(setting, main->message);
+ if (F_status_is_error(setting->state.status)) {
+ iki_write_print_line_last_locked(setting, F_status_set_fine(setting->state.status) == F_interrupt ? main->message : main->error);
}
}
#endif // _di_iki_write_main_
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_true on success when performing verification and verify passed.
* F_false on success when performing verification and verify failed.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- iki_write_setting_load(arguments, state, &data, &setting);
+ iki_write_setting_load(arguments, &data, &setting);
}
iki_write_main(&data, &setting);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
iki_write_print_line_first_locked(setting, print);
- fll_error_print(print, F_status_set_fine(setting->status), function, fll_error_file_flag_fallback_e);
+ fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
return F_none;
}
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
iki_write_print_line_first_locked(setting, print);
- fll_error_file_print(print, F_status_set_fine(setting->status), function, fll_error_file_flag_fallback_e, name, operation, type);
+ fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type);
return F_none;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
* @param function
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param object
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
void iki_write_process(fll_program_data_t * const main, iki_write_setting_t * const setting, const f_string_static_t object, const f_string_static_t content) {
if (!object.used) {
- setting->status = F_status_set_error(F_failure);
+ setting->state.status = F_status_set_error(F_failure);
if (main->error.verbosity != f_console_verbosity_quiet_e) {
iki_write_print_line_first_locked(setting, main->error);
return;
}
- setting->status = f_iki_object_is(object);
+ setting->state.status = f_iki_object_is(object);
- if (setting->status == F_false) {
- setting->status = F_status_set_error(F_failure);
+ if (setting->state.status == F_false) {
+ setting->state.status = F_status_set_error(F_failure);
iki_write_print_error_object_not_valid(setting, main->error, object);
return;
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(f_iki_object_is));
return;
setting->escaped.used = 0;
- setting->status = fll_iki_content_escape(content, setting->quote, &setting->escaped);
+ setting->state.status = fll_iki_content_escape(content, setting->quote, &setting->escaped);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(fll_iki_content_escape));
return;
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_iki_object_is().
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- status_code_setting_load(arguments, state, &data, &setting);
+ status_code_setting_load(arguments, &data, &setting);
}
status_code_main(&data, &setting);
fll_program_standard_set_down(&data);
- return (F_status_is_error(setting.status) || setting.status == F_false) ? 1 : 0;
+ return (F_status_is_error(setting.state.status) || setting.state.status == F_false) ? 1 : 0;
}
* The main program settings.
* (Must be of type status_code_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
#define status_code_setting_t_initialize \
{ \
status_code_main_flag_none_e, \
- f_state_initialize_t, \
+ f_state_t_initialize, \
f_string_static_t_initialize, \
f_string_static_t_initialize, \
0, \
#endif // _di_status_code_setting_delete_
#ifndef _di_status_code_setting_load_
- void status_code_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, status_code_setting_t * const setting) {
+ void status_code_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, status_code_setting_t * const setting) {
if (!main || !setting) return;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
status_code_print_error(setting, main->error, macro_status_code_f(f_console_parameter_process));
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
status_code_print_error(setting, main->error, macro_status_code_f(fll_program_parameter_process_context));
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
status_code_print_error(setting, main->error, macro_status_code_f(fll_program_parameter_process_verbosity));
return;
if (setting->flag & status_code_main_flag_error_e) {
if (setting->flag & status_code_main_flag_warning_e) {
if (!(setting->flag & status_code_main_flag_number_e)) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
status_code_print_line_first_locked(setting, main->error);
status_code_print_error_cannot_error_warning_number(setting, main->error);
}
if (setting->flag & status_code_main_flag_fine_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
status_code_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, status_code_long_error_s, status_code_long_fine_s);
}
}
else if (setting->flag & status_code_main_flag_warning_e && setting->flag & status_code_main_flag_fine_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
status_code_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, status_code_long_warning_s, status_code_long_fine_s);
}
if (main->parameters.remaining.used == 0 && !(main->pipe & fll_program_data_pipe_input_e)) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
status_code_print_line_first_locked(setting, main->error);
status_code_print_error_no_status_codes(setting, main->error);
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* Errors (with error bit) from: fll_program_parameter_process_context().
- * @param state
- * A state for providing flags and handling interrupts during long running operations.
*
* @see f_console_parameter_process()
* @see fll_program_parameter_process_context()
*/
#ifndef _di_status_code_setting_load_
- extern void status_code_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, status_code_setting_t * const setting, f_state_t * const state);
+ extern void status_code_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, status_code_setting_t * const setting);
#endif // _di_status_code_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- status_code_setting_load(arguments, state, &data, &setting);
+ status_code_setting_load(arguments, &data, &setting);
}
status_code_main(&data, &setting);
fll_program_standard_set_down(&data);
- return (F_status_is_error(setting.status) || setting.status == F_false) ? 1 : 0;
+ return (F_status_is_error(setting.state.status) || setting.state.status == F_false) ? 1 : 0;
}
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
status_code_print_line_first_locked(setting, print);
- fll_error_print(print, F_status_set_fine(setting->status), function, fll_error_file_flag_fallback_e);
+ fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
return F_none;
}
status_code_program_help_parameters_s
);
- if (setting->status_string_help_detail) {
- setting->status_string_help_detail(setting, print);
+ if (setting->state.status_string_help_detail) {
+ setting->state.status_string_help_detail(setting, print);
}
f_print_dynamic_raw(setting->line_last, print.to);
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
}
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param name
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* The main program settings.
* (Must be of type status_code_setting_t.)
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
*
* @param setting
* The main program settings.
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @param value
* The parameter value to process.
*
- * @return
- * F_none on success.
- * F_data_not if string starts wth a null (length is 0).
- * F_parameter (with error bit) if a parameter is invalid.
- * F_number (with error bit) if parameter is not a number.
- * F_number_negative (with error bit) on negative value.
- * F_number_overflow (with error bit) on integer overflow.
- * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found.
+ * This alters setting.state.status:
+ * F_none on success.
+ * F_data_not if string starts wth a null (length is 0).
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_number (with error bit) if parameter is not a number.
+ * F_number_negative (with error bit) on negative value.
+ * F_number_overflow (with error bit) on integer overflow.
+ * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found.
*
- * Errors (with error bit) from: fss_status_code_convert_number().
+ * Errors (with error bit) from: fss_status_code_convert_number().
*
* @see fss_status_code_convert_number()
*/
#ifndef _di_status_code_process_check_
- extern f_status_t status_code_process_check(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value) F_attribute_visibility_internal_d;
+ extern void status_code_process_check(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value) F_attribute_visibility_internal_d;
#endif // _di_status_code_process_check_
/**
* @param value
* The parameter value to process.
*
- * @return
- * F_none on success.
- * F_data_not if string is empty.
- *
- * Errors (with error bit) from: fl_console_parameter_to_number_unsigned().
- * Errors (with error bit) from: fll_fss_status_string_to().
- * Errors (with error bit) from: fll_status_string_from().
+ * This alters setting.state.status:
+ * F_none on success.
+ * F_data_not if string is empty.
*
+ * Errors (with error bit) from: fl_console_parameter_to_number_unsigned().
+ * Errors (with error bit) from: fll_fss_status_string_to().
+ * Errors (with error bit) from: fll_status_string_from().
*
* @see fl_console_parameter_to_number_unsigned()
* @see fll_fss_status_string_from()
* @see fll_status_string_from()
*/
#ifndef _di_status_code_process_number_
- extern f_status_t status_code_process_number(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value) F_attribute_visibility_internal_d;
+ extern void status_code_process_number(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value) F_attribute_visibility_internal_d;
#endif // _di_status_code_process_number_
/**
* @param value
* The parameter value to process.
*
- * @return
- * F_none on success.
- * F_data_not if string starts wth a null (length is 0).
- * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found.
- * F_number (with error bit) if parameter is not a number.
- * F_number_negative (with error bit) on negative value.
- * F_number_overflow (with error bit) on integer overflow.
- * F_parameter (with error bit) if a parameter is invalid.
+ * This alters setting.state.status:
+ * F_none on success.
+ * F_data_not if string starts wth a null (length is 0).
+ * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found.
+ * F_number (with error bit) if parameter is not a number.
+ * F_number_negative (with error bit) on negative value.
+ * F_number_overflow (with error bit) on integer overflow.
+ * F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_status_string_to().
- * Errors (with error bit) from: fll_fss_status_string_to().
- * Errors (with error bit) from: fss_status_code_convert_number().
+ * Errors (with error bit) from: f_status_string_to().
+ * Errors (with error bit) from: fll_fss_status_string_to().
+ * Errors (with error bit) from: fss_status_code_convert_number().
*
* @see f_status_string_to()
* @see fll_fss_status_string_to()
* @see fss_status_code_convert_number()
*/
#ifndef _di_status_code_process_normal_
- extern f_status_t status_code_process_normal(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value) F_attribute_visibility_internal_d;
+ extern void status_code_process_normal(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value) F_attribute_visibility_internal_d;
#endif // _di_status_code_process_normal_
/**
* The converted number.
* Will not be updated on error.
*
- * @return
- * F_none on success.
- * F_data_not if string starts wth a null (length is 0).
- * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found.
- * F_number (with error bit) if parameter is not a number.
- * F_number_negative (with error bit) on negative value.
- * F_number_overflow (with error bit) on integer overflow.
- * F_parameter (with error bit) if a parameter is invalid.
+ * This alters setting.state.status:
+ * F_none on success.
+ * F_data_not if string starts wth a null (length is 0).
+ * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment is found.
+ * F_number (with error bit) if parameter is not a number.
+ * F_number_negative (with error bit) on negative value.
+ * F_number_overflow (with error bit) on integer overflow.
+ * F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: fl_console_parameter_to_number_unsigned().
+ * Errors (with error bit) from: fl_console_parameter_to_number_unsigned().
*
* @see fl_console_parameter_to_number_unsigned()
*/
#ifndef _di_status_code_convert_number_
- extern f_status_t status_code_convert_number(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value, f_number_unsigned_t *number) F_attribute_visibility_internal_d;
+ extern void status_code_convert_number(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value, f_number_unsigned_t *number) F_attribute_visibility_internal_d;
#endif // _di_status_code_convert_number_
#ifdef __cplusplus
if (!main || !setting) return;
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
status_code_print_line_last_locked(setting, main->error);
return;
}
- if (!setting->status_string_from || !setting->status_string_to) {
+ if (!setting->state.status_string_from || !setting->state.status_string_to) {
- if (!setting->status_string_from) {
+ if (!setting->state.status_string_from) {
status_code_print_error_invalid_callback(setting, main->error, macro_status_code_f(status_string_from));
}
- if (!setting->status_string_to) {
+ if (!setting->state.status_string_to) {
status_code_print_error_invalid_callback(setting, main->error, macro_status_code_f(status_string_to));
}
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
return;
}
- setting->status = F_none;
+ setting->state.status = F_none;
if (setting->flag & status_code_main_flag_help_e) {
status_code_print_help(setting, main->message);
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
return;
}
status2 = status_code_process_number(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]);
- if (F_status_is_error(status2) && setting->status == F_none) {
- setting->status = status2;
+ if (F_status_is_error(status2) && setting->state.status == F_none) {
+ setting->state.status = status2;
}
} // for
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
return;
}
status2 = status_code_process_check(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]);
- if (F_status_is_error(status2) && setting->status == F_none) {
- setting->status = status2;
+ if (F_status_is_error(status2) && setting->state.status == F_none) {
+ setting->state.status = status2;
}
} // for
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
return;
}
status2 = status_code_process_normal(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]);
- if (F_status_is_error(status2) && setting->status == F_none) {
- setting->status = status2;
+ if (F_status_is_error(status2) && setting->state.status == F_none) {
+ setting->state.status = status2;
}
} // for
}
}
- if (F_status_is_error(setting->status)) {
- status_code_print_line_last_locked(setting, main->error);
- }
- else if (setting->status != F_interrupt) {
- status_code_print_line_last_locked(setting, main->message);
+ if (F_status_is_error(setting->state.status)) {
+ status_code_print_line_last_locked(setting, F_status_set_fine(setting->state.status) == F_interrupt ? main->message : main->error);
}
}
#endif // _di_status_code_main_
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_true on success when performing verification and verify passed.
* F_false on success when performing verification and verify failed.
--- /dev/null
+#include "utf8.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_utf8_convert_bytesequence_
+ void utf8_convert_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
+
+ if (!main || !setting) return;
+
+ bool valid_not = F_false;
+
+ uint32_t codepoint = 0;
+
+ if (sequence.used) {
+ setting->state.status = f_utf_unicode_to(sequence.string, sequence.used, &codepoint);
+ }
+ else {
+ setting->state.status = F_status_set_error(F_utf_not);
+ }
+
+ if (F_status_is_error(setting->state.status)) {
+ setting->state.status = F_status_set_fine(setting->state.status);
+
+ if (setting->state.status == F_failure || setting->state.status == F_utf_not || setting->state.status == F_complete_not_utf || setting->state.status == F_utf_fragment || setting->state.status == F_valid_not) {
+ valid_not = F_true;
+
+ utf8_print_character_invalid(setting, main->output, sequence);
+ }
+ else {
+ setting->state.status = F_status_set_error(setting->state.status);
+
+ utf8_print_error_decode(setting, main->error, sequence);
+
+ return;
+ }
+ }
+ else if (!(setting->flag & utf8_main_flag_verify_e)) {
+ if (setting->mode & utf8_mode_to_bytesequence_e) {
+ utf8_print_bytesequence(setting, main->output, sequence);
+ }
+ else if (setting->mode & utf8_mode_to_codepoint_e) {
+ utf8_print_codepoint(setting, main->output, codepoint);
+ }
+ else {
+ utf8_print_combining_or_width(setting, main->output, sequence);
+ }
+ }
+
+ if (valid_not || F_status_is_error(setting->state.status)) {
+ setting->state.status = F_utf_not;
+ }
+ else {
+ setting->state.status = F_none;
+ }
+ }
+#endif // _di_utf8_convert_bytesequence_
+
+#ifndef _di_utf8_process_file_bytesequence_
+ void utf8_process_file_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) {
+
+ if (!main || !setting) return;
+
+ bool valid = F_true;
+ bool next = F_true;
+ uint8_t mode_codepoint = utf8_codepoint_mode_ready_e;
+
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+
+ f_char_t block[4] = { 0, 0, 0, 0 };
+ f_string_static_t sequence = macro_f_string_static_t_initialize(block, 0, 4);
+
+ do {
+ setting->state.status = f_file_stream_read_block(file, &setting->buffer);
+
+ if (setting->state.status == F_none_eof && !setting->buffer.used) break;
+
+ for (i = 0; F_status_is_error_not(setting->state.status) && i < setting->buffer.used; ) {
+
+ if (!((++main->signal_check) % utf8_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
+
+ setting->state.status = F_interrupt;
+
+ break;
+ }
+
+ main->signal_check = 0;
+ }
+
+ setting->state.status = F_none;
+
+ // Get the current width only when processing a new block.
+ if (next) {
+ sequence.used = macro_f_utf_byte_width(setting->buffer.string[i]);
+ next = F_false;
+ }
+
+ for (; j < sequence.used && i < setting->buffer.used; ++j, ++i) {
+ sequence.string[j] = setting->buffer.string[i];
+ } // for
+
+ if (j == sequence.used) {
+ if (setting->mode & utf8_mode_from_bytesequence_e) {
+ utf8_convert_bytesequence(main, setting, sequence);
+ }
+ else {
+ utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
+
+ if (F_status_is_error_not(setting->state.status) && setting->state.status != F_next) {
+ utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
+ }
+ }
+
+ if (setting->state.status == F_utf_not) {
+ valid = F_false;
+ }
+
+ j = 0;
+ next = F_true;
+ }
+ } // for
+
+ i = 0;
+ setting->buffer.used = 0;
+
+ } while (F_status_is_error_not(setting->state.status) && setting->state.status != F_interrupt);
+
+ // Handle last (incomplete) sequence when the buffer ended before the sequence is supposed to end.
+ if (F_status_is_error_not(setting->state.status) && setting->state.status != F_interrupt && next == F_false) {
+ sequence.used = j;
+
+ if (setting->mode & utf8_mode_from_bytesequence_e) {
+ utf8_convert_bytesequence(main, setting, sequence);
+ }
+ else {
+ utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
+
+ if (F_status_is_error_not(setting->state.status) && setting->state.status != F_next) {
+ utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
+ }
+ }
+
+ if (setting->state.status == F_utf_not) {
+ valid = F_false;
+ }
+ }
+
+ setting->buffer.used = 0;
+
+ if (F_status_is_error(setting->state.status) || setting->state.status == F_interrupt) return;
+
+ setting->state.status = valid;
+ }
+#endif // _di_utf8_process_file_bytesequence_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
* A byte sequences representing a single character to convert.
* This does not stop on NULL and will process all text until sequence.used.
*
- * @return
- * F_none on success.
- * F_utf_not on invalid UTF-8 (which is still "success" when verifying).
+ * This alters setting.state.status:
+ * F_none on success.
+ * F_utf_not on invalid UTF-8 (which is still "success" when verifying).
*
- * F_utf_not (with error bit) if not verifying and
+ * F_utf_not (with error bit) if not verifying and
*
- * Errors (with error bit) from: f_utf_unicode_to()
+ * Errors (with error bit) from: f_utf_unicode_to()
*/
#ifndef _di_utf8_convert_bytesequence_
- extern f_status_t utf8_convert_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) F_attribute_visibility_internal_d;
+ extern void utf8_convert_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) F_attribute_visibility_internal_d;
#endif // _di_utf8_convert_bytesequence_
/**
* The file stream to process.
* This file may contain NULLs.
*
- * @return
- * F_true on success and is valid.
- * F_false on success and contains invalid sequences.
- * F_interrupt on (exit) signal received.
+ * This alters setting.state.status:
+ * F_true on success and is valid.
+ * F_false on success and contains invalid sequences.
+ * F_interrupt on (exit) signal received.
*
- * Errors (with error bit) from: utf8_convert_bytesequence()
- * Errors (with error bit) from: utf8_detect_codepoint()
+ * Errors (with error bit) from: utf8_convert_bytesequence()
+ * Errors (with error bit) from: utf8_detect_codepoint()
*
* @see fll_program_standard_signal_received()
* @see utf8_convert_bytesequence()
* @see utf8_detect_codepoint()
*/
#ifndef _di_utf8_process_file_bytesequence_
- extern f_status_t utf8_process_file_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) F_attribute_visibility_internal_d;
+ extern void utf8_process_file_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) F_attribute_visibility_internal_d;
#endif // _di_utf8_process_file_bytesequence_
#ifdef __cplusplus
#include "utf8.h"
-#include "private-common.h"
-#include "private-utf8.h"
-#include "private-utf8_bytesequence.h"
-#include "private-utf8_codepoint.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _di_utf8_convert_codepoint_
- f_status_t utf8_convert_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) {
+ void utf8_convert_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) {
+
+ if (!main || !setting) return;
+
+ setting->state.status = F_none;
- f_status_t status = F_none;
bool valid_not = F_false;
if (*mode != utf8_codepoint_mode_end_e) {
if (setting->text.used + unicode.used >= setting->text.size) {
- status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &setting->text);
- if (F_status_is_error(status)) return status;
+ setting->state.status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &setting->text);
+ if (F_status_is_error(setting->state.status)) return;
}
for (f_array_length_t i = 0; i < unicode.used; ++i) {
if (*mode == utf8_codepoint_mode_end_e) {
uint32_t codepoint = 0;
- status = f_utf_unicode_string_to(setting->text.string, setting->text.used, &codepoint);
+ setting->state.status = f_utf_unicode_string_to(setting->text.string, setting->text.used, &codepoint);
- if (F_status_is_error(status)) {
- status = F_status_set_fine(status);
+ if (F_status_is_error(setting->state.status)) {
+ setting->state.status = F_status_set_fine(setting->state.status);
- if (status == F_failure || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_valid_not) {
+ if (setting->state.status == F_failure || setting->state.status == F_utf_not || setting->state.status == F_complete_not_utf || setting->state.status == F_utf_fragment || setting->state.status == F_valid_not) {
valid_not = F_true;
utf8_print_character_invalid(setting, main->output, unicode);
}
else {
- status = F_status_set_error(status);
+ setting->state.status = F_status_set_error(setting->state.status);
- utf8_print_error_decode(setting, main->error, status, unicode);
+ utf8_print_error_decode(setting, main->error, unicode);
- return status;
+ return;
}
}
else if (!(setting->flag & utf8_main_flag_verify_e)) {
f_char_t byte[4] = { 0, 0, 0, 0 };
f_string_static_t unicode = macro_f_string_static_t_initialize(byte, 0, 4);
- status = f_utf_unicode_from(codepoint, 4, &unicode.string);
+ setting->state.status = f_utf_unicode_from(codepoint, 4, &unicode.string);
- if (F_status_is_error(status)) {
+ if (F_status_is_error(setting->state.status)) {
if (setting->mode & utf8_mode_to_bytesequence_e) {
- utf8_print_error_encode(setting, main->error, status, codepoint);
+ utf8_print_error_encode(setting, main->error, codepoint);
}
else {
utf8_print_combining_or_width_invalid(setting, main->output);
}
}
else if (setting->mode & utf8_mode_to_bytesequence_e) {
- status = F_none;
+ setting->state.status = F_none;
unicode.used = macro_f_utf_byte_width(unicode.string[0]);
utf8_print_bytesequence(setting, main->output, unicode);
}
else {
- status = F_none;
+ setting->state.status = F_none;
utf8_print_combining_or_width(setting, main->output, unicode);
}
}
}
else if (*mode == utf8_codepoint_mode_bad_end_e) {
- status = F_none;
+ setting->state.status = F_none;
utf8_print_character_invalid(setting, main->output, unicode);
}
else {
- return F_none;
+ setting->state.status = F_none;
+
+ return;
}
*mode = utf8_codepoint_mode_ready_e;
setting->text.used = 0;
- if (valid_not || F_status_is_error(status)) {
- return F_utf_not;
+ if (valid_not || F_status_is_error(setting->state.status)) {
+ setting->state.status = F_utf_not;
}
-
- return status;
}
#endif // _di_utf8_convert_codepoint_
#ifndef _di_utf8_convert_raw_
- f_status_t utf8_convert_raw(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t hex, uint8_t *mode) {
+ void utf8_convert_raw(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t hex, uint8_t *mode) {
+
+ if (!main || !setting) return;
+
+ setting->state.status = F_none;
- f_status_t status = F_none;
bool valid_not = F_false;
if (*mode != utf8_codepoint_mode_raw_end_e) {
if (setting->text.used + hex.used >= setting->text.size) {
- status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &setting->text);
- if (F_status_is_error(status)) return status;
+ setting->state.status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &setting->text);
+ if (F_status_is_error(setting->state.status)) return;
}
for (f_array_length_t i = 0; i < hex.used; ++i) {
{
f_number_unsigned_t number = 0;
- status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, setting->text, &number);
+ setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, setting->text, &number);
raw = (f_utf_char_t) number;
}
- if (F_status_is_error(status)) {
- status = F_status_set_fine(status);
+ if (F_status_is_error(setting->state.status)) {
+ setting->state.status = F_status_set_fine(setting->state.status);
- if (status == F_number || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_number_decimal || status == F_number_negative || status == F_number_positive || status == F_number_overflow) {
+ if (setting->state.status == F_number || setting->state.status == F_utf_not || setting->state.status == F_complete_not_utf || setting->state.status == F_utf_fragment || setting->state.status == F_number_decimal || setting->state.status == F_number_negative || setting->state.status == F_number_positive || setting->state.status == F_number_overflow) {
valid_not = F_true;
utf8_print_character_invalid(setting, main->output, hex);
}
else {
- status = F_status_set_error(status);
+ setting->state.status = F_status_set_error(setting->state.status);
- utf8_print_error_decode(setting, main->error, status, hex);
+ utf8_print_error_decode(setting, main->error, hex);
- return status;
+ return;
}
}
else if (!(setting->flag & utf8_main_flag_verify_e)) {
}
}
else if (*mode == utf8_codepoint_mode_bad_end_e) {
- status = F_none;
+ setting->state.status = F_none;
utf8_print_character_invalid(setting, main->output, hex);
}
else {
- return F_none;
+ setting->state.status = F_none;
+
+ return;
}
*mode = utf8_codepoint_mode_ready_e;
setting->text.used = 0;
- if (valid_not || F_status_is_error(status)) {
- return F_valid_not;
+ if (valid_not || F_status_is_error(setting->state.status)) {
+ setting->state.status = F_valid_not;
}
-
- return status;
}
#endif // _di_utf8_convert_raw_
#ifndef _di_utf8_detect_codepoint_
- f_status_t utf8_detect_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) {
+ void utf8_detect_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) {
+
+ if (!main || !setting) return;
// Skip past NULL.
if (!unicode.string[0]) {
- return F_next;
+ setting->state.status = F_next;
+
+ return;
}
- f_status_t status = F_none;
+ setting->state.status = F_none;
if (unicode.string[0] == f_string_ascii_u_s.string[0] || unicode.string[0] == f_string_ascii_U_s.string[0] || unicode.string[0] == f_string_ascii_plus_s.string[0]) {
// Do nothing.
// Do nothing.
}
else if (unicode.string[0] == f_string_ascii_space_s.string[0]) {
- status = F_space;
+ setting->state.status = F_space;
}
else if (macro_f_utf_byte_width_is(*unicode.string)) {
- status = f_utf_is_whitespace(unicode.string, 4, F_true);
+ setting->state.status = f_utf_is_whitespace(unicode.string, 4, F_true);
- if (F_status_is_error(status)) {
- if (F_status_set_fine(status) == F_complete_not_utf || F_status_set_fine(status) == F_utf_fragment) {
- status = F_valid_not;
+ if (F_status_is_error(setting->state.status)) {
+ if (F_status_set_fine(setting->state.status) == F_complete_not_utf || F_status_set_fine(setting->state.status) == F_utf_fragment) {
+ setting->state.status = F_valid_not;
}
else {
- return status;
+ return;
}
}
- if (status == F_true) {
- status = F_space;
- }
- else {
- status = F_valid_not;
- }
+ setting->state.status = (setting->state.status == F_true) ? F_space : F_valid_not;
}
else {
if (unicode.string[0] < 0x30 || unicode.string[0] > (0x39 && unicode.string[0] < 0x41) || (unicode.string[0] > 0x46 && unicode.string[0] < 0x61) || unicode.string[0] > 0x66) {
- status = f_utf_is_whitespace(unicode.string, 4, F_true);
+ setting->state.status = f_utf_is_whitespace(unicode.string, 4, F_true);
- if (F_status_is_error(status)) {
- if (F_status_set_fine(status) == F_complete_not_utf || F_status_set_fine(status) == F_utf_fragment) {
- status = F_valid_not;
+ if (F_status_is_error(setting->state.status)) {
+ if (F_status_set_fine(setting->state.status) == F_complete_not_utf || F_status_set_fine(setting->state.status) == F_utf_fragment) {
+ setting->state.status = F_valid_not;
}
else {
- return status;
+ return;
}
}
- if (status == F_true) {
- status = F_space;
- }
- else {
- status = F_none;
- }
+ setting->state.status = (setting->state.status == F_true) ? F_space : F_none;
}
}
- if (status == F_valid_not) {
+ if (setting->state.status == F_valid_not) {
if (*mode != utf8_codepoint_mode_bad_e) {
if (*mode == utf8_codepoint_mode_bad_begin_e) {
*mode = utf8_codepoint_mode_bad_e;
}
else {
if (*mode == utf8_codepoint_mode_bad_e) {
- if (status == F_space) {
+ if (setting->state.status == F_space) {
*mode = utf8_codepoint_mode_bad_end_e;
}
}
else if (*mode == utf8_codepoint_mode_ready_e) {
- if (status == F_space) {
- status = F_next;
+ if (setting->state.status == F_space) {
+ setting->state.status = F_next;
}
else if (unicode.string[0] == f_string_ascii_u_s.string[0] || unicode.string[0] == f_string_ascii_U_s.string[0]) {
*mode = utf8_codepoint_mode_begin_e;
}
}
else if (*mode == utf8_codepoint_mode_raw_number_e) {
- if (status == F_space) {
+ if (setting->state.status == F_space) {
*mode = utf8_codepoint_mode_raw_end_e;
}
}
else if (*mode == utf8_codepoint_mode_number_e) {
- if (status == F_space) {
+ if (setting->state.status == F_space) {
*mode = utf8_codepoint_mode_end_e;
}
}
}
-
- return status;
}
#endif // _di_utf8_detect_codepoint_
#ifndef _di_utf8_process_file_codepoint_
- f_status_t utf8_process_file_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) {
+ void utf8_process_file_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) {
+
+ if (!main || !setting) return;
+
+ setting->state.status = F_none;
- f_status_t status = F_none;
bool valid = F_true;
bool next = F_true;
uint8_t mode_codepoint = utf8_codepoint_mode_ready_e;
f_string_static_t sequence = macro_f_string_static_t_initialize(block, 0, 0);
do {
- status = f_file_stream_read_block(file, &setting->buffer);
+ setting->state.status = f_file_stream_read_block(file, &setting->buffer);
- if (status == F_none_eof && !setting->buffer.used) {
+ if (setting->state.status == F_none_eof && !setting->buffer.used) {
// Handle complete character, which must be explicitly set to end in this situation.
if (mode_codepoint == utf8_codepoint_mode_number_e || mode_codepoint == utf8_codepoint_mode_raw_number_e) {
if (mode_codepoint == utf8_codepoint_mode_number_e) {
mode_codepoint = utf8_codepoint_mode_end_e;
- status = utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
}
else if (mode_codepoint == utf8_codepoint_mode_raw_number_e) {
mode_codepoint = utf8_codepoint_mode_raw_end_e;
- status = utf8_convert_raw(main, setting, sequence, &mode_codepoint);
+ utf8_convert_raw(main, setting, sequence, &mode_codepoint);
// Raw mode represents an invalid Unicode sequence.
valid = F_false;
j = 0;
next = F_true;
- status = F_none_eof;
+ setting->state.status = F_none_eof;
mode_codepoint = utf8_codepoint_mode_ready_e;
}
break;
}
- for (i = 0; F_status_is_fine(status) && i < setting->buffer.used; ) {
+ for (i = 0; F_status_is_error_not(setting->state.status) && i < setting->buffer.used; ) {
if (!((++main->signal_check) % utf8_signal_check_d)) {
if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- status = F_interrupt;
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
main->signal_check = 0;
}
- status = F_none;
+ setting->state.status = F_none;
// Get the current width only when processing a new block.
if (next) {
if (j >= sequence.used) {
if (setting->mode & utf8_mode_from_bytesequence_e) {
- status = utf8_convert_bytesequence(main, setting, sequence);
+ utf8_convert_bytesequence(main, setting, sequence);
}
else {
- status = utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
- if (F_status_is_fine(status) && status != F_next) {
+ if (F_status_is_error_not(setting->state.status) && setting->state.status != F_next) {
if (mode_codepoint == utf8_codepoint_mode_raw_begin_e || mode_codepoint == utf8_codepoint_mode_raw_number_e || mode_codepoint == utf8_codepoint_mode_raw_end_e) {
- status = utf8_convert_raw(main, setting, sequence, &mode_codepoint);
+ utf8_convert_raw(main, setting, sequence, &mode_codepoint);
// Raw mode represents an invalid Unicode sequence.
valid = F_false;
}
else {
- status = utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
}
}
}
- if (status == F_utf_not) {
+ if (setting->state.status == F_utf_not) {
valid = F_false;
}
setting->buffer.used = 0;
- } while (F_status_is_fine(status) && status != F_interrupt);
+ } while (F_status_is_error_not(setting->state.status));
// Handle last (incomplete) character when the buffer ended before the character is supposed to end.
- if (F_status_is_error_not(status) && status != F_interrupt && next == F_false) {
+ if (F_status_is_error_not(setting->state.status) && next == F_false) {
sequence.used = j;
if (setting->mode & utf8_mode_from_bytesequence_e) {
- status = utf8_convert_bytesequence(main, setting, sequence);
+ utf8_convert_bytesequence(main, setting, sequence);
}
else {
- status = utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
- if (F_status_is_fine(status) && status != F_next) {
+ if (F_status_is_error_not(setting->state.status) && setting->state.status != F_next) {
if (mode_codepoint == utf8_codepoint_mode_raw_begin_e || mode_codepoint == utf8_codepoint_mode_raw_number_e || mode_codepoint == utf8_codepoint_mode_raw_end_e) {
- status = utf8_convert_raw(main, setting, sequence, &mode_codepoint);
+ utf8_convert_raw(main, setting, sequence, &mode_codepoint);
// Raw mode represents an invalid Unicode sequence.
valid = F_false;
}
else {
- status = utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
+ utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
}
}
}
- if (status == F_utf_not) {
+ if (setting->state.status == F_utf_not) {
valid = F_false;
}
}
setting->buffer.used = 0;
- if (F_status_is_error(status) || status == F_interrupt) return status;
+ if (F_status_is_error(setting->state.status)) return;
- return valid;
+ setting->state.status = valid;
}
#endif // _di_utf8_process_file_codepoint_
* @param mode
* The codepoint mode the text is currently in.
*
- * @return
- * F_none on success.
- * F_utf_not on invalid UTF-8 (which is still "success" when verifying).
+ * This alters setting.state.status:
+ * F_none on success.
+ * F_utf_not on invalid UTF-8 (which is still "success" when verifying).
*
- * F_utf_not (with error bit) if not verifying and the Unicode value is invalid.
+ * F_utf_not (with error bit) if not verifying and the Unicode value is invalid.
*
- * Errors (with error bit) from: f_utf_unicode_to()
+ * Errors (with error bit) from: f_utf_unicode_to()
*
* @see f_utf_unicode_to()
*/
#ifndef _di_utf8_convert_codepoint_
- extern f_status_t utf8_convert_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) F_attribute_visibility_internal_d;
+ extern void utf8_convert_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) F_attribute_visibility_internal_d;
#endif // _di_utf8_convert_codepoint_
/**
* @param mode
* The codepoint mode the text is currently in.
*
- * @return
- * F_none on success.
- * F_valid_not on invalid raw (which is still "success" when verifying).
+ * This alters setting.state.status:
+ * F_none on success.
+ * F_valid_not on invalid raw (which is still "success" when verifying).
*
- * F_valid_not (with error bit) if not verifying and the raw value is invalid.
+ * F_valid_not (with error bit) if not verifying and the raw value is invalid.
*
- * Errors (with error bit) from: fl_conversion_dynamic_to_unsigned_detect()
+ * Errors (with error bit) from: fl_conversion_dynamic_to_unsigned_detect()
*
* @see fl_conversion_dynamic_to_unsigned_detect()
*/
#ifndef _di_utf8_convert_raw_
- extern f_status_t utf8_convert_raw(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t hex, uint8_t *mode) F_attribute_visibility_internal_d;
+ extern void utf8_convert_raw(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t hex, uint8_t *mode) F_attribute_visibility_internal_d;
#endif // _di_utf8_convert_raw_
/**
* @param mode
* Designate the mode in which the curent state is being processed.
*
- * @return
- * F_none on success.
- * F_next on success, but should not be processed (it is white space or NULL).
- * F_space on success, but the character is whitespace.
+ * This alters setting.state.status:
+ * F_none on success.
+ * F_next on success, but should not be processed (it is white space or NULL).
+ * F_space on success, but the character is whitespace.
*
- * Errors (with error bit) from: f_utf_is_whitespace()
+ * Errors (with error bit) from: f_utf_is_whitespace()
*/
#ifndef _di_utf8_detect_codepoint_
- extern f_status_t utf8_detect_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) F_attribute_visibility_internal_d;
+ extern void utf8_detect_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) F_attribute_visibility_internal_d;
#endif // _di_utf8_detect_codepoint_
/**
* The file stream to process.
* This file may contain NULLs.
*
- * @return
- * F_true on success and is valid.
- * F_false on success and contains invalid sequences.
- * F_interrupt on (exit) signal received.
+ * This alters setting.state.status:
+ * F_true on success and is valid.
+ * F_false on success and contains invalid sequences.
+ * F_interrupt on (exit) signal received.
*
- * Errors (with error bit) from: utf8_convert_bytesequence()
- * Errors (with error bit) from: utf8_detect_codepoint()
+ * Errors (with error bit) from: utf8_convert_bytesequence()
+ * Errors (with error bit) from: utf8_detect_codepoint()
*
* @see fll_program_standard_signal_received()
* @see utf8_convert_bytesequence()
* @see utf8_detect_codepoint()
*/
#ifndef _di_utf8_process_file_codepoint_
- extern f_status_t utf8_process_file_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) F_attribute_visibility_internal_d;
+ extern void utf8_process_file_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) F_attribute_visibility_internal_d;
#endif // _di_utf8_process_file_codepoint_
#ifdef __cplusplus
#endif // _di_utf8_main_flag_e_
/**
+ * Codepoint modes for converting to/from binary and codepoint values.
+ *
+ * The special "raw" format is used only for reading from codepoint format where that format represents binary character that is not a valid Unicode character.
+ * This is intended to be used to save and restore the original binary data even if that data is invalid.
+ *
+ * private_utf8_codepoint_mode_*:
+ * - ready: The codepoint has yet to be processed, skip leading spaces until first 'U' is matched.
+ * - begin: The first 'U' is matched, look for the '+'.
+ * - number: The '+' is matched, process numbers.
+ * - end: The last number is reached (at either white space or EOS/EOF).
+ * - bad: This is not a valid codepoint.
+ * - bad_begin: This is the beginning of an invalid codepoint.
+ * - bad_end: The end of bad is detected, which happens on white space or end of buffer.
+ * - raw_begin: This is the beginning of a potential raw data (matched '0').
+ * - raw_number: This is the confirmed beginning of raw data (matched 'X'), process numbers.
+ * - raw_end: The end of raw data is detected, which happens on white space or end of buffer.
+ */
+#ifndef _di_utf8_codepoint_modes_
+ enum {
+ utf8_codepoint_mode_ready_e = 1,
+ utf8_codepoint_mode_begin_e,
+ utf8_codepoint_mode_number_e,
+ utf8_codepoint_mode_end_e,
+ utf8_codepoint_mode_bad_e,
+ utf8_codepoint_mode_bad_begin_e,
+ utf8_codepoint_mode_bad_end_e,
+ utf8_codepoint_mode_raw_begin_e,
+ utf8_codepoint_mode_raw_number_e,
+ utf8_codepoint_mode_raw_end_e,
+ }; // enum
+#endif // _di__utf8_codepoint_modes_
+
+/**
* The main program parameters.
*/
#ifndef _di_utf8_parameter_e_
{ \
utf8_mode_from_bytesequence_e | utf8_mode_to_codepoint_e, \
utf8_main_flag_none_e, \
- f_state_initialize_t, \
+ f_state_t_initialize, \
f_color_set_t_initialize, \
f_color_set_t_initialize, \
f_string_static_t_initialize, \
#endif // _di_utf8_setting_delete_
#ifndef _di_utf8_setting_load_
- void utf8_setting_load(const f_console_arguments_t arguments, f_state_t * const state, fll_program_data_t * const main, utf8_setting_t * const setting) {
+ void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
- // Load parameters.
- setting->status = f_console_parameter_process(arguments, state, &main->parameters, 0);
+ f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_process));
return;
const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e };
- setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+ setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error(setting, main->error, macro_utf8_f(fll_program_parameter_process_context));
return;
const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
- setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+ setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error(setting, main->error, macro_utf8_f(fll_program_parameter_process_verbosity));
return;
choices.array = choices_array;
choices.used = 2;
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+ setting->state.status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_prioritize_right));
return;
choices.used = 4;
choice = 1;
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+ setting->state.status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_prioritize_right));
return;
if (main->parameters.array[utf8_parameter_to_file_e].result & f_console_result_value_e) {
if (main->parameters.array[utf8_parameter_to_file_e].values.used > 1) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
utf8_print_error_parameter_file_to_too_many(setting, main->error);
if (main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]].used) {
setting->path_files_to.used = 0;
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
+ setting->state.status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by));
return;
setting->path_files_to.array[setting->path_files_to.used].used = 0;
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
+ setting->state.status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamic_append_nulless));
return;
++setting->path_files_to.used;
- setting->status = f_file_stream_open(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
+ setting->state.status = f_file_stream_open(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error_file(setting, main->error, macro_utf8_f(f_file_stream_open), main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
return;
utf8_print_line_first_locked(setting, main->error);
utf8_print_error_parameter_file_name_empty(setting, main->error, main->parameters.array[utf8_parameter_to_file_e].values.array[0]);
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
return;
}
}
else if (main->parameters.array[utf8_parameter_to_file_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
utf8_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, utf8_long_to_file_s);
if (main->parameters.array[utf8_parameter_from_file_e].result & f_console_result_value_e) {
setting->path_files_from.used = 0;
- setting->status = f_string_dynamics_increase_by(main->parameters.array[utf8_parameter_from_file_e].values.used, &setting->path_files_from);
+ setting->state.status = f_string_dynamics_increase_by(main->parameters.array[utf8_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by));
return;
index = main->parameters.array[utf8_parameter_from_file_e].values.array[i];
setting->path_files_from.array[i].used = 0;
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
+ setting->state.status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(setting->status), macro_utf8_f(f_string_dynamic_append_nulless), fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), macro_utf8_f(f_string_dynamic_append_nulless), fll_error_file_flag_fallback_e);
break;
}
if (f_file_exists(main->parameters.arguments.array[index], F_true) != F_true) {
utf8_print_error_parameter_file_not_found(setting, main->error, F_true, main->parameters.arguments.array[index]);
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = F_status_set_error(F_file_found_not);
}
}
}
else {
utf8_print_error_parameter_file_name_empty(setting, main->error, index);
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = F_status_set_error(F_parameter);
}
}
} // for
- if (F_status_is_error(setting->status)) return;
+ if (F_status_is_error(setting->state.status)) return;
setting->flag |= utf8_main_flag_file_from_e;
}
else if (main->parameters.array[utf8_parameter_from_file_e].result & f_console_result_found_e) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
utf8_print_line_first_locked(setting, main->error);
fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, utf8_long_from_file_s);
if (main->parameters.remaining.used) {
setting->remaining.used = 0;
- setting->status = f_string_dynamics_increase_by(main->parameters.remaining.used, &setting->remaining);
+ setting->state.status = f_string_dynamics_increase_by(main->parameters.remaining.used, &setting->remaining);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by));
return;
}
if (!(main->parameters.array[utf8_parameter_from_file_e].result & f_console_result_found_e) && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- setting->status = F_status_set_error(F_parameter);
+ setting->state.status = F_status_set_error(F_parameter);
utf8_print_line_first_locked(setting, main->error);
utf8_print_error_no_from(setting, main->error);
* @param setting
* The program main setting data.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
*
* Errors (with error bit) from: f_console_parameter_process().
* @see fll_program_parameter_process_context()
*/
#ifndef _di_utf8_setting_load_
- extern void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting, f_state_t * const state);
+ extern void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting);
#endif // _di_utf8_setting_load_
/**
* The main program settings.
* All buffers are deallocated.
*
- * This does not alter setting.status.
+ * This does not alter setting.state.status.
*
* @return
* F_none on success.
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
- f_state_t state = f_state_t_initialize;
- utf8_setting_load(arguments, state, &data, &setting);
+ utf8_setting_load(arguments, &data, &setting);
}
utf8_main(&data, &setting);
fll_program_standard_set_down(&data);
- return (F_status_is_error(setting.status) || setting.status == F_false) ? 1 : 0;
+ return (F_status_is_error(setting.state.status) || setting.state.status == F_false) ? 1 : 0;
}
#include "utf8.h"
-#include "private-common.h"
#ifdef __cplusplus
extern "C" {
#ifndef _di_utf8_print_error_
f_status_t utf8_print_error(utf8_setting_t * const setting, const fl_print_t print, const f_string_t function) {
+ if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
utf8_print_line_first_locked(setting, print);
- fll_error_print(print, F_status_set_fine(setting->status), function, fll_error_file_flag_fallback_e);
+ fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e);
return F_none;
}
#endif // _di_utf8_print_error_
#ifndef _di_utf8_print_error_decode_
- f_status_t utf8_print_error_decode(utf8_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_static_t invalid) {
+ f_status_t utf8_print_error_decode(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t invalid) {
+ if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
fl_print_format("%]", print.to, print.set->notable);
}
- if (F_status_set_fine(status) == F_utf_not) {
+ if (F_status_set_fine(setting->state.status) == F_utf_not) {
fl_print_format("%[', not a valid UTF-8 character sequence.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
}
- else if (F_status_set_fine(status) == F_complete_not_utf) {
+ else if (F_status_set_fine(setting->state.status) == F_complete_not_utf) {
fl_print_format("%[', invalid UTF-8 (truncated).%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
}
- else if (F_status_set_fine(status) == F_utf_fragment) {
+ else if (F_status_set_fine(setting->state.status) == F_utf_fragment) {
fl_print_format("%[', invalid UTF-8 fragment.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
}
else {
fl_print_format("%[', error status code%] ", print.to, print.set->error, print.set->error, f_string_eol_s);
- fl_print_format("%[%ui%]", print.to, print.set->notable, F_status_set_fine(status), print.set->notable);
+ fl_print_format("%[%ui%]", print.to, print.set->notable, F_status_set_fine(setting->state.status), print.set->notable);
fl_print_format("%[.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
}
#endif // _di_utf8_print_error_decode_
#ifndef _di_utf8_print_error_encode_
- f_status_t utf8_print_error_encode(utf8_setting_t * const setting, const fl_print_t print, const f_status_t status, const uint32_t codepoint) {
+ f_status_t utf8_print_error_encode(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint) {
+ if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
utf8_print_line_first_unlocked(setting, print);
fl_print_format("%[%QFailed to encode Unicode codepoint '%]", print.to, print.set->error, print.prefix, print.set->error);
fl_print_format("%[U+%_U%]", print.to, print.set->notable, codepoint, print.set->notable);
- if (F_status_set_fine(status) == F_utf_not) {
+ if (F_status_set_fine(setting->state.status) == F_utf_not) {
fl_print_format("%[', not a valid Unicode codepoint.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
}
else {
fl_print_format("%[', error status code%] ", print.to, print.set->error, print.set->error, f_string_eol_s);
- fl_print_format("%[%ui%]", print.to, print.set->notable, F_status_set_fine(status), print.set->notable);
+ fl_print_format("%[%ui%]", print.to, print.set->notable, F_status_set_fine(setting->state.status), print.set->notable);
fl_print_format("%[.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
}
#ifndef _di_utf8_print_error_file_
f_status_t utf8_print_error_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
+ if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
utf8_print_line_first_locked(setting, print);
- fll_error_file_print(print, F_status_set_fine(setting->status), function, fll_error_file_flag_fallback_e, name, operation, type);
+ fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type);
return F_none;
}
#ifndef _di_utf8_print_error_no_from_
f_status_t utf8_print_error_no_from(utf8_setting_t * const setting, const fl_print_t print) {
+ if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
fll_print_format("%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", print.to, print.set->error, print.prefix, print.set->error, f_string_eol_s);
#ifndef _di_utf8_print_error_parameter_file_name_empty_
f_status_t utf8_print_error_parameter_file_name_empty(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index) {
+ if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
f_file_stream_lock(print.to);
#ifndef _di_utf8_print_error_parameter_file_not_found_
f_status_t utf8_print_error_parameter_file_not_found(utf8_setting_t * const setting, const fl_print_t print, const bool from, const f_string_static_t name) {
+ if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
f_file_stream_lock(print.to);
#ifndef _di_utf8_print_error_parameter_file_to_too_many_
f_status_t utf8_print_error_parameter_file_to_too_many(utf8_setting_t * const setting, const fl_print_t print) {
+ if (!setting) return F_status_set_error(F_output_not);
if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
utf8_print_line_first_locked(setting, print);
#ifndef _di_utf8_print_bytesequence_
f_status_t utf8_print_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) {
+ if (!setting) return F_output_not;
+
fl_print_format("%r%r%r", print.to, setting->prepend, sequence, setting->append);
return F_none;
#ifndef _di_utf8_print_character_invalid_
f_status_t utf8_print_character_invalid(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t invalid) {
+ if (!setting) return F_output_not;
if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
if (!invalid.used) return F_output_not;
#ifndef _di_utf8_print_codepoint_
f_status_t utf8_print_codepoint(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint) {
+ if (!setting) return F_output_not;
+
if (codepoint < 0x10000) {
fl_print_format("%rU+%04_U%r", print.to, setting->prepend, codepoint, setting->append);
}
#ifndef _di_utf8_print_combining_or_width_
f_status_t utf8_print_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) {
+ if (!setting) return F_output_not;
+
if (setting->mode & utf8_mode_to_combining_e) {
f_status_t status = f_utf_is_combining(sequence.string, sequence.used);
#ifndef _di_utf8_print_combining_or_width_invalid_
f_status_t utf8_print_combining_or_width_invalid(utf8_setting_t * const setting, const fl_print_t print) {
+ if (!setting) return F_output_not;
if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, utf8_string_unknown_s, setting->valid_not, setting->append);
#ifndef _di_utf8_print_help_
f_status_t utf8_print_help(utf8_setting_t * const setting, const fl_print_t print) {
+ if (!setting) return F_output_not;
+
f_file_stream_lock(print.to);
f_print_dynamic_raw(setting->line_first, print.to);
#ifndef _di_utf8_print_line_first_locked_
f_status_t utf8_print_line_first_locked(utf8_setting_t * const setting, const fl_print_t print) {
- if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (!setting) return F_status_set_error(F_output_not);
+ if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & (utf8_main_flag_verify_e | utf8_main_flag_file_to_e)) return F_output_not;
}
#ifndef _di_utf8_print_line_first_unlocked_
f_status_t utf8_print_line_first_unlocked(utf8_setting_t * const setting, const fl_print_t print) {
- if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (!setting) return F_status_set_error(F_output_not);
+ if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & (utf8_main_flag_verify_e | utf8_main_flag_file_to_e)) return F_output_not;
}
#ifndef _di_utf8_print_line_last_locked_
f_status_t utf8_print_line_last_locked(utf8_setting_t * const setting, const fl_print_t print) {
- if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (!setting) return F_status_set_error(F_output_not);
+ if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & (utf8_main_flag_verify_e | utf8_main_flag_file_to_e)) return F_output_not;
}
// Two lines are printed because the normal final end of line is never printed by design.
// If this is an error or the header flag is set, then the normal end of line is printed by design so do not print this second new line.
- if (F_status_is_error_not(setting->status) && !(setting->flag & utf8_main_flag_header_e)) {
+ if (F_status_is_error_not(setting->state.status) && !(setting->flag & utf8_main_flag_header_e)) {
fll_print_dynamic_raw(setting->line_last, print.to);
}
#ifndef _di_utf8_print_line_last_unlocked_
f_status_t utf8_print_line_last_unlocked(utf8_setting_t * const setting, const fl_print_t print) {
- if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (!setting) return F_status_set_error(F_output_not);
+ if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (print.verbosity < f_console_verbosity_normal_e) return F_output_not;
if (setting->flag & (utf8_main_flag_verify_e | utf8_main_flag_file_to_e)) return F_output_not;
}
#ifndef _di_utf8_print_raw_bytesequence_
f_status_t utf8_print_raw_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_utf_char_t raw, const uint8_t width) {
+ if (!setting) return F_output_not;
if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
f_string_static_t character = macro_f_string_static_t_initialize(0, 0, width);
#ifndef _di_utf8_print_raw_codepoint_
f_status_t utf8_print_raw_codepoint(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t raw) {
+ if (!setting) return F_output_not;
if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, raw, setting->valid_not, setting->append);
#ifndef _di_utf8_print_raw_combining_or_width_
f_status_t utf8_print_raw_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const uint8_t width) {
+ if (!setting) return F_output_not;
if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
if (setting->mode & utf8_mode_to_combining_e) {
#ifndef _di_utf8_print_section_header_file_
f_status_t utf8_print_section_header_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t name, const f_array_length_t index) {
+ if (!setting) return F_output_not;
if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
if (setting->flag & utf8_main_flag_verify_e) return F_output_not;
#ifndef _di_utf8_print_section_header_parameter_
f_status_t utf8_print_section_header_parameter(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index) {
+ if (!setting) return F_output_not;
if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
if (setting->flag & utf8_main_flag_verify_e) return F_output_not;
#ifndef _di_utf8_print_section_header_pipe_
f_status_t utf8_print_section_header_pipe(utf8_setting_t * const setting, const fl_print_t print) {
+ if (!setting) return F_output_not;
if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
if (setting->flag & utf8_main_flag_verify_e) return F_output_not;
#ifndef _di_utf8_print_width_
f_status_t utf8_print_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) {
+ if (!setting) return F_status_set_error(F_output_not);
+ if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+
f_status_t status = f_utf_is_wide(sequence.string, sequence.used);
if (status == F_true) {
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* F_none on success.
* F_output_not on success, but no printing is performed.
*
+ * F_output_not (with error bit) if setting is NULL.
+ *
* @see fll_error_print()
*/
#ifndef _di_utf8_print_error_
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param invalid
* The byte sequence string or unicode codepoint string representing a single character to print.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_error_decode_
- extern f_status_t utf8_print_error_decode(utf8_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_static_t invalid);
+ extern f_status_t utf8_print_error_decode(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t invalid);
#endif // _di_utf8_print_error_decode_
/**
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param codepoint
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_error_encode_
- extern f_status_t utf8_print_error_encode(utf8_setting_t * const setting, const fl_print_t print, const f_status_t status, const uint32_t codepoint);
+ extern f_status_t utf8_print_error_encode(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint);
#endif // _di_utf8_print_error_encode_
/**
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
* @param function
* F_none on success.
* F_output_not on success, but no printing is performed.
*
+ * F_output_not (with error bit) if setting is NULL.
+ *
* @see fll_error_file_print()
*/
#ifndef _di_utf8_print_error_file_
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_error_no_from_
extern f_status_t utf8_print_error_no_from(utf8_setting_t * const setting, const fl_print_t print);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
* @param index
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_error_parameter_file_name_empty_
extern f_status_t utf8_print_error_parameter_file_name_empty(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
* @param from
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_error_parameter_file_not_found_
extern f_status_t utf8_print_error_parameter_file_not_found(utf8_setting_t * const setting, const fl_print_t print, const bool from, const f_string_static_t name);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_error_parameter_file_to_too_many_
extern f_status_t utf8_print_error_parameter_file_to_too_many(utf8_setting_t * const setting, const fl_print_t print);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
* @param sequence
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_bytesequence_
extern f_status_t utf8_print_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
* @param invalid
* F_none on success.
* F_output_not on success, but no printing is performed.
*
+ * F_output_not (with error bit) if setting is NULL.
+ *
* @see utf8_print_combining_or_width()
*/
#ifndef _di_utf8_print_character_invalid_
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
* @param codepoint
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_codepoint_
extern f_status_t utf8_print_codepoint(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
* @param sequence
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_combining_or_width_
extern f_status_t utf8_print_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates how printing is to be performed.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_combining_or_width_invalid_
extern f_status_t utf8_print_combining_or_width_invalid(utf8_setting_t * const setting, const fl_print_t print);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* The output structure to print to.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_help_
extern f_status_t utf8_print_help(utf8_setting_t * const setting, const fl_print_t print);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_line_first_locked_
extern f_status_t utf8_print_line_first_locked(utf8_setting_t * const setting, const fl_print_t print);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_line_first_unlocked_
extern f_status_t utf8_print_line_first_unlocked(utf8_setting_t * const setting, const fl_print_t print);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_line_last_locked_
extern f_status_t utf8_print_line_last_locked(utf8_setting_t * const setting, const fl_print_t print);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_line_last_unlocked_
extern f_status_t utf8_print_line_last_unlocked(utf8_setting_t * const setting, const fl_print_t print);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param raw
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_raw_bytesequence_
extern f_status_t utf8_print_raw_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_utf_char_t raw, const uint8_t width);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param raw
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_raw_codepoint_
extern f_status_t utf8_print_raw_codepoint(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t raw);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param width
* F_none on success.
* F_output_not on success, but no printing is performed.
*
+ * F_output_not (with error bit) if setting is NULL.
+ *
* @see utf8_print_width()
*/
#ifndef _di_utf8_print_raw_combining_or_width_
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param name
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_section_header_file_
extern f_status_t utf8_print_section_header_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t name, const f_array_length_t index);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param index
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_section_header_parameter_
extern f_status_t utf8_print_section_header_parameter(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_section_header_pipe_
extern f_status_t utf8_print_section_header_pipe(utf8_setting_t * const setting, const fl_print_t print);
* @param setting
* The main program settings.
*
- * This does not alter setting.status.
- *
- * Assumed to always be non-NULL.
+ * This does not alter setting.state.status.
* @param print
* Designates the how and where to print.
* @param sequence
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_utf8_print_width_
extern f_status_t utf8_print_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence);
extern "C" {
#endif
-/**
- * Codepoint modes for converting to/from binary and codepoint values.
- *
- * The special "raw" format is used only for reading from codepoint format where that format represents binary character that is not a valid Unicode character.
- * This is intended to be used to save and restore the original binary data even if that data is invalid.
- *
- * private_utf8_codepoint_mode_*:
- * - ready: The codepoint has yet to be processed, skip leading spaces until first 'U' is matched.
- * - begin: The first 'U' is matched, look for the '+'.
- * - number: The '+' is matched, process numbers.
- * - end: The last number is reached (at either white space or EOS/EOF).
- * - bad: This is not a valid codepoint.
- * - bad_begin: This is the beginning of an invalid codepoint.
- * - bad_end: The end of bad is detected, which happens on white space or end of buffer.
- * - raw_begin: This is the beginning of a potential raw data (matched '0').
- * - raw_number: This is the confirmed beginning of raw data (matched 'X'), process numbers.
- * - raw_end: The end of raw data is detected, which happens on white space or end of buffer.
- */
-#ifndef _di_utf8_codepoint_modes_
- enum {
- utf8_codepoint_mode_ready_e = 1,
- utf8_codepoint_mode_begin_e,
- utf8_codepoint_mode_number_e,
- utf8_codepoint_mode_end_e,
- utf8_codepoint_mode_bad_e,
- utf8_codepoint_mode_bad_begin_e,
- utf8_codepoint_mode_bad_end_e,
- utf8_codepoint_mode_raw_begin_e,
- utf8_codepoint_mode_raw_number_e,
- utf8_codepoint_mode_raw_end_e,
- };
-#endif // _di__utf8_codepoint_modes_
-
#ifdef __cplusplus
} // extern "C"
#endif
+++ /dev/null
-#include "utf8.h"
-#include "private-common.h"
-#include "private-utf8.h"
-#include "private-utf8_bytesequence.h"
-#include "private-utf8_codepoint.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _di_utf8_convert_bytesequence_
- f_status_t utf8_convert_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
-
- f_status_t status = F_none;
- bool valid_not = F_false;
-
- uint32_t codepoint = 0;
-
- if (sequence.used) {
- status = f_utf_unicode_to(sequence.string, sequence.used, &codepoint);
- }
- else {
- status = F_status_set_error(F_utf_not);
- }
-
- if (F_status_is_error(status)) {
- status = F_status_set_fine(status);
-
- if (status == F_failure || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_valid_not) {
- valid_not = F_true;
-
- utf8_print_character_invalid(setting, main->output, sequence);
- }
- else {
- status = F_status_set_error(status);
-
- utf8_print_error_decode(setting, main->error, status, sequence);
-
- return status;
- }
- }
- else if (!(setting->flag & utf8_main_flag_verify_e)) {
- if (setting->mode & utf8_mode_to_bytesequence_e) {
- utf8_print_bytesequence(setting, main->output, sequence);
- }
- else if (setting->mode & utf8_mode_to_codepoint_e) {
- utf8_print_codepoint(setting, main->output, codepoint);
- }
- else {
- utf8_print_combining_or_width(setting, main->output, sequence);
- }
- }
-
- if (valid_not || F_status_is_error(status)) return F_utf_not;
-
- return F_none;
- }
-#endif // _di_utf8_convert_bytesequence_
-
-#ifndef _di_utf8_process_file_bytesequence_
- f_status_t utf8_process_file_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) {
-
- f_status_t status = F_none;
-
- bool valid = F_true;
- bool next = F_true;
- uint8_t mode_codepoint = utf8_codepoint_mode_ready_e;
-
- f_array_length_t i = 0;
- f_array_length_t j = 0;
-
- f_char_t block[4] = { 0, 0, 0, 0 };
- f_string_static_t sequence = macro_f_string_static_t_initialize(block, 0, 4);
-
- do {
- status = f_file_stream_read_block(file, &setting->buffer);
-
- if (status == F_none_eof && !setting->buffer.used) break;
-
- for (i = 0; F_status_is_fine(status) && i < setting->buffer.used; ) {
-
- if (!((++main->signal_check) % utf8_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
-
- status = F_interrupt;
-
- break;
- }
-
- main->signal_check = 0;
- }
-
- status = F_none;
-
- // Get the current width only when processing a new block.
- if (next) {
- sequence.used = macro_f_utf_byte_width(setting->buffer.string[i]);
- next = F_false;
- }
-
- for (; j < sequence.used && i < setting->buffer.used; ++j, ++i) {
- sequence.string[j] = setting->buffer.string[i];
- } // for
-
- if (j == sequence.used) {
- if (setting->mode & utf8_mode_from_bytesequence_e) {
- status = utf8_convert_bytesequence(main, setting, sequence);
- }
- else {
- status = utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
-
- if (F_status_is_fine(status) && status != F_next) {
- status = utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
- }
- }
-
- if (status == F_utf_not) {
- valid = F_false;
- }
-
- j = 0;
- next = F_true;
- }
- } // for
-
- i = 0;
- setting->buffer.used = 0;
-
- } while (F_status_is_fine(status) && status != F_interrupt);
-
- // Handle last (incomplete) sequence when the buffer ended before the sequence is supposed to end.
- if (F_status_is_error_not(status) && status != F_interrupt && next == F_false) {
- sequence.used = j;
-
- if (setting->mode & utf8_mode_from_bytesequence_e) {
- status = utf8_convert_bytesequence(main, setting, sequence);
- }
- else {
- status = utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
-
- if (F_status_is_fine(status) && status != F_next) {
- status = utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
- }
- }
-
- if (status == F_utf_not) {
- valid = F_false;
- }
- }
-
- setting->buffer.used = 0;
-
- if (F_status_is_error(status) || status == F_interrupt) return status;
-
- return valid;
- }
-#endif // _di_utf8_process_file_bytesequence_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
#include "utf8.h"
-#include "private-common.h"
-#include "private-utf8.h"
-#include "private-utf8_bytesequence.h"
-#include "private-utf8_codepoint.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _di_utf8_process_text_
- f_status_t utf8_process_text(fll_program_data_t * const main, utf8_setting_t * const setting, f_string_static_t text) {
+ void utf8_process_text(fll_program_data_t * const main, utf8_setting_t * const setting, f_string_static_t text) {
- if (!text.used) return F_true;
+ if (!main || !setting) return;
+
+ if (!text.used) {
+ setting->state.status = F_true;
+
+ return;
+ }
+
+ setting->state.status = F_none;
- f_status_t status = F_none;
bool valid = F_true;
uint8_t mode_codepoint = utf8_codepoint_mode_ready_e;
f_file_stream_lock(main->output.to);
- for (; text.string[0] && F_status_is_error_not(status); ) {
+ for (; text.string[0] && F_status_is_error_not(setting->state.status); ) {
if (!((++main->signal_check) % utf8_signal_check_d)) {
if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
main->signal_check = 0;
}
- status = F_none;
+ setting->state.status = F_none;
if (setting->mode & utf8_mode_from_bytesequence_e) {
- status = utf8_convert_bytesequence(main, setting, text);
+ utf8_convert_bytesequence(main, setting, text);
}
else {
- status = utf8_detect_codepoint(main, setting, text, &mode_codepoint);
+ utf8_detect_codepoint(main, setting, text, &mode_codepoint);
- if (F_status_is_error(status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_line_first_locked(setting, main->error);
- fll_error_print(main->error, F_status_set_fine(status), macro_utf8_f(utf8_detect_codepoint), fll_error_file_flag_fallback_e);
+ fll_error_print(main->error, F_status_set_fine(setting->state.status), macro_utf8_f(utf8_detect_codepoint), fll_error_file_flag_fallback_e);
break;
}
- if (F_status_is_fine(status) && status != F_next) {
- status = utf8_convert_codepoint(main, setting, text, &mode_codepoint);
+ if (F_status_is_error_not(setting->state.status) && setting->state.status != F_next) {
+ utf8_convert_codepoint(main, setting, text, &mode_codepoint);
}
}
- if (status == F_utf_not) {
+ if (setting->state.status == F_utf_not) {
valid = F_false;
}
utf8_process_text_width(&text);
} // for
- if (F_status_is_error_not(status) && !(setting->mode & utf8_mode_from_bytesequence_e)) {
+ if (F_status_is_error_not(setting->state.status) && !(setting->mode & utf8_mode_from_bytesequence_e)) {
if (mode_codepoint != utf8_codepoint_mode_ready_e && mode_codepoint != utf8_codepoint_mode_end_e && mode_codepoint != utf8_codepoint_mode_bad_end_e && mode_codepoint != utf8_codepoint_mode_raw_end_e) {
if (mode_codepoint == utf8_codepoint_mode_number_e) {
mode_codepoint = utf8_codepoint_mode_end_e;
text.used = 0;
if (mode_codepoint == utf8_codepoint_mode_raw_number_e) {
- status = utf8_convert_raw(main, setting, text, &mode_codepoint);
+ utf8_convert_raw(main, setting, text, &mode_codepoint);
}
else {
- status = utf8_convert_codepoint(main, setting, text, &mode_codepoint);
+ utf8_convert_codepoint(main, setting, text, &mode_codepoint);
}
}
}
- if (F_status_is_error(status)) {
- f_file_stream_unlock(main->output.to);
-
- return status;
- }
-
f_file_stream_unlock(main->output.to);
- return valid;
+ if (F_status_is_error_not(setting->state.status)) {
+ setting->state.status = valid;
+ }
}
#endif // _di_utf8_process_text_
#ifndef _di_utf8_process_text_width_
void utf8_process_text_width(f_string_static_t *text) {
+ if (!text) return;
if (!text->string[0]) return;
text->used = 0;
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*/
-#ifndef _PRIVATE_utf8_h
-#define _PRIVATE_utf8_h
+#ifndef _utf8_process_h
+#define _utf8_process_h
#ifdef __cplusplus
extern "C" {
* This represent a single text data.
* This text is NULL terminated and can therefore not contain any NULLs.
*
- * @return
- * F_true on success and is valid.
- * F_false on success and contains invalid sequences.
- * F_interrupt on (exit) signal received.
+ * This alters setting.state.status:
+ * F_true on success and is valid.
+ * F_false on success and contains invalid sequences.
+ * F_interrupt on (exit) signal received.
*
- * Errors (with error bit) from: utf8_convert_bytesequence()
- * Errors (with error bit) from: utf8_convert_codepoint()
- * Errors (with error bit) from: utf8_detect_codepoint()
+ * Errors (with error bit) from: utf8_convert_bytesequence()
+ * Errors (with error bit) from: utf8_convert_codepoint()
+ * Errors (with error bit) from: utf8_detect_codepoint()
*
* @see utf8_convert_bytesequence()
* @see utf8_convert_codepoint()
* @see utf8_signal_received()
*/
#ifndef _di_utf8_process_text_
- extern f_status_t utf8_process_text(fll_program_data_t * const main, utf8_setting_t * const setting, f_string_static_t text) F_attribute_visibility_internal_d;
+ extern void utf8_process_text(fll_program_data_t * const main, utf8_setting_t * const setting, f_string_static_t text) F_attribute_visibility_internal_d;
#endif // _di_utf8_process_text_
/**
} // extern "C"
#endif
-#endif // _PRIVATE_utf8_h
+#endif // _utf8_process_h
#include "utf8.h"
-#include "private-common.h"
-#include "private-utf8.h"
-#include "private-utf8_bytesequence.h"
-#include "private-utf8_codepoint.h"
#ifdef __cplusplus
extern "C" {
if (!main || !setting) return;
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_line_last_locked(setting, main->error);
return;
}
- setting->status = F_none;
+ setting->state.status = F_none;
if (setting->flag & utf8_main_flag_help_e) {
utf8_print_help(setting, main->message);
utf8_print_section_header_pipe(setting, main->output);
if (setting->mode & utf8_mode_from_bytesequence_e) {
- setting->status = utf8_process_file_bytesequence(main, setting, file);
+ utf8_process_file_bytesequence(main, setting, file);
}
else {
- setting->status = utf8_process_file_codepoint(main, setting, file);
+ utf8_process_file_codepoint(main, setting, file);
}
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (setting->mode & utf8_mode_to_bytesequence_e) {
if (setting->flag & utf8_main_flag_header_e) {
fll_print_dynamic_raw(f_string_eol_s, main->output.to);
}
}
- if (F_status_is_error(setting->status) && F_status_set_fine(setting->status) != F_utf_fragment && F_status_set_fine(setting->status) != F_complete_not_utf) {
+ if (F_status_is_error(setting->state.status) && F_status_set_fine(setting->state.status) != F_utf_fragment && F_status_set_fine(setting->state.status) != F_complete_not_utf) {
utf8_print_error_file(setting, main->error, setting->mode & utf8_mode_from_bytesequence_e ? macro_utf8_f(utf8_process_file_bytesequence) : macro_utf8_f(utf8_process_file_codepoint), f_string_empty_s, f_file_operation_process_s, fll_error_file_type_pipe_e);
}
}
// Process "from" files.
- if (F_status_is_error_not(setting->status) && setting->status != F_interrupt && (setting->flag & utf8_main_flag_file_from_e)) {
+ if (F_status_is_error_not(setting->state.status) && (setting->flag & utf8_main_flag_file_from_e)) {
f_file_t file = macro_f_file_t_initialize(0, -1, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
- for (f_array_length_t i = 0; i < setting->path_files_from.used && setting->status != F_interrupt; ++i) {
+ for (f_array_length_t i = 0; i < setting->path_files_from.used && F_status_is_error_not(setting->state.status); ++i) {
if (!((++main->signal_check) % utf8_signal_check_d)) {
if (fll_program_standard_signal_received(main)) {
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
utf8_print_section_header_file(setting, main->output, setting->path_files_from.array[i], i);
- setting->status = f_file_stream_open(setting->path_files_from.array[i], f_string_empty_s, &file);
+ setting->state.status = f_file_stream_open(setting->path_files_from.array[i], f_string_empty_s, &file);
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
utf8_print_error_file(setting, main->error, macro_utf8_f(f_file_stream_open), setting->path_files_from.array[i], f_file_operation_open_s, fll_error_file_type_file_e);
break;
}
if (setting->mode & utf8_mode_from_bytesequence_e) {
- setting->status = utf8_process_file_bytesequence(main, setting, file);
+ utf8_process_file_bytesequence(main, setting, file);
}
else {
- setting->status = utf8_process_file_codepoint(main, setting, file);
+ utf8_process_file_codepoint(main, setting, file);
}
f_file_stream_flush(file);
f_file_stream_close(&file);
if (setting->flag & utf8_main_flag_verify_e) {
- if (setting->status == F_false) {
+ if (setting->state.status == F_false) {
valid = F_false;
}
}
- if (F_status_is_error_not(setting->status)) {
+ if (F_status_is_error_not(setting->state.status)) {
if (setting->mode & utf8_mode_to_bytesequence_e) {
if (setting->flag & utf8_main_flag_header_e) {
fll_print_dynamic_raw(f_string_eol_s, main->output.to);
}
}
- if (F_status_is_error(setting->status) && F_status_set_fine(setting->status) != F_utf_fragment && F_status_set_fine(setting->status) != F_complete_not_utf) {
+ if (F_status_is_error(setting->state.status) && F_status_set_fine(setting->state.status) != F_utf_fragment && F_status_set_fine(setting->state.status) != F_complete_not_utf) {
utf8_print_error_file(setting, main->error, setting->mode & utf8_mode_from_bytesequence_e ? macro_utf8_f(utf8_process_file_bytesequence) : macro_utf8_f(utf8_process_file_codepoint), setting->path_files_from.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
break;
}
// Process remaining parameters.
- if (F_status_is_error_not(setting->status) && setting->status != F_interrupt && setting->remaining.used) {
- for (f_array_length_t i = 0; F_status_is_error_not(setting->status) && i < setting->remaining.used; ++i) {
+ if (F_status_is_error_not(setting->state.status) && setting->remaining.used) {
+ for (f_array_length_t i = 0; F_status_is_error_not(setting->state.status) && i < setting->remaining.used; ++i) {
if (!((++main->signal_check) % utf8_signal_check_d)) {
if (fll_program_standard_signal_received(main)) {
- setting->status = F_status_set_error(F_interrupt);
+ setting->state.status = F_status_set_error(F_interrupt);
break;
}
utf8_print_section_header_parameter(setting, main->output, main->parameters.remaining.array[i]);
- setting->status = utf8_process_text(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]);
+ utf8_process_text(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]);
if (setting->flag & utf8_main_flag_verify_e) {
- if (setting->status == F_false) {
+ if (setting->state.status == F_false) {
valid = F_false;
}
}
} // for
}
- if (F_status_is_error(setting->status)) {
+ if (F_status_is_error(setting->state.status)) {
+ if (F_status_set_fine(setting->state.status) == F_interrupt) return;
+
utf8_print_line_last_locked(setting, main->error);
return;
}
- if (setting->status == F_interrupt) return;
-
utf8_print_line_last_locked(setting, main->message);
if (setting->flag & utf8_main_flag_verify_e) {
- setting->status = valid;
+ setting->state.status = valid;
}
else {
- setting->status = F_none;
+ setting->state.status = F_none;
}
}
#endif // _di_utf8_main_
#include <program/utf8/main/common-string.h>
#include <program/utf8/main/common-type.h>
#include <program/utf8/main/common.h>
+#include <program/utf8/main/bytesequence.h>
+#include <program/utf8/main/codepoint.h>
#include <program/utf8/main/print.h>
+#include <program/utf8/main/process.h>
#ifdef __cplusplus
extern "C" {
* @param setting
* The main program settings.
*
- * This alters setting.status:
+ * This alters setting.state.status:
* F_none on success.
* F_true on success when performing verification and verify passed.
* F_false on success when performing verification and verify failed.
- * F_interrupt on (exit) signal received.
*
+ * F_interrupt (with error bit) on (exit) signal received.
* F_parameter (with error bit) if main is NULL or setting is NULL.
*/
#ifndef _di_utf8_main_
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
-build_sources_library main/common.c main/common-print.c main/common-string.c main/common-type.c main/print.c main/utf8.c
-build_sources_library main/private-common.c main/private-utf8.c main/private-utf8_bytesequence.c main/private-utf8_codepoint.c
+build_sources_library main/common.c main/common-print.c main/common-string.c main/common-type.c main/bytesequence.c main/codepoint.c main/print.c main/process.c main/utf8.c
build_sources_program main/main.c
-build_sources_headers main/common.h main/common-print.h main/common-string.h main/common-type.h main/print.h main/utf8.h
+build_sources_headers main/common.h main/common-print.h main/common-string.h main/common-type.h main/bytesequence.h main/codepoint.h main/print.h main/process.h main/utf8.h
build_sources_documentation man