From 4bae30fe8de3758a4302f08a15e47416f781ebb4 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 30 Jul 2024 21:45:38 -0500 Subject: [PATCH] Refactor: Change bit-wise enumerations into defines. I did some reviewing of how the enumerations used for flags are used. These generally are not being used as a type. An enumeration slightly increases the resulting binary size. Enumeration values might be limited to just type of int. This seems like an easy (small) optimization to just use defines rather than enumerations for flags and other bit-wise numbers. --- sources/c/program/controller/controller/main.c | 2 +- sources/c/program/controller/init/main.c | 2 +- sources/c/program/controller/main/common.c | 28 ++++---- sources/c/program/controller/main/common/define.h | 76 ++++++++++++++++------ .../c/program/controller/main/common/enumeration.h | 38 ----------- sources/c/program/controller/main/common/type.h | 2 +- sources/c/program/controller/main/entry/process.c | 34 +++++----- sources/c/program/controller/main/entry/setting.c | 2 +- sources/c/program/controller/main/perform.c | 4 +- .../controller/main/print/error/rule/setting.c | 6 +- .../controller/main/print/message/entry/item.c | 2 +- .../controller/main/print/output/entry/setting.c | 2 +- .../controller/main/print/output/rule/setting.c | 4 +- sources/c/program/controller/main/process.c | 14 ++-- sources/c/program/controller/main/rule/instance.c | 2 +- sources/c/program/controller/main/rule/setting.c | 6 +- sources/c/program/controller/main/thread/cleanup.c | 2 +- sources/c/program/controller/main/thread/entry.c | 10 +-- .../c/program/controller/main/thread/instance.c | 4 +- sources/c/program/controller/main/thread/signal.c | 2 +- sources/c/program/controller/main/time.c | 2 +- 21 files changed, 121 insertions(+), 123 deletions(-) diff --git a/sources/c/program/controller/controller/main.c b/sources/c/program/controller/controller/main.c index 45ad6f8..aa68c3d 100644 --- a/sources/c/program/controller/controller/main.c +++ b/sources/c/program/controller/controller/main.c @@ -25,7 +25,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.program.pipe = fll_program_data_pipe_input_e; } - data.setting.flag |= controller_main_flag_interruptible_e; + data.setting.flag |= controller_main_flag_interruptible_d; fll_program_standard_set_up(&data.program); diff --git a/sources/c/program/controller/init/main.c b/sources/c/program/controller/init/main.c index 369db13..c9d77a3 100644 --- a/sources/c/program/controller/init/main.c +++ b/sources/c/program/controller/init/main.c @@ -29,7 +29,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.process.entry.pid = controller_entry_pid_disable_e; data.process.entry.show = controller_entry_show_init_e; data.process.mode = controller_process_mode_service_e; - data.setting.flag &= ~controller_main_flag_interruptible_e; + data.setting.flag &= ~controller_main_flag_interruptible_d; fll_program_standard_set_up(&data.program); diff --git a/sources/c/program/controller/main/common.c b/sources/c/program/controller/main/common.c index d06449e..02c3c33 100644 --- a/sources/c/program/controller/main/common.c +++ b/sources/c/program/controller/main/common.c @@ -105,28 +105,28 @@ extern "C" { } if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { - main->setting.flag |= controller_main_flag_help_e; + main->setting.flag |= controller_main_flag_help_d; return; } if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { - main->setting.flag |= controller_main_flag_version_e; + main->setting.flag |= controller_main_flag_version_d; return; } if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { - main->setting.flag |= controller_main_flag_copyright_e; + main->setting.flag |= controller_main_flag_copyright_d; return; } if (main->program.pipe & fll_program_data_pipe_input_e) { - main->setting.flag |= controller_main_flag_pipe_e; + main->setting.flag |= controller_main_flag_pipe_d; } else { - main->setting.flag &= ~controller_main_flag_pipe_e; + main->setting.flag &= ~controller_main_flag_pipe_d; } f_string_static_t * const args = main->program.parameters.arguments.array; @@ -155,7 +155,7 @@ extern "C" { const uint16_t flags[] = { 0, - controller_main_flag_pid_e, + controller_main_flag_pid_d, 0, 0, }; @@ -206,9 +206,9 @@ extern "C" { }; const uint16_t flags[] = { - controller_main_flag_daemon_e, - controller_main_flag_simulate_e, - controller_main_flag_validate_e, + controller_main_flag_daemon_d, + controller_main_flag_simulate_d, + controller_main_flag_validate_d, }; for (index = 0; index < 3; ++index) { @@ -239,7 +239,7 @@ extern "C" { } } - if (!main->process.path_pid.used && !(main->setting.flag & controller_main_flag_pid_e)) { + if (!main->process.path_pid.used && !(main->setting.flag & controller_main_flag_pid_d)) { main->setting.state.status = f_string_dynamic_append(controller_default_path_pid_s, &main->process.path_pid); if (F_status_is_error_not(main->setting.state.status)) { @@ -314,18 +314,18 @@ extern "C" { if (main->program.parameters.array[controller_parameter_interruptible_e].result & f_console_result_found_e) { if (main->program.parameters.array[controller_parameter_uninterruptible_e].result & f_console_result_found_e) { if (main->program.parameters.array[controller_parameter_interruptible_e].location < main->program.parameters.array[controller_parameter_uninterruptible_e].location) { - main->setting.flag &= ~controller_main_flag_interruptible_e; + main->setting.flag &= ~controller_main_flag_interruptible_d; } else { - main->setting.flag |= controller_main_flag_interruptible_e; + main->setting.flag |= controller_main_flag_interruptible_d; } } else { - main->setting.flag |= controller_main_flag_interruptible_e; + main->setting.flag |= controller_main_flag_interruptible_d; } } else if (main->program.parameters.array[controller_parameter_uninterruptible_e].result & f_console_result_found_e) { - main->setting.flag &= ~controller_main_flag_interruptible_e; + main->setting.flag &= ~controller_main_flag_interruptible_d; } } #endif // _di_controller_setting_load_ diff --git a/sources/c/program/controller/main/common/define.h b/sources/c/program/controller/main/common/define.h index 817d1d9..191e8b0 100644 --- a/sources/c/program/controller/main/common/define.h +++ b/sources/c/program/controller/main/common/define.h @@ -37,6 +37,62 @@ extern "C" { #endif // _di_controller_allocation_d_ /** + * Controller lock defines. + * + * controller_lock_*_d: + * - mutex_max_retry: The maximum amount of times to retry the mutex lock before giving up. + */ +#ifndef _di_controller_lock_d_ + #define controller_lock_mutex_max_retry_d 1000000 +#endif // _di_controller_lock_d_ + +/** + * Flags associated with Controller locks. + * + * controller_lock_flag_*_d: + * - setup_not: No locks are initialized, so do not attempt to deallocate them. + */ +#ifndef _di_controller_lock_flag_d_ + #define controller_lock_flag_setup_not_d 0x1 +#endif // _di_controller_lock_flag_d_ + +/** + * Flags passed to the main function or program. + * + * When number mode is not specified, then mode is "string" mode (there is no flag for "string" mode). + * + * controller_main_flag_*_d: + * - none: No flags set. + * - copyright: Print copyright. + * - daemon: Run the process in the background and create a PID file. + * - error: Check if status is "error". + * - fine: Check if status is "fine". + * - help: Print help. + * - interruptible: The process is interruptible. + * - pid: Designate that a custom PID is specified. + * - pipe: Use the input pipe. + * - simulate: Perform simulation of rules rather than execution. + * - validate: Perform validation of rules rather than execution. + * - version: Print version. + * - version_copyright_help: A helper flag representing version, copyright, and help flag bits being set. + */ +#ifndef _di_controller_main_flag_d_ + #define controller_main_flag_none_d 0x0 + #define controller_main_flag_copyright_d 0x1 + #define controller_main_flag_daemon_d 0x2 + #define controller_main_flag_error_d 0x4 + #define controller_main_flag_fine_d 0x8 + #define controller_main_flag_help_d 0x10 + #define controller_main_flag_interruptible_d 0x20 + #define controller_main_flag_pid_d 0x40 + #define controller_main_flag_pipe_d 0x80 + #define controller_main_flag_simulate_d 0x100 + #define controller_main_flag_validate_d 0x200 + #define controller_main_flag_version_d 0x400 + #define controller_main_flag_version_copyright_help_d 0x411 +#endif // _di_controller_main_flag_d_ + +/** * The program signal defines. * * controller_signal_*_d: @@ -66,26 +122,6 @@ extern "C" { #define controller_with_session_same_d 0x4 #endif // _di_controller_with_d_ -/** - * Controller lock defines. - * - * controller_lock_*_d: - * - mutex_max_retry: The maximum amount of times to retry the mutex lock before giving up. - */ -#ifndef _di_controller_lock_d_ - #define controller_lock_mutex_max_retry_d 1000000 -#endif // _di_controller_lock_d_ - -/** - * Flags associated with Controller locks. - * - * controller_lock_flag_*_d: - * - setup_not: No locks are initialized, so do not attempt to deallocate them. - */ -#ifndef _di_controller_lock_flag_d_ - #define controller_lock_flag_setup_not_d 0x1 -#endif // _di_controller_lock_flag_d_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/sources/c/program/controller/main/common/enumeration.h b/sources/c/program/controller/main/common/enumeration.h index ba5b38a..929164f 100644 --- a/sources/c/program/controller/main/common/enumeration.h +++ b/sources/c/program/controller/main/common/enumeration.h @@ -17,44 +17,6 @@ extern "C" { #endif /** - * Flags passed to the main function or program. - * - * When number mode is not specified, then mode is "string" mode (there is no flag for "string" mode). - * - * controller_main_flag_*_e: - * - none: No flags set. - * - copyright: Print copyright. - * - daemon: Run the process in the background and create a PID file. - * - error: Check if status is "error". - * - fine: Check if status is "fine". - * - help: Print help. - * - interruptible: The process is interruptible. - * - pid: Designate that a custom PID is specified. - * - pipe: Use the input pipe. - * - simulate: Perform simulation of rules rather than execution. - * - validate: Perform validation of rules rather than execution. - * - version: Print version. - * - version_copyright_help: A helper flag representing version, copyright, and help flag bits being set. - */ -#ifndef _di_controller_main_flag_e_ - enum { - controller_main_flag_none_e = 0x0, - controller_main_flag_copyright_e = 0x1, - controller_main_flag_daemon_e = 0x2, - controller_main_flag_error_e = 0x4, - controller_main_flag_fine_e = 0x8, - controller_main_flag_help_e = 0x10, - controller_main_flag_interruptible_e = 0x20, - controller_main_flag_pid_e = 0x40, - controller_main_flag_pipe_e = 0x80, - controller_main_flag_simulate_e = 0x100, - controller_main_flag_validate_e = 0x200, - controller_main_flag_version_e = 0x400, - controller_main_flag_version_copyright_help_e = 0x411, - }; // enum -#endif // _di_controller_main_flag_e_ - -/** * The main program parameters. */ #ifndef _di_controller_parameter_e_ diff --git a/sources/c/program/controller/main/common/type.h b/sources/c/program/controller/main/common/type.h index 7eedbbf..c75a9d5 100644 --- a/sources/c/program/controller/main/common/type.h +++ b/sources/c/program/controller/main/common/type.h @@ -44,7 +44,7 @@ extern "C" { #define controller_setting_t_initialize \ { \ - controller_main_flag_none_e, \ + controller_main_flag_none_d, \ F_okay, \ f_state_t_initialize, \ f_string_dynamic_t_initialize, \ diff --git a/sources/c/program/controller/main/entry/process.c b/sources/c/program/controller/main/entry/process.c index c0ef3ae..47fe4dd 100644 --- a/sources/c/program/controller/main/entry/process.c +++ b/sources/c/program/controller/main/entry/process.c @@ -56,7 +56,7 @@ extern "C" { return status; } - if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.message.verbosity > f_console_verbosity_normal_e) { + if ((main->setting.flag & controller_main_flag_simulate_d) || main->program.message.verbosity > f_console_verbosity_normal_e) { controller_print_message_entry_item_process(&main->program.message, is_entry, failsafe ? controller_failsafe_s : f_string_empty_s, cache->action.name_item); } @@ -86,7 +86,7 @@ extern "C" { } if (F_status_is_error(entry_action->status)) { - if (main->setting.flag & controller_main_flag_simulate_e) { + if (main->setting.flag & controller_main_flag_simulate_d) { controller_print_message_entry_action_state_failed(&main->program.message, cache, entry_action, is_entry); } else { @@ -112,23 +112,23 @@ extern "C" { if (entry_action->type == controller_entry_action_type_ready_e) { if ((entry_action->code & controller_entry_rule_code_wait_d) || main->process.ready == controller_process_ready_wait_e) { - if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e || entry->show == controller_entry_show_init_e) { + if ((main->setting.flag & controller_main_flag_simulate_d) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e || entry->show == controller_entry_show_init_e) { controller_print_message_entry_action_wait(&main->program.message, is_entry, controller_ready_s); } - if (!(main->setting.flag & controller_main_flag_validate_e)) { + if (!(main->setting.flag & controller_main_flag_validate_d)) { status = controller_rule_wait_all(main, is_entry, F_false); if (F_status_is_error(status)) return status; } } if (main->process.ready == controller_process_ready_yes_e) { - if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e) { + if ((main->setting.flag & controller_main_flag_simulate_d) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e) { controller_print_message_entry_action_ready(&main->program.message, is_entry, controller_ready_s); } } else { - if (!failsafe && (main->program.error.verbosity == f_console_verbosity_verbose_e || entry->show == controller_entry_show_init_e) && !(main->setting.flag & controller_main_flag_simulate_e)) { + if (!failsafe && (main->program.error.verbosity == f_console_verbosity_verbose_e || entry->show == controller_entry_show_init_e) && !(main->setting.flag & controller_main_flag_simulate_d)) { controller_print_message_entry_state(&main->program.message, is_entry, controller_ready_s); } @@ -176,7 +176,7 @@ extern "C" { return status; } - if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.message.verbosity > f_console_verbosity_normal_e) { + if ((main->setting.flag & controller_main_flag_simulate_d) || main->program.message.verbosity > f_console_verbosity_normal_e) { controller_print_message_entry_item_process(&main->program.message, is_entry, f_string_empty_s, cache->action.name_item); } @@ -224,7 +224,7 @@ extern "C" { f_thread_unlock(&main->thread.lock.rule); - if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e || (entry->show == controller_entry_show_init_e && entry_action->type != controller_entry_action_type_consider_e)) { + if ((main->setting.flag & controller_main_flag_simulate_d) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e || (entry->show == controller_entry_show_init_e && entry_action->type != controller_entry_action_type_consider_e)) { controller_print_message_entry_item_rule(&main->program.message, entry, entry_action, is_entry, alias_rule); } @@ -295,7 +295,7 @@ extern "C" { // Designate the Action as failed. entry_action->status = controller_status_simplify_error(F_failure); - if (!(main->setting.flag & controller_main_flag_simulate_e)) { + if (!(main->setting.flag & controller_main_flag_simulate_d)) { f_thread_unlock(&main->thread.lock.rule); if (entry_action->code & controller_entry_rule_code_require_d) return F_status_set_error(F_require); @@ -316,7 +316,7 @@ extern "C" { options_force = 0; options_instance = 0; - if (main->setting.flag & controller_main_flag_simulate_e) { + if (main->setting.flag & controller_main_flag_simulate_d) { options_instance |= controller_instance_option_simulate_e; } @@ -328,12 +328,12 @@ extern "C" { options_instance |= controller_instance_option_wait_e; } - if (main->setting.flag & controller_main_flag_validate_e) { + if (main->setting.flag & controller_main_flag_validate_d) { options_instance |= controller_instance_option_validate_e; } if (entry_action->code & controller_entry_rule_code_asynchronous_d) { - if (!(main->setting.flag & controller_main_flag_validate_e)) { + if (!(main->setting.flag & controller_main_flag_validate_d)) { options_force |= controller_instance_option_asynchronous_e; } @@ -343,17 +343,17 @@ extern "C" { status = controller_rule_instance_begin(main, cache, options_force, alias_rule, controller_entry_action_type_to_rule_action_type(entry_action->type), options_instance, is_entry ? controller_instance_type_entry_e : controller_instance_type_exit_e, stack); if (F_status_set_fine(status) == F_memory_not || status == F_child || F_status_set_fine(status) == F_interrupt) break; - if (F_status_is_error(status) && !(main->setting.flag & controller_main_flag_simulate_e) && (entry_action->code & controller_entry_rule_code_require_d)) { + if (F_status_is_error(status) && !(main->setting.flag & controller_main_flag_simulate_d) && (entry_action->code & controller_entry_rule_code_require_d)) { return F_status_set_error(F_require); } } } else if (entry_action->type == controller_entry_action_type_execute_e) { - if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.message.verbosity > f_console_verbosity_normal_e || entry->show == controller_entry_show_init_e) { + if ((main->setting.flag & controller_main_flag_simulate_d) || main->program.message.verbosity > f_console_verbosity_normal_e || entry->show == controller_entry_show_init_e) { controller_print_message_entry_item_executing(&main->program.message, is_entry, &entry_action->parameters); } - if (main->setting.flag & controller_main_flag_simulate_e) return F_execute; + if (main->setting.flag & controller_main_flag_simulate_d) return F_execute; controller_thread_instance_cancel(main, is_entry, is_entry ? controller_thread_cancel_execute_e : controller_thread_cancel_exit_execute_e); @@ -467,13 +467,13 @@ extern "C" { if (F_status_is_error(status_lock)) return status_lock; // Check to see if any required processes failed, but do not do this if already operating in failsafe. - if (F_status_is_error_not(status) && !failsafe && !(main->setting.flag & controller_main_flag_validate_e) && main->process.mode != controller_process_mode_helper_e) { + if (F_status_is_error_not(status) && !failsafe && !(main->setting.flag & controller_main_flag_validate_d) && main->process.mode != controller_process_mode_helper_e) { const f_status_t status_wait = controller_rule_wait_all(main, is_entry, F_true); if (F_status_is_error(status_wait)) return status_wait; if (status_wait == F_require) return F_status_set_error(F_require); } - if (((main->setting.flag & controller_main_flag_simulate_e) && main->program.error.verbosity > f_console_verbosity_error_e) || main->program.error.verbosity > f_console_verbosity_normal_e) { + if (((main->setting.flag & controller_main_flag_simulate_d) && main->program.error.verbosity > f_console_verbosity_error_e) || main->program.error.verbosity > f_console_verbosity_normal_e) { controller_print_message_entry_item_done(&main->program.message, is_entry, failsafe, controller_main_s); } diff --git a/sources/c/program/controller/main/entry/setting.c b/sources/c/program/controller/main/entry/setting.c index ed0de40..307e849 100644 --- a/sources/c/program/controller/main/entry/setting.c +++ b/sources/c/program/controller/main/entry/setting.c @@ -269,7 +269,7 @@ extern "C" { continue; } - if (main->setting.flag & controller_main_flag_pid_e) { + if (main->setting.flag & controller_main_flag_pid_d) { controller_print_error_entry_setting_ignored(&main->program.error, cache, is_entry); } else { diff --git a/sources/c/program/controller/main/perform.c b/sources/c/program/controller/main/perform.c index 80f769d..cb2961d 100644 --- a/sources/c/program/controller/main/perform.c +++ b/sources/c/program/controller/main/perform.c @@ -10,8 +10,8 @@ extern "C" { if (!main) return F_status_set_error(F_parameter); if (!is_entry) return F_okay; - if (main->setting.flag & controller_main_flag_validate_e) { - if ((main->setting.flag & controller_main_flag_simulate_e)) { + if (main->setting.flag & controller_main_flag_validate_d) { + if ((main->setting.flag & controller_main_flag_simulate_d)) { controller_print_debug_perform_pid_file_control_socket(&main->program.debug); } diff --git a/sources/c/program/controller/main/print/error/rule/setting.c b/sources/c/program/controller/main/print/error/rule/setting.c index 4f50a1f..a6ef447 100644 --- a/sources/c/program/controller/main/print/error/rule/setting.c +++ b/sources/c/program/controller/main/print/error/rule/setting.c @@ -78,7 +78,7 @@ extern "C" { controller_t * const main = (controller_t *) print->custom; if (print->verbosity != f_console_verbosity_debug_e) { - if (!(print->verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_e))) { + if (!(print->verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_d))) { return F_output_not; } } @@ -255,7 +255,7 @@ extern "C" { controller_t * const main = (controller_t *) print->custom; if (print->verbosity != f_console_verbosity_debug_e) { - if (!(print->verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_e))) { + if (!(print->verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_d))) { return F_output_not; } } @@ -288,7 +288,7 @@ extern "C" { controller_t * const main = (controller_t *) print->custom; if (print->verbosity != f_console_verbosity_debug_e) { - if (!(print->verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_e))) { + if (!(print->verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_d))) { return F_output_not; } } diff --git a/sources/c/program/controller/main/print/message/entry/item.c b/sources/c/program/controller/main/print/message/entry/item.c index 89c60dd..4af0971 100644 --- a/sources/c/program/controller/main/print/message/entry/item.c +++ b/sources/c/program/controller/main/print/message/entry/item.c @@ -112,7 +112,7 @@ extern "C" { fl_print_format("%r%r %r Item Rule ", print->to, f_string_eol_s, action->type == controller_entry_action_type_consider_e ? controller_print_entry_considering_s : controller_print_entry_processing_s, is_entry ? controller_entry_s : controller_exit_s); fl_print_format("'%[%Q%]'", print->to, print->set->title, alias_rule, print->set->title); - if (entry->show == controller_entry_show_init_e && !(main->setting.flag & controller_main_flag_simulate_e)) { + if (entry->show == controller_entry_show_init_e && !(main->setting.flag & controller_main_flag_simulate_d)) { fl_print_format(" [%[%r%]]", print->to, print->notable, action->code == controller_entry_rule_code_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, print->notable); if (action->code == controller_entry_rule_code_wait_d) { diff --git a/sources/c/program/controller/main/print/output/entry/setting.c b/sources/c/program/controller/main/print/output/entry/setting.c index ebe966a..59e6153 100644 --- a/sources/c/program/controller/main/print/output/entry/setting.c +++ b/sources/c/program/controller/main/print/output/entry/setting.c @@ -11,7 +11,7 @@ extern "C" { controller_t * const main = (controller_t *) print->custom; - if (print->verbosity < f_console_verbosity_debug_e && !((main->setting.flag & controller_main_flag_simulate_e) && print->verbosity > f_console_verbosity_normal_e)) { + if (print->verbosity < f_console_verbosity_debug_e && !((main->setting.flag & controller_main_flag_simulate_d) && print->verbosity > f_console_verbosity_normal_e)) { return F_output_not; } diff --git a/sources/c/program/controller/main/print/output/rule/setting.c b/sources/c/program/controller/main/print/output/rule/setting.c index 2594602..a0c4c12 100644 --- a/sources/c/program/controller/main/print/output/rule/setting.c +++ b/sources/c/program/controller/main/print/output/rule/setting.c @@ -11,7 +11,7 @@ extern "C" { controller_t * const main = (controller_t *) print->custom; - if (print->verbosity < f_console_verbosity_debug_e && !((main->setting.flag & controller_main_flag_simulate_e) && print->verbosity > f_console_verbosity_normal_e)) { + if (print->verbosity < f_console_verbosity_debug_e && !((main->setting.flag & controller_main_flag_simulate_d) && print->verbosity > f_console_verbosity_normal_e)) { return F_output_not; } @@ -35,7 +35,7 @@ extern "C" { controller_t * const main = (controller_t *) print->custom; - if (print->verbosity < f_console_verbosity_debug_e && !((main->setting.flag & controller_main_flag_simulate_e) && print->verbosity > f_console_verbosity_normal_e)) { + if (print->verbosity < f_console_verbosity_debug_e && !((main->setting.flag & controller_main_flag_simulate_d) && print->verbosity > f_console_verbosity_normal_e)) { return F_output_not; } diff --git a/sources/c/program/controller/main/process.c b/sources/c/program/controller/main/process.c index 29d513a..caba90e 100644 --- a/sources/c/program/controller/main/process.c +++ b/sources/c/program/controller/main/process.c @@ -11,14 +11,14 @@ extern "C" { main->setting.state.status = F_okay; - if (main->setting.flag & controller_main_flag_version_copyright_help_e) { - if (main->setting.flag & controller_main_flag_help_e) { + if (main->setting.flag & controller_main_flag_version_copyright_help_d) { + if (main->setting.flag & controller_main_flag_help_d) { controller_print_message_help(&main->program.message, F_false); } - else if (main->setting.flag & controller_main_flag_version_e) { + else if (main->setting.flag & controller_main_flag_version_d) { fll_program_print_version(&main->program.message, controller_program_version_s); } - else if (main->setting.flag & controller_main_flag_copyright_e) { + else if (main->setting.flag & controller_main_flag_copyright_d) { fll_program_print_copyright(&main->program.message, fll_program_copyright_year_author_s); } @@ -54,7 +54,7 @@ extern "C" { controller_print_error_status(&main->program.error, macro_controller_f(f_thread_create), status); } else { - if (main->setting.flag & controller_main_flag_daemon_e) { + if (main->setting.flag & controller_main_flag_daemon_d) { main->process.ready = controller_process_ready_done_e; if (f_file_exists(main->process.path_pid, F_true) == F_true) { @@ -82,7 +82,7 @@ extern "C" { // Only make the Rule and control threads available once any/all pre-processing is complete. if (F_status_is_error_not(status) && status != F_failure && status != F_child && main->thread.enabled == controller_thread_enabled_e) { - if (!(main->setting.flag & controller_main_flag_validate_e)) { + if (!(main->setting.flag & controller_main_flag_validate_d)) { // Wait for the Entry thread to complete before starting the Rule thread. controller_thread_join(&main->thread.id_rule); @@ -114,7 +114,7 @@ extern "C" { return; } - if (F_status_is_error_not(status) && status != F_failure && !(main->setting.flag & controller_main_flag_validate_e) && controller_thread_is_enabled(&main->thread, F_true)) { + if (F_status_is_error_not(status) && status != F_failure && !(main->setting.flag & controller_main_flag_validate_d) && controller_thread_is_enabled(&main->thread, F_true)) { if (main->process.mode == controller_process_mode_service_e) { controller_thread_join(&main->thread.id_signal); } diff --git a/sources/c/program/controller/main/rule/instance.c b/sources/c/program/controller/main/rule/instance.c index c933d6c..418a15b 100644 --- a/sources/c/program/controller/main/rule/instance.c +++ b/sources/c/program/controller/main/rule/instance.c @@ -261,7 +261,7 @@ extern "C" { options_instance = 0; - if (main->setting.flag & controller_main_flag_simulate_e) { + if (main->setting.flag & controller_main_flag_simulate_d) { options_instance |= controller_instance_option_simulate_e; } diff --git a/sources/c/program/controller/main/rule/setting.c b/sources/c/program/controller/main/rule/setting.c index 8911a5e..4ebc66f 100644 --- a/sources/c/program/controller/main/rule/setting.c +++ b/sources/c/program/controller/main/rule/setting.c @@ -1069,7 +1069,7 @@ extern "C" { rule->timeout_stop = number; } - if (main->program.error.verbosity == f_console_verbosity_debug_e || (main->program.error.verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_e))) { + if (main->program.error.verbosity == f_console_verbosity_debug_e || (main->program.error.verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_d))) { f_string_static_t name_sub = controller_stop_s; if (timeout_code == controller_rule_timeout_code_kill_d) { @@ -1225,7 +1225,7 @@ extern "C" { rule->nice = number; rule->has |= controller_rule_has_nice_d; - if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.error.verbosity == f_console_verbosity_verbose_e) { + if ((main->setting.flag & controller_main_flag_simulate_d) || main->program.error.verbosity == f_console_verbosity_verbose_e) { cache->action.generic.used = 0; state.status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &cache->action.generic); @@ -1303,7 +1303,7 @@ extern "C" { rule->user = number; rule->has |= controller_rule_has_user_d; - if (main->program.error.verbosity == f_console_verbosity_debug_e || (main->program.error.verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_e))) { + if (main->program.error.verbosity == f_console_verbosity_debug_e || (main->program.error.verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_d))) { cache->action.generic.used = 0; state.status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &cache->action.generic); diff --git a/sources/c/program/controller/main/thread/cleanup.c b/sources/c/program/controller/main/thread/cleanup.c index 73cc28c..77b6e56 100644 --- a/sources/c/program/controller/main/thread/cleanup.c +++ b/sources/c/program/controller/main/thread/cleanup.c @@ -16,7 +16,7 @@ extern "C" { if (main->thread.enabled != controller_thread_enabled_e) return 0; const f_time_spec_t delay = macro_f_time_spec_t_initialize_1( - (main->setting.flag & controller_main_flag_simulate_e) + (main->setting.flag & controller_main_flag_simulate_d) ? controller_thread_cleanup_interval_short_d : controller_thread_cleanup_interval_long_d, 0 diff --git a/sources/c/program/controller/main/thread/entry.c b/sources/c/program/controller/main/thread/entry.c index 10d15ab..9d86391 100644 --- a/sources/c/program/controller/main/thread/entry.c +++ b/sources/c/program/controller/main/thread/entry.c @@ -28,13 +28,13 @@ extern "C" { else if (*status != F_child) { *status = controller_entry_preprocess(main, F_true); - if ((main->setting.flag & controller_main_flag_simulate_e) && (main->setting.flag & controller_main_flag_validate_e)) { + if ((main->setting.flag & controller_main_flag_simulate_d) && (main->setting.flag & controller_main_flag_validate_d)) { controller_print_output_entry_setting_validate(&main->program.output, F_true); } } if (F_status_is_error_not(*status) && *status != F_child) { - if (!(main->setting.flag & controller_main_flag_validate_e) || (main->setting.flag & controller_main_flag_simulate_e)) { + if (!(main->setting.flag & controller_main_flag_validate_d) || (main->setting.flag & controller_main_flag_simulate_d)) { if (main->process.entry.pid == controller_entry_pid_require_e && f_file_exists(main->process.path_pid, F_true) == F_true) { *status = F_status_set_error(F_available_not); main->process.ready = controller_process_ready_fail_e; @@ -94,7 +94,7 @@ extern "C" { } } - if (F_status_is_error_not(*status) && *status != F_child && !(main->setting.flag & controller_main_flag_validate_e) && main->process.mode == controller_process_mode_helper_e) { + if (F_status_is_error_not(*status) && *status != F_child && !(main->setting.flag & controller_main_flag_validate_d) && main->process.mode == controller_process_mode_helper_e) { const f_time_spec_t time = macro_f_time_spec_t_initialize_1(controller_thread_timeout_exit_helper_seconds_d, controller_thread_timeout_exit_helper_nanoseconds_d); f_time_sleep_spec(time, 0); @@ -143,13 +143,13 @@ extern "C" { else if (*status != F_child) { *status = controller_entry_preprocess(main, F_false); - if ((main->setting.flag & controller_main_flag_simulate_e) && (main->setting.flag & controller_main_flag_validate_e)) { + if ((main->setting.flag & controller_main_flag_simulate_d) && (main->setting.flag & controller_main_flag_validate_d)) { controller_print_output_entry_setting_validate(&main->program.output, F_false); } } if (F_status_is_error_not(*status) && *status != F_child && *status != F_file_found_not) { - if (!(main->setting.flag & controller_main_flag_validate_e) || (main->setting.flag & controller_main_flag_simulate_e)) { + if (!(main->setting.flag & controller_main_flag_validate_d) || (main->setting.flag & controller_main_flag_simulate_d)) { *status = controller_entry_process(main, F_false, F_false); diff --git a/sources/c/program/controller/main/thread/instance.c b/sources/c/program/controller/main/thread/instance.c index 70685ff..9cd8c67 100644 --- a/sources/c/program/controller/main/thread/instance.c +++ b/sources/c/program/controller/main/thread/instance.c @@ -52,7 +52,7 @@ extern "C" { time.tv_sec = 0; time.tv_nsec = interval_nanoseconds; - if (main->process.mode == controller_process_mode_helper_e && !(main->setting.flag & controller_main_flag_validate_e)) { + if (main->process.mode == controller_process_mode_helper_e && !(main->setting.flag & controller_main_flag_validate_d)) { for (i = 0; i < main->thread.instances.used; ++i) { if (!main->thread.instances.array[i]) continue; @@ -115,7 +115,7 @@ extern "C" { main->thread.id_signal = 0; } - if (main->process.mode == controller_process_mode_helper_e && !(main->setting.flag & controller_main_flag_validate_e)) { + if (main->process.mode == controller_process_mode_helper_e && !(main->setting.flag & controller_main_flag_validate_d)) { f_thread_mutex_unlock(&main->thread.lock.cancel); return; diff --git a/sources/c/program/controller/main/thread/signal.c b/sources/c/program/controller/main/thread/signal.c index b95b888..fb633fc 100644 --- a/sources/c/program/controller/main/thread/signal.c +++ b/sources/c/program/controller/main/thread/signal.c @@ -9,7 +9,7 @@ extern "C" { if (!main) return; if (!controller_thread_is_enabled(&main->thread, is_normal)) return; - if (!(main->setting.flag & controller_main_flag_interruptible_e)) return; + if (!(main->setting.flag & controller_main_flag_interruptible_d)) return; siginfo_t information; f_time_spec_t time = f_time_spec_t_initialize; diff --git a/sources/c/program/controller/main/time.c b/sources/c/program/controller/main/time.c index 2124fb8..d6a957e 100644 --- a/sources/c/program/controller/main/time.c +++ b/sources/c/program/controller/main/time.c @@ -47,7 +47,7 @@ extern "C" { if (!main) return F_status_set_error(F_parameter); // When sleep is a second or more, instead wait for terminating signals if interruptible. - if ((main->setting.flag & controller_main_flag_interruptible_e) && time.tv_sec) { + if ((main->setting.flag & controller_main_flag_interruptible_d) && time.tv_sec) { siginfo_t information; f_signal_t signal = f_signal_t_initialize; -- 1.8.3.1