From: Kevin Day Date: Sun, 9 Feb 2025 06:20:23 +0000 (-0600) Subject: Update: Callback changes and improvements. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=25c4556c3eab46de5fcd4d126345622988a8d067;p=fll Update: Callback changes and improvements. The `void *(*)(void *)` function structure is being used so add that as a function callback type `f_void_pointer_call_t`. Add `fl_print_call_t` function callback type. Rename the console parameter callback from `callback` to `on_match`. Add `f_console_parameters_call_t` function callback type. Fix documentation comment where `length` should instead be `used`. The `void_main` are now replaced with literal `main` type now that the typedef structure improvements are in place. Shorten the `callback` name to `call`. Use more typedefs for functions. This better takes advantage of how functions are a "first class citizen" in C. --- diff --git a/build/stand_alone/byte_dump.config.h b/build/stand_alone/byte_dump.config.h index 8ad648b..6701a8b 100644 --- a/build/stand_alone/byte_dump.config.h +++ b/build/stand_alone/byte_dump.config.h @@ -1502,6 +1502,7 @@ #define _di_fl_conversion_dynamic_to_signed_detect_ #define _di_fl_conversion_dynamic_to_unsigned_ //#define _di_fl_conversion_dynamic_to_unsigned_detect_ +#define _di_fl_print_call_t_ //#define _di_fl_print_debug_s_ //#define _di_fl_print_error_s_ //#define _di_fl_print_format_ diff --git a/build/stand_alone/example.config.h b/build/stand_alone/example.config.h index 9c9bca5..66362c2 100644 --- a/build/stand_alone/example.config.h +++ b/build/stand_alone/example.config.h @@ -1441,6 +1441,7 @@ #define _di_f_utf_unicode_to_ #define _di_f_utf_width_e_ #define _di_f_void_call_t_ +#define _di_fl_print_call_t_ //#define _di_fl_print_debug_s_ //#define _di_fl_print_error_s_ //#define _di_fl_print_format_ diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index 56ec4a3..d3612b7 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -1978,6 +1978,7 @@ //#define _di_fl_iki_read_ //#define _di_fl_path_canonical_ #define _di_fl_path_clean_ +#define _di_fl_print_call_t_ //#define _di_fl_print_debug_s_ //#define _di_fl_print_error_s_ //#define _di_fl_print_format_ diff --git a/build/stand_alone/firewall.config.h b/build/stand_alone/firewall.config.h index 1b32b4f..2ad5eb2 100644 --- a/build/stand_alone/firewall.config.h +++ b/build/stand_alone/firewall.config.h @@ -2041,6 +2041,7 @@ #define _di_fl_iki_read_ #define _di_fl_path_canonical_ #define _di_fl_path_clean_ +#define _di_fl_print_call_t_ //#define _di_fl_print_debug_s_ //#define _di_fl_print_error_s_ //#define _di_fl_print_format_ diff --git a/build/stand_alone/utf8.config.h b/build/stand_alone/utf8.config.h index 9621de3..1218fb1 100644 --- a/build/stand_alone/utf8.config.h +++ b/build/stand_alone/utf8.config.h @@ -1520,6 +1520,7 @@ #define _di_fl_conversion_dynamic_to_signed_detect_ #define _di_fl_conversion_dynamic_to_unsigned_ //#define _di_fl_conversion_dynamic_to_unsigned_detect_ +#define _di_fl_print_call_t_ //#define _di_fl_print_debug_s_ //#define _di_fl_print_error_s_ //#define _di_fl_print_format_ diff --git a/level_0/f_console/c/console.c b/level_0/f_console/c/console.c index 74c55ca..3a4c57b 100644 --- a/level_0/f_console/c/console.c +++ b/level_0/f_console/c/console.c @@ -204,11 +204,11 @@ extern "C" { // Additional parameters must always follow what requests ("needs") them. if (process.needs.used) { - if (parameters->callback) { + if (parameters->on_match) { process.type = f_console_parameter_state_type_need_e; process.at = process.needs.array[0]; - parameters->callback(arguments, (void * const) parameters, &process, data); + parameters->on_match(arguments, (void * const) parameters, &process, data); if (F_status_is_error(state->status)) break; if (state->status == F_break) break; if (state->status == F_continue) continue; @@ -235,11 +235,11 @@ extern "C" { continue; } - if (parameters->callback) { + if (parameters->on_match) { process.type = f_console_parameter_state_type_identify_e; process.at = 0; - parameters->callback(arguments, (void * const) parameters, &process, data); + parameters->on_match(arguments, (void * const) parameters, &process, data); if (F_status_is_error(state->status)) break; if (state->status == F_break) break; if (state->status == F_continue) continue; @@ -279,11 +279,11 @@ extern "C" { process.width = macro_f_utf_byte_width_is(arguments.argv[process.location][process.location_sub]); - if (parameters->callback) { + if (parameters->on_match) { process.type = f_console_parameter_state_type_short_preprocess_e; process.at = i; - parameters->callback(arguments, (void * const) parameters, &process, data); + parameters->on_match(arguments, (void * const) parameters, &process, data); if (F_status_is_error(state->status)) break; if (state->status == F_break || state->status == F_continue) { @@ -397,11 +397,11 @@ extern "C" { if (!parameters->array[i].match_short.string) continue; if (arguments.argv[process.location][process.location_sub] != *parameters->array[i].match_short.string) continue; - if (parameters->callback) { + if (parameters->on_match) { process.type = f_console_parameter_state_type_short_e; process.at = i; - parameters->callback(arguments, (void * const) parameters, &process, data); + parameters->on_match(arguments, (void * const) parameters, &process, data); if (F_status_is_error(state->status)) break; if (state->status == F_break || state->status == F_continue) { @@ -502,11 +502,11 @@ extern "C" { if (!parameters->array[i].match_long.string) continue; if (strncmp(&arguments.argv[process.location][process.location_sub], parameters->array[i].match_long.string, parameters->array[i].match_long.used + 1)) continue; - if (parameters->callback) { + if (parameters->on_match) { process.type = f_console_parameter_state_type_long_e; process.at = i; - parameters->callback(arguments, (void * const) parameters, &process, data); + parameters->on_match(arguments, (void * const) parameters, &process, data); if (F_status_is_error(state->status)) break; if (state->status == F_break || state->status == F_continue) { @@ -545,11 +545,11 @@ extern "C" { if (!parameters->array[i].match_simple.used && !parameters->array[i].match_simple.string) continue; if (strncmp(arguments.argv[process.location], parameters->array[i].match_simple.string, parameters->array[i].match_simple.used + 1)) continue; - if (parameters->callback) { + if (parameters->on_match) { process.type = f_console_parameter_state_type_simple_e; process.at = i; - parameters->callback(arguments, (void * const) parameters, &process, data); + parameters->on_match(arguments, (void * const) parameters, &process, data); if (F_status_is_error(state->status)) break; if (state->status == F_break || state->status == F_continue) { @@ -615,11 +615,11 @@ extern "C" { // Add the missed parameter to the remaining array. if (!process.found) { - if (parameters->callback) { + if (parameters->on_match) { process.type = f_console_parameter_state_type_miss_e; process.at = 0; - parameters->callback(arguments, (void * const) parameters, &process, data); + parameters->on_match(arguments, (void * const) parameters, &process, data); if (F_status_is_error(state->status)) break; if (state->status == F_break) break; if (state->status == F_continue) continue; @@ -642,11 +642,11 @@ extern "C" { } // while // Make sure the entire parameters arguments array is populated. - if (parameters->callback) { + if (parameters->on_match) { process.type = f_console_parameter_state_type_wrap_up_e; process.at = 0; - parameters->callback(arguments, (void * const) parameters, &process, data); + parameters->on_match(arguments, (void * const) parameters, &process, data); } else { state->status = F_process; diff --git a/level_0/f_console/c/console/common.h b/level_0/f_console/c/console/common.h index 651c87c..5b3d8c1 100644 --- a/level_0/f_console/c/console/common.h +++ b/level_0/f_console/c/console/common.h @@ -505,9 +505,9 @@ extern "C" { * - array: Intended to be populated with an array of f_console_parameter_t whose size is defined by the "used" property. * - arguments: An array of arguments pointing to the argv[] strings with the string lengths already calculated (This is a dynamic array of f_string_static_t). * - remaining: An array of indexes within the arguments representing unmatched parameters. - * - length: The total number of parameters in the parameters array. + * - used: The total number of parameters in the parameters array. * - * callback: A callback to perform when matched in order to handle condition values. + * - on_match: A callback to perform when matched in order to handle condition values. * * The callback function arguments: * - arguments: The console arguments being processed. @@ -526,13 +526,15 @@ extern "C" { * Failure to properly handle this can lead to integrity and security issues. */ #ifndef _di_f_console_parameters_t_ + typedef void (*f_console_parameters_call_t) (const f_console_arguments_t arguments, void * const parameters, f_console_parameter_state_t * const state, void * const data); + typedef struct { f_console_parameter_t *array; f_string_dynamics_t arguments; f_number_unsigneds_t remaining; f_number_unsigned_t used; - void (*callback)(const f_console_arguments_t arguments, void * const parameters, f_console_parameter_state_t * const state, void * const data); + f_console_parameters_call_t on_match; } f_console_parameters_t; #define f_console_parameters_t_initialize { \ @@ -543,12 +545,12 @@ extern "C" { 0 \ } - #define macro_f_console_parameters_t_initialize_1(parameters, used, callback) { \ + #define macro_f_console_parameters_t_initialize_1(parameters, used, on_match) { \ parameters, \ f_string_dynamics_t_initialize, \ f_number_unsigneds_t_initialize, \ used, \ - callback \ + on_match \ } #endif // _di_f_console_parameters_t_ diff --git a/level_0/f_directory/c/directory/recurse_do.h b/level_0/f_directory/c/directory/recurse_do.h index b00885b..de95672 100644 --- a/level_0/f_directory/c/directory/recurse_do.h +++ b/level_0/f_directory/c/directory/recurse_do.h @@ -61,7 +61,7 @@ extern "C" { #ifndef _di_f_directory_recurse_do_t_ typedef struct f_directory_recurse_do_t_ f_directory_recurse_do_t; - typedef void (*f_directory_recurse_do_call_t)(f_directory_recurse_do_t * const recurse, const f_string_static_t name, const uint16_t flag); + typedef void (*f_directory_recurse_do_call_t) (f_directory_recurse_do_t * const recurse, const f_string_static_t name, const uint16_t flag); struct f_directory_recurse_do_t_ { f_number_unsigned_t depth; diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index e789c02..fb6b3b0 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -924,7 +924,7 @@ extern "C" { #endif // _di_f_thread_condition_wait_timed_ #ifndef _di_f_thread_create_ - f_status_t f_thread_create(const f_thread_attribute_t * const attribute, f_thread_id_t * const id, void *(*routine) (void *), void * const argument) { + f_status_t f_thread_create(const f_thread_attribute_t * const attribute, f_thread_id_t * const id, const f_void_pointer_call_t routine, void * const argument) { #ifndef _di_level_0_parameter_checking_ if (!id) return F_status_set_error(F_parameter); if (!routine) return F_status_set_error(F_parameter); diff --git a/level_0/f_thread/c/thread.h b/level_0/f_thread/c/thread.h index 7f64a06..80c9cc4 100644 --- a/level_0/f_thread/c/thread.h +++ b/level_0/f_thread/c/thread.h @@ -1270,7 +1270,7 @@ extern "C" { * @see pthread_create() */ #ifndef _di_f_thread_create_ - extern f_status_t f_thread_create(const f_thread_attribute_t * const attribute, f_thread_id_t * const id, void *(*routine) (void *), void * const argument); + extern f_status_t f_thread_create(const f_thread_attribute_t * const attribute, f_thread_id_t * const id, const f_void_pointer_call_t routine, void * const argument); #endif // _di_f_thread_create_ /** diff --git a/level_0/f_type/c/type/state.h b/level_0/f_type/c/type/state.h index 83c5a45..1c2c87b 100644 --- a/level_0/f_type/c/type/state.h +++ b/level_0/f_type/c/type/state.h @@ -69,7 +69,7 @@ extern "C" { #ifndef _di_f_state_t_ typedef struct f_state_t_ f_state_t; - typedef void (*f_state_call_t)(f_state_t * const state, void * const internal); + typedef void (*f_state_call_t) (f_state_t * const state, void * const internal); struct f_state_t_ { uint16_t step_large; diff --git a/level_0/f_type/c/type/void.h b/level_0/f_type/c/type/void.h index bdbe5c9..b67cbc7 100644 --- a/level_0/f_type/c/type/void.h +++ b/level_0/f_type/c/type/void.h @@ -17,7 +17,7 @@ extern "C" { #endif /** - * A generic callback function that accepts no parameters and returns no parameters. + * A generic callback function that accepts no parameters and returns no variables. */ #ifndef _di_f_void_call_t_ typedef void (*f_void_call_t) (void); @@ -25,6 +25,15 @@ extern "C" { #define f_void_call_t_initialize 0 #endif // _di_f_void_call_t_ +/** + * A generic callback function that accepts a single void pointer parameter and returns a void pointer. + */ +#ifndef _di_f_void_pointer_call_t_ + typedef void *(*f_void_pointer_call_t) (void *); + + #define f_void_call_t_initialize 0 +#endif // _di_f_void_pointer_call_t_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_1/fl_print/c/print/common.h b/level_1/fl_print/c/print/common.h index 044045f..f9ec5f8 100644 --- a/level_1/fl_print/c/print/common.h +++ b/level_1/fl_print/c/print/common.h @@ -111,6 +111,15 @@ extern "C" { #define macro_fl_print_t_initialize_warning_2(suffix, set) macro_fl_print_t_initialize_1(macro_f_file_t_initialize_2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, 0, fl_print_warning_s, suffix, f_color_set_t_initialize, f_color_set_t_initialize, set, 0) #endif // _di_fl_print_t_ +/** + * Provide a simple callback fo the print function where only fl_print_t is accepted. + * + * This returns a status. + */ +#ifndef _di_fl_print_call_t_ + typedef f_status_t (*fl_print_call_t)(fl_print_t * const print); +#endif // _di_fl_print_call_t_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fake/c/main/main.c b/level_3/fake/c/main/main.c index 15bd06d..a774b69 100644 --- a/level_3/fake/c/main/main.c +++ b/level_3/fake/c/main/main.c @@ -27,7 +27,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { f_console_parameter_t parameters[] = fake_console_parameter_t_initialize; data.program.parameters.array = parameters; data.program.parameters.used = fake_parameter_total_d; - data.program.parameters.callback = &fake_setting_load_parameter_callback; + data.program.parameters.on_match = &fake_setting_load_parameter_callback; data.program.environment = envp; if (f_pipe_input_exists()) { diff --git a/level_3/fss_read/c/basic/fss_read.c b/level_3/fss_read/c/basic/fss_read.c index 5c183f1..7839593 100644 --- a/level_3/fss_read/c/basic/fss_read.c +++ b/level_3/fss_read/c/basic/fss_read.c @@ -6,20 +6,18 @@ extern "C" { #endif #ifndef _di_fss_read_basic_process_help_ - void fss_read_basic_process_help(void * const void_main) { + void fss_read_basic_process_help(fss_read_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_read_basic_print_message_help(&((fss_read_main_t *) void_main)->program.message); + fss_read_basic_print_message_help(&main->program.message); } #endif // _di_fss_read_basic_process_help_ #ifndef _di_fss_read_basic_process_load_ - void fss_read_basic_process_load(void * const void_main) { + void fss_read_basic_process_load(fss_read_main_t * const main) { - if (!void_main) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; fll_fss_basic_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.state); diff --git a/level_3/fss_read/c/basic/fss_read.h b/level_3/fss_read/c/basic/fss_read.h index ad15803..134cdd4 100644 --- a/level_3/fss_read/c/basic/fss_read.h +++ b/level_3/fss_read/c/basic/fss_read.h @@ -72,7 +72,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This does not alter main.setting.state.status. * @@ -81,7 +80,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_read_basic_process_help_ - extern void fss_read_basic_process_help(void * const main); + extern void fss_read_basic_process_help(fss_read_main_t * const main); #endif // _di_fss_read_basic_process_help_ /** @@ -93,7 +92,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -111,7 +109,7 @@ extern "C" { * @see fss_read_file_identify() */ #ifndef _di_fss_read_basic_process_load_ - extern void fss_read_basic_process_load(void * const main); + extern void fss_read_basic_process_load(fss_read_main_t * const main); #endif // _di_fss_read_basic_process_load_ #ifdef __cplusplus diff --git a/level_3/fss_read/c/basic/main.c b/level_3/fss_read/c/basic/main.c index 88eae9b..3627fff 100644 --- a/level_3/fss_read/c/basic/main.c +++ b/level_3/fss_read/c/basic/main.c @@ -24,27 +24,27 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.standard = fss_read_basic_standard_s; data.setting.open_object = f_fss_basic_open_s; - data.callback.process_help = &fss_read_basic_process_help; - data.callback.process_last_line = &fss_read_process_last_line; - data.callback.process = &fss_read_process; - - data.callback.process_at = &fss_read_process_at; - data.callback.process_at_line = &fss_read_process_at_line; - data.callback.process_columns = &fss_read_process_columns; - data.callback.process_load = &fss_read_basic_process_load; - data.callback.process_name = &fss_read_process_name; - data.callback.process_total = &fss_read_process_total; - - data.callback.print_at = &fss_read_print_at; - data.callback.print_content = &fss_read_print_content; - data.callback.print_content_empty = &fss_read_print_content_empty; - data.callback.print_content_ignore = 0; - data.callback.print_content_next = 0; - data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_basic_print_object_end; - data.callback.print_object_end_content = &fss_read_print_object_end_content; - data.callback.print_object_end_empty = &fss_read_print_content_empty; - data.callback.print_set_end = &fss_read_print_set_end; + data.call.process_help = &fss_read_basic_process_help; + data.call.process_last_line = &fss_read_process_last_line; + data.call.process = &fss_read_process; + + data.call.process_at = &fss_read_process_at; + data.call.process_at_line = &fss_read_process_at_line; + data.call.process_columns = &fss_read_process_columns; + data.call.process_load = &fss_read_basic_process_load; + data.call.process_name = &fss_read_process_name; + data.call.process_total = &fss_read_process_total; + + data.call.print_at = &fss_read_print_at; + data.call.print_content = &fss_read_print_content; + data.call.print_content_empty = &fss_read_print_content_empty; + data.call.print_content_ignore = 0; + data.call.print_content_next = 0; + data.call.print_object = &fss_read_print_object; + data.call.print_object_end = &fss_read_basic_print_object_end; + data.call.print_object_end_content = &fss_read_print_object_end_content; + data.call.print_object_end_empty = &fss_read_print_content_empty; + data.call.print_set_end = &fss_read_print_set_end; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_read/c/basic_list/fss_read.c b/level_3/fss_read/c/basic_list/fss_read.c index c00338f..4a0bb1a 100644 --- a/level_3/fss_read/c/basic_list/fss_read.c +++ b/level_3/fss_read/c/basic_list/fss_read.c @@ -6,20 +6,18 @@ extern "C" { #endif #ifndef _di_fss_read_basic_list_process_help_ - void fss_read_basic_list_process_help(void * const void_main) { + void fss_read_basic_list_process_help(fss_read_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_read_basic_list_print_message_help(&((fss_read_main_t *) void_main)->program.message); + fss_read_basic_list_print_message_help(&main->program.message); } #endif // _di_fss_read_basic_list_process_help_ #ifndef _di_fss_read_basic_list_process_load_ - void fss_read_basic_list_process_load(void * const void_main) { + void fss_read_basic_list_process_load(fss_read_main_t * const main) { - if (!void_main) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; fll_fss_basic_list_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state); diff --git a/level_3/fss_read/c/basic_list/fss_read.h b/level_3/fss_read/c/basic_list/fss_read.h index b637844..531e024 100644 --- a/level_3/fss_read/c/basic_list/fss_read.h +++ b/level_3/fss_read/c/basic_list/fss_read.h @@ -72,7 +72,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This does not alter main.setting.state.status. * @@ -81,7 +80,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_read_basic_list_process_help_ - extern void fss_read_basic_list_process_help(void * const main); + extern void fss_read_basic_list_process_help(fss_read_main_t * const main); #endif // _di_fss_read_basic_list_process_help_ /** @@ -93,7 +92,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -111,7 +109,7 @@ extern "C" { * @see fss_read_file_identify() */ #ifndef _di_fss_read_basic_list_process_load_ - extern void fss_read_basic_list_process_load(void * const main); + extern void fss_read_basic_list_process_load(fss_read_main_t * const main); #endif // _di_fss_read_basic_list_process_load_ #ifdef __cplusplus diff --git a/level_3/fss_read/c/basic_list/main.c b/level_3/fss_read/c/basic_list/main.c index b22d94e..38f3ccf 100644 --- a/level_3/fss_read/c/basic_list/main.c +++ b/level_3/fss_read/c/basic_list/main.c @@ -24,26 +24,26 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.standard = fss_read_basic_list_standard_s; data.setting.open_object = f_fss_basic_list_open_s; - data.callback.process_help = &fss_read_basic_list_process_help; - data.callback.process_last_line = &fss_read_process_last_line; - data.callback.process = &fss_read_process; - - data.callback.process_at = &fss_read_process_at; - data.callback.process_at_line = &fss_read_process_at_line; - data.callback.process_columns = &fss_read_process_columns; - data.callback.process_load = &fss_read_basic_list_process_load; - data.callback.process_name = &fss_read_process_name; - data.callback.process_total = &fss_read_process_total_multiple; - - data.callback.print_at = &fss_read_print_at; - data.callback.print_content = &fss_read_print_content; - data.callback.print_content_ignore = &fss_read_print_content_ignore; - data.callback.print_content_next = 0; - data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_basic_list_print_object_end; - data.callback.print_object_end_content = &fss_read_print_object_end_content; - data.callback.print_object_end_empty = &fss_read_print_object_end_empty; - data.callback.print_set_end = &fss_read_print_set_end_no_eol; + data.call.process_help = &fss_read_basic_list_process_help; + data.call.process_last_line = &fss_read_process_last_line; + data.call.process = &fss_read_process; + + data.call.process_at = &fss_read_process_at; + data.call.process_at_line = &fss_read_process_at_line; + data.call.process_columns = &fss_read_process_columns; + data.call.process_load = &fss_read_basic_list_process_load; + data.call.process_name = &fss_read_process_name; + data.call.process_total = &fss_read_process_total_multiple; + + data.call.print_at = &fss_read_print_at; + data.call.print_content = &fss_read_print_content; + data.call.print_content_ignore = &fss_read_print_content_ignore; + data.call.print_content_next = 0; + data.call.print_object = &fss_read_print_object; + data.call.print_object_end = &fss_read_basic_list_print_object_end; + data.call.print_object_end_content = &fss_read_print_object_end_content; + data.call.print_object_end_empty = &fss_read_print_object_end_empty; + data.call.print_set_end = &fss_read_print_set_end_no_eol; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_read/c/embedded_list/fss_read.c b/level_3/fss_read/c/embedded_list/fss_read.c index bcfa371..29611b9 100644 --- a/level_3/fss_read/c/embedded_list/fss_read.c +++ b/level_3/fss_read/c/embedded_list/fss_read.c @@ -6,20 +6,18 @@ extern "C" { #endif #ifndef _di_fss_read_embedded_list_process_help_ - void fss_read_embedded_list_process_help(void * const void_main) { + void fss_read_embedded_list_process_help(fss_read_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_read_embedded_list_print_message_help(&((fss_read_main_t *) void_main)->program.message); + fss_read_embedded_list_print_message_help(&main->program.message); } #endif // _di_fss_read_embedded_list_process_help_ #ifndef _di_fss_read_embedded_list_process_load_ - void fss_read_embedded_list_process_load(void * const void_main) { + void fss_read_embedded_list_process_load(fss_read_main_t * const main) { - if (!void_main) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; { f_state_t state = main->setting.state; diff --git a/level_3/fss_read/c/embedded_list/fss_read.h b/level_3/fss_read/c/embedded_list/fss_read.h index 3d401f7..60b9809 100644 --- a/level_3/fss_read/c/embedded_list/fss_read.h +++ b/level_3/fss_read/c/embedded_list/fss_read.h @@ -73,7 +73,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This does not alter main.setting.state.status. * @@ -82,7 +81,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_read_embedded_list_process_help_ - extern void fss_read_embedded_list_process_help(void * const main); + extern void fss_read_embedded_list_process_help(fss_read_main_t * const main); #endif // _di_fss_read_embedded_list_process_help_ /** @@ -94,7 +93,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -112,7 +110,7 @@ extern "C" { * @see fss_read_file_identify() */ #ifndef _di_fss_read_embedded_list_process_load_ - extern void fss_read_embedded_list_process_load(void * const main); + extern void fss_read_embedded_list_process_load(fss_read_main_t * const main); #endif // _di_fss_read_embedded_list_process_load_ #ifdef __cplusplus diff --git a/level_3/fss_read/c/embedded_list/main.c b/level_3/fss_read/c/embedded_list/main.c index 2f9f46b..2c309e5 100644 --- a/level_3/fss_read/c/embedded_list/main.c +++ b/level_3/fss_read/c/embedded_list/main.c @@ -25,26 +25,26 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.standard = fss_read_embedded_list_standard_s; data.setting.open_object = f_fss_embedded_list_open_s; - data.callback.process_help = &fss_read_embedded_list_process_help; - data.callback.process_last_line = &fss_read_process_last_line; - data.callback.process = &fss_read_embedded_list_process; - - data.callback.process_at = &fss_read_process_at; - data.callback.process_at_line = &fss_read_process_at_line; - data.callback.process_columns = &fss_read_process_columns; - data.callback.process_load = &fss_read_embedded_list_process_load; - data.callback.process_name = &fss_read_process_name; - data.callback.process_total = &fss_read_process_total_multiple; - - data.callback.print_at = &fss_read_print_at; - data.callback.print_content = &fss_read_print_content; - data.callback.print_content_ignore = &fss_read_print_content_ignore; - data.callback.print_content_next = 0; - data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_embedded_list_print_object_end; - data.callback.print_object_end_content = &fss_read_print_object_end_content; - data.callback.print_object_end_empty = &fss_read_print_object_end_empty; - data.callback.print_set_end = &fss_read_embedded_list_print_set_end; + data.call.process_help = &fss_read_embedded_list_process_help; + data.call.process_last_line = &fss_read_process_last_line; + data.call.process = &fss_read_embedded_list_process; + + data.call.process_at = &fss_read_process_at; + data.call.process_at_line = &fss_read_process_at_line; + data.call.process_columns = &fss_read_process_columns; + data.call.process_load = &fss_read_embedded_list_process_load; + data.call.process_name = &fss_read_process_name; + data.call.process_total = &fss_read_process_total_multiple; + + data.call.print_at = &fss_read_print_at; + data.call.print_content = &fss_read_print_content; + data.call.print_content_ignore = &fss_read_print_content_ignore; + data.call.print_content_next = 0; + data.call.print_object = &fss_read_print_object; + data.call.print_object_end = &fss_read_embedded_list_print_object_end; + data.call.print_object_end_content = &fss_read_print_object_end_content; + data.call.print_object_end_empty = &fss_read_print_object_end_empty; + data.call.print_set_end = &fss_read_embedded_list_print_set_end; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_read/c/embedded_list/process.c b/level_3/fss_read/c/embedded_list/process.c index e6f91f3..7f2e512 100644 --- a/level_3/fss_read/c/embedded_list/process.c +++ b/level_3/fss_read/c/embedded_list/process.c @@ -6,14 +6,12 @@ extern "C" { #endif #ifndef _di_fss_read_embedded_list_process_ - void fss_read_embedded_list_process(void * const void_main) { + void fss_read_embedded_list_process(fss_read_main_t * const main) { - if (!void_main) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; // The process_load() callback is required to be non-NULL. - if (!main->callback.process_load) return; + if (!main->call.process_load) return; // This standard does not support multiple select, so any select greater than 0 can be predicted without processing the buffer. if ((main->setting.flag & fss_read_main_flag_select_d) && main->setting.select) { @@ -44,7 +42,7 @@ extern "C" { main->setting.quotes_object.used = 0; main->setting.quotes_content.used = 0; - main->callback.process_load(main); + main->call.process_load(main); if (F_status_is_error(main->setting.state.status)) return; fss_read_embedded_list_process_determine_depth(main); @@ -55,8 +53,8 @@ extern "C" { bool names[main->setting.objects.used]; - if (main->callback.process_name) { - main->callback.process_name(main, names); + if (main->call.process_name) { + main->call.process_name(main, names); if (F_status_is_error(main->setting.state.status)) return; } else if (main->setting.objects.used) { @@ -66,25 +64,25 @@ extern "C" { } if (main->setting.flag & fss_read_main_flag_total_d) { - if (main->callback.process_total) { - main->callback.process_total(main, names); + if (main->call.process_total) { + main->call.process_total(main, names); } } else if ((main->setting.flag & fss_read_main_flag_at_d) && main->setting.depth.index_at) { - if (main->callback.process_at) { - main->callback.process_at(main, names, *delimits_object, *delimits_content); + if (main->call.process_at) { + main->call.process_at(main, names, *delimits_object, *delimits_content); } } else if (main->setting.flag & fss_read_main_flag_columns_d) { - if (main->callback.process_columns) { - main->callback.process_columns(main, names); + if (main->call.process_columns) { + main->call.process_columns(main, names); } } else { f_number_unsigned_t i = 0; if (main->setting.flag & fss_read_main_flag_line_d) { - if (main->callback.process_at_line) { + if (main->call.process_at_line) { f_number_unsigned_t line = 0; for (; i < main->setting.contents.used && main->setting.state.status != F_success; ++i) { @@ -92,18 +90,18 @@ extern "C" { if (!names[i]) continue; if (fss_read_signal_check(main)) return; - main->callback.process_at_line(void_main, i, *delimits_object, *delimits_content, &line); + main->call.process_at_line(main, i, *delimits_object, *delimits_content, &line); if (F_status_is_error(main->setting.state.status)) return; } // for } } - else if (main->callback.print_at) { + else if (main->call.print_at) { for (; i < main->setting.contents.used; ++i) { if (!names[i]) continue; if (fss_read_signal_check(main)) return; - main->callback.print_at(&main->program.output, i, *delimits_object, *delimits_content); + main->call.print_at(&main->program.output, i, *delimits_object, *delimits_content); } // for } } diff --git a/level_3/fss_read/c/embedded_list/process.h b/level_3/fss_read/c/embedded_list/process.h index eb7f7b1..8fa9245 100644 --- a/level_3/fss_read/c/embedded_list/process.h +++ b/level_3/fss_read/c/embedded_list/process.h @@ -23,7 +23,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -33,7 +32,7 @@ extern "C" { * @see fss_read_signal_check() */ #ifndef _di_fss_read_embedded_list_process_ - extern void fss_read_embedded_list_process(void * const main); + extern void fss_read_embedded_list_process(fss_read_main_t * const main); #endif // _di_fss_read_embedded_list_process_ /** diff --git a/level_3/fss_read/c/extended/fss_read.c b/level_3/fss_read/c/extended/fss_read.c index bead096..e5ee344 100644 --- a/level_3/fss_read/c/extended/fss_read.c +++ b/level_3/fss_read/c/extended/fss_read.c @@ -6,20 +6,18 @@ extern "C" { #endif #ifndef _di_fss_read_extended_process_help_ - void fss_read_extended_process_help(void * const void_main) { + void fss_read_extended_process_help(fss_read_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_read_extended_print_message_help(&((fss_read_main_t *) void_main)->program.message); + fss_read_extended_print_message_help(&main->program.message); } #endif // _di_fss_read_extended_process_help_ #ifndef _di_fss_read_extended_process_load_ - void fss_read_extended_process_load(void * const void_main) { + void fss_read_extended_process_load(fss_read_main_t * const main) { - if (!void_main) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; fll_fss_extended_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.contents, &main->setting.quotes_object, &main->setting.quotes_content, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.state); diff --git a/level_3/fss_read/c/extended/fss_read.h b/level_3/fss_read/c/extended/fss_read.h index aefd159..2a50d8f 100644 --- a/level_3/fss_read/c/extended/fss_read.h +++ b/level_3/fss_read/c/extended/fss_read.h @@ -72,7 +72,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. @@ -81,7 +80,7 @@ extern "C" { * If FALSE, then this is not the last Content in the Content set. */ #ifndef _di_fss_read_extended_process_content_ - extern void fss_read_extended_process_content(void * const main, const bool last); + extern void fss_read_extended_process_content(fss_read_main_t * const main, const bool last); #endif // _di_fss_read_extended_process_content_ /** @@ -91,7 +90,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This does not alter main.setting.state.status. * @@ -100,7 +98,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_read_extended_process_help_ - extern void fss_read_extended_process_help(void * const main); + extern void fss_read_extended_process_help(fss_read_main_t * const main); #endif // _di_fss_read_extended_process_help_ /** @@ -112,7 +110,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -130,7 +127,7 @@ extern "C" { * @see fss_read_file_identify() */ #ifndef _di_fss_read_extended_process_load_ - extern void fss_read_extended_process_load(void * const main); + extern void fss_read_extended_process_load(fss_read_main_t * const main); #endif // _di_fss_read_extended_process_load_ #ifdef __cplusplus diff --git a/level_3/fss_read/c/extended/main.c b/level_3/fss_read/c/extended/main.c index a8954bc..b2d9fb9 100644 --- a/level_3/fss_read/c/extended/main.c +++ b/level_3/fss_read/c/extended/main.c @@ -24,27 +24,27 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.standard = fss_read_extended_standard_s; data.setting.open_object = f_fss_extended_open_s; - data.callback.process_help = &fss_read_extended_process_help; - data.callback.process_last_line = &fss_read_process_last_line; - data.callback.process = &fss_read_process; - - data.callback.process_at = &fss_read_process_at; - data.callback.process_at_line = &fss_read_process_at_line; - data.callback.process_columns = &fss_read_process_columns; - data.callback.process_load = &fss_read_extended_process_load; - data.callback.process_name = &fss_read_process_name; - data.callback.process_total = &fss_read_process_total; - - data.callback.print_at = &fss_read_print_at; - data.callback.print_content = &fss_read_print_content; - data.callback.print_content_empty = &fss_read_print_content_empty; - data.callback.print_content_ignore = &fss_read_print_content_ignore; - data.callback.print_content_next = &fss_read_extended_print_content_next; - data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_extended_print_object_end; - data.callback.print_object_end_content = &fss_read_print_object_end_content; - data.callback.print_object_end_empty = &fss_read_print_content_empty; - data.callback.print_set_end = &fss_read_print_set_end; + data.call.process_help = &fss_read_extended_process_help; + data.call.process_last_line = &fss_read_process_last_line; + data.call.process = &fss_read_process; + + data.call.process_at = &fss_read_process_at; + data.call.process_at_line = &fss_read_process_at_line; + data.call.process_columns = &fss_read_process_columns; + data.call.process_load = &fss_read_extended_process_load; + data.call.process_name = &fss_read_process_name; + data.call.process_total = &fss_read_process_total; + + data.call.print_at = &fss_read_print_at; + data.call.print_content = &fss_read_print_content; + data.call.print_content_empty = &fss_read_print_content_empty; + data.call.print_content_ignore = &fss_read_print_content_ignore; + data.call.print_content_next = &fss_read_extended_print_content_next; + data.call.print_object = &fss_read_print_object; + data.call.print_object_end = &fss_read_extended_print_object_end; + data.call.print_object_end_content = &fss_read_print_object_end_content; + data.call.print_object_end_empty = &fss_read_print_content_empty; + data.call.print_set_end = &fss_read_print_set_end; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_read/c/extended_list/fss_read.c b/level_3/fss_read/c/extended_list/fss_read.c index affe47b..6f9df66 100644 --- a/level_3/fss_read/c/extended_list/fss_read.c +++ b/level_3/fss_read/c/extended_list/fss_read.c @@ -6,20 +6,18 @@ extern "C" { #endif #ifndef _di_fss_read_extended_list_process_help_ - void fss_read_extended_list_process_help(void * const void_main) { + void fss_read_extended_list_process_help(fss_read_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_read_extended_list_print_message_help(&((fss_read_main_t *) void_main)->program.message); + fss_read_extended_list_print_message_help(&main->program.message); } #endif // _di_fss_read_extended_list_process_help_ #ifndef _di_fss_read_extended_list_process_load_ - void fss_read_extended_list_process_load(void * const void_main) { + void fss_read_extended_list_process_load(fss_read_main_t * const main) { - if (!void_main) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; fll_fss_extended_list_read(main->setting.buffer, &main->setting.range, &main->setting.objects, &main->setting.closes, &main->setting.contents, &main->setting.delimits_object, &main->setting.delimits_content, &main->setting.comments, &main->setting.state); diff --git a/level_3/fss_read/c/extended_list/fss_read.h b/level_3/fss_read/c/extended_list/fss_read.h index 4d4891d..a691f19 100644 --- a/level_3/fss_read/c/extended_list/fss_read.h +++ b/level_3/fss_read/c/extended_list/fss_read.h @@ -72,7 +72,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This does not alter main.setting.state.status. * @@ -81,7 +80,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_read_extended_list_process_help_ - extern void fss_read_extended_list_process_help(void * const main); + extern void fss_read_extended_list_process_help(fss_read_main_t * const main); #endif // _di_fss_read_extended_list_process_help_ /** @@ -93,7 +92,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -111,7 +109,7 @@ extern "C" { * @see fss_read_file_identify() */ #ifndef _di_fss_read_extended_list_process_load_ - extern void fss_read_extended_list_process_load(void * const main); + extern void fss_read_extended_list_process_load(fss_read_main_t * const main); #endif // _di_fss_read_extended_list_process_load_ #ifdef __cplusplus diff --git a/level_3/fss_read/c/extended_list/main.c b/level_3/fss_read/c/extended_list/main.c index b67c22c..96772c5 100644 --- a/level_3/fss_read/c/extended_list/main.c +++ b/level_3/fss_read/c/extended_list/main.c @@ -24,26 +24,26 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.standard = fss_read_extended_list_standard_s; data.setting.open_object = f_fss_extended_list_open_s; - data.callback.process_help = &fss_read_extended_list_process_help; - data.callback.process_last_line = &fss_read_process_last_line; - data.callback.process = &fss_read_process; - - data.callback.process_at = &fss_read_process_at; - data.callback.process_at_line = &fss_read_process_at_line; - data.callback.process_columns = &fss_read_process_columns; - data.callback.process_load = &fss_read_extended_list_process_load; - data.callback.process_name = &fss_read_process_name; - data.callback.process_total = &fss_read_process_total_multiple; - - data.callback.print_at = &fss_read_print_at; - data.callback.print_content = &fss_read_print_content; - data.callback.print_content_ignore = &fss_read_print_content_ignore; - data.callback.print_content_next = 0; - data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_extended_list_print_object_end; - data.callback.print_object_end_content = &fss_read_print_object_end_content; - data.callback.print_object_end_empty = &fss_read_print_object_end_empty; - data.callback.print_set_end = &fss_read_extended_list_print_set_end; + data.call.process_help = &fss_read_extended_list_process_help; + data.call.process_last_line = &fss_read_process_last_line; + data.call.process = &fss_read_process; + + data.call.process_at = &fss_read_process_at; + data.call.process_at_line = &fss_read_process_at_line; + data.call.process_columns = &fss_read_process_columns; + data.call.process_load = &fss_read_extended_list_process_load; + data.call.process_name = &fss_read_process_name; + data.call.process_total = &fss_read_process_total_multiple; + + data.call.print_at = &fss_read_print_at; + data.call.print_content = &fss_read_print_content; + data.call.print_content_ignore = &fss_read_print_content_ignore; + data.call.print_content_next = 0; + data.call.print_object = &fss_read_print_object; + data.call.print_object_end = &fss_read_extended_list_print_object_end; + data.call.print_object_end_content = &fss_read_print_object_end_content; + data.call.print_object_end_empty = &fss_read_print_object_end_empty; + data.call.print_set_end = &fss_read_extended_list_print_set_end; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_read/c/main/common.c b/level_3/fss_read/c/main/common.c index 969c9f7..14aed69 100644 --- a/level_3/fss_read/c/main/common.c +++ b/level_3/fss_read/c/main/common.c @@ -466,8 +466,8 @@ extern "C" { if (main->setting.buffer.used) { main->setting.files.array[0].range.stop = main->setting.buffer.used - 1; - if (main->callback.process_last_line) { - main->callback.process_last_line((void *) main); + if (main->call.process_last_line) { + main->call.process_last_line(main); if (F_status_is_error(main->setting.state.status)) return; } @@ -555,8 +555,8 @@ extern "C" { if (main->setting.buffer.used > file_data->range.start) { main->setting.files.array[main->setting.files.used++].range.stop = main->setting.buffer.used - 1; - if (main->callback.process_last_line) { - main->callback.process_last_line((void *) main); + if (main->call.process_last_line) { + main->call.process_last_line(main); if (F_status_is_error(main->setting.state.status)) break; } } @@ -577,11 +577,9 @@ extern "C" { #endif // _di_fss_read_setting_load_ #ifndef _di_fss_read_setting_load_depth_ - void fss_read_setting_load_depth(const f_console_arguments_t arguments, void * const void_main, f_console_parameters_t * const parameters) { + void fss_read_setting_load_depth(const f_console_arguments_t arguments, fss_read_main_t * const main, f_console_parameters_t * const parameters) { - if (!void_main || !parameters) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main || !parameters) return; f_number_unsigned_t i = 1; diff --git a/level_3/fss_read/c/main/common.h b/level_3/fss_read/c/main/common.h index f4b0cfe..b32fea9 100644 --- a/level_3/fss_read/c/main/common.h +++ b/level_3/fss_read/c/main/common.h @@ -97,7 +97,6 @@ extern "C" { * The main program data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -124,7 +123,7 @@ extern "C" { * @see fss_read_setting_load() */ #ifndef _di_fss_read_setting_load_depth_ - extern void fss_read_setting_load_depth(const f_console_arguments_t arguments, void * const main, f_console_parameters_t * const parameters); + extern void fss_read_setting_load_depth(const f_console_arguments_t arguments, fss_read_main_t * const main, f_console_parameters_t * const parameters); #endif // _di_fss_read_setting_load_depth_ #ifdef __cplusplus diff --git a/level_3/fss_read/c/main/common/type.h b/level_3/fss_read/c/main/common/type.h index 6c56605..24cdad5 100644 --- a/level_3/fss_read/c/main/common/type.h +++ b/level_3/fss_read/c/main/common/type.h @@ -164,33 +164,45 @@ extern "C" { * print_set_end: Print the Content set end, usually called by several callbacks within the process() callback. * print_set_end_empty: Print set end for cases where the Content is empty and only something like a closing new line is required. */ -#ifndef _di_fss_read_callback_t_ +#ifndef _di_fss_read_call_t_ + typedef void (*fss_read_process_main_call_t) (fss_read_main_t * const main); + typedef void (*fss_read_process_main_at_call_t) (fss_read_main_t * const main, const bool names[], const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); + typedef void (*fss_read_process_main_at_line_call_t) (fss_read_main_t * const main, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content, f_number_unsigned_t * const line); + typedef void (*fss_read_process_main_names_call_t) (fss_read_main_t * const main, bool names[]); + typedef void (*fss_read_process_main_names_const_call_t) (fss_read_main_t * const main, const bool names[]); + + typedef f_status_t (*print_at_call_t)(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); + typedef f_status_t (*print_object_call_t)(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits); + typedef f_status_t (*print_object_end_content_call_t)(fl_print_t * const print, const f_number_unsigned_t at, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); + typedef f_status_t (*print_content_call_t)(fl_print_t * const print, const f_number_unsigned_t at, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); + typedef f_status_t (*print_set_end_call_t)(fl_print_t * const print, const f_number_unsigned_t close); + typedef struct { - void (*process)(void * const main); - void (*process_help)(void * const main); - void (*process_last_line)(void * const main); - - void (*process_at)(void * const main, const bool names[], const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); - void (*process_at_line)(void * const void_main, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content, f_number_unsigned_t * const line); - void (*process_columns)(void * const main, const bool names[]); - void (*process_load)(void * const main); - void (*process_name)(void * const main, bool names[]); - void (*process_total)(void * const main, const bool names[]); - - f_status_t (*print_at)(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); - f_status_t (*print_object)(fl_print_t * const print, const f_number_unsigned_t at, const f_number_unsigneds_t delimits); - f_status_t (*print_object_end_content)(fl_print_t * const print, const f_number_unsigned_t at, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); - f_status_t (*print_content)(fl_print_t * const print, const f_number_unsigned_t at, const f_range_t range, const uint8_t quote, const f_number_unsigneds_t delimits); - f_status_t (*print_content_empty)(fl_print_t * const print); - f_status_t (*print_content_ignore)(fl_print_t * const print); - f_status_t (*print_content_next)(fl_print_t * const print); - f_status_t (*print_object_end)(fl_print_t * const print); - f_status_t (*print_object_end_empty)(fl_print_t * const print); - f_status_t (*print_set_end)(fl_print_t * const print, const f_number_unsigned_t close); - f_status_t (*print_set_end_empty)(fl_print_t * const print); - } fss_read_callback_t; - - #define fss_read_callback_t_initialize \ + fss_read_process_main_call_t process; + fss_read_process_main_call_t process_help; + fss_read_process_main_call_t process_last_line; + + fss_read_process_main_at_call_t process_at; + fss_read_process_main_at_line_call_t process_at_line; + fss_read_process_main_names_const_call_t process_columns; + fss_read_process_main_call_t process_load; + fss_read_process_main_names_call_t process_name; + fss_read_process_main_names_const_call_t process_total; + + print_at_call_t print_at; + print_object_call_t print_object; + print_object_end_content_call_t print_object_end_content; + print_content_call_t print_content; + fl_print_call_t print_content_empty; + fl_print_call_t print_content_ignore; + fl_print_call_t print_content_next; + fl_print_call_t print_object_end; + fl_print_call_t print_object_end_empty; + print_set_end_call_t print_set_end; + fl_print_call_t print_set_end_empty; + } fss_read_call_t; + + #define fss_read_call_t_initialize \ { \ 0, \ 0, \ @@ -213,7 +225,7 @@ extern "C" { 0, \ 0, \ } -#endif // _di_fss_read_callback_t_ +#endif // _di_fss_read_call_t_ /** * The fss read main program settings. @@ -315,15 +327,16 @@ extern "C" { /** * The main program data as a single structure. * - * cache: The cache data. - * callback: The callback data. - * program: The main program data. - * setting: The settings data. + * Properties: + * - cache: The cache data. + * - call: The callbacks. + * - program: The main program data. + * - setting: The settings data. */ #ifndef _di_fss_read_main_t_ struct fss_read_main_t_ { fss_read_cache_t cache; - fss_read_callback_t callback; + fss_read_call_t call; fll_program_data_t program; fss_read_setting_t setting; }; @@ -331,13 +344,22 @@ extern "C" { #define fss_read_main_t_initialize \ { \ fss_read_cache_t_initialize, \ - fss_read_callback_t_initialize, \ + fss_read_call_t_initialize, \ fll_program_data_t_initialize, \ fss_read_setting_t_initialize, \ } #endif // _di_fss_read_main_t_ /** + * Callback type for the fss_read_setting_load() argument. + * + * Perform the initial processing for fss_read_setting_load(). + */ +#ifndef _di_fss_read_setting_load_call_t_ + typedef void (*fss_read_setting_load_call_t) (const f_console_arguments_t arguments, fss_read_main_t * const main); +#endif // _di_fss_read_setting_load_call_t_ + +/** * Delete the program main cache data. * * @param cache @@ -418,7 +440,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This does not alter main.setting.state.status. * diff --git a/level_3/fss_read/c/main/fss_read.c b/level_3/fss_read/c/main/fss_read.c index f91cbaf..cdb9f0f 100644 --- a/level_3/fss_read/c/main/fss_read.c +++ b/level_3/fss_read/c/main/fss_read.c @@ -46,20 +46,16 @@ extern "C" { #endif // _di_fss_read_delimit_object_is_ #ifndef _di_fss_read_main_ - void fss_read_main(void * const void_main) { + void fss_read_main(fss_read_main_t * const main) { - if (!void_main) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; - - if (F_status_is_error(main->setting.state.status)) return; + if (!main || F_status_is_error(main->setting.state.status)) return; main->setting.state.status = F_okay; if (main->setting.flag & fss_read_main_flag_version_copyright_help_d) { if (main->setting.flag & fss_read_main_flag_help_d) { - if (main->callback.process_help) { - main->callback.process_help(void_main); + if (main->call.process_help) { + main->call.process_help(main); } else { fss_read_print_message_help(&main->program.message); @@ -80,8 +76,8 @@ extern "C" { } if (main->setting.flag & fss_read_main_flag_object_content_d) { - if (main->callback.process) { - main->callback.process(void_main); + if (main->call.process) { + main->call.process(main); } } @@ -106,11 +102,9 @@ extern "C" { #endif // _di_fss_read_file_identify_ #ifndef _di_fss_read_process_last_line_ - void fss_read_process_last_line(void * const void_main) { - - if (!void_main) return; + void fss_read_process_last_line(fss_read_main_t * const main) { - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; main->setting.state.status = f_string_dynamic_append_assure(f_string_eol_s, &main->setting.buffer); diff --git a/level_3/fss_read/c/main/fss_read.h b/level_3/fss_read/c/main/fss_read.h index b2fb43b..2819368 100644 --- a/level_3/fss_read/c/main/fss_read.h +++ b/level_3/fss_read/c/main/fss_read.h @@ -120,7 +120,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -130,7 +129,7 @@ extern "C" { * Errors (with error bit) from: main.callback.process(). */ #ifndef _di_fss_read_main_ - extern void fss_read_main(void * const main); + extern void fss_read_main(fss_read_main_t * const main); #endif // _di_fss_read_main_ /** @@ -161,7 +160,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -175,7 +173,7 @@ extern "C" { * @see fss_read_signal_check() */ #ifndef _di_fss_read_process_last_line_ - extern void fss_read_process_last_line(void * const void_main); + extern void fss_read_process_last_line(fss_read_main_t * const main); #endif // _di_fss_read_process_last_line_ #ifdef __cplusplus diff --git a/level_3/fss_read/c/main/main.c b/level_3/fss_read/c/main/main.c index 2d54138..886a16a 100644 --- a/level_3/fss_read/c/main/main.c +++ b/level_3/fss_read/c/main/main.c @@ -84,11 +84,11 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { } #ifndef _di_fss_read_main_process_help_ - void fss_read_main_process_help(void * const void_main) { + void fss_read_main_process_help(fss_read_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_read_main_print_message_help(&((fss_read_main_t *) void_main)->program.message); + fss_read_main_print_message_help(&main->program.message); } #endif // _di_fss_read_main_process_help_ @@ -98,27 +98,27 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { if (!main || F_status_is_error(main->setting.state.status) || (main->setting.flag & fss_read_main_flag_version_d)) return; // Use the default standard of: FSS-0000 (Basic) - main->callback.process_help = &fss_read_main_process_help; - main->callback.process_last_line = &fss_read_process_last_line; - main->callback.process = &fss_read_process; - - main->callback.process_at = &fss_read_process_at; - main->callback.process_at_line = &fss_read_process_at_line; - main->callback.process_columns = &fss_read_process_columns; - main->callback.process_load = &fss_read_basic_process_load; - main->callback.process_name = &fss_read_process_name; - main->callback.process_total = &fss_read_process_total; - - main->callback.print_at = &fss_read_print_at; - main->callback.print_content = &fss_read_print_content; - main->callback.print_content_empty = &fss_read_print_content_empty; - main->callback.print_content_ignore = 0; - main->callback.print_content_next = 0; - main->callback.print_object = &fss_read_print_object; - main->callback.print_object_end = &fss_read_basic_print_object_end; - main->callback.print_object_end_content = &fss_read_print_object_end_content; - main->callback.print_object_end_empty = &fss_read_print_content_empty; - main->callback.print_set_end = &fss_read_print_set_end; + main->call.process_help = &fss_read_main_process_help; + main->call.process_last_line = &fss_read_process_last_line; + main->call.process = &fss_read_process; + + main->call.process_at = &fss_read_process_at; + main->call.process_at_line = &fss_read_process_at_line; + main->call.process_columns = &fss_read_process_columns; + main->call.process_load = &fss_read_basic_process_load; + main->call.process_name = &fss_read_process_name; + main->call.process_total = &fss_read_process_total; + + main->call.print_at = &fss_read_print_at; + main->call.print_content = &fss_read_print_content; + main->call.print_content_empty = &fss_read_print_content_empty; + main->call.print_content_ignore = 0; + main->call.print_content_next = 0; + main->call.print_object = &fss_read_print_object; + main->call.print_object_end = &fss_read_basic_print_object_end; + main->call.print_object_end_content = &fss_read_print_object_end_content; + main->call.print_object_end_empty = &fss_read_print_content_empty; + main->call.print_set_end = &fss_read_print_set_end; main->setting.standard = fss_read_basic_standard_s; main->setting.open_object = f_fss_basic_open_s; @@ -160,22 +160,22 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->program.parameters.array[fss_read_parameter_payload_e].flag |= f_console_flag_disable_e; - main->callback.process_at = &fss_read_process_at; - main->callback.process_at_line = &fss_read_process_at_line; - main->callback.process_columns = &fss_read_process_columns; - main->callback.process_help = &fss_read_basic_process_help; - main->callback.process_load = &fss_read_basic_process_load; - main->callback.process_name = &fss_read_process_name; - main->callback.process = &fss_read_process; - main->callback.process_total = &fss_read_process_total; - - main->callback.print_content = &fss_read_print_content; - main->callback.print_content_ignore = 0; - main->callback.print_content_next = 0; - main->callback.print_object_end = &fss_read_basic_print_object_end; - main->callback.print_object_end_content = &fss_read_print_object_end_content; - main->callback.print_object_end_empty = &fss_read_print_content_empty; - main->callback.print_set_end = &fss_read_print_set_end; + main->call.process_at = &fss_read_process_at; + main->call.process_at_line = &fss_read_process_at_line; + main->call.process_columns = &fss_read_process_columns; + main->call.process_help = &fss_read_basic_process_help; + main->call.process_load = &fss_read_basic_process_load; + main->call.process_name = &fss_read_process_name; + main->call.process = &fss_read_process; + main->call.process_total = &fss_read_process_total; + + main->call.print_content = &fss_read_print_content; + main->call.print_content_ignore = 0; + main->call.print_content_next = 0; + main->call.print_object_end = &fss_read_basic_print_object_end; + main->call.print_object_end_content = &fss_read_print_object_end_content; + main->call.print_object_end_empty = &fss_read_print_content_empty; + main->call.print_set_end = &fss_read_print_set_end; } else if (f_compare_dynamic(as, fss_read_format_code_short_0001_s) == F_equal_to || f_compare_dynamic(as, fss_read_format_code_long_0001_s) == F_equal_to || @@ -198,21 +198,21 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->program.parameters.array[fss_read_parameter_payload_e].flag |= f_console_flag_disable_e; - main->callback.process_at = &fss_read_process_at; - main->callback.process_at_line = &fss_read_process_at_line; - main->callback.process_columns = &fss_read_process_columns; - main->callback.process_help = &fss_read_extended_process_help; - main->callback.process_load = &fss_read_extended_process_load; - main->callback.process_name = &fss_read_process_name; - main->callback.process = &fss_read_process; - main->callback.process_total = &fss_read_process_total; - - main->callback.print_content = &fss_read_print_content; - main->callback.print_content_next = &fss_read_extended_print_content_next; - main->callback.print_object_end = &fss_read_extended_print_object_end; - main->callback.print_object_end_content = &fss_read_print_object_end_content; - main->callback.print_object_end_empty = &fss_read_print_content_empty; - main->callback.print_set_end = &fss_read_print_set_end; + main->call.process_at = &fss_read_process_at; + main->call.process_at_line = &fss_read_process_at_line; + main->call.process_columns = &fss_read_process_columns; + main->call.process_help = &fss_read_extended_process_help; + main->call.process_load = &fss_read_extended_process_load; + main->call.process_name = &fss_read_process_name; + main->call.process = &fss_read_process; + main->call.process_total = &fss_read_process_total; + + main->call.print_content = &fss_read_print_content; + main->call.print_content_next = &fss_read_extended_print_content_next; + main->call.print_object_end = &fss_read_extended_print_object_end; + main->call.print_object_end_content = &fss_read_print_object_end_content; + main->call.print_object_end_empty = &fss_read_print_content_empty; + main->call.print_set_end = &fss_read_print_set_end; } else if (f_compare_dynamic(as, fss_read_format_code_short_0002_s) == F_equal_to || f_compare_dynamic(as, fss_read_format_code_long_0002_s) == F_equal_to || @@ -235,21 +235,21 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->program.parameters.array[fss_read_parameter_payload_e].flag |= f_console_flag_disable_e; - main->callback.process_at = &fss_read_process_at; - main->callback.process_at_line = &fss_read_process_at_line; - main->callback.process_columns = &fss_read_process_columns; - main->callback.process_help = &fss_read_basic_list_process_help; - main->callback.process_load = &fss_read_basic_list_process_load; - main->callback.process_name = &fss_read_process_name; - main->callback.process = &fss_read_process; - main->callback.process_total = &fss_read_process_total_multiple; - - main->callback.print_content = &fss_read_print_content; - main->callback.print_content_next = 0; - main->callback.print_object_end = &fss_read_basic_list_print_object_end; - main->callback.print_object_end_content = &fss_read_print_object_end_content; - main->callback.print_object_end_empty = &fss_read_print_object_end_empty; - main->callback.print_set_end = &fss_read_print_set_end_no_eol; + main->call.process_at = &fss_read_process_at; + main->call.process_at_line = &fss_read_process_at_line; + main->call.process_columns = &fss_read_process_columns; + main->call.process_help = &fss_read_basic_list_process_help; + main->call.process_load = &fss_read_basic_list_process_load; + main->call.process_name = &fss_read_process_name; + main->call.process = &fss_read_process; + main->call.process_total = &fss_read_process_total_multiple; + + main->call.print_content = &fss_read_print_content; + main->call.print_content_next = 0; + main->call.print_object_end = &fss_read_basic_list_print_object_end; + main->call.print_object_end_content = &fss_read_print_object_end_content; + main->call.print_object_end_empty = &fss_read_print_object_end_empty; + main->call.print_set_end = &fss_read_print_set_end_no_eol; } else if (f_compare_dynamic(as, fss_read_format_code_short_0003_s) == F_equal_to || f_compare_dynamic(as, fss_read_format_code_long_0003_s) == F_equal_to || @@ -275,21 +275,21 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->program.parameters.array[fss_read_parameter_payload_e].flag |= f_console_flag_disable_e; - main->callback.process_at = &fss_read_process_at; - main->callback.process_at_line = &fss_read_process_at_line; - main->callback.process_columns = &fss_read_process_columns; - main->callback.process_help = &fss_read_extended_list_process_help; - main->callback.process_load = &fss_read_extended_list_process_load; - main->callback.process_name = &fss_read_process_name; - main->callback.process = &fss_read_process; - main->callback.process_total = &fss_read_process_total_multiple; - - main->callback.print_content = &fss_read_print_content; - main->callback.print_content_next = 0; - main->callback.print_object_end = &fss_read_extended_list_print_object_end; - main->callback.print_object_end_content = &fss_read_print_object_end_content; - main->callback.print_object_end_empty = &fss_read_print_object_end_empty; - main->callback.print_set_end = &fss_read_extended_list_print_set_end; + main->call.process_at = &fss_read_process_at; + main->call.process_at_line = &fss_read_process_at_line; + main->call.process_columns = &fss_read_process_columns; + main->call.process_help = &fss_read_extended_list_process_help; + main->call.process_load = &fss_read_extended_list_process_load; + main->call.process_name = &fss_read_process_name; + main->call.process = &fss_read_process; + main->call.process_total = &fss_read_process_total_multiple; + + main->call.print_content = &fss_read_print_content; + main->call.print_content_next = 0; + main->call.print_object_end = &fss_read_extended_list_print_object_end; + main->call.print_object_end_content = &fss_read_print_object_end_content; + main->call.print_object_end_empty = &fss_read_print_object_end_empty; + main->call.print_set_end = &fss_read_extended_list_print_set_end; } else if (f_compare_dynamic(as, fss_read_format_code_short_0008_s) == F_equal_to || f_compare_dynamic(as, fss_read_format_code_long_0008_s) == F_equal_to || @@ -314,21 +314,21 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->program.parameters.array[fss_read_parameter_payload_e].flag |= f_console_flag_disable_e; - main->callback.process_at = &fss_read_process_at; - main->callback.process_at_line = &fss_read_process_at_line; - main->callback.process_columns = &fss_read_process_columns; - main->callback.process_help = &fss_read_embedded_list_process_help; - main->callback.process_load = &fss_read_embedded_list_process_load; - main->callback.process_name = &fss_read_process_name; - main->callback.process = &fss_read_embedded_list_process; - main->callback.process_total = &fss_read_process_total_multiple; - - main->callback.print_content = &fss_read_print_content; - main->callback.print_content_next = 0; - main->callback.print_object_end = &fss_read_embedded_list_print_object_end; - main->callback.print_object_end_content = &fss_read_print_object_end_content; - main->callback.print_object_end_empty = &fss_read_print_object_end_empty; - main->callback.print_set_end = &fss_read_embedded_list_print_set_end; + main->call.process_at = &fss_read_process_at; + main->call.process_at_line = &fss_read_process_at_line; + main->call.process_columns = &fss_read_process_columns; + main->call.process_help = &fss_read_embedded_list_process_help; + main->call.process_load = &fss_read_embedded_list_process_load; + main->call.process_name = &fss_read_process_name; + main->call.process = &fss_read_embedded_list_process; + main->call.process_total = &fss_read_process_total_multiple; + + main->call.print_content = &fss_read_print_content; + main->call.print_content_next = 0; + main->call.print_object_end = &fss_read_embedded_list_print_object_end; + main->call.print_object_end_content = &fss_read_print_object_end_content; + main->call.print_object_end_empty = &fss_read_print_object_end_empty; + main->call.print_set_end = &fss_read_embedded_list_print_set_end; } else if (f_compare_dynamic(as, fss_read_format_code_short_000e_s) == F_equal_to || f_compare_dynamic(as, fss_read_format_code_long_000e_s) == F_equal_to || @@ -352,27 +352,27 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->program.parameters.array[fss_read_parameter_payload_e].flag &= ~f_console_flag_disable_e; - main->callback.process_at = &fss_read_process_at; - main->callback.process_at_line = &fss_read_process_at_line; - main->callback.process_columns = &fss_read_process_columns; - main->callback.process_help = &fss_read_payload_process_help; - main->callback.process_load = &fss_read_payload_process_load; - main->callback.process_name = &fss_read_process_name; - main->callback.process = &fss_read_process; - main->callback.process_total = &fss_read_process_total_multiple; - - main->callback.print_content = &fss_read_payload_print_content; - main->callback.print_content_next = 0; - main->callback.print_object_end = &fss_read_payload_print_object_end; - main->callback.print_object_end_content = &fss_read_print_object_end_content; - main->callback.print_object_end_empty = &fss_read_print_object_end_empty; - main->callback.print_set_end = &fss_read_print_set_end_no_eol; + main->call.process_at = &fss_read_process_at; + main->call.process_at_line = &fss_read_process_at_line; + main->call.process_columns = &fss_read_process_columns; + main->call.process_help = &fss_read_payload_process_help; + main->call.process_load = &fss_read_payload_process_load; + main->call.process_name = &fss_read_process_name; + main->call.process = &fss_read_process; + main->call.process_total = &fss_read_process_total_multiple; + + main->call.print_content = &fss_read_payload_print_content; + main->call.print_content_next = 0; + main->call.print_object_end = &fss_read_payload_print_object_end; + main->call.print_object_end_content = &fss_read_print_object_end_content; + main->call.print_object_end_empty = &fss_read_print_object_end_empty; + main->call.print_set_end = &fss_read_print_set_end_no_eol; } else { main->setting.state.status = F_status_set_error(F_parameter); if (main->setting.flag & fss_read_main_flag_help_d) { - fss_read_main_process_help((void *) main); + fss_read_main_process_help(main); } else { fss_read_main_print_error_format_unknown(&main->program.error, as); @@ -387,7 +387,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { if (F_status_is_error(main->setting.state.status)) { if (main->setting.flag & fss_read_main_flag_help_d) { - fss_read_main_process_help((void *) main); + fss_read_main_process_help(main); } else { fss_read_print_error(&main->program.error, macro_fss_read_f(f_console_parameter_reset)); @@ -400,7 +400,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { if (F_status_is_error(main->setting.state.status)) { if (main->setting.flag & fss_read_main_flag_help_d) { - fss_read_main_process_help((void *) main); + fss_read_main_process_help(main); } else { fss_read_print_error(&main->program.error, macro_fss_read_f(f_console_parameter_process)); @@ -419,7 +419,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.state.status = F_status_set_error(F_parameter); if (main->setting.flag & fss_read_main_flag_help_d) { - fss_read_main_process_help((void *) main); + fss_read_main_process_help(main); } else { fss_read_main_print_error_parameter_as_changed(&main->program.error, as, main->program.parameters.arguments.array[index_new]); @@ -433,7 +433,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.state.status = F_status_set_error(F_parameter); if (main->setting.flag & fss_read_main_flag_help_d) { - fss_read_main_process_help((void *) main); + fss_read_main_process_help(main); return; } diff --git a/level_3/fss_read/c/main/main.h b/level_3/fss_read/c/main/main.h index f6331eb..e452f3a 100644 --- a/level_3/fss_read/c/main/main.h +++ b/level_3/fss_read/c/main/main.h @@ -38,7 +38,6 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp); * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This does not alter main.setting.state.status. * @@ -47,7 +46,7 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp); * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_read_main_process_help_ - extern void fss_read_main_process_help(void * const main); + extern void fss_read_main_process_help(fss_read_main_t * const main); #endif // _di_fss_read_main_process_help_ /** diff --git a/level_3/fss_read/c/main/print/data.c b/level_3/fss_read/c/main/print/data.c index 824b204..acfc6dd 100644 --- a/level_3/fss_read/c/main/print/data.c +++ b/level_3/fss_read/c/main/print/data.c @@ -23,20 +23,20 @@ extern "C" { uint8_t print_state = 0x0; if (main->setting.flag & fss_read_main_flag_object_d) { - if (main->callback.print_object) { + if (main->call.print_object) { print_state = 0x1; - main->callback.print_object(&main->program.output, at, delimits_object); + main->call.print_object(&main->program.output, at, delimits_object); } } if (main->setting.flag & fss_read_main_flag_content_d) { if (main->setting.flag & fss_read_main_flag_select_d) { if (main->setting.select < main->setting.contents.array[at].used && main->setting.contents.array[at].array[main->setting.select].start <= main->setting.contents.array[at].array[main->setting.select].stop) { - if (main->callback.print_content && main->callback.print_object_end_content) { + if (main->call.print_content && main->call.print_object_end_content) { if (print_state & 0x1) { if (F_status_set_fine( - main->callback.print_object_end_content( + main->call.print_object_end_content( &main->program.output, at, main->setting.contents.array[at].array[main->setting.select], @@ -49,7 +49,7 @@ extern "C" { } else { if (F_status_set_fine( - main->callback.print_content( + main->call.print_content( &main->program.output, at, main->setting.contents.array[at].array[main->setting.select], @@ -67,7 +67,7 @@ extern "C" { } } else if (main->setting.contents.array[at].used) { - if (main->callback.print_content && main->callback.print_object_end_content) { + if (main->call.print_content && main->call.print_object_end_content) { f_number_unsigned_t i = 0; // Loop through with conditionals only when necessary for performance reasons. @@ -80,7 +80,7 @@ extern "C" { if (print_state & 0x1) { if (F_status_set_fine( - main->callback.print_object_end_content( + main->call.print_object_end_content( &main->program.output, at, main->setting.contents.array[at].array[i], @@ -92,7 +92,7 @@ extern "C" { } } else if (F_status_set_fine( - main->callback.print_content( + main->call.print_content( &main->program.output, at, main->setting.contents.array[at].array[i], @@ -114,11 +114,11 @@ extern "C" { if (fss_read_signal_check(main)) return F_status_set_error(F_interrupt); if (main->setting.contents.array[at].array[i].start > main->setting.contents.array[at].array[i].stop) continue; - if (main->callback.print_content_next) { - main->callback.print_content_next(&main->program.output); + if (main->call.print_content_next) { + main->call.print_content_next(&main->program.output); } - main->callback.print_content( + main->call.print_content( &main->program.output, at, main->setting.contents.array[at].array[i], @@ -134,36 +134,36 @@ extern "C" { if (print_state & 0x8) { if (print_state & 0x1) { - if (!(print_state & 0x4) && main->callback.print_object_end_empty) { - main->callback.print_object_end_empty(&main->program.output); + if (!(print_state & 0x4) && main->call.print_object_end_empty) { + main->call.print_object_end_empty(&main->program.output); } } if ((print_state & 0x1) || !(print_state & 0x10)) { - if (main->callback.print_set_end) { - main->callback.print_set_end(&main->program.output, at); + if (main->call.print_set_end) { + main->call.print_set_end(&main->program.output, at); } } } else { if ((print_state & 0x3) != 0x3 && (print_state & 0x1)) { - if (!(print_state & 0x4) && main->callback.print_object_end) { - main->callback.print_object_end(&main->program.output); + if (!(print_state & 0x4) && main->call.print_object_end) { + main->call.print_object_end(&main->program.output); } } - if (main->callback.print_set_end) { - main->callback.print_set_end(&main->program.output, at); + if (main->call.print_set_end) { + main->call.print_set_end(&main->program.output, at); } } } else if (print_state & 0x1) { - if (main->callback.print_object_end_empty) { - main->callback.print_object_end_empty(&main->program.output); + if (main->call.print_object_end_empty) { + main->call.print_object_end_empty(&main->program.output); } - if (main->callback.print_set_end) { - main->callback.print_set_end(&main->program.output, at); + if (main->call.print_set_end) { + main->call.print_set_end(&main->program.output, at); } } @@ -178,8 +178,8 @@ extern "C" { fss_read_main_t * const main = (fss_read_main_t *) print->custom; - if (main->callback.print_content_ignore) { - main->callback.print_content_ignore(&main->program.output); + if (main->call.print_content_ignore) { + main->call.print_content_ignore(&main->program.output); } if (main->setting.flag & fss_read_main_flag_original_d) { @@ -196,8 +196,8 @@ extern "C" { } } - if (main->callback.print_content_ignore) { - main->callback.print_content_ignore(&main->program.output); + if (main->call.print_content_ignore) { + main->call.print_content_ignore(&main->program.output); } return F_okay; @@ -383,16 +383,16 @@ extern "C" { fss_read_main_t * const main = (fss_read_main_t *) print->custom; - if (main->callback.print_object_end) { - const f_status_t status = main->callback.print_object_end(print); + if (main->call.print_object_end) { + const f_status_t status = main->call.print_object_end(print); if (F_status_is_error(status) || status == F_output_not) return status; } - if (main->callback.print_content) { - return main->callback.print_content(print, at, range, quote, delimits); + if (main->call.print_content) { + return main->call.print_content(print, at, range, quote, delimits); } - return main->callback.print_object_end ? F_okay : F_output_not; + return main->call.print_object_end ? F_okay : F_output_not; } #endif // _di_fss_read_print_object_end_content_ @@ -403,8 +403,8 @@ extern "C" { fss_read_main_t * const main = (fss_read_main_t *) print->custom; - const f_status_t status_1 = (main->callback.print_object_end) ? main->callback.print_object_end(print) : F_output_not; - const f_status_t status_2 = (main->callback.print_content_empty) ? main->callback.print_content_empty(print) : F_output_not; + const f_status_t status_1 = (main->call.print_object_end) ? main->call.print_object_end(print) : F_output_not; + const f_status_t status_2 = (main->call.print_content_empty) ? main->call.print_content_empty(print) : F_output_not; if (F_status_is_error(status_1)) return status_1; if (F_status_is_error(status_2)) return status_2; diff --git a/level_3/fss_read/c/main/process.c b/level_3/fss_read/c/main/process.c index 330329c..0b1d55c 100644 --- a/level_3/fss_read/c/main/process.c +++ b/level_3/fss_read/c/main/process.c @@ -5,11 +5,9 @@ extern "C" { #endif #ifndef _di_fss_read_process_ - void fss_read_process(void * const void_main) { + void fss_read_process(fss_read_main_t * const main) { - if (!void_main) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; // For depth, most standards do not support nesting, so any depth greater than 0 can be predicted without processing the buffer. // For select, most standards do not support multiple select, so any select greater than 0 can be predicted without processing the buffer. @@ -24,7 +22,7 @@ extern "C" { } // The process_load() callback is required to be non-NULL. - if (!main->callback.process_load) return; + if (!main->call.process_load) return; if (main->setting.buffer.used) { main->setting.range.start = 0; @@ -44,7 +42,7 @@ extern "C" { main->setting.quotes_object.used = 0; main->setting.quotes_content.used = 0; - main->callback.process_load(main); + main->call.process_load(main); if (F_status_is_error(main->setting.state.status)) return; const f_number_unsigneds_t * const delimits_object = !(main->setting.flag & fss_read_main_flag_original_d) && fss_read_delimit_object_is(main, 0) ? &main->setting.delimits_object : &fss_read_except_none_c; @@ -52,8 +50,8 @@ extern "C" { bool names[main->setting.objects.used]; - if (main->callback.process_name) { - main->callback.process_name(main, names); + if (main->call.process_name) { + main->call.process_name(main, names); if (F_status_is_error(main->setting.state.status)) return; } else if (main->setting.objects.used) { @@ -63,26 +61,26 @@ extern "C" { } if (main->setting.flag & fss_read_main_flag_total_d) { - if (main->callback.process_total) { - main->callback.process_total(main, names); + if (main->call.process_total) { + main->call.process_total(main, names); } } else if ((main->setting.flag & fss_read_main_flag_at_d) && main->setting.depth.index_at) { - if (main->callback.process_at) { + if (main->call.process_at) { - main->callback.process_at(main, names, *delimits_object, *delimits_content); + main->call.process_at(main, names, *delimits_object, *delimits_content); } } else if (main->setting.flag & fss_read_main_flag_columns_d) { - if (main->callback.process_columns) { - main->callback.process_columns(main, names); + if (main->call.process_columns) { + main->call.process_columns(main, names); } } else { f_number_unsigned_t i = 0; if (main->setting.flag & fss_read_main_flag_line_d) { - if (main->callback.process_at_line) { + if (main->call.process_at_line) { f_number_unsigned_t line = 0; for (; i < main->setting.contents.used && main->setting.state.status != F_success; ++i) { @@ -90,18 +88,18 @@ extern "C" { if (!names[i]) continue; if (fss_read_signal_check(main)) return; - main->callback.process_at_line(void_main, i, *delimits_object, *delimits_content, &line); + main->call.process_at_line(main, i, *delimits_object, *delimits_content, &line); if (F_status_is_error(main->setting.state.status)) return; } // for } } - else if (main->callback.print_at) { + else if (main->call.print_at) { for (; i < main->setting.contents.used; ++i) { if (!names[i]) continue; if (fss_read_signal_check(main)) return; - main->callback.print_at(&main->program.output, i, *delimits_object, *delimits_content); + main->call.print_at(&main->program.output, i, *delimits_object, *delimits_content); } // for } } @@ -113,11 +111,9 @@ extern "C" { #endif // _di_fss_read_process_ #ifndef _di_fss_read_process_at_ - void fss_read_process_at(void * const void_main, const bool names[], const f_number_unsigneds_t delimits_object, f_number_unsigneds_t delimits_content) { - - if (!void_main) return; + void fss_read_process_at(fss_read_main_t * const main, const bool names[], const f_number_unsigneds_t delimits_object, f_number_unsigneds_t delimits_content) { - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; if (main->setting.depth.value_at >= main->setting.objects.used) { if (main->setting.flag & (fss_read_main_flag_columns_d | fss_read_main_flag_total_d)) { @@ -152,17 +148,17 @@ extern "C" { // If using "--at" for standards that only support one line per Object, then the only valid line is line 0. if ((main->setting.feature & fss_read_feature_flag_line_single_d) && !at) break; - if (main->callback.process_at_line) { + if (main->call.process_at_line) { f_number_unsigned_t line = 0; - main->callback.process_at_line(void_main, i, delimits_object, delimits_content, &line); + main->call.process_at_line(main, i, delimits_object, delimits_content, &line); } } else if (main->setting.flag & fss_read_main_flag_columns_d) { fss_read_print_number(&main->program.output, main->setting.contents.array[i].used); } - else if (main->callback.print_at) { - main->callback.print_at(&main->program.output, i, delimits_object, delimits_content); + else if (main->call.print_at) { + main->call.print_at(&main->program.output, i, delimits_object, delimits_content); } if (F_status_is_error(main->setting.state.status)) return; @@ -186,31 +182,29 @@ extern "C" { #endif // _di_fss_read_process_at_ #ifndef _di_fss_read_process_at_line_ - void fss_read_process_at_line(void * const void_main, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content, f_number_unsigned_t * const line) { + void fss_read_process_at_line(fss_read_main_t * const main, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content, f_number_unsigned_t * const line) { - if (!void_main || !line) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main || !line) return; // 0x1 = object printed, 0x2 = content printed, 0x4 = object end printed, 0x8 = content is empty, 0x10 = select is out of range. uint8_t print_state = 0x0; if (main->setting.flag & fss_read_main_flag_object_d) { if (*line == main->setting.line) { - if (main->callback.print_object) { - if (F_status_set_fine(main->callback.print_object(&main->program.output, at, delimits_object)) != F_output_not) { + if (main->call.print_object) { + if (F_status_set_fine(main->call.print_object(&main->program.output, at, delimits_object)) != F_output_not) { print_state = 0x1; } } if (!(main->setting.flag & fss_read_main_flag_content_d)) { - if (main->callback.print_object_end) { - main->callback.print_object_end(&main->program.output); + if (main->call.print_object_end) { + main->call.print_object_end(&main->program.output); } if (!(main->setting.feature & fss_read_feature_flag_object_as_line_d)) { - if (main->callback.print_set_end) { - main->callback.print_set_end(&main->program.output, at); + if (main->call.print_set_end) { + main->call.print_set_end(&main->program.output, at); } } @@ -219,8 +213,8 @@ extern "C" { return; } - if ((main->setting.feature & fss_read_feature_flag_object_as_line_d) && main->callback.print_object_end) { - if (F_status_set_fine(main->callback.print_object_end(&main->program.output)) != F_output_not) { + if ((main->setting.feature & fss_read_feature_flag_object_as_line_d) && main->call.print_object_end) { + if (F_status_set_fine(main->call.print_object_end(&main->program.output)) != F_output_not) { print_state = 0x4; } } @@ -239,8 +233,8 @@ extern "C" { if (main->setting.flag & fss_read_main_flag_object_d) { if (!(main->setting.feature & fss_read_feature_flag_object_as_line_d)) { if (*line == main->setting.line) { - if (main->callback.print_set_end) { - main->callback.print_set_end(&main->program.output, at); + if (main->call.print_set_end) { + main->call.print_set_end(&main->program.output, at); } main->setting.state.status = F_success; @@ -253,8 +247,8 @@ extern "C" { } else if (main->setting.flag & fss_read_main_flag_empty_d) { if (*line == main->setting.line) { - if (main->callback.print_set_end) { - main->callback.print_set_end(&main->program.output, at); + if (main->call.print_set_end) { + main->call.print_set_end(&main->program.output, at); } main->setting.state.status = F_success; @@ -268,8 +262,8 @@ extern "C" { else { if (main->setting.flag & fss_read_main_flag_empty_d) { if (*line == main->setting.line) { - if (main->callback.print_set_end) { - main->callback.print_set_end(&main->program.output, at); + if (main->call.print_set_end) { + main->call.print_set_end(&main->program.output, at); } main->setting.state.status = F_success; @@ -290,19 +284,19 @@ extern "C" { if (main->setting.feature & fss_read_feature_flag_line_single_d) { if (*line == main->setting.line) { - if (main->setting.contents.array[at].used && main->callback.print_content && main->callback.print_object_end_content) { + if (main->setting.contents.array[at].used && main->call.print_content && main->call.print_object_end_content) { for (f_status_t printed = F_okay; ; ) { if (main->setting.contents.array[at].array[i].start <= main->setting.contents.array[at].array[i].stop) { if ((print_state & 0x1) && !(print_state & 0x4)) { - printed = main->callback.print_object_end_content(&main->program.output, at, main->setting.contents.array[at].array[i], (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content); + printed = main->call.print_object_end_content(&main->program.output, at, main->setting.contents.array[at].array[i], (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content); if (F_status_set_fine(printed) != F_output_not) { print_state |= 0x6; } } else { - printed = main->callback.print_content(&main->program.output, at, main->setting.contents.array[at].array[i], (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content); + printed = main->call.print_content(&main->program.output, at, main->setting.contents.array[at].array[i], (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content); if (F_status_set_fine(printed) != F_output_not) { print_state |= 0x2; @@ -315,14 +309,14 @@ extern "C" { if (++i >= main->setting.contents.array[at].used) break; - if (F_status_set_fine(printed) != F_output_not && main->callback.print_content_next) { - main->callback.print_content_next(&main->program.output); + if (F_status_set_fine(printed) != F_output_not && main->call.print_content_next) { + main->call.print_content_next(&main->program.output); } } // for } - if (main->callback.print_set_end) { - main->callback.print_set_end(&main->program.output, at); + if (main->call.print_set_end) { + main->call.print_set_end(&main->program.output, at); } main->setting.state.status = F_success; @@ -332,7 +326,7 @@ extern "C" { ++(*line); } - else if (main->callback.print_content && main->callback.print_object_end_content) { + else if (main->call.print_content && main->call.print_object_end_content) { f_number_unsigned_t j = 0; f_number_unsigned_t k = 0; @@ -364,10 +358,10 @@ extern "C" { main->setting.range.stop = j; if ((print_state & 0x1) && !(print_state & 0x4)) { - main->callback.print_object_end_content(&main->program.output, at, main->setting.range, (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content); + main->call.print_object_end_content(&main->program.output, at, main->setting.range, (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content); } else { - main->callback.print_content(&main->program.output, at, main->setting.range, (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content); + main->call.print_content(&main->program.output, at, main->setting.range, (at < main->setting.quotes_content.used && i < main->setting.quotes_content.array[at].used) ? main->setting.quotes_content.array[at].array[i] : 0, delimits_content); } main->setting.state.status = F_success; @@ -388,8 +382,8 @@ extern "C" { // Simulate the ending by printing. if ((main->setting.flag & fss_read_main_flag_object_d) && (main->setting.feature & fss_read_feature_flag_content_has_close_d)) { if (*line == main->setting.line) { - if (main->callback.print_set_end) { - main->callback.print_set_end(&main->program.output, at); + if (main->call.print_set_end) { + main->call.print_set_end(&main->program.output, at); } main->setting.state.status = F_success; @@ -406,11 +400,9 @@ extern "C" { #endif // _di_fss_read_process_at_line_ #ifndef _di_fss_read_process_columns_ - void fss_read_process_columns(void * const void_main, const bool names[]) { - - if (!void_main) return; + void fss_read_process_columns(fss_read_main_t * const main, const bool names[]) { - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; if (!(main->setting.flag & fss_read_main_flag_content_d)) { fss_read_print_number(&main->program.output, 0); @@ -483,11 +475,9 @@ extern "C" { #endif // _di_fss_read_process_columns_ #ifndef _di_fss_read_process_name_ - void fss_read_process_name(void * const void_main, bool names[]) { + void fss_read_process_name(fss_read_main_t * const main, bool names[]) { - if (!void_main) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; if (main->setting.depth.index_name) { f_number_unsigned_t i = 0; @@ -524,11 +514,9 @@ extern "C" { #endif // _di_fss_read_process_name_ #ifndef _di_fss_read_process_total_ - void fss_read_process_total(void * const void_main, const bool names[]) { - - if (!void_main) return; + void fss_read_process_total(fss_read_main_t * const main, const bool names[]) { - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; f_number_unsigned_t total = 0; f_number_unsigned_t i = 0; @@ -602,11 +590,9 @@ extern "C" { #endif // _di_fss_read_process_total_ #ifndef _di_fss_read_process_total_multiple_ - void fss_read_process_total_multiple(void * const void_main, const bool names[]) { - - if (!void_main) return; + void fss_read_process_total_multiple(fss_read_main_t * const main, const bool names[]) { - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; f_number_unsigned_t total = 0; f_number_unsigned_t at = 0; diff --git a/level_3/fss_read/c/main/process.h b/level_3/fss_read/c/main/process.h index d298ed0..072815e 100644 --- a/level_3/fss_read/c/main/process.h +++ b/level_3/fss_read/c/main/process.h @@ -23,7 +23,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -42,7 +41,7 @@ extern "C" { * @see fss_read_signal_check() */ #ifndef _di_fss_read_process_ - extern void fss_read_process(void * const main); + extern void fss_read_process(fss_read_main_t * const main); #endif // _di_fss_read_process_ /** @@ -54,7 +53,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -73,7 +71,7 @@ extern "C" { * @see fss_read_signal_check() */ #ifndef _di_fss_read_process_at_ - extern void fss_read_process_at(void * const main, const bool names[], const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); + extern void fss_read_process_at(fss_read_main_t * const main, const bool names[], const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content); #endif // _di_fss_read_process_at_ /** @@ -83,7 +81,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.range. * @@ -109,7 +106,7 @@ extern "C" { * Must not be NULL. */ #ifndef _di_fss_read_process_at_line_ - extern void fss_read_process_at_line(void * const main, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content, f_number_unsigned_t * const line); + extern void fss_read_process_at_line(fss_read_main_t * const main, const f_number_unsigned_t at, const f_number_unsigneds_t delimits_object, const f_number_unsigneds_t delimits_content, f_number_unsigned_t * const line); #endif // _di_fss_read_process_at_line_ /** @@ -119,7 +116,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -132,7 +128,7 @@ extern "C" { * @see fss_read_signal_check() */ #ifndef _di_fss_read_process_columns_ - extern void fss_read_process_columns(void * const main, const bool names[]); + extern void fss_read_process_columns(fss_read_main_t * const main, const bool names[]); #endif // _di_fss_read_process_columns_ /** @@ -142,7 +138,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -155,7 +150,7 @@ extern "C" { * @see fss_read_signal_check() */ #ifndef _di_fss_read_process_name_ - extern void fss_read_process_name(void * const main, bool names[]); + extern void fss_read_process_name(fss_read_main_t * const main, bool names[]); #endif // _di_fss_read_process_name_ /** @@ -167,7 +162,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -180,7 +174,7 @@ extern "C" { * @see fss_read_signal_check() */ #ifndef _di_fss_read_process_total_ - extern void fss_read_process_total(void * const main, const bool names[]); + extern void fss_read_process_total(fss_read_main_t * const main, const bool names[]); #endif // _di_fss_read_process_total_ /** @@ -192,7 +186,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -205,7 +198,7 @@ extern "C" { * @see fss_read_signal_check() */ #ifndef _di_fss_read_process_total_multiple_ - extern void fss_read_process_total_multiple(void * const main, const bool names[]); + extern void fss_read_process_total_multiple(fss_read_main_t * const main, const bool names[]); #endif // _di_fss_read_process_total_multiple_ #ifdef __cplusplus diff --git a/level_3/fss_read/c/payload/fss_read.c b/level_3/fss_read/c/payload/fss_read.c index 2b2aec5..e6993b6 100644 --- a/level_3/fss_read/c/payload/fss_read.c +++ b/level_3/fss_read/c/payload/fss_read.c @@ -6,20 +6,18 @@ extern "C" { #endif #ifndef _di_fss_read_payload_process_help_ - void fss_read_payload_process_help(void * const void_main) { + void fss_read_payload_process_help(fss_read_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_read_payload_print_message_help(&((fss_read_main_t *) void_main)->program.message); + fss_read_payload_print_message_help(&main->program.message); } #endif // _di_fss_read_payload_process_help_ #ifndef _di_fss_read_payload_process_load_ - void fss_read_payload_process_load(void * const void_main) { - - if (!void_main) return; + void fss_read_payload_process_load(fss_read_main_t * const main) { - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; if (main->setting.buffer.used) { main->setting.range.start = 0; @@ -131,11 +129,9 @@ extern "C" { #endif // _di_fss_read_payload_process_load_ #ifndef _di_fss_read_payload_process_set_ - void fss_read_payload_process_set(void * const void_main) { + void fss_read_payload_process_set(fss_read_main_t * const main) { - if (!void_main) return; - - fss_read_main_t * const main = (fss_read_main_t *) void_main; + if (!main) return; main->setting.state.status = F_okay; } diff --git a/level_3/fss_read/c/payload/fss_read.h b/level_3/fss_read/c/payload/fss_read.h index 7f31631..b19f2ea 100644 --- a/level_3/fss_read/c/payload/fss_read.h +++ b/level_3/fss_read/c/payload/fss_read.h @@ -73,7 +73,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This does not alter main.setting.state.status. * @@ -82,7 +81,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_read_payload_process_help_ - extern void fss_read_payload_process_help(void * const main); + extern void fss_read_payload_process_help(fss_read_main_t * const main); #endif // _di_fss_read_payload_process_help_ /** @@ -94,7 +93,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -112,7 +110,7 @@ extern "C" { * @see fss_read_file_identify() */ #ifndef _di_fss_read_payload_process_load_ - extern void fss_read_payload_process_load(void * const main); + extern void fss_read_payload_process_load(fss_read_main_t * const main); #endif // _di_fss_read_payload_process_load_ /** @@ -122,13 +120,12 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_read_main_t. * * This alters main.setting.state.status: * F_okay on success. */ #ifndef _di_fss_read_payload_process_set_ - extern void fss_read_payload_process_set(void * const main); + extern void fss_read_payload_process_set(fss_read_main_t * const main); #endif // _di_fss_read_payload_process_set_ /** diff --git a/level_3/fss_read/c/payload/main.c b/level_3/fss_read/c/payload/main.c index 3ef3bc9..14dbee6 100644 --- a/level_3/fss_read/c/payload/main.c +++ b/level_3/fss_read/c/payload/main.c @@ -24,27 +24,27 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.standard = fss_read_payload_standard_s; data.setting.open_object = f_fss_payload_list_open_s; - data.callback.process_help = &fss_read_payload_process_help; - data.callback.process_last_line = &fss_read_process_last_line; - data.callback.process = &fss_read_process; - - data.callback.process_at = &fss_read_process_at; - data.callback.process_at_line = &fss_read_process_at_line; - data.callback.process_columns = &fss_read_process_columns; - data.callback.process_load = &fss_read_payload_process_load; - data.callback.process_name = &fss_read_process_name; - data.callback.process_total = &fss_read_process_total_multiple; - - data.callback.print_at = &fss_read_print_at; - data.callback.print_content = &fss_read_payload_print_content; - data.callback.print_content_empty = &fss_read_print_content_empty; - data.callback.print_content_ignore = &fss_read_print_content_ignore; - data.callback.print_content_next = 0; - data.callback.print_object = &fss_read_print_object; - data.callback.print_object_end = &fss_read_payload_print_object_end; - data.callback.print_object_end_content = &fss_read_print_object_end_content; - data.callback.print_object_end_empty = &fss_read_print_object_end_empty; - data.callback.print_set_end = &fss_read_print_set_end_no_eol; + data.call.process_help = &fss_read_payload_process_help; + data.call.process_last_line = &fss_read_process_last_line; + data.call.process = &fss_read_process; + + data.call.process_at = &fss_read_process_at; + data.call.process_at_line = &fss_read_process_at_line; + data.call.process_columns = &fss_read_process_columns; + data.call.process_load = &fss_read_payload_process_load; + data.call.process_name = &fss_read_process_name; + data.call.process_total = &fss_read_process_total_multiple; + + data.call.print_at = &fss_read_print_at; + data.call.print_content = &fss_read_payload_print_content; + data.call.print_content_empty = &fss_read_print_content_empty; + data.call.print_content_ignore = &fss_read_print_content_ignore; + data.call.print_content_next = 0; + data.call.print_object = &fss_read_print_object; + data.call.print_object_end = &fss_read_payload_print_object_end; + data.call.print_object_end_content = &fss_read_print_object_end_content; + data.call.print_object_end_empty = &fss_read_print_object_end_empty; + data.call.print_set_end = &fss_read_print_set_end_no_eol; f_console_parameter_t parameters[] = fss_read_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_read/c/payload/print.c b/level_3/fss_read/c/payload/print.c index 798e7a7..7ad8815 100644 --- a/level_3/fss_read/c/payload/print.c +++ b/level_3/fss_read/c/payload/print.c @@ -16,8 +16,8 @@ extern "C" { return fll_print_dynamic_partial_raw(main->setting.buffer, range, print->to); } - if (main->callback.print_content_ignore) { - main->callback.print_content_ignore(&main->program.output); + if (main->call.print_content_ignore) { + main->call.print_content_ignore(&main->program.output); } if (main->setting.flag & fss_read_main_flag_original_d) { @@ -34,8 +34,8 @@ extern "C" { } } - if (main->callback.print_content_ignore) { - main->callback.print_content_ignore(&main->program.output); + if (main->call.print_content_ignore) { + main->call.print_content_ignore(&main->program.output); } return F_okay; diff --git a/level_3/fss_write/c/basic/fss_write.c b/level_3/fss_write/c/basic/fss_write.c index 9876d08..50cc7e4 100644 --- a/level_3/fss_write/c/basic/fss_write.c +++ b/level_3/fss_write/c/basic/fss_write.c @@ -6,11 +6,9 @@ extern "C" { #endif #ifndef _di_fss_write_basic_process_content_ - void fss_write_basic_process_content(void * const void_main, const bool last) { + void fss_write_basic_process_content(fss_write_main_t * const main, const bool last) { - if (!void_main) return; - - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if (main->setting.content) { fl_fss_basic_content_write( @@ -51,20 +49,18 @@ extern "C" { #endif // _di_fss_write_basic_process_content_ #ifndef _di_fss_write_basic_process_help_ - void fss_write_basic_process_help(void * const void_main) { + void fss_write_basic_process_help(fss_write_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_write_basic_print_help(&((fss_write_main_t *) void_main)->program.message); + fss_write_basic_print_help(&main->program.message); } #endif // _di_fss_write_basic_process_help_ #ifndef _di_fss_write_basic_process_object_ - void fss_write_basic_process_object(void * const void_main) { - - if (!void_main) return; + void fss_write_basic_process_object(fss_write_main_t * const main) { - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if (main->setting.object) { fl_fss_basic_object_write( diff --git a/level_3/fss_write/c/basic/fss_write.h b/level_3/fss_write/c/basic/fss_write.h index 0314ab1..f17885a 100644 --- a/level_3/fss_write/c/basic/fss_write.h +++ b/level_3/fss_write/c/basic/fss_write.h @@ -66,7 +66,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. @@ -75,7 +74,7 @@ extern "C" { * If FALSE, then this is not the last Content in the Content set. */ #ifndef _di_fss_write_basic_process_content_ - extern void fss_write_basic_process_content(void * const main, const bool last); + extern void fss_write_basic_process_content(fss_write_main_t * const main, const bool last); #endif // _di_fss_write_basic_process_content_ /** @@ -85,7 +84,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This does not alter main.setting.state.status. * @@ -94,7 +92,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_write_basic_process_help_ - extern void fss_write_basic_process_help(void * const main); + extern void fss_write_basic_process_help(fss_write_main_t * const main); #endif // _di_fss_write_basic_process_help_ /** @@ -104,13 +102,12 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. */ #ifndef _di_fss_write_basic_process_object_ - extern void fss_write_basic_process_object(void * const main); + extern void fss_write_basic_process_object(fss_write_main_t * const main); #endif // _di_fss_write_basic_process_object_ #ifdef __cplusplus diff --git a/level_3/fss_write/c/basic/main.c b/level_3/fss_write/c/basic/main.c index 2284eaf..1e92e7a 100644 --- a/level_3/fss_write/c/basic/main.c +++ b/level_3/fss_write/c/basic/main.c @@ -19,12 +19,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.state.custom = (void *) &data; data.setting.standard = fss_write_basic_standard_s; - data.callback.process_content = &fss_write_basic_process_content; - data.callback.process_help = &fss_write_basic_process_help; - data.callback.process_normal = &fss_write_process_normal; - data.callback.process_object = &fss_write_basic_process_object; - data.callback.process_pipe = &fss_write_process_pipe; - data.callback.process_set = &fss_write_process_set; + data.call.process_content = &fss_write_basic_process_content; + data.call.process_help = &fss_write_basic_process_help; + data.call.process_normal = &fss_write_process_normal; + data.call.process_object = &fss_write_basic_process_object; + data.call.process_pipe = &fss_write_process_pipe; + data.call.process_set = &fss_write_process_set; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_write/c/basic_list/fss_write.c b/level_3/fss_write/c/basic_list/fss_write.c index 076fdd4..7256293 100644 --- a/level_3/fss_write/c/basic_list/fss_write.c +++ b/level_3/fss_write/c/basic_list/fss_write.c @@ -6,11 +6,9 @@ extern "C" { #endif #ifndef _di_fss_write_basic_list_process_content_ - void fss_write_basic_list_process_content(void * const void_main, const bool last) { + void fss_write_basic_list_process_content(fss_write_main_t * const main, const bool last) { - if (!void_main) return; - - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if (main->setting.content) { fl_fss_basic_list_content_write( @@ -54,20 +52,18 @@ extern "C" { #endif // _di_fss_write_basic_list_process_content_ #ifndef _di_fss_write_basic_list_process_help_ - void fss_write_basic_list_process_help(void * const void_main) { + void fss_write_basic_list_process_help(fss_write_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_write_basic_list_print_help(&((fss_write_main_t *) void_main)->program.message); + fss_write_basic_list_print_help(&main->program.message); } #endif // _di_fss_write_basic_list_process_help_ #ifndef _di_fss_write_basic_list_process_object_ - void fss_write_basic_list_process_object(void * const void_main) { - - if (!void_main) return; + void fss_write_basic_list_process_object(fss_write_main_t * const main) { - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if (main->setting.object) { fl_fss_basic_list_object_write( diff --git a/level_3/fss_write/c/basic_list/fss_write.h b/level_3/fss_write/c/basic_list/fss_write.h index ebb9e24..0f0a6c3 100644 --- a/level_3/fss_write/c/basic_list/fss_write.h +++ b/level_3/fss_write/c/basic_list/fss_write.h @@ -67,7 +67,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. @@ -76,7 +75,7 @@ extern "C" { * If FALSE, then this is not the last Content in the Content set. */ #ifndef _di_fss_write_basic_list_process_content_ - extern void fss_write_basic_list_process_content(void * const main, const bool last); + extern void fss_write_basic_list_process_content(fss_write_main_t * const main, const bool last); #endif // _di_fss_write_basic_list_process_content_ /** @@ -86,7 +85,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This does not alter main.setting.state.status. * @@ -95,7 +93,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_write_basic_list_process_help_ - extern void fss_write_basic_list_process_help(void * const main); + extern void fss_write_basic_list_process_help(fss_write_main_t * const main); #endif // _di_fss_write_basic_list_process_help_ /** @@ -105,13 +103,12 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. */ #ifndef _di_fss_write_basic_list_process_object_ - extern void fss_write_basic_list_process_object(void * const main); + extern void fss_write_basic_list_process_object(fss_write_main_t * const main); #endif // _di_fss_write_basic_list_process_object_ #ifdef __cplusplus diff --git a/level_3/fss_write/c/basic_list/main.c b/level_3/fss_write/c/basic_list/main.c index cd197e7..d13bbcb 100644 --- a/level_3/fss_write/c/basic_list/main.c +++ b/level_3/fss_write/c/basic_list/main.c @@ -19,12 +19,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.state.custom = (void *) &data; data.setting.standard = fss_write_basic_list_standard_s; - data.callback.process_content = &fss_write_basic_list_process_content; - data.callback.process_help = &fss_write_basic_list_process_help; - data.callback.process_normal = &fss_write_process_normal; - data.callback.process_object = &fss_write_basic_list_process_object; - data.callback.process_pipe = &fss_write_process_pipe; - data.callback.process_set = &fss_write_process_set; + data.call.process_content = &fss_write_basic_list_process_content; + data.call.process_help = &fss_write_basic_list_process_help; + data.call.process_normal = &fss_write_process_normal; + data.call.process_object = &fss_write_basic_list_process_object; + data.call.process_pipe = &fss_write_process_pipe; + data.call.process_set = &fss_write_process_set; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_write/c/embedded_list/fss_write.c b/level_3/fss_write/c/embedded_list/fss_write.c index db551aa..3aca9c0 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.c +++ b/level_3/fss_write/c/embedded_list/fss_write.c @@ -6,11 +6,9 @@ extern "C" { #endif #ifndef _di_fss_write_embedded_list_process_content_ - void fss_write_embedded_list_process_content(void * const void_main, const bool last) { + void fss_write_embedded_list_process_content(fss_write_main_t * const main, const bool last) { - if (!void_main) return; - - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if (main->setting.content) { fl_fss_embedded_list_content_write( @@ -59,20 +57,18 @@ extern "C" { #endif // _di_fss_write_embedded_list_process_content_ #ifndef _di_fss_write_embedded_list_process_help_ - void fss_write_embedded_list_process_help(void * const void_main) { + void fss_write_embedded_list_process_help(fss_write_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_write_embedded_list_print_help(&((fss_write_main_t *) void_main)->program.message); + fss_write_embedded_list_print_help(&main->program.message); } #endif // _di_fss_write_embedded_list_process_help_ #ifndef _di_fss_write_embedded_list_process_object_ - void fss_write_embedded_list_process_object(void * const void_main) { - - if (!void_main) return; + void fss_write_embedded_list_process_object(fss_write_main_t * const main) { - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if (main->setting.object) { fl_fss_embedded_list_object_write( diff --git a/level_3/fss_write/c/embedded_list/fss_write.h b/level_3/fss_write/c/embedded_list/fss_write.h index 9516c12..b042455 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.h +++ b/level_3/fss_write/c/embedded_list/fss_write.h @@ -66,7 +66,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. @@ -75,7 +74,7 @@ extern "C" { * If FALSE, then this is not the last Content in the Content set. */ #ifndef _di_fss_write_embedded_list_process_content_ - extern void fss_write_embedded_list_process_content(void * const main, const bool last); + extern void fss_write_embedded_list_process_content(fss_write_main_t * const main, const bool last); #endif // _di_fss_write_embedded_list_process_content_ /** @@ -85,7 +84,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This does not alter main.setting.state.status. * @@ -94,7 +92,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_write_embedded_list_process_help_ - extern void fss_write_embedded_list_process_help(void * const main); + extern void fss_write_embedded_list_process_help(fss_write_main_t * const main); #endif // _di_fss_write_embedded_list_process_help_ /** @@ -104,13 +102,12 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. */ #ifndef _di_fss_write_embedded_list_process_object_ - extern void fss_write_embedded_list_process_object(void * const main); + extern void fss_write_embedded_list_process_object(fss_write_main_t * const main); #endif // _di_fss_write_embedded_list_process_object_ #ifdef __cplusplus diff --git a/level_3/fss_write/c/embedded_list/main.c b/level_3/fss_write/c/embedded_list/main.c index 70a0fd7..dce6350 100644 --- a/level_3/fss_write/c/embedded_list/main.c +++ b/level_3/fss_write/c/embedded_list/main.c @@ -22,12 +22,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.state.custom = (void *) &data; data.setting.standard = fss_write_embedded_list_standard_s; - data.callback.process_content = &fss_write_embedded_list_process_content; - data.callback.process_help = &fss_write_embedded_list_process_help; - data.callback.process_normal = &fss_write_process_normal; - data.callback.process_object = &fss_write_embedded_list_process_object; - data.callback.process_pipe = &fss_write_process_pipe; - data.callback.process_set = &fss_write_process_set; + data.call.process_content = &fss_write_embedded_list_process_content; + data.call.process_help = &fss_write_embedded_list_process_help; + data.call.process_normal = &fss_write_process_normal; + data.call.process_object = &fss_write_embedded_list_process_object; + data.call.process_pipe = &fss_write_process_pipe; + data.call.process_set = &fss_write_process_set; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_write/c/extended/fss_write.c b/level_3/fss_write/c/extended/fss_write.c index b1599f8..464f12f 100644 --- a/level_3/fss_write/c/extended/fss_write.c +++ b/level_3/fss_write/c/extended/fss_write.c @@ -6,11 +6,9 @@ extern "C" { #endif #ifndef _di_fss_write_extended_process_content_ - void fss_write_extended_process_content(void * const void_main, const bool last) { + void fss_write_extended_process_content(fss_write_main_t * const main, const bool last) { - if (!void_main) return; - - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if (main->setting.content) { fl_fss_extended_content_write( @@ -63,20 +61,18 @@ extern "C" { #endif // _di_fss_write_extended_process_content_ #ifndef _di_fss_write_extended_process_help_ - void fss_write_extended_process_help(void * const void_main) { + void fss_write_extended_process_help(fss_write_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_write_extended_print_help(&((fss_write_main_t *) void_main)->program.message); + fss_write_extended_print_help(&main->program.message); } #endif // _di_fss_write_extended_process_help_ #ifndef _di_fss_write_extended_process_object_ - void fss_write_extended_process_object(void * const void_main) { - - if (!void_main) return; + void fss_write_extended_process_object(fss_write_main_t * const main) { - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if (main->setting.object) { fl_fss_extended_object_write( diff --git a/level_3/fss_write/c/extended/fss_write.h b/level_3/fss_write/c/extended/fss_write.h index 56e175f..ef75194 100644 --- a/level_3/fss_write/c/extended/fss_write.h +++ b/level_3/fss_write/c/extended/fss_write.h @@ -66,7 +66,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. @@ -75,7 +74,7 @@ extern "C" { * If FALSE, then this is not the last Content in the Content set. */ #ifndef _di_fss_write_extended_process_content_ - extern void fss_write_extended_process_content(void * const main, const bool last); + extern void fss_write_extended_process_content(fss_write_main_t * const main, const bool last); #endif // _di_fss_write_extended_process_content_ /** @@ -85,7 +84,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This does not alter main.setting.state.status. * @@ -94,7 +92,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_write_extended_process_help_ - extern void fss_write_extended_process_help(void * const main); + extern void fss_write_extended_process_help(fss_write_main_t * const main); #endif // _di_fss_write_extended_process_help_ /** @@ -104,13 +102,12 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. */ #ifndef _di_fss_write_extended_process_object_ - extern void fss_write_extended_process_object(void * const main); + extern void fss_write_extended_process_object(fss_write_main_t * const main); #endif // _di_fss_write_extended_process_object_ #ifdef __cplusplus diff --git a/level_3/fss_write/c/extended/main.c b/level_3/fss_write/c/extended/main.c index d26773d..384fc5d 100644 --- a/level_3/fss_write/c/extended/main.c +++ b/level_3/fss_write/c/extended/main.c @@ -21,12 +21,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.state.custom = (void *) &data; data.setting.standard = fss_write_extended_standard_s; - data.callback.process_content = &fss_write_extended_process_content; - data.callback.process_help = &fss_write_extended_process_help; - data.callback.process_normal = &fss_write_process_normal; - data.callback.process_object = &fss_write_extended_process_object; - data.callback.process_pipe = &fss_write_process_pipe; - data.callback.process_set = &fss_write_process_set; + data.call.process_content = &fss_write_extended_process_content; + data.call.process_help = &fss_write_extended_process_help; + data.call.process_normal = &fss_write_process_normal; + data.call.process_object = &fss_write_extended_process_object; + data.call.process_pipe = &fss_write_process_pipe; + data.call.process_set = &fss_write_process_set; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_write/c/extended_list/fss_write.c b/level_3/fss_write/c/extended_list/fss_write.c index 1bbbf38..97cc1ac 100644 --- a/level_3/fss_write/c/extended_list/fss_write.c +++ b/level_3/fss_write/c/extended_list/fss_write.c @@ -6,11 +6,9 @@ extern "C" { #endif #ifndef _di_fss_write_extended_list_process_content_ - void fss_write_extended_list_process_content(void * const void_main, const bool last) { + void fss_write_extended_list_process_content(fss_write_main_t * const main, const bool last) { - if (!void_main) return; - - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if (main->setting.content) { fl_fss_extended_list_content_write( @@ -59,20 +57,18 @@ extern "C" { #endif // _di_fss_write_extended_list_process_content_ #ifndef _di_fss_write_extended_list_process_help_ - void fss_write_extended_list_process_help(void * const void_main) { + void fss_write_extended_list_process_help(fss_write_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_write_extended_list_print_help(&((fss_write_main_t *) void_main)->program.message); + fss_write_extended_list_print_help(&main->program.message); } #endif // _di_fss_write_extended_list_process_help_ #ifndef _di_fss_write_extended_list_process_object_ - void fss_write_extended_list_process_object(void * const void_main) { - - if (!void_main) return; + void fss_write_extended_list_process_object(fss_write_main_t * const main) { - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if (main->setting.object) { fl_fss_extended_list_object_write( diff --git a/level_3/fss_write/c/extended_list/fss_write.h b/level_3/fss_write/c/extended_list/fss_write.h index beda6d9..ea8fbf0 100644 --- a/level_3/fss_write/c/extended_list/fss_write.h +++ b/level_3/fss_write/c/extended_list/fss_write.h @@ -66,7 +66,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. @@ -75,7 +74,7 @@ extern "C" { * If FALSE, then this is not the last Content in the Content set. */ #ifndef _di_fss_write_extended_list_process_content_ - extern void fss_write_extended_list_process_content(void * const main, const bool last); + extern void fss_write_extended_list_process_content(fss_write_main_t * const main, const bool last); #endif // _di_fss_write_extended_list_process_content_ /** @@ -85,7 +84,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This does not alter main.setting.state.status. * @@ -94,7 +92,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_write_extended_list_process_help_ - extern void fss_write_extended_list_process_help(void * const main); + extern void fss_write_extended_list_process_help(fss_write_main_t * const main); #endif // _di_fss_write_extended_list_process_help_ /** @@ -104,13 +102,12 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status. * This uses and alters main.setting.buffer. */ #ifndef _di_fss_write_extended_list_process_object_ - extern void fss_write_extended_list_process_object(void * const main); + extern void fss_write_extended_list_process_object(fss_write_main_t * const main); #endif // _di_fss_write_extended_list_process_object_ #ifdef __cplusplus diff --git a/level_3/fss_write/c/extended_list/main.c b/level_3/fss_write/c/extended_list/main.c index 4e39132..7207e09 100644 --- a/level_3/fss_write/c/extended_list/main.c +++ b/level_3/fss_write/c/extended_list/main.c @@ -21,12 +21,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.flag |= fss_write_main_flag_ignore_d; - data.callback.process_content = &fss_write_extended_list_process_content; - data.callback.process_help = &fss_write_extended_list_process_help; - data.callback.process_normal = &fss_write_process_normal; - data.callback.process_object = &fss_write_extended_list_process_object; - data.callback.process_pipe = &fss_write_process_pipe; - data.callback.process_set = &fss_write_process_set; + data.call.process_content = &fss_write_extended_list_process_content; + data.call.process_help = &fss_write_extended_list_process_help; + data.call.process_normal = &fss_write_process_normal; + data.call.process_object = &fss_write_extended_list_process_object; + data.call.process_pipe = &fss_write_process_pipe; + data.call.process_set = &fss_write_process_set; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index 605d12e..11def30 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_fss_write_setting_load_ - void fss_write_setting_load(const f_console_arguments_t arguments, fss_write_main_t * const main, void (*callback)(const f_console_arguments_t arguments, fss_write_main_t * const main)) { + void fss_write_setting_load(const f_console_arguments_t arguments, fss_write_main_t * const main, const fss_write_setting_load_call_t load_call) { if (!main) return; @@ -60,8 +60,8 @@ extern "C" { main->setting.flag &= ~fss_write_main_flag_pipe_d; } - if (callback) { - callback(arguments, main); + if (load_call) { + load_call(arguments, main); if (F_status_is_error(main->setting.state.status)) return; if (main->setting.state.status == F_done) { diff --git a/level_3/fss_write/c/main/common.h b/level_3/fss_write/c/main/common.h index a3ed8ce..48da5fb 100644 --- a/level_3/fss_write/c/main/common.h +++ b/level_3/fss_write/c/main/common.h @@ -40,9 +40,10 @@ extern "C" { * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: fll_program_parameter_process_context(). * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). - * @param callback + * @param load_call * (optional) Designate a function to call after performing the initial processing, but before printing help. * If the function returns F_done, then this function immediately returns, resetting status to F_okay. + * * Set to NULL to disable. * * @see f_console_parameter_process() @@ -51,7 +52,7 @@ extern "C" { * @see fll_program_parameter_process_verbosity_standard() */ #ifndef _di_fss_write_setting_load_ - extern void fss_write_setting_load(const f_console_arguments_t arguments, fss_write_main_t * const main, void (*callback)(const f_console_arguments_t arguments, fss_write_main_t * const main)); + extern void fss_write_setting_load(const f_console_arguments_t arguments, fss_write_main_t * const main, const fss_write_setting_load_call_t load_call); #endif // _di_fss_write_setting_load_ #ifdef __cplusplus diff --git a/level_3/fss_write/c/main/common/type.h b/level_3/fss_write/c/main/common/type.h index f94dbaa..ef5e276 100644 --- a/level_3/fss_write/c/main/common/type.h +++ b/level_3/fss_write/c/main/common/type.h @@ -33,17 +33,20 @@ extern "C" { * process_pipe: Process using the data from input pipe. * process_set: Process a set of Object and one or more Content. */ -#ifndef _di_fss_write_callback_t_ +#ifndef _di_fss_write_call_t_ + typedef void (*fss_write_process_main_call_t) (fss_write_main_t * const main); + typedef void (*fss_write_process_content_call_t) (fss_write_main_t * const main, const bool last); + typedef struct { - void (*process_content)(void * const main, const bool last); - void (*process_help)(void * const main); - void (*process_normal)(void * const main); - void (*process_object)(void * const main); - void (*process_pipe)(void * const main); - void (*process_set)(void * const main); - } fss_write_callback_t; - - #define fss_write_callback_t_initialize \ + fss_write_process_content_call_t process_content; + fss_write_process_main_call_t process_help; + fss_write_process_main_call_t process_normal; + fss_write_process_main_call_t process_object; + fss_write_process_main_call_t process_pipe; + fss_write_process_main_call_t process_set; + } fss_write_call_t; + + #define fss_write_call_t_initialize \ { \ 0, \ 0, \ @@ -52,7 +55,7 @@ extern "C" { 0, \ 0, \ } -#endif // _di_fss_write_callback_t_ +#endif // _di_fss_write_call_t_ /** * The fss write main program settings. @@ -131,26 +134,36 @@ extern "C" { /** * The main program data as a single structure. * - * callback: The callback data. - * program: The main program data. - * setting: The settings data. + * Properties: + * - call: The callbacks. + * - program: The main program data. + * - setting: The settings data. */ #ifndef _di_fss_write_main_t_ struct fss_write_main_t_ { - fss_write_callback_t callback; + fss_write_call_t call; fll_program_data_t program; fss_write_setting_t setting; }; #define fss_write_main_t_initialize \ { \ - fss_write_callback_t_initialize, \ + fss_write_call_t_initialize, \ fll_program_data_t_initialize, \ fss_write_setting_t_initialize, \ } #endif // _di_fss_write_main_t_ /** + * Callback type for the fss_write_setting_load() argument. + * + * Perform the initial processing for fss_write_setting_load(). + */ +#ifndef _di_fss_write_setting_load_call_t_ + typedef void (*fss_write_setting_load_call_t) (const f_console_arguments_t arguments, fss_write_main_t * const main); +#endif // _di_fss_write_setting_load_call_t_ + +/** * De-allocate main program data. * * @param main diff --git a/level_3/fss_write/c/main/fss_write.c b/level_3/fss_write/c/main/fss_write.c index 10344f3..9433cfb 100644 --- a/level_3/fss_write/c/main/fss_write.c +++ b/level_3/fss_write/c/main/fss_write.c @@ -5,20 +5,16 @@ extern "C" { #endif #ifndef _di_fss_write_main_ - void fss_write_main(void * const void_main) { + void fss_write_main(fss_write_main_t * const main) { - if (!void_main) return; - - fss_write_main_t * const main = (fss_write_main_t *) void_main; - - if (F_status_is_error(main->setting.state.status)) return; + if (!main || F_status_is_error(main->setting.state.status)) return; main->setting.state.status = F_okay; if (main->setting.flag & fss_write_main_flag_version_copyright_help_d) { if (main->setting.flag & fss_write_main_flag_help_d) { - if (main->callback.process_help) { - main->callback.process_help(void_main); + if (main->call.process_help) { + main->call.process_help(main); } else { fss_write_print_message_help(&main->program.message); @@ -39,15 +35,15 @@ extern "C" { } if (main->setting.flag & fss_write_main_flag_pipe_d) { - if (main->callback.process_pipe) { - main->callback.process_pipe(void_main); + if (main->call.process_pipe) { + main->call.process_pipe(main); } } if (F_status_is_error_not(main->setting.state.status)) { if (main->setting.flag & (fss_write_main_flag_object_d | fss_write_main_flag_content_d | fss_write_main_flag_object_open_d | fss_write_main_flag_content_next_d | fss_write_main_flag_content_end_d)) { - if (main->callback.process_normal) { - main->callback.process_normal(void_main); + if (main->call.process_normal) { + main->call.process_normal(main); } } } @@ -59,25 +55,23 @@ extern "C" { #endif // _di_fss_write_main_ #ifndef _di_fss_write_process_normal_ - void fss_write_process_normal(void * const void_main) { + void fss_write_process_normal(fss_write_main_t * const main) { - if (!void_main) return; + if (!main) return; fss_write_process_normal_data( - (fss_write_main_t *) void_main, - (((fss_write_main_t *) void_main)->setting.flag & fss_write_main_flag_object_d) - ? ((fss_write_main_t *) void_main)->setting.objects.used - : ((fss_write_main_t *) void_main)->setting.contentss.used + main, + ((main)->setting.flag & fss_write_main_flag_object_d) + ? (main)->setting.objects.used + : (main)->setting.contentss.used ); } #endif // _di_fss_write_process_normal_ #ifndef _di_fss_write_process_normal_data_ - void fss_write_process_normal_data(void * const void_main, const f_number_unsigned_t length) { + void fss_write_process_normal_data(fss_write_main_t * const main, const f_number_unsigned_t length) { - if (!void_main) return; - - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; main->setting.ignores = 0; main->setting.object = 0; @@ -101,7 +95,7 @@ extern "C" { main->setting.ignores = &main->setting.ignoress.array[i]; } - main->callback.process_set(void_main); + main->call.process_set(main); if (F_status_is_error(main->setting.state.status)) break; } // for } @@ -111,20 +105,16 @@ extern "C" { main->setting.contents = 0; main->setting.ignores = 0; - main->callback.process_set(void_main); + main->call.process_set(main); } } } #endif // _di_fss_write_process_normal_data_ #ifndef _di_fss_write_process_pipe_ - void fss_write_process_pipe(void * const void_main) { - - if (!void_main) return; + void fss_write_process_pipe(fss_write_main_t * const main) { - fss_write_main_t * const main = (fss_write_main_t *) void_main; - - if (!main->callback.process_set) return; + if (!main || !main->call.process_set) return; if (main->program.message.verbosity > f_console_verbosity_error_e) { fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); @@ -382,7 +372,7 @@ extern "C" { // End Object or Content set. if (state == 0x3) { - main->callback.process_set(void_main); + main->call.process_set(main); if (F_status_is_error(main->setting.state.status)) break; state = 0; @@ -399,7 +389,7 @@ extern "C" { // If the pipe ended before finishing, then attempt to wrap up. if (F_status_is_error_not(main->setting.state.status) && status_pipe == F_okay_eof && state) { - main->callback.process_set(void_main); + main->call.process_set(main); flag |= 0x1; } @@ -420,11 +410,7 @@ extern "C" { #endif // _di_fss_write_process_pipe_ #ifndef _di_fss_write_process_set_ - void fss_write_process_set(void * const void_main) { - - if (!void_main) return; - - fss_write_main_t * const main = (fss_write_main_t *) void_main; + void fss_write_process_set(fss_write_main_t * const main) { main->setting.buffer.used = 0; @@ -441,15 +427,15 @@ extern "C" { } } - if (main->callback.process_object) { - main->callback.process_object(void_main); + if (main->call.process_object) { + main->call.process_object(main); if (F_status_is_error(main->setting.state.status)) return; } } if ((!(main->setting.flag & fss_write_main_flag_partial_d) || (main->setting.flag & fss_write_main_flag_partial_d) && (main->setting.flag & fss_write_main_flag_content_d)) && main->setting.contents || (main->setting.flag & (fss_write_main_flag_content_next_d | fss_write_main_flag_content_end_d))) { - if (main->callback.process_content) { + if (main->call.process_content) { if (main->setting.contents && main->setting.contents->used) { for (f_number_unsigned_t i = 0; i < main->setting.contents->used; ++i) { @@ -464,14 +450,14 @@ extern "C" { main->setting.content = &main->setting.contents->array[i]; - main->callback.process_content(void_main, i + 1 == main->setting.contents->used); + main->call.process_content(main, i + 1 == main->setting.contents->used); if (F_status_is_error(main->setting.state.status)) return; } // for } else { main->setting.content = 0; - main->callback.process_content(void_main, F_true); + main->call.process_content(main, F_true); if (F_status_is_error(main->setting.state.status)) return; } } diff --git a/level_3/fss_write/c/main/fss_write.h b/level_3/fss_write/c/main/fss_write.h index 4bb96d3..ee8e3f6 100644 --- a/level_3/fss_write/c/main/fss_write.h +++ b/level_3/fss_write/c/main/fss_write.h @@ -77,7 +77,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.custom.setting.state.status: * F_okay on success. @@ -88,7 +87,7 @@ extern "C" { * F_parameter (with error bit) if main is NULL or setting is NULL. */ #ifndef _di_fss_write_main_ - extern void fss_write_main(void * const main); + extern void fss_write_main(fss_write_main_t * const main); #endif // _di_fss_write_main_ /** @@ -98,7 +97,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.custom.setting.state.status: * status from fss_write_process_normal_data(). @@ -108,7 +106,7 @@ extern "C" { * @see fss_write_process_normal_data() */ #ifndef _di_fss_write_process_normal_ - extern void fss_write_process_normal(void * const main); + extern void fss_write_process_normal(fss_write_main_t * const main); #endif // _di_fss_write_process_normal_ /** @@ -118,7 +116,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.custom.setting.state.status: * F_okay on success. @@ -127,7 +124,7 @@ extern "C" { * F_parameter (with error bit) if main is NULL or setting is NULL. */ #ifndef _di_fss_write_process_normal_data_ - void fss_write_process_normal_data(void * const main, const f_number_unsigned_t length); + void fss_write_process_normal_data(fss_write_main_t * const main, const f_number_unsigned_t length); #endif // _di_fss_write_process_normal_data_ /** @@ -137,7 +134,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -148,7 +144,7 @@ extern "C" { * F_parameter (with error bit) if main is NULL or setting is NULL. */ #ifndef _di_fss_write_process_pipe_ - extern void fss_write_process_pipe(void * const main); + extern void fss_write_process_pipe(fss_write_main_t * const main); #endif // _di_fss_write_process_pipe_ /** @@ -158,7 +154,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -167,7 +162,7 @@ extern "C" { * F_parameter (with error bit) if main is NULL or setting is NULL. */ #ifndef _di_fss_write_process_set_ - extern void fss_write_process_set(void * const main); + extern void fss_write_process_set(fss_write_main_t * const main); #endif // _di_fss_write_process_set_ #ifdef __cplusplus diff --git a/level_3/fss_write/c/main/main.c b/level_3/fss_write/c/main/main.c index b59c018..b73759c 100644 --- a/level_3/fss_write/c/main/main.c +++ b/level_3/fss_write/c/main/main.c @@ -83,11 +83,11 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { } #ifndef _di_fss_write_main_process_help_ - void fss_write_main_process_help(void * const void_main) { + void fss_write_main_process_help(fss_write_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_write_main_print_help(&((fss_write_main_t *) void_main)->program.message); + fss_write_main_print_help(&main->program.message); } #endif // _di_fss_write_main_process_help_ @@ -98,12 +98,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.standard = fss_write_basic_standard_s; - main->callback.process_content = &fss_write_basic_process_content; - main->callback.process_help = &fss_write_main_process_help; - main->callback.process_normal = &fss_write_process_normal; - main->callback.process_object = &fss_write_basic_process_object; - main->callback.process_pipe = &fss_write_process_pipe; - main->callback.process_set = &fss_write_process_set; + main->call.process_content = &fss_write_basic_process_content; + main->call.process_help = &fss_write_main_process_help; + main->call.process_normal = &fss_write_process_normal; + main->call.process_object = &fss_write_basic_process_object; + main->call.process_pipe = &fss_write_process_pipe; + main->call.process_set = &fss_write_process_set; if (main->program.parameters.array[fss_write_parameter_as_e].result & f_console_result_value_e && main->program.parameters.array[fss_write_parameter_as_e].values.used) { @@ -124,12 +124,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { // Remove flags not supported for this standard. main->setting.flag &= ~(fss_write_main_flag_ignore_d | fss_write_main_flag_content_multiple_d); - main->callback.process_content = &fss_write_basic_process_content; - main->callback.process_help = &fss_write_basic_process_help; - main->callback.process_object = &fss_write_basic_process_object; - main->callback.process_pipe = &fss_write_process_pipe; - main->callback.process_normal = &fss_write_process_normal; - main->callback.process_set = &fss_write_process_set; + main->call.process_content = &fss_write_basic_process_content; + main->call.process_help = &fss_write_basic_process_help; + main->call.process_object = &fss_write_basic_process_object; + main->call.process_pipe = &fss_write_process_pipe; + main->call.process_normal = &fss_write_process_normal; + main->call.process_set = &fss_write_process_set; } else if (f_compare_dynamic(argv[index], fss_write_format_code_short_0001_s) == F_equal_to || f_compare_dynamic(argv[index], fss_write_format_code_long_0001_s) == F_equal_to || @@ -142,12 +142,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.flag &= ~fss_write_main_flag_ignore_d; main->setting.flag |= fss_write_main_flag_content_multiple_d; - main->callback.process_content = &fss_write_extended_process_content; - main->callback.process_help = &fss_write_extended_process_help; - main->callback.process_object = &fss_write_extended_process_object; - main->callback.process_pipe = &fss_write_process_pipe; - main->callback.process_normal = &fss_write_process_normal; - main->callback.process_set = &fss_write_process_set; + main->call.process_content = &fss_write_extended_process_content; + main->call.process_help = &fss_write_extended_process_help; + main->call.process_object = &fss_write_extended_process_object; + main->call.process_pipe = &fss_write_process_pipe; + main->call.process_normal = &fss_write_process_normal; + main->call.process_set = &fss_write_process_set; } else if (f_compare_dynamic(argv[index], fss_write_format_code_short_0002_s) == F_equal_to || f_compare_dynamic(argv[index], fss_write_format_code_long_0002_s) == F_equal_to || @@ -159,12 +159,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { // Remove flags not supported for this standard. main->setting.flag &= ~(fss_write_main_flag_ignore_d | fss_write_main_flag_content_multiple_d); - main->callback.process_content = &fss_write_basic_list_process_content; - main->callback.process_help = &fss_write_basic_list_process_help; - main->callback.process_object = &fss_write_basic_list_process_object; - main->callback.process_pipe = &fss_write_process_pipe; - main->callback.process_normal = &fss_write_process_normal; - main->callback.process_set = &fss_write_process_set; + main->call.process_content = &fss_write_basic_list_process_content; + main->call.process_help = &fss_write_basic_list_process_help; + main->call.process_object = &fss_write_basic_list_process_object; + main->call.process_pipe = &fss_write_process_pipe; + main->call.process_normal = &fss_write_process_normal; + main->call.process_set = &fss_write_process_set; } else if (f_compare_dynamic(argv[index], fss_write_format_code_short_0003_s) == F_equal_to || f_compare_dynamic(argv[index], fss_write_format_code_long_0003_s) == F_equal_to || @@ -177,12 +177,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.flag &= ~fss_write_main_flag_content_multiple_d; main->setting.flag |= fss_write_main_flag_ignore_d; - main->callback.process_content = &fss_write_extended_list_process_content; - main->callback.process_help = &fss_write_extended_list_process_help; - main->callback.process_object = &fss_write_extended_list_process_object; - main->callback.process_pipe = &fss_write_process_pipe; - main->callback.process_normal = &fss_write_process_normal; - main->callback.process_set = &fss_write_process_set; + main->call.process_content = &fss_write_extended_list_process_content; + main->call.process_help = &fss_write_extended_list_process_help; + main->call.process_object = &fss_write_extended_list_process_object; + main->call.process_pipe = &fss_write_process_pipe; + main->call.process_normal = &fss_write_process_normal; + main->call.process_set = &fss_write_process_set; } else if (f_compare_dynamic(argv[index], fss_write_format_code_short_0008_s) == F_equal_to || f_compare_dynamic(argv[index], fss_write_format_code_long_0008_s) == F_equal_to || @@ -194,12 +194,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.flag |= fss_write_main_flag_ignore_d; main->setting.flag |= fss_write_main_flag_content_multiple_d; - main->callback.process_content = &fss_write_embedded_list_process_content; - main->callback.process_help = &fss_write_embedded_list_process_help; - main->callback.process_object = &fss_write_embedded_list_process_object; - main->callback.process_pipe = &fss_write_process_pipe; - main->callback.process_normal = &fss_write_process_normal; - main->callback.process_set = &fss_write_process_set; + main->call.process_content = &fss_write_embedded_list_process_content; + main->call.process_help = &fss_write_embedded_list_process_help; + main->call.process_object = &fss_write_embedded_list_process_object; + main->call.process_pipe = &fss_write_process_pipe; + main->call.process_normal = &fss_write_process_normal; + main->call.process_set = &fss_write_process_set; } else if (f_compare_dynamic(argv[index], fss_write_format_code_short_000e_s) == F_equal_to || f_compare_dynamic(argv[index], fss_write_format_code_long_000e_s) == F_equal_to || @@ -211,12 +211,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { // Remove flags not supported for this standard. main->setting.flag &= ~(fss_write_main_flag_ignore_d | fss_write_main_flag_content_multiple_d); - main->callback.process_content = 0; - main->callback.process_help = &fss_write_payload_process_help; - main->callback.process_normal = &fss_write_process_normal; - main->callback.process_object = 0; - main->callback.process_pipe = &fss_write_payload_process_pipe; - main->callback.process_set = &fss_write_payload_process_set; + main->call.process_content = 0; + main->call.process_help = &fss_write_payload_process_help; + main->call.process_normal = &fss_write_process_normal; + main->call.process_object = 0; + main->call.process_pipe = &fss_write_payload_process_pipe; + main->call.process_set = &fss_write_payload_process_set; } else { if (main->setting.flag & fss_write_main_flag_help_d) { @@ -233,7 +233,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { if (F_status_is_error(main->setting.state.status)) { if (main->setting.flag & fss_write_main_flag_help_d) { - fss_write_main_process_help((void *) main); + fss_write_main_process_help(main); } return; @@ -243,7 +243,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { main->setting.state.status = F_status_set_error(F_parameter); if (main->setting.flag & fss_write_main_flag_help_d) { - fss_write_main_process_help((void *) main); + fss_write_main_process_help(main); return; } diff --git a/level_3/fss_write/c/main/main.h b/level_3/fss_write/c/main/main.h index 687b89d..17b8647 100644 --- a/level_3/fss_write/c/main/main.h +++ b/level_3/fss_write/c/main/main.h @@ -38,7 +38,6 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp); * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This does not alter main.setting.state.status. * @@ -47,7 +46,7 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp); * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_write_main_process_help_ - extern void fss_write_main_process_help(void * const main); + extern void fss_write_main_process_help(fss_write_main_t * const main); #endif // _di_fss_write_main_process_help_ /** diff --git a/level_3/fss_write/c/payload/fss_write.c b/level_3/fss_write/c/payload/fss_write.c index cbb6389..e32c7da 100644 --- a/level_3/fss_write/c/payload/fss_write.c +++ b/level_3/fss_write/c/payload/fss_write.c @@ -6,20 +6,18 @@ extern "C" { #endif #ifndef _di_fss_write_payload_process_help_ - void fss_write_payload_process_help(void * const void_main) { + void fss_write_payload_process_help(fss_write_main_t * const main) { - if (!void_main) return; + if (!main) return; - fss_write_payload_print_help(&((fss_write_main_t *) void_main)->program.message); + fss_write_payload_print_help(&main->program.message); } #endif // _di_fss_write_payload_process_help_ #ifndef _di_fss_write_payload_process_pipe_ - void fss_write_payload_process_pipe(void * const void_main) { - - if (!void_main) return; + void fss_write_payload_process_pipe(fss_write_main_t * const main) { - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; f_status_t status_pipe = F_okay; f_file_t input = f_file_t_initialize; @@ -298,7 +296,7 @@ extern "C" { // End Object or Content set. if (state == 0x3) { - fss_write_payload_process_set(void_main); + fss_write_payload_process_set(main); if (F_status_is_error(main->setting.state.status)) break; state = 0; @@ -343,7 +341,7 @@ extern "C" { // If the pipe ended before finishing, then attempt to wrap up. if (F_status_is_error_not(main->setting.state.status) && status_pipe == F_okay_eof && state) { - fss_write_payload_process_set(void_main); + fss_write_payload_process_set(main); flag |= 0x1; } @@ -379,11 +377,9 @@ extern "C" { #endif // _di_fss_write_payload_process_pipe_ #ifndef _di_fss_write_payload_process_set_ - void fss_write_payload_process_set(void * const void_main) { + void fss_write_payload_process_set(fss_write_main_t * const main) { - if (!void_main) return; - - fss_write_main_t * const main = (fss_write_main_t *) void_main; + if (!main) return; if ((!(main->setting.flag & fss_write_main_flag_partial_d) || (main->setting.flag & fss_write_main_flag_partial_d) && (main->setting.flag & fss_write_main_flag_object_d))) { if (main->setting.object && !(main->setting.flag & fss_write_main_flag_partial_d) && main->setting.contents && main->setting.contents->used) { diff --git a/level_3/fss_write/c/payload/fss_write.h b/level_3/fss_write/c/payload/fss_write.h index 80d5bc4..43d7748 100644 --- a/level_3/fss_write/c/payload/fss_write.h +++ b/level_3/fss_write/c/payload/fss_write.h @@ -67,7 +67,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This does not alter main.setting.state.status. * @@ -76,7 +75,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fss_write_payload_process_help_ - extern void fss_write_payload_process_help(void * const main); + extern void fss_write_payload_process_help(fss_write_main_t * const main); #endif // _di_fss_write_payload_process_help_ /** @@ -86,7 +85,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -97,7 +95,7 @@ extern "C" { * F_parameter (with error bit) if main is NULL or setting is NULL. */ #ifndef _di_fss_write_payload_process_pipe_ - extern void fss_write_payload_process_pipe(void * const main); + extern void fss_write_payload_process_pipe(fss_write_main_t * const main); #endif // _di_fss_write_payload_process_pipe_ /** @@ -107,7 +105,6 @@ extern "C" { * The program and settings data. * * Must not be NULL. - * Must be of type fss_write_main_t. * * This alters main.setting.state.status: * F_okay on success. @@ -116,7 +113,7 @@ extern "C" { * F_parameter (with error bit) if main is NULL or setting is NULL. */ #ifndef _di_fss_write_payload_process_set_ - extern void fss_write_payload_process_set(void * const main); + extern void fss_write_payload_process_set(fss_write_main_t * const main); #endif // _di_fss_write_payload_process_set_ /** @@ -133,6 +130,8 @@ extern "C" { * @param setting * The main program settings. * + * Must not be NULL. + * * This alters setting.process_help, setting.process_normal, and setting.process_pipe. * * This alters setting.state.status: diff --git a/level_3/fss_write/c/payload/main.c b/level_3/fss_write/c/payload/main.c index f9ae3f5..4a8eee8 100644 --- a/level_3/fss_write/c/payload/main.c +++ b/level_3/fss_write/c/payload/main.c @@ -20,12 +20,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.setting.state.custom = (void *) &data; data.setting.standard = fss_write_payload_standard_s; - data.callback.process_content = 0; - data.callback.process_help = &fss_write_payload_process_help; - data.callback.process_normal = &fss_write_process_normal; - data.callback.process_object = 0; - data.callback.process_pipe = &fss_write_payload_process_pipe; - data.callback.process_set = &fss_write_payload_process_set; + data.call.process_content = 0; + data.call.process_help = &fss_write_payload_process_help; + data.call.process_normal = &fss_write_process_normal; + data.call.process_object = 0; + data.call.process_pipe = &fss_write_payload_process_pipe; + data.call.process_set = &fss_write_payload_process_set; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/iki_read/c/main/common/type.c b/level_3/iki_read/c/main/common/type.c index a2612bf..241441f 100644 --- a/level_3/iki_read/c/main/common/type.c +++ b/level_3/iki_read/c/main/common/type.c @@ -23,8 +23,8 @@ extern "C" { fll_program_data_delete(&main->program); iki_read_setting_delete(&main->setting); - if (main->callback.delete_data) { - main->callback.delete_data(main); + if (main->call.delete_data) { + main->call.delete_data(main); } } #endif // _di_iki_read_main_delete_ diff --git a/level_3/iki_read/c/main/common/type.h b/level_3/iki_read/c/main/common/type.h index f5c5abc..d9e54aa 100644 --- a/level_3/iki_read/c/main/common/type.h +++ b/level_3/iki_read/c/main/common/type.h @@ -59,17 +59,21 @@ extern "C" { * - delete_data: Delete the IKI/EKI data. */ #ifndef _di_iki_read_callback_t_ + typedef void (*iki_read_main_call_t) (iki_read_main_t * const main); + typedef void (*iki_read_print_data_call_t) (fl_print_t * const print, const f_number_unsigned_t index); + typedef void (*iki_read_process_buffer_ranges_call_t) (iki_read_main_t * const main, f_range_t * const range_buffer); + typedef struct { - void (*identify_alteration)(iki_read_main_t * const main); + iki_read_main_call_t identify_alteration; - void (*print_data)(fl_print_t * const print, const f_number_unsigned_t index); - void (*print_help)(fl_print_t * const print); + iki_read_print_data_call_t print_data; + fl_print_call_t print_help; - void (*process_buffer_ranges)(iki_read_main_t * const main, f_range_t * const range_buffer); - void (*process_buffer_ranges_whole)(iki_read_main_t * const main, f_range_t * const range_buffer); - void (*process_buffer_total)(iki_read_main_t * const main); + iki_read_process_buffer_ranges_call_t process_buffer_ranges; + iki_read_process_buffer_ranges_call_t process_buffer_ranges_whole; + iki_read_main_call_t process_buffer_total; - void (*delete_data)(iki_read_main_t * const main); + iki_read_main_call_t delete_data; } iki_read_callback_t; #define iki_read_callback_t_initialize \ @@ -152,16 +156,16 @@ extern "C" { * The main program data as a single structure. * * Properties: - * - cache: The cache data. - * - callback: The callbacks. - * - data: A pointer for the structure representing IKI data (or EKI data). - * - program: The main program data. - * - setting: The settings data. + * - cache: The cache data. + * - call: The callbacks. + * - data: A pointer for the structure representing IKI data (or EKI data). + * - program: The main program data. + * - setting: The settings data. */ #ifndef _di_iki_read_main_t_ struct iki_read_main_t_ { iki_read_cache_t cache; - iki_read_callback_t callback; + iki_read_callback_t call; void * data; fll_program_data_t program; iki_read_setting_t setting; diff --git a/level_3/iki_read/c/main/iki_read.c b/level_3/iki_read/c/main/iki_read.c index add8460..6f2edf8 100644 --- a/level_3/iki_read/c/main/iki_read.c +++ b/level_3/iki_read/c/main/iki_read.c @@ -13,8 +13,8 @@ extern "C" { if (main->setting.flag & iki_read_main_flag_version_copyright_help_d) { if (main->setting.flag & iki_read_main_flag_help_d) { - if (main->callback.print_help) { - main->callback.print_help(&main->program.message); + if (main->call.print_help) { + main->call.print_help(&main->program.message); } } else if (main->setting.flag & iki_read_main_flag_version_d) { diff --git a/level_3/iki_read/c/main/process.c b/level_3/iki_read/c/main/process.c index d6bac31..8f2dc0a 100644 --- a/level_3/iki_read/c/main/process.c +++ b/level_3/iki_read/c/main/process.c @@ -15,8 +15,8 @@ extern "C" { iki_read_process_line(main, &buffer_range); if (main->setting.flag & iki_read_main_flag_total_d) { - if (main->callback.process_buffer_total) { - main->callback.process_buffer_total(main); + if (main->call.process_buffer_total) { + main->call.process_buffer_total(main); if (F_status_is_error_not(main->setting.state.status)) { main->setting.state.status = F_okay; @@ -32,13 +32,13 @@ extern "C" { return; } - if (main->callback.process_buffer_ranges_whole) { - main->callback.process_buffer_ranges_whole(main, &buffer_range); + if (main->call.process_buffer_ranges_whole) { + main->call.process_buffer_ranges_whole(main, &buffer_range); } } else { - if (main->callback.process_buffer_ranges) { - main->callback.process_buffer_ranges(main, &buffer_range); + if (main->call.process_buffer_ranges) { + main->call.process_buffer_ranges(main, &buffer_range); } } diff --git a/level_3/iki_write/c/main/common/type.h b/level_3/iki_write/c/main/common/type.h index 29f8a18..3454f7c 100644 --- a/level_3/iki_write/c/main/common/type.h +++ b/level_3/iki_write/c/main/common/type.h @@ -59,22 +59,25 @@ extern "C" { * * - process_objects_content: Process an Objects and Content set. */ -#ifndef _di_iki_write_callback_t_ +#ifndef _di_iki_write_call_t_ + typedef void (*iki_write_load_objects_content_pipe_call_t)(void * const main, const f_range_t range, uint8_t * const pipe_state); + typedef void (*iki_write_process_objects_content_call_t)(void * const main, const f_string_statics_t objects, const f_string_static_t content); + typedef struct { - void (*load_objects_content_pipe)(void * const main, const f_range_t range, uint8_t * const pipe_state); + iki_write_load_objects_content_pipe_call_t load_objects_content_pipe; - void (*print_help)(fl_print_t * const print); + fl_print_call_t print_help; - void (*process_objects_content)(void * const main, const f_string_statics_t objects, const f_string_static_t content); - } iki_write_callback_t; + iki_write_process_objects_content_call_t process_objects_content; + } iki_write_call_t; - #define iki_write_callback_t_initialize \ + #define iki_write_call_t_initialize \ { \ 0, \ 0, \ 0, \ } -#endif // _di_iki_write_callback_t_ +#endif // _di_iki_write_call_t_ /** * The IKI write main program settings. @@ -116,15 +119,15 @@ extern "C" { * The main program data as a single structure. * * Properties: - * - cache: The cache data. - * - callback: The callbacks. - * - program: The main program data. - * - setting: The settings data. + * - cache: The cache data. + * - call: The callbacks. + * - program: The main program data. + * - setting: The settings data. */ #ifndef _di_iki_write_main_t_ struct iki_write_main_t_ { iki_write_cache_t cache; - iki_write_callback_t callback; + iki_write_call_t call; fll_program_data_t program; iki_write_setting_t setting; }; @@ -132,7 +135,7 @@ extern "C" { #define iki_write_main_t_initialize \ { \ iki_write_cache_t_initialize, \ - iki_write_callback_t_initialize, \ + iki_write_call_t_initialize, \ fll_program_data_t_initialize, \ iki_write_setting_t_initialize, \ } diff --git a/level_3/iki_write/c/main/iki_write.c b/level_3/iki_write/c/main/iki_write.c index 0d0224d..d4a7052 100644 --- a/level_3/iki_write/c/main/iki_write.c +++ b/level_3/iki_write/c/main/iki_write.c @@ -13,8 +13,8 @@ extern "C" { if (main->setting.flag & iki_write_main_flag_version_copyright_help_d) { if (main->setting.flag & iki_write_main_flag_help_d) { - if (main->callback.print_help) { - main->callback.print_help(&main->program.output); + if (main->call.print_help) { + main->call.print_help(&main->program.output); } } else if (main->setting.flag & iki_write_main_flag_version_d) { @@ -96,8 +96,8 @@ extern "C" { range.stop = range.start - 1; range.start = previous; - if (main->callback.load_objects_content_pipe) { - main->callback.load_objects_content_pipe((void *) main, range, &pipe_state); + if (main->call.load_objects_content_pipe) { + main->call.load_objects_content_pipe((void *) main, range, &pipe_state); if (F_status_is_error(main->setting.state.status)) break; } @@ -125,7 +125,7 @@ extern "C" { if (iki_write_signal_check(main)) return; - main->callback.process_objects_content((void *) main, main->setting.objectss.array[i], main->setting.contents.array[i]); + main->call.process_objects_content((void *) main, main->setting.objectss.array[i], main->setting.contents.array[i]); if (F_status_is_error(main->setting.state.status)) break; fll_print_dynamic_raw(f_string_eol_s, main->program.output.to);