From 69a23301dad344929492863e77c38786382fb99e Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 18 Feb 2025 18:52:11 -0600 Subject: [PATCH] Update: IKI Write from main/data.callback to main/data.call. Rename `callback` to `call` to e consistent with recent naming changes. --- level_3/iki_write/c/eki/main.c | 6 +++--- level_3/iki_write/c/eki/print.c | 6 ++++-- level_3/iki_write/c/eki/print.h | 8 +++++++- level_3/iki_write/c/eki/process.c | 16 ++++++---------- level_3/iki_write/c/eki/process.h | 4 ++-- level_3/iki_write/c/iki/main.c | 6 +++--- level_3/iki_write/c/iki/print.c | 6 ++++-- level_3/iki_write/c/iki/print.h | 8 +++++++- level_3/iki_write/c/iki/process.c | 16 ++++++---------- level_3/iki_write/c/iki/process.h | 4 ++-- level_3/iki_write/c/main/common/type.h | 4 ++-- 11 files changed, 46 insertions(+), 38 deletions(-) diff --git a/level_3/iki_write/c/eki/main.c b/level_3/iki_write/c/eki/main.c index f410530..a0d10a0 100644 --- a/level_3/iki_write/c/eki/main.c +++ b/level_3/iki_write/c/eki/main.c @@ -16,9 +16,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.program.output.custom = (void *) &data; data.program.warning.custom = (void *) &data; - data.callback.load_objects_content_pipe = &iki_write_eki_load_objects_content_pipe; - data.callback.print_help = &iki_write_eki_print_message_help; - data.callback.process_objects_content = &iki_write_eki_process_objects_content; + data.call.load_objects_content_pipe = &iki_write_eki_load_objects_content_pipe; + data.call.print_help = &iki_write_eki_print_message_help; + data.call.process_objects_content = &iki_write_eki_process_objects_content; f_console_parameter_t parameters[] = iki_write_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/iki_write/c/eki/print.c b/level_3/iki_write/c/eki/print.c index a770b93..3efbbc0 100644 --- a/level_3/iki_write/c/eki/print.c +++ b/level_3/iki_write/c/eki/print.c @@ -46,9 +46,9 @@ extern "C" { #endif // _di_iki_write_eki_print_error_objects_not_valid_ #ifndef _di_iki_write_eki_print_message_help_ - void iki_write_eki_print_message_help(fl_print_t * const print) { + f_status_t iki_write_eki_print_message_help(fl_print_t * const print) { - if (!print) return; + if (!print) return F_status_set_error(F_output_not); f_file_stream_lock(print->to); @@ -66,6 +66,8 @@ extern "C" { f_file_stream_flush(print->to); f_file_stream_unlock(print->to); + + return F_okay; } #endif // _di_iki_write_eki_print_message_help_ diff --git a/level_3/iki_write/c/eki/print.h b/level_3/iki_write/c/eki/print.h index 69824e9..36d340d 100644 --- a/level_3/iki_write/c/eki/print.h +++ b/level_3/iki_write/c/eki/print.h @@ -57,9 +57,15 @@ extern "C" { * The output structure to print to. * * This does not alter print.custom.setting.state.status. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_iki_write_eki_print_message_help_ - extern void iki_write_eki_print_message_help(fl_print_t * const print); + extern f_status_t iki_write_eki_print_message_help(fl_print_t * const print); #endif // _di_iki_write_eki_print_message_help_ /** diff --git a/level_3/iki_write/c/eki/process.c b/level_3/iki_write/c/eki/process.c index 6cd7d8b..d55fb0d 100644 --- a/level_3/iki_write/c/eki/process.c +++ b/level_3/iki_write/c/eki/process.c @@ -5,13 +5,11 @@ extern "C" { #endif #ifndef _di_iki_write_eki_load_objects_content_pipe_ - void iki_write_eki_load_objects_content_pipe(void * const void_main, const f_range_t range, uint8_t * const pipe_state) { + void iki_write_eki_load_objects_content_pipe(iki_write_main_t * const main, const f_range_t range, uint8_t * const pipe_state) { - if (!void_main) return; + if (!main) return; - iki_write_main_t * const main = (iki_write_main_t *) void_main; - - if (!pipe_state || !main->callback.process_objects_content) { + if (!pipe_state || !main->call.process_objects_content) { main->setting.state.status = F_status_set_error(F_parameter); iki_write_print_error(&main->program.error, macro_iki_write_f(iki_write_callback_load_objects_content_pipe)); @@ -30,7 +28,7 @@ extern "C" { } } - main->callback.process_objects_content((void *) main, main->cache.objects, main->cache.content); + main->call.process_objects_content((void *) main, main->cache.objects, main->cache.content); if (F_status_is_error(main->setting.state.status)) return; fll_print_dynamic_raw(f_string_eol_s, main->program.output.to); @@ -117,11 +115,9 @@ extern "C" { #endif // _di_iki_write_eki_load_objects_content_pipe_ #ifndef _di_iki_write_eki_process_objects_content_ - void iki_write_eki_process_objects_content(void * const void_main, const f_string_statics_t objects, const f_string_static_t content) { - - if (!void_main) return; + void iki_write_eki_process_objects_content(iki_write_main_t * const main, const f_string_statics_t objects, const f_string_static_t content) { - iki_write_main_t * const main = (iki_write_main_t *) void_main; + if (!main) return; { f_number_unsigned_t i = 0; diff --git a/level_3/iki_write/c/eki/process.h b/level_3/iki_write/c/eki/process.h index 1fc7e2a..af44118 100644 --- a/level_3/iki_write/c/eki/process.h +++ b/level_3/iki_write/c/eki/process.h @@ -45,7 +45,7 @@ extern "C" { * @see f_iki_write() */ #ifndef _di_iki_write_eki_load_objects_content_pipe_ - extern void iki_write_eki_load_objects_content_pipe(void * const main, const f_range_t range, uint8_t * const pipe_state); + extern void iki_write_eki_load_objects_content_pipe(iki_write_main_t * const main, const f_range_t range, uint8_t * const pipe_state); #endif // _di_iki_write_eki_load_objects_content_pipe_ /** @@ -72,7 +72,7 @@ extern "C" { * @see f_iki_eki_write() */ #ifndef _di_iki_write_eki_process_objects_content_ - extern void iki_write_eki_process_objects_content(void * const main, const f_string_statics_t objects, const f_string_static_t content); + extern void iki_write_eki_process_objects_content(iki_write_main_t * const main, const f_string_statics_t objects, const f_string_static_t content); #endif // _di_iki_write_eki_process_objects_content_ #ifdef __cplusplus diff --git a/level_3/iki_write/c/iki/main.c b/level_3/iki_write/c/iki/main.c index a068605..2573014 100644 --- a/level_3/iki_write/c/iki/main.c +++ b/level_3/iki_write/c/iki/main.c @@ -16,9 +16,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.program.output.custom = (void *) &data; data.program.warning.custom = (void *) &data; - data.callback.load_objects_content_pipe = &iki_write_iki_load_objects_content_pipe; - data.callback.print_help = &iki_write_iki_print_message_help; - data.callback.process_objects_content = &iki_write_iki_process_objects_content; + data.call.load_objects_content_pipe = &iki_write_iki_load_objects_content_pipe; + data.call.print_help = &iki_write_iki_print_message_help; + data.call.process_objects_content = &iki_write_iki_process_objects_content; f_console_parameter_t parameters[] = iki_write_console_parameter_t_initialize; data.program.parameters.array = parameters; diff --git a/level_3/iki_write/c/iki/print.c b/level_3/iki_write/c/iki/print.c index 1c2d78c..697abed 100644 --- a/level_3/iki_write/c/iki/print.c +++ b/level_3/iki_write/c/iki/print.c @@ -23,9 +23,9 @@ extern "C" { #endif // _di_iki_write_iki_print_error_object_not_valid_ #ifndef _di_iki_write_iki_print_message_help_ - void iki_write_iki_print_message_help(fl_print_t * const print) { + f_status_t iki_write_iki_print_message_help(fl_print_t * const print) { - if (!print) return; + if (!print) return F_status_set_error(F_output_not); f_file_stream_lock(print->to); @@ -43,6 +43,8 @@ extern "C" { f_file_stream_flush(print->to); f_file_stream_unlock(print->to); + + return F_okay; } #endif // _di_iki_write_iki_print_message_help_ diff --git a/level_3/iki_write/c/iki/print.h b/level_3/iki_write/c/iki/print.h index a75e0b6..b167eb3 100644 --- a/level_3/iki_write/c/iki/print.h +++ b/level_3/iki_write/c/iki/print.h @@ -39,9 +39,15 @@ extern "C" { * The output structure to print to. * * This does not alter print.custom.setting.state.status. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_iki_write_iki_print_message_help_ - extern void iki_write_iki_print_message_help(fl_print_t * const print); + extern f_status_t iki_write_iki_print_message_help(fl_print_t * const print); #endif // _di_iki_write_iki_print_message_help_ /** diff --git a/level_3/iki_write/c/iki/process.c b/level_3/iki_write/c/iki/process.c index 28a480d..ea8efae 100644 --- a/level_3/iki_write/c/iki/process.c +++ b/level_3/iki_write/c/iki/process.c @@ -5,13 +5,11 @@ extern "C" { #endif #ifndef _di_iki_write_iki_load_objects_content_pipe_ - void iki_write_iki_load_objects_content_pipe(void * const void_main, const f_range_t range, uint8_t * const pipe_state) { + void iki_write_iki_load_objects_content_pipe(iki_write_main_t * const main, const f_range_t range, uint8_t * const pipe_state) { - if (!void_main) return; + if (!main) return; - iki_write_main_t * const main = (iki_write_main_t *) void_main; - - if (!pipe_state || !main->callback.process_objects_content) { + if (!pipe_state || !main->call.process_objects_content) { main->setting.state.status = F_status_set_error(F_parameter); iki_write_print_error(&main->program.error, macro_iki_write_f(iki_write_callback_load_objects_content_pipe)); @@ -32,7 +30,7 @@ extern "C" { } } - main->callback.process_objects_content((void *) main, main->cache.objects, main->cache.content); + main->call.process_objects_content((void *) main, main->cache.objects, main->cache.content); if (F_status_is_error(main->setting.state.status)) return; fll_print_dynamic_raw(f_string_eol_s, main->program.output.to); @@ -68,11 +66,9 @@ extern "C" { #endif // _di_iki_write_iki_load_objects_content_pipe_ #ifndef _di_iki_write_iki_process_objects_content_ - void iki_write_iki_process_objects_content(void * const void_main, const f_string_statics_t objects, const f_string_static_t content) { - - if (!void_main) return; + void iki_write_iki_process_objects_content(iki_write_main_t * const main, const f_string_statics_t objects, const f_string_static_t content) { - iki_write_main_t * const main = (iki_write_main_t *) void_main; + if (!main) return; // Only the first index is used because IKI only supports one Object (Vocabulary). if (!objects.used || !objects.array[0].used) { diff --git a/level_3/iki_write/c/iki/process.h b/level_3/iki_write/c/iki/process.h index adba6ec..4de4838 100644 --- a/level_3/iki_write/c/iki/process.h +++ b/level_3/iki_write/c/iki/process.h @@ -44,7 +44,7 @@ extern "C" { * @see f_iki_write() */ #ifndef _di_iki_write_iki_load_objects_content_pipe_ - extern void iki_write_iki_load_objects_content_pipe(void * const main, const f_range_t range, uint8_t * const pipe_state); + extern void iki_write_iki_load_objects_content_pipe(iki_write_main_t * const main, const f_range_t range, uint8_t * const pipe_state); #endif // _di_iki_write_iki_load_objects_content_pipe_ /** @@ -71,7 +71,7 @@ extern "C" { * @see f_iki_write() */ #ifndef _di_iki_write_iki_process_objects_content_ - extern void iki_write_iki_process_objects_content(void * const main, const f_string_statics_t objects, const f_string_static_t content); + extern void iki_write_iki_process_objects_content(iki_write_main_t * const main, const f_string_statics_t objects, const f_string_static_t content); #endif // _di_iki_write_iki_process_objects_content_ #ifdef __cplusplus diff --git a/level_3/iki_write/c/main/common/type.h b/level_3/iki_write/c/main/common/type.h index 3f2f123..39b504a 100644 --- a/level_3/iki_write/c/main/common/type.h +++ b/level_3/iki_write/c/main/common/type.h @@ -61,8 +61,8 @@ extern "C" { */ #ifndef _di_iki_write_call_t_ typedef void (*iki_write_settings_load_call_t)(const f_console_arguments_t arguments, iki_write_main_t * const main); - 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 void (*iki_write_load_objects_content_pipe_call_t)(iki_write_main_t * const main, const f_range_t range, uint8_t * const pipe_state); + typedef void (*iki_write_process_objects_content_call_t)(iki_write_main_t * const main, const f_string_statics_t objects, const f_string_static_t content); typedef struct { iki_write_load_objects_content_pipe_call_t load_objects_content_pipe; -- 1.8.3.1