From 00f7eda60f947ef73d0f1dbbe91f9421f4554483 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 19 Jun 2024 21:32:00 -0500 Subject: [PATCH] Progress: Continue migrating the project. --- data/build/settings | 4 +- sources/c/main/common/print.c | 3 + sources/c/main/common/print.h | 3 + sources/c/main/common/string/general.c | 2 +- sources/c/main/common/string/general.h | 2 +- sources/c/main/controller.h | 1 + sources/c/main/entry.c | 25 +- sources/c/main/entry.h | 4 +- sources/c/main/entry/action.c | 539 +++++++++++++++++++++++++++ sources/c/main/entry/action.h | 63 ++++ sources/c/main/file.c | 14 +- sources/c/main/file.h | 6 +- sources/c/main/print/debug.h | 2 - sources/c/main/print/debug/rule/action.h | 7 - sources/c/main/print/debug/rule/execute.h | 7 - sources/c/main/print/error.h | 12 - sources/c/main/print/error/entry.h | 8 - sources/c/main/print/error/entry/action.h | 6 - sources/c/main/print/error/entry/item.h | 9 - sources/c/main/print/error/entry/setting.h | 5 - sources/c/main/print/error/lock.h | 3 - sources/c/main/print/error/perform/pid.h | 71 ---- sources/c/main/print/error/rule.h | 6 - sources/c/main/print/error/rule/item.h | 30 -- sources/c/main/print/error/rule/setting.h | 4 - sources/c/main/print/lock.h | 9 +- sources/c/main/print/message.h | 8 - sources/c/main/print/message/entry.h | 3 - sources/c/main/print/message/entry/action.h | 6 - sources/c/main/print/message/entry/item.h | 15 - sources/c/main/print/warning/entry/action.h | 8 +- sources/c/main/print/warning/entry/item.c | 31 ++ sources/c/main/print/warning/entry/item.h | 54 +++ sources/c/main/print/warning/entry/setting.h | 2 +- sources/c/main/print/warning/rule/action.h | 3 - 35 files changed, 720 insertions(+), 255 deletions(-) create mode 100644 sources/c/main/print/warning/entry/item.c create mode 100644 sources/c/main/print/warning/entry/item.h diff --git a/data/build/settings b/data/build/settings index 535f11b..7832d42 100644 --- a/data/build/settings +++ b/data/build/settings @@ -58,7 +58,7 @@ build_sources_library main/print/lock.c main/print/error/lock.c build_sources_library main/print/output/entry/setting.c main/print/output/rule/execute.c build_sources_library main/print/message.c main/print/message/entry.c main/print/message/entry/action.c main/print/message/entry/item.c build_sources_library main/print/verbose.c -build_sources_library main/print/warning.c main/print/warning/entry/action.c main/print/warning/entry/setting.c +build_sources_library main/print/warning.c main/print/warning/entry/action.c main/print/warning/entry/item.c main/print/warning/entry/setting.c build_sources_library main/signal.c main/time.c build_sources_library main/thread.c main/thread/cleanup.c main/thread/control.c main/thread/entry.c main/thread/instance.c main/thread/is.c main/thread/rule.c main/thread/signal.c build_sources_library main/validate.c @@ -83,7 +83,7 @@ build_sources_headers main/print/lock.h main/print/error/lock.h build_sources_headers main/print/output/entry/setting.h main/print/output/rule/execute.h build_sources_headers main/print/message.h main/print/message/entry.h main/print/message/entry/action.h main/print/message/entry/item.h build_sources_headers main/print/verbose.h -build_sources_headers main/print/warning.h main/print/warning/entry/action.h main/print/warning/entry/setting.h +build_sources_headers main/print/warning.h main/print/warning/entry/action.h main/print/warning/entry/item.h main/print/warning/entry/setting.h build_sources_headers main/signal.h main/time.h build_sources_headers main/thread.h main/thread/cleanup.h main/thread/control.h main/thread/entry.h main/thread/instance.h main/thread/is.h main/thread/rule.h main/thread/signal.h build_sources_headers main/validate.h diff --git a/sources/c/main/common/print.c b/sources/c/main/common/print.c index a489503..ceae44c 100644 --- a/sources/c/main/common/print.c +++ b/sources/c/main/common/print.c @@ -8,12 +8,14 @@ extern "C" { const f_string_t controller_f_a[] = { "controller_convert_group_id", "controller_convert_user_id", + "controller_file_load", "controller_lock_create", "controller_rule_copy", "controller_path_canonical_relative", "f_console_parameter_process", "f_environment_get_all", "f_file_exists", + "f_file_name_base", "f_file_stat", "f_file_stream_open", "f_file_stream_read", @@ -37,6 +39,7 @@ extern "C" { "f_thread_create", "f_time_spec_millisecond", "fl_conversion_dynamic_partial_to_signed_detect", + "fl_conversion_dynamic_to_unsigned_detect ", "fl_environment_load_names", "fl_fss_extended_list_content_read", "fl_fss_extended_list_object_read", diff --git a/sources/c/main/common/print.h b/sources/c/main/common/print.h index 7bf2381..2f879ad 100644 --- a/sources/c/main/common/print.h +++ b/sources/c/main/common/print.h @@ -41,12 +41,14 @@ extern "C" { enum { controller_f_controller_convert_group_id_e, controller_f_controller_convert_user_id_e, + controller_f_controller_file_load_e, controller_f_controller_lock_create_e, controller_f_controller_rule_copy_e, controller_f_controller_path_canonical_relative_e, controller_f_f_console_parameter_process_e, controller_f_f_environment_get_all_e, controller_f_f_file_exists_e, + controller_f_f_file_name_base_e, controller_f_f_file_stat_e, controller_f_f_file_stream_open_e, controller_f_f_file_stream_read_e, @@ -70,6 +72,7 @@ extern "C" { controller_f_f_thread_create_e, controller_f_f_time_spec_millisecond_e, controller_f_fl_conversion_dynamic_partial_to_signed_detect_e, + controller_f_fl_conversion_dynamic_to_unsigned_detect_e, controller_f_fl_environment_load_names_e, controller_f_fl_fss_extended_list_content_read_e, controller_f_fl_fss_extended_list_object_read_e, diff --git a/sources/c/main/common/string/general.c b/sources/c/main/common/string/general.c index fdfe696..357f260 100644 --- a/sources/c/main/common/string/general.c +++ b/sources/c/main/common/string/general.c @@ -62,7 +62,7 @@ extern "C" { const f_string_static_t controller_length_s = macro_f_string_static_t_initialize_1(CONTROLLER_length_s, 0, CONTROLLER_length_s_length); const f_string_static_t controller_limit_s = macro_f_string_static_t_initialize_1(CONTROLLER_limit_s, 0, CONTROLLER_limit_s_length); const f_string_static_t controller_locks_s = macro_f_string_static_t_initialize_1(CONTROLLER_locks_s, 0, CONTROLLER_locks_s_length); - const f_string_static_t controller_s = macro_f_string_static_t_initialize_1(CONTROLLER_main_s, 0, CONTROLLER_main_s_length); + const f_string_static_t controller_main_s = macro_f_string_static_t_initialize_1(CONTROLLER_main_s, 0, CONTROLLER_main_s_length); const f_string_static_t controller_max_s = macro_f_string_static_t_initialize_1(CONTROLLER_max_s, 0, CONTROLLER_max_s_length); const f_string_static_t controller_memlock_s = macro_f_string_static_t_initialize_1(CONTROLLER_memlock_s, 0, CONTROLLER_memlock_s_length); const f_string_static_t controller_method_s = macro_f_string_static_t_initialize_1(CONTROLLER_method_s, 0, CONTROLLER_method_s_length); diff --git a/sources/c/main/common/string/general.h b/sources/c/main/common/string/general.h index d099c47..0450ea0 100644 --- a/sources/c/main/common/string/general.h +++ b/sources/c/main/common/string/general.h @@ -353,7 +353,7 @@ extern "C" { extern const f_string_static_t controller_length_s; extern const f_string_static_t controller_limit_s; extern const f_string_static_t controller_locks_s; - extern const f_string_static_t controller_s; + extern const f_string_static_t controller_main_s; extern const f_string_static_t controller_max_s; extern const f_string_static_t controller_memlock_s; extern const f_string_static_t controller_method_s; diff --git a/sources/c/main/controller.h b/sources/c/main/controller.h index 289b065..3cb4b54 100644 --- a/sources/c/main/controller.h +++ b/sources/c/main/controller.h @@ -136,6 +136,7 @@ #include #include #include +#include #include #include #include diff --git a/sources/c/main/entry.c b/sources/c/main/entry.c index 92319cd..593a319 100644 --- a/sources/c/main/entry.c +++ b/sources/c/main/entry.c @@ -89,7 +89,7 @@ extern "C" { status = f_memory_array_increase_by(main->thread.cache.object_items.used, sizeof(f_range_t), (void **) &main->thread.cache.object_items.array, &main->thread.cache.object_items.used, &main->thread.cache.object_items.size); if (F_status_is_error(status)) { - controller_print_error_entry(&main->program.error, cache, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true); + controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true); } else { @@ -152,17 +152,7 @@ extern "C" { for (j = (code & 0x1) ? 1 : 0; j < entry->items.used; ++j) { if (f_compare_dynamic(entry->items.array[j].name, main->thread.cache.action.name_item) == F_equal_to) { - if (main->program.warning.verbosity == f_console_verbosity_debug_e) { - controller_lock_print(main->program.warning.to, &main->thread); - - fl_print_format("%r%[%QIgnoring duplicate %r item '%]", main->program.warning.to, f_string_eol_s, main->program.warning.context, main->program.warning.prefix, (entry->flag & controller_entry_flag_is_e) ? controller_entry_s : controller_exit_s, main->program.warning.context); - fl_print_format(f_string_format_Q_single_s.string, main->program.warning.to, main->program.warning.notable, main->thread.cache.action.name_file, main->program.warning.notable); - fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.warning.to, main->program.warning.context, main->program.warning.context, f_string_eol_s); - - controller_print_error_entry_cache(&main->program.warning, &main->thread.cache.action, entry->flag & controller_entry_flag_is_e); - - controller_unlock_print_flush(main->program.warning.to, &main->thread); - } + controller_print_warning_entry_item_duplicate_ignore(&main->program.warning, &main->thread.cache, entry->flag & controller_entry_flag_is_e, main->thread.cache.action.name_item); code |= 0x2; @@ -176,7 +166,6 @@ extern "C" { if (f_compare_dynamic(controller_main_s, main->thread.cache.action.name_item) == F_equal_to) { code |= 0x1; - at = 0; if (!entry->items.used) { @@ -184,7 +173,7 @@ extern "C" { } } else if (f_compare_dynamic(controller_settings_s, main->thread.cache.action.name_item) == F_equal_to) { - status = controller_entry_setting_read(main, cache, entry->flag & controller_entry_flag_is_e, *range); + status = controller_entry_setting_read(main, entry->flag & controller_entry_flag_is_e, *range); continue; } @@ -193,7 +182,7 @@ extern "C" { } else { - // skip position 0, which is reserved for "main". + // Skip position 0, which is reserved for "main". entry->items.array[0].name.used = 0; at = 1; @@ -210,13 +199,13 @@ extern "C" { break; } - status = controller_entry_actions_read(main, cache, entry->flag & controller_entry_flag_is_e, *range, &entry->items.array[at].actions); + status = controller_entry_action_read(main, entry->flag & controller_entry_flag_is_e, *range, &entry->items.array[at].actions); if (F_status_is_error(status)) { if (F_status_set_fine(status) != F_interrupt) { controller_lock_print(main->program.error.to, &main->thread); - controller_print_error_entry_cache(entry->flag & controller_entry_flag_is_e, &main->program.error, &main->thread.cache.action); + controller_print_error_entry_cache(&main->program.error, &main->thread.cache.action, entry->flag & controller_entry_flag_is_e); controller_unlock_print_flush(main->program.error.to, &main->thread); } @@ -305,7 +294,7 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) != F_interrupt) { - controller_print_error_entry_cache(entry->flag & controller_entry_flag_is_e, &main->program.error, &main->thread.cache.action); + controller_print_error_entry_cache(&main->program.error, &main->thread.cache.action, entry->flag & controller_entry_flag_is_e); } entry->status = controller_status_simplify_error(F_status_set_fine(status)); diff --git a/sources/c/main/entry.h b/sources/c/main/entry.h index 6901da3..18c4c23 100644 --- a/sources/c/main/entry.h +++ b/sources/c/main/entry.h @@ -34,7 +34,7 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: controller_entry_actions_read(). + * Errors (with error bit) from: controller_entry_action_read(). * Errors (with error bit) from: controller_entry_items_increase_by(). * Errors (with error bit) from: controller_file_load(). * Errors (with error bit) from: controller_status_simplify_error(). @@ -48,7 +48,7 @@ extern "C" { * Errors (with error bit) from: f_fss_apply_delimit(). * Errors (with error bit) from: fll_fss_basic_list_read(). * - * @see controller_entry_actions_read() + * @see controller_entry_action_read() * @see controller_entry_items_increase_by() * @see controller_file_load() * @see controller_status_simplify_error() diff --git a/sources/c/main/entry/action.c b/sources/c/main/entry/action.c index e69de29..b269bd1 100644 --- a/sources/c/main/entry/action.c +++ b/sources/c/main/entry/action.c @@ -0,0 +1,539 @@ +#include "../controller.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_controller_entry_action_read_ + f_status_t controller_entry_action_read(controller_t * const main, const uint8_t is_entry, f_range_t range, controller_entry_actions_t * const actions) { + + if (!main || !actions) return F_status_set_error(F_parameter); + + f_status_t status = F_okay; + f_status_t status_action = F_okay; + + actions->used = 0; + + main->thread.cache.object_actions.used = main->thread.cache.object_actions.size; + main->thread.cache.content_actions.used = main->thread.cache.content_actions.size; + + while (main->thread.cache.object_actions.used) { + + main->thread.cache.object_actions.array[--main->thread.cache.object_actions.used].start = 1; + main->thread.cache.object_actions.array[main->thread.cache.object_actions.used].stop = 0; + } // while + + while (main->thread.cache.content_actions.used) { + main->thread.cache.content_actions.array[--main->thread.cache.content_actions.used].used = 0; + } // while + + { + controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize_1(is_entry, global.thread); + f_state_t state = macro_f_state_t_initialize_1(controller_common_allocation_large_d, controller_common_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); + f_range_t content_range = range; + + fll_fss_extended_read(main->thread.cache.buffer_file, &content_range, &main->thread.cache.object_actions, &main->thread.cache.content_actions, 0, 0, &main->thread.cache.delimits, 0, &state); + } + + if (F_status_is_error(status)) { + controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fll_fss_extended_read), F_true); + + return status; + } + + f_state_t state = f_state_t_initialize; + + f_fss_apply_delimit(main->thread.cache.delimits, &main->thread.cache.buffer_file, &state); + + if (F_status_is_error(status)) { + controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true); + + return status; + } + + main->thread.cache.delimits.used = 0; + + status f_memory_array_increase_by(main->thread.cache.object_actions.used, sizeof(controller_entry_action_t), (void **) &actions->array, &actions->used, &actions->size); + + if (F_status_is_error(status)) { + controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true); + + return status; + } + + controller_entry_action_t *action = 0; + + f_number_unsigned_t allocate = 0; + f_number_unsigned_t at_least = 0; + f_number_unsigned_t at_most = 0; + + f_number_unsigned_t i = 0; + f_number_unsigned_t j = 0; + + for (; i < main->thread.cache.object_actions.used; ++i) { + + main->thread.cache.action.line_action = 0; + main->thread.cache.action.name_action.used = 0; + + action = &actions->array[actions->used]; + action->type = 0; + action->code = 0; + action->line = 0; + action->number = 0; + action->status = F_known_not; + action->parameters.used = 0; + + f_fss_count_lines(main->thread.cache.buffer_file, main->thread.cache.object_actions.array[i].start, &main->thread.cache.action.line_action, &global.main->setting.state); + + if (F_status_is_error(status)) { + controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true); + + break; + } + + action->line = ++main->thread.cache.action.line_action; + + status = f_rip_dynamic_partial_nulless(main->thread.cache.buffer_file, main->thread.cache.object_actions.array[i], &main->thread.cache.action.name_action); + + if (F_status_is_error(status)) { + controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true); + + break; + } + + if (f_compare_dynamic(controller_consider_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_consider_e; + } + else if (f_compare_dynamic(controller_execute_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_execute_e; + } + else if (f_compare_dynamic(controller_failsafe_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_failsafe_e; + } + else if (f_compare_dynamic(controller_freeze_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_freeze_e; + } + else if (f_compare_dynamic(controller_item_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_item_e; + } + else if (f_compare_dynamic(controller_kill_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_kill_e; + } + else if (f_compare_dynamic(controller_pause_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_pause_e; + } + else if (f_compare_dynamic(controller_ready_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_ready_e; + } + else if (f_compare_dynamic(controller_reload_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_reload_e; + } + else if (f_compare_dynamic(controller_restart_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_restart_e; + } + else if (f_compare_dynamic(controller_resume_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_resume_e; + } + else if (f_compare_dynamic(controller_start_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_start_e; + } + else if (f_compare_dynamic(controller_stop_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_stop_e; + } + else if (f_compare_dynamic(controller_thaw_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_thaw_e; + } + else if (f_compare_dynamic(controller_timeout_s, main->thread.cache.action.name_action) == F_equal_to) { + actions->array[actions->used].type = controller_entry_action_type_timeout_e; + } + else { + if (global.main->program.warning.verbosity == f_console_verbosity_debug_e) { + controller_lock_print(global.main->program.warning.to, global.thread); + + fl_print_format("%r%[%QUnknown %r item action '%]", global.main->program.warning.to, f_string_eol_s, global.main->program.warning.context, global.main->program.warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.warning.context); + fl_print_format(f_string_format_Q_single_s.string, global.main->program.warning.to, global.main->program.warning.notable, main->thread.cache.action.name_action, global.main->program.warning.notable); + fl_print_format(f_string_format_sentence_end_quote_s.string, global.main->program.warning.to, global.main->program.warning.context, global.main->program.warning.context, f_string_eol_s); + + controller_entry_print_error_cache(is_entry, &global.main->program.warning, main->thread.cache.action); + + controller_unlock_print_flush(global.main->program.warning.to, global.thread); + } + + continue; + } + + if (action->type == controller_entry_action_type_consider_e || controller_entry_action_type_is_rule(action->type)) { + allocate = main->thread.cache.content_actions.array[i].used; + at_least = 2; + at_most = allocate; + } + else if (action->type == controller_entry_action_type_execute_e) { + allocate = main->thread.cache.content_actions.array[i].used; + at_least = 1; + at_most = allocate; + } + else if (action->type == controller_entry_action_type_failsafe_e || action->type == controller_entry_action_type_item_e) { + allocate = 1; + at_least = 1; + at_most = 1; + } + else if (action->type == controller_entry_action_type_timeout_e) { + allocate = 2; + at_least = 1; + at_most = 2; + } + else if (action->type == controller_entry_action_type_ready_e) { + allocate = 1; + at_least = 0; + at_most = 1; + } + + if (main->thread.cache.content_actions.array[i].used < at_least || main->thread.cache.content_actions.array[i].used > at_most) { + action->status = F_status_set_error(F_parameter); + + if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) { + f_thread_mutex_lock(&global.thread->lock.print); + + f_file_stream_lock(global.main->program.error.to); + + fl_print_format("%r%[%QThe %r item action '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context); + fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, main->thread.cache.action.name_action, global.main->program.error.notable); + fl_print_format("%[' requires ", global.main->program.error.to, global.main->program.error.context); + + if (at_least == at_most) { + f_print_terminated("exactly ", global.main->program.error.to); + } + + fl_print_format("%]%[%un%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.notable, at_least, global.main->program.error.notable); + + if (action->type == controller_entry_action_type_consider_e || controller_entry_action_type_is_rule(action->type)) { + fl_print_format("%[ or more parameters.%]%r", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s); + } + else { + if (at_least == at_most) { + fl_print_format("%[ parameters.%]%r", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s); + } + else { + fl_print_format("%[ to %]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context); + fl_print_format("%[%un%]", global.main->program.error.to, global.main->program.error.notable, at_most, global.main->program.error.notable); + fl_print_format("%[ parameters.%]%r", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s); + } + } + + f_file_stream_unlock(global.main->program.error.to); + + f_thread_mutex_unlock(&global.thread->lock.print); + } + } + else { + action->status = F_okay; + } + + if (F_status_is_error(action->status)) { + if (F_status_is_error_not(status_action)) { + status_action = action->status; + } + + continue; + } + + if (allocate) { + status = f_memory_array_increase_by(allocate, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); + + if (F_status_is_error(status)) { + controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true); + + action->status = status; + + if (F_status_is_error_not(status_action)) { + status_action = status; + } + + break; + } + + for (j = 0; j < allocate && j < main->thread.cache.content_actions.array[i].used; ++j) { + + action->parameters.array[j].used = 0; + + if (main->thread.cache.content_actions.array[i].array[j].start > main->thread.cache.content_actions.array[i].array[j].stop) continue; + + status = f_memory_array_increase_by((main->thread.cache.content_actions.array[i].array[j].stop - main->thread.cache.content_actions.array[i].array[j].start) + 1, sizeof(f_char_t), (void **) &action->parameters.array[j].string, &action->parameters.array[j].used, &action->parameters.array[j].size); + + if (F_status_is_error(status)) { + controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true); + + break; + } + + status = f_string_dynamic_partial_append_nulless(main->thread.cache.buffer_file, main->thread.cache.content_actions.array[i].array[j], &action->parameters.array[j]); + + if (F_status_is_error(status)) { + controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_partial_append_nulless), F_true); + + break; + } + + ++action->parameters.used; + } // for + + if (F_status_is_error_not(action->status)) { + if (action->type == controller_entry_action_type_consider_e || controller_entry_action_type_is_rule(action->type)) { + if (action->parameters.array[0].used) { + + // Force the path to be canonical (removing all '../' parts). + status = controller_path_canonical_relative(global.setting, action->parameters.array[0], &main->thread.cache.buffer_path); + + if (F_status_is_error(status)) { + controller_entry_print_error_file(is_entry, &global.main->program.error, main->thread.cache.action, F_status_set_fine(status), "controller_path_canonical_relative", F_true, main->thread.cache.action.generic, f_file_operation_analyze_s, fll_error_file_type_path_e, global.thread); + + action->status = status; + + if (F_status_set_fine(status) == F_memory_not) { + status_action = status; + + break; + } + + if (F_status_is_error_not(status_action)) { + status_action = status; + } + } + } + else { + action->status = F_status_set_error(F_parameter); + + if (F_status_is_error_not(status_action)) { + status_action = action->status; + } + + if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) { + fll_print_format("%r%[%QThe %r item action must not have an empty string for a path (the first parameter).%]%r", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context, f_string_eol_s); + } + } + + if (action->parameters.array[1].used) { + main->thread.cache.buffer_path.used = 0; + + status = f_file_name_base(action->parameters.array[1], &main->thread.cache.buffer_path); + + if (F_status_is_error(status)) { + controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_file_name_base), F_true); + + if (F_status_set_fine(status) == F_memory_not) { + status_action = status; + + break; + } + + action->status = status; + + if (F_status_is_error_not(status_action)) { + status_action = status; + } + } + else { + if (f_compare_dynamic(action->parameters.array[1], main->thread.cache.buffer_path) == F_equal_to_not) { + if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(global.main->program.error.to); + + fl_print_format("%r%[%QThe %r item action second parameter '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context); + fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[1], global.main->program.error.notable); + fl_print_format("%[' must be a base path name, such as '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context); + fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, main->thread.cache.buffer_path, global.main->program.error.notable); + fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s); + + f_file_stream_unlock(global.main->program.error.to); + } + + action->status = F_status_set_error(F_parameter); + + if (F_status_is_error_not(status_action)) { + status_action = action->status; + } + } + } + } + else { + action->status = F_status_set_error(F_parameter); + + if (F_status_is_error_not(status_action)) { + status_action = action->status; + } + + if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) { + fll_print_format("%r%[%QThe %r item action must not have an empty string for a rule name (the second parameter).%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context, f_string_eol_s); + } + } + + for (j = 2; j < action->parameters.used; ++j) { + + if (f_compare_dynamic(controller_asynchronous_s, action->parameters.array[j]) == F_equal_to) { + action->code |= controller_entry_rule_code_asynchronous_d; + } + else if (f_compare_dynamic(controller_require_s, action->parameters.array[j]) == F_equal_to) { + action->code |= controller_entry_rule_code_require_d; + } + else if (f_compare_dynamic(controller_wait_s, action->parameters.array[j]) == F_equal_to) { + action->code |= controller_entry_rule_code_wait_d; + } + else { + if (action->status == F_okay) { + action->status = F_status_set_error(F_support_not); + + if (F_status_is_error_not(status_action)) { + status_action = action->status; + } + } + + if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(global.main->program.error.to); + + fl_print_format("%r%[%QThe %r item action third parameter (and beyond) must be one of '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context); + fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_asynchronous_s, global.main->program.error.notable); + fl_print_format("%[', '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context); + fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_require_s, global.main->program.error.notable); + fl_print_format("%[', or '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context); + fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_wait_s, global.main->program.error.notable); + fl_print_format("%[' but instead has '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context); + fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[j], global.main->program.error.notable); + fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s); + + f_file_stream_unlock(global.main->program.error.to); + } + } + } // for + } + else if (action->type == controller_entry_action_type_failsafe_e || action->type == controller_entry_action_type_item_e) { + if (f_compare_dynamic(controller_main_s, action->parameters.array[0]) == F_equal_to) { + action->status = F_status_set_error(F_support_not); + + if (F_status_is_error_not(status_action)) { + status_action = action->status; + } + + if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(global.main->program.error.to); + + fl_print_format("%r%[%QThe %r item action may not specify the reserved item '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context); + fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_main_s, global.main->program.error.notable); + fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s); + + f_file_stream_unlock(global.main->program.error.to); + } + } + } + else if (action->type == controller_entry_action_type_timeout_e) { + + if (f_compare_dynamic(controller_kill_s, action->parameters.array[0]) == F_equal_to) { + action->code = controller_entry_timeout_code_kill_d; + } + else if (f_compare_dynamic(controller_start_s, action->parameters.array[0]) == F_equal_to) { + action->code = controller_entry_timeout_code_start_d; + } + else if (f_compare_dynamic(controller_stop_s, action->parameters.array[0]) == F_equal_to) { + action->code = controller_entry_timeout_code_stop_d; + } + else { + action->status = F_status_set_error(F_support_not); + + if (F_status_is_error_not(status_action)) { + status_action = action->status; + } + + if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(global.main->program.error.to); + + fl_print_format("%r%[%QThe %r item action must have one of '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context); + fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_kill_s, global.main->program.error.notable); + fl_print_format("%[', '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context); + fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_start_s, global.main->program.error.notable); + fl_print_format("%[', or '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context); + fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_stop_s, global.main->program.error.notable); + fl_print_format("%[' but instead has '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context); + fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[0], global.main->program.error.notable); + fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s); + + f_file_stream_unlock(global.main->program.error.to); + } + } + + if (action->status == F_okay) { + if (action->parameters.used == 2) { + action->flag &= ~controller_entry_action_flag_undefined_e; + + status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, action->parameters.array[1], &action->number); + + if (F_status_is_error(status) || status == F_data_not) { + action->number = 0; + + if (status == F_data_not) { + action->status = F_status_set_error(F_number); + } + else { + action->status = controller_status_simplify_error(F_status_set_fine(status)); + } + + if (F_status_set_fine(status) == F_memory_not) { + controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_to_unsigned_detect), F_true); + + status_action = status; + + break; + } + + if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(global.main->program.error.to); + + fl_print_format("%r%[%QThe %r item action parameter '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context); + fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[1], global.main->program.error.notable); + fl_print_format("%[' is not a valid supported number.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s); + + f_file_stream_unlock(global.main->program.error.to); + } + } + } + else { + action->flag |= controller_entry_action_flag_undefined_e; + } + } + } + else if (action->type == controller_entry_action_type_ready_e) { + if (action->parameters.used) { + if (f_compare_dynamic(controller_wait_s, action->parameters.array[0]) == F_equal_to) { + action->code |= controller_entry_rule_code_wait_d; + } + else { + action->status = F_status_set_error(F_support_not); + + if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(global.main->program.error.to); + + fl_print_format("%r%[%QThe %r item action may only have '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context); + fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_wait_s, global.main->program.error.notable); + fl_print_format("%[' but instead has '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context); + fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[0], global.main->program.error.notable); + fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s); + + f_file_stream_unlock(global.main->program.error.to); + } + } + } + } + } + } + + ++actions->used; + } // for + + if (F_status_is_error(status_action)) { + return status_action; + } + + return status; + } +#endif // _di_controller_entry_action_read_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/sources/c/main/entry/action.h b/sources/c/main/entry/action.h index e69de29..2b05f66 100644 --- a/sources/c/main/entry/action.h +++ b/sources/c/main/entry/action.h @@ -0,0 +1,63 @@ +/** + * FLL - Level 3 + * + * Project: Controller + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the entry action functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _controller_main_entry_action_h +#define _controller_main_entry_action_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Read the entry list, loading all items and values. + * + * @param main + * The main program data. + * + * Must not be NULL. + * @param is_entry + * If TRUE, then this operates as an entry. + * If FALSE, then this operates as an exit. + * @param range + * The range in the list buffer representing the content. + * @param actions + * The processed actions. + * + * Must not be NULL. + * + * @return + * F_okay on success. + * + * Errors (with error bit) from: controller_entry_actions_increase_by(). + * Errors (with error bit) from: f_fss_apply_delimit(). + * Errors (with error bit) from: f_fss_count_lines(). + * Errors (with error bit) from: f_memory_array_increase_by(). + * Errors (with error bit) from: f_rip_dynamic_partial_nulless(). + * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * Errors (with error bit) from: fll_fss_extended_read(). + * + * @see controller_entry_actions_increase_by() + * @see f_fss_apply_delimit() + * @see f_fss_count_lines() + * @see f_memory_array_increase_by() + * @see f_rip_dynamic_partial_nulless() + * @see f_string_dynamic_partial_append_nulless() + * @see fll_fss_extended_read() + */ +#ifndef _di_controller_entry_action_read_ + extern f_status_t controller_entry_action_read(controller_t * const main, const uint8_t is_entry, const f_range_t range, controller_entry_actions_t * const actions); +#endif // _di_controller_entry_action_read_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _controller_main_entry_action_h diff --git a/sources/c/main/file.c b/sources/c/main/file.c index 5b3121e..08455f9 100644 --- a/sources/c/main/file.c +++ b/sources/c/main/file.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_controller_file_load_ - f_status_t controller_file_load(controller_t * const main, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix) { + f_status_t controller_file_load(controller_t * const main, const uint8_t required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix) { if (!main) return F_status_set_error(F_parameter); @@ -16,26 +16,26 @@ extern "C" { main->thread.cache.timestamp.seconds = 0; main->thread.cache.timestamp.seconds_nano = 0; - f_status_t status = f_string_dynamic_append(path_prefix, &main->thread.cache.action.name_file); + f_status_t status = f_string_dynamic_append_nulless(path_prefix, &main->thread.cache.action.name_file); if (F_status_is_error_not(status)) { - status = f_string_dynamic_append(f_path_separator_s, &main->thread.cache.action.name_file); + status = f_string_dynamic_append_nulless(f_path_separator_s, &main->thread.cache.action.name_file); } if (F_status_is_error_not(status)) { - status = f_string_dynamic_append(path_name, &main->thread.cache.action.name_file); + status = f_string_dynamic_append_nulless(path_name, &main->thread.cache.action.name_file); } if (F_status_is_error_not(status)) { - status = f_string_dynamic_append(f_path_extension_separator_s, &main->thread.cache.action.name_file); + status = f_string_dynamic_append_nulless(f_path_extension_separator_s, &main->thread.cache.action.name_file); } if (F_status_is_error_not(status)) { - status = f_string_dynamic_append(path_suffix, &main->thread.cache.action.name_file); + status = f_string_dynamic_append_nulless(path_suffix, &main->thread.cache.action.name_file); } if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status)); + controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append_nulless), F_status_set_fine(status)); return status; } diff --git a/sources/c/main/file.h b/sources/c/main/file.h index 2ad4908..ceab24b 100644 --- a/sources/c/main/file.h +++ b/sources/c/main/file.h @@ -22,8 +22,8 @@ extern "C" { * @param main * The main program data. * - * The following within the main.thread.cache is updated: - * - name_file: The partial path of the file is inserted. + * The following within the main.thread.cache is changed: + * - action.name_file: The partial path of the file is inserted. * - buffer_file: The contents of the file is inserted. * - timestamp: This is updated to reflect the last changed timestamp. * @@ -54,7 +54,7 @@ extern "C" { * @see f_string_append() */ #ifndef _di_controller_file_load_ - extern f_status_t controller_file_load(controller_t * const main, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix); + extern f_status_t controller_file_load(controller_t * const main, const uint8_t required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix); #endif // _di_controller_file_load_ /** diff --git a/sources/c/main/print/debug.h b/sources/c/main/print/debug.h index 778e3d8..a80f7da 100644 --- a/sources/c/main/print/debug.h +++ b/sources/c/main/print/debug.h @@ -37,8 +37,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() */ #ifndef _di_controller_print_debug_directory_path_empty_ extern f_status_t controller_print_debug_directory_path_empty(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name); diff --git a/sources/c/main/print/debug/rule/action.h b/sources/c/main/print/debug/rule/action.h index 3a5afd2..56f41eb 100644 --- a/sources/c/main/print/debug/rule/action.h +++ b/sources/c/main/print/debug/rule/action.h @@ -33,13 +33,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fl_print_format() - * @see fll_error_print() - * - * @see controller_lock_print() - * @see controller_print_error_rule_cache() - * @see controller_unlock_print_flush() */ #ifndef _di_controller_print_debug_rule_action_empty_ extern f_status_t controller_print_debug_rule_action_empty(fl_print_t * const print, controller_cache_t * const cache); diff --git a/sources/c/main/print/debug/rule/execute.h b/sources/c/main/print/debug/rule/execute.h index 851f1c5..967933b 100644 --- a/sources/c/main/print/debug/rule/execute.h +++ b/sources/c/main/print/debug/rule/execute.h @@ -35,13 +35,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fl_print_format() - * @see fll_error_print() - * - * @see controller_lock_print() - * @see controller_print_error_rule_cache() - * @see controller_unlock_print_flush() */ #ifndef _di_controller_main_print_debug_rule_execute_rerun_ extern f_status_t controller_main_print_debug_rule_execute_rerun(fl_print_t * const print, controller_rule_rerun_item_t * const rerun, const uint8_t action); diff --git a/sources/c/main/print/error.h b/sources/c/main/print/error.h index 8207d58..2b53e7e 100644 --- a/sources/c/main/print/error.h +++ b/sources/c/main/print/error.h @@ -33,8 +33,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() */ #ifndef _di_controller_print_error_ extern f_status_t controller_print_error(fl_print_t * const print, const f_string_t function); @@ -63,8 +61,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() */ #ifndef _di_controller_print_error_failsafe_item_ extern f_status_t controller_print_error_failsafe_item(fl_print_t * const print, controller_thread_t * const thread, f_string_dynamic_t * const name); @@ -96,8 +92,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. - * - * @see fll_error_file_print() */ #ifndef _di_controller_print_error_file_ extern f_status_t controller_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); @@ -131,8 +125,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if a parameter is NULL. - * - * @see fll_error_file_print() */ #ifndef _di_controller_print_error_file_status_ extern f_status_t controller_print_error_file_status(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type, const f_status_t status); @@ -157,8 +149,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() */ #ifndef _di_controller_print_error_status_ extern f_status_t controller_print_error_status(fl_print_t * const print, const f_string_t function, const f_status_t status); @@ -185,8 +175,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() */ #ifndef _di_controller_print_error_file_pid_exists_ extern f_status_t controller_print_error_file_pid_exists(fl_print_t * const print, controller_thread_t * const thread, const f_string_dynamic_t path); diff --git a/sources/c/main/print/error/entry.h b/sources/c/main/print/error/entry.h index b507fd4..949dbc3 100644 --- a/sources/c/main/print/error/entry.h +++ b/sources/c/main/print/error/entry.h @@ -46,9 +46,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_error_entry_ extern f_status_t controller_print_error_entry(fl_print_t * const print, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback); @@ -82,9 +79,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see controller_entry_actions_read() - * @see controller_entry_read() */ #ifndef _di_controller_print_error_entry_cache_ extern f_status_t controller_print_error_entry_cache(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry); @@ -125,8 +119,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() */ #ifndef _di_controller_print_error_entry_file_ extern f_status_t controller_print_error_entry_file(fl_print_t * const print, const uint8_t is_entry, const f_status_t status, const char * const function, const uint8_t fallback, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); diff --git a/sources/c/main/print/error/entry/action.h b/sources/c/main/print/error/entry/action.h index 32da325..276e046 100644 --- a/sources/c/main/print/error/entry/action.h +++ b/sources/c/main/print/error/entry/action.h @@ -42,9 +42,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_error_entry_action_execution_failure_ extern f_status_t controller_print_error_entry_action_execution_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const int code); @@ -76,9 +73,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_error_entry_action_execution_missing_ extern f_status_t controller_print_error_entry_action_execution_missing(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name); diff --git a/sources/c/main/print/error/entry/item.h b/sources/c/main/print/error/entry/item.h index dc5fd80..8e7a0c5 100644 --- a/sources/c/main/print/error/entry/item.h +++ b/sources/c/main/print/error/entry/item.h @@ -44,9 +44,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_error_entry_item_failure_ extern f_status_t controller_print_error_entry_item_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t message); @@ -78,9 +75,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_error_entry_item_invalid_ extern f_status_t controller_print_error_entry_item_invalid(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_number_unsigned_t number); @@ -112,9 +106,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_error_entry_item_setting_support_not_option_ extern f_status_t controller_print_error_entry_item_setting_support_not_option(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t setting); diff --git a/sources/c/main/print/error/entry/setting.h b/sources/c/main/print/error/entry/setting.h index f473c31..efb65de 100644 --- a/sources/c/main/print/error/entry/setting.h +++ b/sources/c/main/print/error/entry/setting.h @@ -49,8 +49,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see controller_entry_settings_read() */ #ifndef _di_controller_print_error_entry_setting_with_range_ extern f_status_t controller_print_error_entry_setting_with_range(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_t before, const f_range_t range, const f_string_t after); @@ -175,9 +173,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_error_entry_setting_support_not_number_ extern f_status_t controller_print_error_entry_setting_support_not_number(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t buffer, const f_range_t range); diff --git a/sources/c/main/print/error/lock.h b/sources/c/main/print/error/lock.h index 3bc4ad0..14a237d 100644 --- a/sources/c/main/print/error/lock.h +++ b/sources/c/main/print/error/lock.h @@ -39,9 +39,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_error_lock_critical_ extern f_status_t controller_print_error_lock_critical(fl_print_t * const print, const f_status_t status, const uint8_t is_read); diff --git a/sources/c/main/print/error/perform/pid.h b/sources/c/main/print/error/perform/pid.h index 95b9a77..d9d9d0b 100644 --- a/sources/c/main/print/error/perform/pid.h +++ b/sources/c/main/print/error/perform/pid.h @@ -17,77 +17,6 @@ extern "C" { #endif /** - * Print debug message about PID file and control socket. - * - * @param print - * The output structure to print to. - * - * This requires print.custom to be controller_t. - * - * 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_controller_print_debug_perform_pid_file_control_socket_ - extern f_status_t controller_print_debug_perform_pid_file_control_socket(fl_print_t * const print); -#endif // _di_controller_print_debug_perform_pid_file_control_socket_ - -/** - * Print debug message on problems when creating PID file. - * - * @param print - * The output structure to print to. - * - * This requires print.custom to be controller_t. - * - * This does not alter print.custom.setting.state.status. - * @param function - * The name of the function associated with the error. - * @param status - * The status code to process. - * Make sure this has F_status_set_fine() called if the status code has any error or warning bits. - * @param is_entry - * If TRUE, then this operates as an entry. - * If FALSE, then this operates as an exit. - * - * @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_controller_print_debug_perform_pid_file_create_problem_ - extern f_status_t controller_print_debug_perform_pid_file_create_problem(fl_print_t * const print, const f_string_t function, const f_status_t status, const uint8_t is_entry); -#endif // _di_controller_print_debug_perform_pid_file_create_problem_ - -/** - * Print debug message on success when creating PID file. - * - * @param print - * The output structure to print to. - * - * This requires print.custom to be controller_t. - * - * This does not alter print.custom.setting.state.status. - * @param is_entry - * If TRUE, then this operates as an entry. - * If FALSE, then this operates as an exit. - * - * @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_controller_print_debug_perform_pid_file_create_success_ - extern f_status_t controller_print_debug_perform_pid_file_create_success(fl_print_t * const print, const uint8_t is_entry); -#endif // _di_controller_print_debug_perform_pid_file_create_success_ - -/** * Print error message on problems when creating PID file. * * @param print diff --git a/sources/c/main/print/error/rule.h b/sources/c/main/print/error/rule.h index e9ed73d..42d0caf 100644 --- a/sources/c/main/print/error/rule.h +++ b/sources/c/main/print/error/rule.h @@ -50,9 +50,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() - * @see controller_print_error_rule_cache() */ #ifndef _di_controller_print_error_rule_ extern f_status_t controller_print_error_rule(fl_print_t * const print, controller_cache_action_t * const cache, const f_status_t status, const f_string_t function, const uint8_t fallback, const uint8_t item); @@ -86,9 +83,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_error_rule_cache_ extern f_status_t controller_print_error_rule_cache(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t item); diff --git a/sources/c/main/print/error/rule/item.h b/sources/c/main/print/error/rule/item.h index c183bbc..78b64fc 100644 --- a/sources/c/main/print/error/rule/item.h +++ b/sources/c/main/print/error/rule/item.h @@ -36,8 +36,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see controller_print_error_rule_cache() */ #ifndef _di_controller_print_error_rule_item_ extern f_status_t controller_print_error_rule_item(fl_print_t * const print, const controller_cache_action_t cache, const bool item, const f_status_t status); @@ -60,13 +58,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fl_print_format() - * @see fll_error_print() - * - * @see controller_lock_print() - * @see controller_print_error_rule_cache() - * @see controller_unlock_print_flush() */ #ifndef _di_controller_print_error_rule_item_action_first_ extern f_status_t controller_print_error_rule_item_action_first(fl_print_t * const print, controller_cache_t * const cache); @@ -93,13 +84,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fl_print_format() - * @see fll_error_print() - * - * @see controller_lock_print() - * @see controller_print_error_rule_cache() - * @see controller_unlock_print_flush() */ #ifndef _di_controller_print_error_rule_item_action_positive_number_not_ extern f_status_t controller_print_error_rule_item_action_positive_number_not(fl_print_t * const print, controller_cache_t * const cache, const f_string_static_t name, const f_number_unsigned_t index); @@ -122,13 +106,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fl_print_format() - * @see fll_error_print() - * - * @see controller_lock_print() - * @see controller_print_error_rule_cache() - * @see controller_unlock_print_flush() */ #ifndef _di_controller_print_error_rule_item_action_second_ extern f_status_t controller_print_error_rule_item_action_second(fl_print_t * const print, controller_cache_t * const cache); @@ -155,13 +132,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fl_print_format() - * @see fll_error_print() - * - * @see controller_lock_print() - * @see controller_print_error_rule_cache() - * @see controller_unlock_print_flush() */ #ifndef _di_controller_print_error_rule_item_action_unknown_ extern f_status_t controller_print_error_rule_item_action_unknown(fl_print_t * const print, controller_cache_t * const cache, const f_string_static_t name, const f_string_static_t unknown); diff --git a/sources/c/main/print/error/rule/setting.h b/sources/c/main/print/error/rule/setting.h index 496edd5..596db8f 100644 --- a/sources/c/main/print/error/rule/setting.h +++ b/sources/c/main/print/error/rule/setting.h @@ -40,8 +40,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see controller_rule_setting_read() */ #ifndef _di_controller_print_error_rule_setting_ extern f_status_t controller_print_error_rule_setting(fl_print_t * const print, controller_thread_t * const thread, controller_cache_t * const cache, const f_string_t message, const f_number_unsigned_t index, const f_number_unsigned_t line_item); @@ -75,8 +73,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see controller_rule_setting_read() */ #ifndef _di_controller_print_error_rule_setting_with_range_ extern f_status_t controller_print_error_rule_setting_with_range(fl_print_t * const print, controller_thread_t * const thread, controller_cache_t * const cache, const f_string_t before, const f_range_t range, const f_string_t after, const f_number_unsigned_t index, const f_number_unsigned_t line_item); diff --git a/sources/c/main/print/lock.h b/sources/c/main/print/lock.h index f9d96a1..9ab12fa 100644 --- a/sources/c/main/print/lock.h +++ b/sources/c/main/print/lock.h @@ -27,9 +27,6 @@ extern "C" { * (optonal) The thread containing the print mutex to lock. * * Set to NULL to not use. - * - * @see f_file_stream_lock() - * @see f_thread_mutex_unlock() */ #ifndef _di_controller_lock_print_ extern void controller_lock_print(const f_file_t to, controller_thread_t * const thread); @@ -51,13 +48,9 @@ extern "C" { * (optonal) The thread containing the print mutex to unlock. * * Set to NULL to not use. - * - * @see f_file_stream_unlock() - * - * @see f_thread_mutex_unlock() */ #ifndef _di_controller_unlock_print_flush_ - void controller_unlock_print_flush(const f_file_t to, controller_thread_t * const thread); + extern void controller_unlock_print_flush(const f_file_t to, controller_thread_t * const thread); #endif // _di_controller_unlock_print_flush_ #ifdef __cplusplus diff --git a/sources/c/main/print/message.h b/sources/c/main/print/message.h index 2d98d17..a6ac3ea 100644 --- a/sources/c/main/print/message.h +++ b/sources/c/main/print/message.h @@ -34,14 +34,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see f_file_stream_flush() - * @see f_file_stream_lock() - * @see f_file_stream_unlock() - * @see f_print_dynamic_raw() - * @see fll_program_print_help_header() - * @see fll_program_print_help_option() - * @see fll_program_print_help_usage() */ #ifndef _di_controller_print_message_help_ extern f_status_t controller_print_message_help(fl_print_t * const print, const uint8_t uninterrupt); diff --git a/sources/c/main/print/message/entry.h b/sources/c/main/print/message/entry.h index e3d5f6e..3708ebc 100644 --- a/sources/c/main/print/message/entry.h +++ b/sources/c/main/print/message/entry.h @@ -40,9 +40,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_message_entry_state_ extern f_status_t controller_print_message_entry_state(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name); diff --git a/sources/c/main/print/message/entry/action.h b/sources/c/main/print/message/entry/action.h index e660b51..a44a478 100644 --- a/sources/c/main/print/message/entry/action.h +++ b/sources/c/main/print/message/entry/action.h @@ -129,9 +129,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_message_entry_action_ready_ extern f_status_t controller_print_message_entry_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name); @@ -161,9 +158,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_message_entry_action_wait_ extern f_status_t controller_print_message_entry_action_wait(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name); diff --git a/sources/c/main/print/message/entry/item.h b/sources/c/main/print/message/entry/item.h index 8b16abe..144d69f 100644 --- a/sources/c/main/print/message/entry/item.h +++ b/sources/c/main/print/message/entry/item.h @@ -39,9 +39,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_message_entry_item_done_ extern f_status_t controller_print_message_entry_item_done(fl_print_t * const print, const uint8_t is_entry, const uint8_t failsafe, const f_string_static_t name); @@ -71,9 +68,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_message_entry_item_executing_ extern f_status_t controller_print_message_entry_item_executing(fl_print_t * const print, const uint8_t is_entry, f_string_dynamics_t * const parameters); @@ -104,9 +98,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_message_entry_item_process_ extern f_status_t controller_print_message_entry_item_process(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t prepend, const f_string_static_t name); @@ -134,9 +125,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_message_entry_item_required_ extern f_status_t controller_print_message_entry_item_required(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name, const f_string_t detail); @@ -172,9 +160,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_message_entry_item_rule_ extern f_status_t controller_print_message_entry_item_rule(fl_print_t * const print, controller_entry_t * const entry, controller_entry_action_t * const action, const uint8_t is_entry, const f_string_static_t alias_rule); diff --git a/sources/c/main/print/warning/entry/action.h b/sources/c/main/print/warning/entry/action.h index 89b1c74..b6a8c7a 100644 --- a/sources/c/main/print/warning/entry/action.h +++ b/sources/c/main/print/warning/entry/action.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry warning action functionality. + * Provides the print entry action warning functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -40,9 +40,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_warning_entry_action_failsafe_twice_ extern f_status_t controller_print_warning_entry_action_failsafe_twice(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry); @@ -74,9 +71,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_warning_entry_action_multiple_ extern f_status_t controller_print_warning_entry_action_multiple(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name); diff --git a/sources/c/main/print/warning/entry/item.c b/sources/c/main/print/warning/entry/item.c new file mode 100644 index 0000000..7647510 --- /dev/null +++ b/sources/c/main/print/warning/entry/item.c @@ -0,0 +1,31 @@ +#include "../../../controller.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_controller_print_warning_entry_item_duplicate_ignore_ + f_status_t controller_print_warning_entry_item_duplicate_ignore(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name) { + + if (!print || !print->custom || !cache) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_debug_e) return F_output_not; + + controller_t * const main = (controller_t *) print->custom; + + controller_lock_print(print->to, &main->thread); + + fl_print_format("%r%[%QIgnoring duplicate %r '%]", print->to, f_string_eol_s, print->context, print->prefix, is_entry ? controller_entry_s : controller_exit_s, print->context); + fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable); + fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->context, print->context, f_string_eol_s); + + controller_print_error_entry_cache(print, &cache->action, is_entry); + + controller_unlock_print_flush(print->to, &main->thread); + + return F_okay; + } +#endif // _di_controller_print_warning_entry_item_duplicate_ignore_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/sources/c/main/print/warning/entry/item.h b/sources/c/main/print/warning/entry/item.h new file mode 100644 index 0000000..26a7ca1 --- /dev/null +++ b/sources/c/main/print/warning/entry/item.h @@ -0,0 +1,54 @@ +/** + * FLL - Level 3 + * + * Project: Controller + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the print entry item warning functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _controller_main_print_warning_entry_item_h +#define _controller_main_print_warning_entry_item_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Print warning message about duplicate items. + * + * @param print + * The output structure to print to. + * + * This requires print.custom to be controller_t. + * + * This does not alter print.custom.setting.state.status. + * + * Must not be NULL. + * @param cache + * The cache. + * + * Must not be NULL. + * @param is_entry + * If TRUE, then this loads as an entry. + * If FALSE, then this loads as an exit. + * @param name + * The item name. + * + * @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_controller_print_warning_entry_item_duplicate_ignore_ + extern f_status_t controller_print_warning_entry_item_duplicate_ignore(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name); +#endif // _di_controller_print_warning_entry_item_duplicate_ignore_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _controller_main_print_warning_entry_item_h diff --git a/sources/c/main/print/warning/entry/setting.h b/sources/c/main/print/warning/entry/setting.h index 8c398f0..4b12817 100644 --- a/sources/c/main/print/warning/entry/setting.h +++ b/sources/c/main/print/warning/entry/setting.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry warning setting functionality. + * Provides the print entry setting warning functionality. * * This is auto-included and should not need to be explicitly included. */ diff --git a/sources/c/main/print/warning/rule/action.h b/sources/c/main/print/warning/rule/action.h index 4295bd0..608a0cf 100644 --- a/sources/c/main/print/warning/rule/action.h +++ b/sources/c/main/print/warning/rule/action.h @@ -37,9 +37,6 @@ extern "C" { * F_output_not on success, but no printing is performed. * * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_file_print() - * @see controller_print_error_entry_cache() */ #ifndef _di_controller_print_warning_entry_action_multiple_ extern f_status_t controller_print_warning_rule_action_unknown(fl_print_t * const print, controller_cache_t * const cache); -- 1.8.3.1