From b7b607c2a4971dd2e37bbfd50bdf73f6868b0310 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 8 Jul 2024 23:13:43 -0500 Subject: [PATCH] Progress: Continue migrating the project, possibly wrapping up the migration. Additional review and tests are still required but this fixes some additional problems encountered during testing. Try to improve grammar by treating special variables as proper nouns, such as Entry, Exit, Rule, Item, etc... Move the environment map onto the Instance. I decided not to put it on the cache but I might change my mind as this is being added for cache purposes. This should help reduce repeated allocations on every execute. I may want to add features to the Controller program to better control when to clear or deallocate memory for more security at the cost of resources and performance. This would allow for post-compile-time configuration. A mistake exposed a lack of error reporting for when Items is an empty array. Add controller_print_error_rule_item_execute_none() to account for this. The bug is that "object" and "content" in controller_rule_parameters_read() are actually optional. I was returning a parameter error when these were not defined. Reduce the local allocation of f_state_t and pass it along as a parameter. These particular functions should be being called sequentially and should be able to safely pass along the state between them. The settings for the IKI read state is temporarily modified as appropriate and then restored when finished. Don't assign enabled variable on lock failure to avoid potential race condition. --- sources/c/controller/main.h | 2 +- sources/c/init/init.h | 6 +- sources/c/init/main.h | 2 +- sources/c/main/common.c | 2 +- sources/c/main/common/define/entry.h | 2 +- sources/c/main/common/define/rule.h | 8 +- sources/c/main/common/enumeration/entry.h | 10 +- sources/c/main/common/enumeration/instance.h | 6 +- sources/c/main/common/enumeration/process.h | 6 +- sources/c/main/common/enumeration/rule.h | 2 +- sources/c/main/common/enumeration/thread.h | 4 +- sources/c/main/common/string/general.h | 2 +- sources/c/main/common/string/rule.h | 2 +- sources/c/main/common/type.h | 2 +- sources/c/main/common/type/cache.h | 4 +- sources/c/main/common/type/entry.h | 12 +- sources/c/main/common/type/instance.c | 1 + sources/c/main/common/type/instance.h | 15 +- sources/c/main/common/type/lock.h | 4 +- sources/c/main/common/type/process.h | 2 +- sources/c/main/common/type/rule.h | 2 +- sources/c/main/convert.h | 8 +- sources/c/main/entry.h | 6 +- sources/c/main/entry/action.h | 6 +- sources/c/main/entry/preprocess.c | 4 +- sources/c/main/entry/preprocess.h | 10 +- sources/c/main/entry/process.c | 10 +- sources/c/main/entry/process.h | 6 +- sources/c/main/entry/setting.h | 8 +- sources/c/main/instance/prepare.h | 8 +- sources/c/main/lock.h | 8 +- sources/c/main/perform.h | 4 +- sources/c/main/print/debug/perform/pid.h | 4 +- sources/c/main/print/debug/rule/action.h | 2 +- sources/c/main/print/debug/rule/execute.h | 6 +- sources/c/main/print/error/entry.h | 22 +-- sources/c/main/print/error/entry/action.h | 38 ++--- sources/c/main/print/error/entry/item.h | 14 +- sources/c/main/print/error/entry/setting.h | 32 ++-- sources/c/main/print/error/perform/pid.h | 4 +- sources/c/main/print/error/rule.c | 6 +- sources/c/main/print/error/rule.h | 18 +-- sources/c/main/print/error/rule/action.c | 12 +- sources/c/main/print/error/rule/action.h | 14 +- sources/c/main/print/error/rule/item.c | 22 ++- sources/c/main/print/error/rule/item.h | 36 ++++- sources/c/main/print/error/rule/setting.c | 6 +- sources/c/main/print/error/rule/setting.h | 8 +- sources/c/main/print/message.c | 2 +- sources/c/main/print/message/entry.h | 8 +- sources/c/main/print/message/entry/action.h | 24 +-- sources/c/main/print/message/entry/item.c | 2 +- sources/c/main/print/message/entry/item.h | 36 ++--- sources/c/main/print/output/entry/setting.h | 12 +- sources/c/main/print/output/rule/execute.h | 2 +- sources/c/main/print/output/rule/setting.h | 2 +- sources/c/main/print/output/rule/validate.c | 4 +- sources/c/main/print/output/rule/validate.h | 10 +- sources/c/main/print/warning/entry/action.h | 10 +- sources/c/main/print/warning/entry/item.h | 6 +- sources/c/main/print/warning/entry/setting.h | 10 +- sources/c/main/print/warning/rule/action.h | 2 +- sources/c/main/print/warning/rule/item.h | 2 +- sources/c/main/print/warning/rule/setting.h | 2 +- sources/c/main/process.c | 4 +- sources/c/main/rule.c | 2 - sources/c/main/rule.h | 18 +-- sources/c/main/rule/action.c | 215 +++++++++++++++------------ sources/c/main/rule/action.h | 42 +++--- sources/c/main/rule/execute.c | 197 ++++++++++++------------ sources/c/main/rule/execute.h | 40 ++--- sources/c/main/rule/expand.h | 4 +- sources/c/main/rule/instance.c | 12 +- sources/c/main/rule/instance.h | 22 +-- sources/c/main/rule/is.h | 2 +- sources/c/main/rule/item.c | 62 ++++---- sources/c/main/rule/item.h | 24 +-- sources/c/main/rule/parameter.c | 76 ++++++---- sources/c/main/rule/parameter.h | 30 ++-- sources/c/main/rule/read.c | 2 +- sources/c/main/rule/read.h | 18 +-- sources/c/main/rule/setting.h | 14 +- sources/c/main/rule/wait.h | 12 +- sources/c/main/thread/entry.h | 14 +- sources/c/main/thread/instance.c | 30 +--- sources/c/main/thread/instance.h | 8 +- sources/c/main/thread/is.h | 10 +- sources/c/main/thread/rule.h | 6 +- sources/c/main/thread/signal.h | 4 +- 89 files changed, 750 insertions(+), 670 deletions(-) diff --git a/sources/c/controller/main.h b/sources/c/controller/main.h index 8e7c09a..d483b77 100644 --- a/sources/c/controller/main.h +++ b/sources/c/controller/main.h @@ -16,7 +16,7 @@ extern "C" { #endif /** - * Standard program entry point. + * Standard program Entry point. * * @param argc * The number of arguments. diff --git a/sources/c/init/init.h b/sources/c/init/init.h index 99e0930..1fe958c 100644 --- a/sources/c/init/init.h +++ b/sources/c/init/init.h @@ -26,12 +26,12 @@ extern "C" { * * Must not be NULL. * @param entry - * The entry data. + * The Entry data. * * Must not be NULL. * @param is_entry - * If TRUE, then this operates as an entry. - * If FALSE, then this operates as an exit. + * If TRUE, then this operates as an Entry. + * If FALSE, then this operates as an Exit. * * @return * F_okay on success. diff --git a/sources/c/init/main.h b/sources/c/init/main.h index ec9da3e..505cabe 100644 --- a/sources/c/init/main.h +++ b/sources/c/init/main.h @@ -16,7 +16,7 @@ extern "C" { #endif /** - * Standard program entry point. + * Standard program Entry point. * * @param argc * The number of arguments. diff --git a/sources/c/main/common.c b/sources/c/main/common.c index abbcaa0..d9360d5 100644 --- a/sources/c/main/common.c +++ b/sources/c/main/common.c @@ -153,7 +153,7 @@ extern "C" { } // for } - // The first remaining argument represents the entry name. + // The first remaining argument represents the Entry name. main->setting.state.status = f_string_dynamic_append(main->program.parameters.remaining.used ? args[main->program.parameters.remaining.array[0]] : controller_default_s, &main->process.name_entry); if (F_status_is_error(main->setting.state.status)) { diff --git a/sources/c/main/common/define/entry.h b/sources/c/main/common/define/entry.h index 5df1642..ae47fdc 100644 --- a/sources/c/main/common/define/entry.h +++ b/sources/c/main/common/define/entry.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the common entry defines. + * Provides the common Entry defines. * * This is auto-included and should not need to be explicitly included. */ diff --git a/sources/c/main/common/define/rule.h b/sources/c/main/common/define/rule.h index 2c72290..e39059f 100644 --- a/sources/c/main/common/define/rule.h +++ b/sources/c/main/common/define/rule.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the common rule defines. + * Provides the common Rule defines. * * This is auto-included and should not need to be explicitly included. */ @@ -59,9 +59,9 @@ extern "C" { * Designate codes for timeout settings to be used during the loading of the Rule timeout settings. * * controller_rule_timeout_code_*_d: - * - kill: Forcibly stop a rule. - * - start: Start a rule. - * - stop: Stop a rule. + * - kill: Forcibly stop a Rule. + * - start: Start a Rule. + * - stop: Stop a Rule. */ #ifndef _di_controller_rule_timeout_code_d_ #define controller_rule_timeout_code_kill_d 1 diff --git a/sources/c/main/common/enumeration/entry.h b/sources/c/main/common/enumeration/entry.h index 8cdb585..11016fe 100644 --- a/sources/c/main/common/enumeration/entry.h +++ b/sources/c/main/common/enumeration/entry.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the common entry enumerations. + * Provides the common Entry enumerations. * * This is auto-included and should not need to be explicitly included. */ @@ -81,7 +81,7 @@ extern "C" { * * controller_entry_flag_*_e: * - none: No flags are set. - * - is: Designate that this is an entry rather than an exit. + * - is: Designate that this is an Entry rather than an Exit. * - timeout_exit_no: The exit timeout is disabled. * - timeout_kill_no: The kill timeout is disabled for Rules by default. * - timeout_start_no: The start timeout is disabled for Rules by default. @@ -102,8 +102,8 @@ extern "C" { * Controller Entry PID enumeration. * * controller_entry_pid_*_e: - * - disable: Do not check for or create a PID file to represent the entry execution. - * - require: Check to see if the PID file exists for an entry at startup and then when "ready" create a pid file, display error on pid file already exists or on failure and then fail. + * - disable: Do not check for or create a PID file to represent the Entry execution. + * - require: Check to see if the PID file exists for an Entry at startup and then when "ready" create a pid file, display error on pid file already exists or on failure and then fail. * - ready: When "ready" create a pid file, display error on failure and then fail (does not check if PID file exists). */ #ifndef _di_controller_entry_pid_e_ @@ -135,7 +135,7 @@ extern "C" { * * controller_entry_show_*_e: * - normal: Do not print anything other than warnings and errors, but allow executed programs and scripts to output however they like. - * - init: Print like an init program, printing status of entry and rules as they are being started, stopped, etc... + * - init: Print like an init program, printing status of Entry and Rules as they are being started, stopped, etc... */ #ifndef _di_controller_entry_show_e_ enum { diff --git a/sources/c/main/common/enumeration/instance.h b/sources/c/main/common/enumeration/instance.h index cd982a4..2e247b3 100644 --- a/sources/c/main/common/enumeration/instance.h +++ b/sources/c/main/common/enumeration/instance.h @@ -42,7 +42,7 @@ extern "C" { * Instance states. * * controller_instance_state_*_e: - * - idle: No instance is running for this rule. + * - idle: No instance is running for this Rule. * - busy: A instance is actively using this, and is running synchronously. * - active: A instance is actively using this, and is running asynchronously. * - done: A instance has finished running on this and there is a thread that needs to be cleaned up. @@ -60,8 +60,8 @@ extern "C" { * Instance types. * * controller_instance_type_*_e: - * - entry: The instance is started from an entry. - * - exit: The instance is started from an exit. + * - entry: The instance is started from an Entry. + * - exit: The instance is started from an Exit. * - control: The instance is started from a control operation. */ #ifndef _di_controller_instance_type_e_ diff --git a/sources/c/main/common/enumeration/process.h b/sources/c/main/common/enumeration/process.h index f79defc..b47ac7c 100644 --- a/sources/c/main/common/enumeration/process.h +++ b/sources/c/main/common/enumeration/process.h @@ -36,9 +36,9 @@ extern "C" { * Controller process mode enumeration. * * controller_process_mode_*: - * - helper: Run as a helper, exiting when finished prrocess entry (and any respective exit). - * - program: Run as a program, exiting when finished prrocess entry (and any respective exit). - * - service: Run as a service, listening for requests after processing entry. + * - helper: Run as a helper, exiting when finished prrocess Entry (and any respective Exit). + * - program: Run as a program, exiting when finished prrocess Entry (and any respective Exit). + * - service: Run as a service, listening for requests after processing Entry. */ #ifndef _di_controller_process_mode_e_ enum { diff --git a/sources/c/main/common/enumeration/rule.h b/sources/c/main/common/enumeration/rule.h index f7a8942..c9e03be 100644 --- a/sources/c/main/common/enumeration/rule.h +++ b/sources/c/main/common/enumeration/rule.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the common rule enumerations. + * Provides the common Rule enumerations. * * This is auto-included and should not need to be explicitly included. */ diff --git a/sources/c/main/common/enumeration/thread.h b/sources/c/main/common/enumeration/thread.h index 5be6ec6..9411ed9 100644 --- a/sources/c/main/common/enumeration/thread.h +++ b/sources/c/main/common/enumeration/thread.h @@ -23,9 +23,9 @@ extern "C" { * - enabled_not: The controller is no longer enabled, shut down and abort all work. * - enabled: The controller is operating normally. * - enabled_execute: The controller is executing another process, all running operations must terminate. - * - enabled_exit: The controller is shutting down, only process exit rules. + * - enabled_exit: The controller is shutting down, only process Exit rules. * - enabled_exit_execute: The controller is executing another process while in failsafe mode, all running operations must terminate. - * - enabled_exit_ready: The controller is shutting down, only process exit rules, and now ready to send termination signals. + * - enabled_exit_ready: The controller is shutting down, only process Exit rules, and now ready to send termination signals. */ enum { controller_thread_enabled_not_e = 0, diff --git a/sources/c/main/common/string/general.h b/sources/c/main/common/string/general.h index 0450ea0..1ac5374 100644 --- a/sources/c/main/common/string/general.h +++ b/sources/c/main/common/string/general.h @@ -19,7 +19,7 @@ extern "C" { /** * All special strings used within this program. * - * These are generally the names to match, representing some action or setting. + * These are generally the names to match, representing some Action or setting. */ #ifndef _di_controller_string_s_ #define CONTROLLER_action_s "action" diff --git a/sources/c/main/common/string/rule.h b/sources/c/main/common/string/rule.h index 08e8c13..6394da6 100644 --- a/sources/c/main/common/string/rule.h +++ b/sources/c/main/common/string/rule.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the common rule string data. + * Provides the common Rule string data. * * This is auto-included and should not need to be explicitly included. */ diff --git a/sources/c/main/common/type.h b/sources/c/main/common/type.h index 97d75b3..1a12297 100644 --- a/sources/c/main/common/type.h +++ b/sources/c/main/common/type.h @@ -19,7 +19,7 @@ extern "C" { /** * The controller main program settings. * - * This is passed to the program-specific main entry point to designate program settings. + * This is passed to the program-specific main Entry point to designate program settings. * These program settings are often processed from the program arguments (often called the command line arguments). * * Properties: diff --git a/sources/c/main/common/type/cache.h b/sources/c/main/common/type/cache.h index b9bd76d..d3568ff 100644 --- a/sources/c/main/common/type/cache.h +++ b/sources/c/main/common/type/cache.h @@ -152,10 +152,10 @@ extern "C" { #endif // _di_controller_cache_delete_ /** - * De-allocate the Controller action cache. + * De-allocate the Controller Action cache. * * @param action - * The action cache. + * The Action cache. * * Must not be NULL. * diff --git a/sources/c/main/common/type/entry.h b/sources/c/main/common/type/entry.h index 7b9b54a..2ffcb7e 100644 --- a/sources/c/main/common/type/entry.h +++ b/sources/c/main/common/type/entry.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the common entry type structures. + * Provides the common Entry type structures. * * This is auto-included and should not need to be explicitly included. */ @@ -137,13 +137,13 @@ extern "C" { * A special macro_controller_entry_t_initialize_1() is provided to easily initialize with a specific set of flags. * * Properties: - * - define: Any defines (environment variables) made available to all Rules in this entry for IKI substitution or just as environment variables. - * - flag: A set of flags associated with the entry. - * - items: The array of entry items. - * - parameter: Any parameters made available to all Rules in this entry for IKI substitution. + * - define: Any defines (environment variables) made available to all Rules in this Entry for IKI substitution or just as environment variables. + * - flag: A set of flags associated with the Entry. + * - items: The array of Entry Items. + * - parameter: Any parameters made available to all Rules in this Entry for IKI substitution. * - pid: The PID file generation setting. * - session: The default session settings (when NULL, no default is specified). - * - show: The show setting for controlling what to show when executing entry items and rules. + * - show: The show setting for controlling what to show when executing Entry Items and rules. * - status: The overall status. * - timeout_exit: The timeout to wait when exiting the Controller program after sending the terminate signal to send the kill signal. * - timeout_kill: The timeout to wait relating to using a kill signal. diff --git a/sources/c/main/common/type/instance.c b/sources/c/main/common/type/instance.c index 5487c66..ea5e2a3 100644 --- a/sources/c/main/common/type/instance.c +++ b/sources/c/main/common/type/instance.c @@ -28,6 +28,7 @@ extern "C" { f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &instance->stack.array, &instance->stack.used, &instance->stack.size); f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &instance->path_pids.array, &instance->path_pids.used, &instance->path_pids.size, &f_string_dynamics_delete_callback); + f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &instance->environment.array, &instance->environment.used, &instance->environment.size, &f_string_maps_delete_callback); } #endif // _di_controller_instance_delete_ diff --git a/sources/c/main/common/type/instance.h b/sources/c/main/common/type/instance.h index 5294464..fa3651e 100644 --- a/sources/c/main/common/type/instance.h +++ b/sources/c/main/common/type/instance.h @@ -30,7 +30,7 @@ extern "C" { * - id: The ID of this process relative to the processes array. * - id_thread: The thread ID, a valid ID when state is "active", and an invalid ID when the state is "busy". * - * - action: The action being performed. + * - action: The Action being performed. * - options: Configuration options for this thread. * - state: The state of the process. * - type: The currently active process type (from the controller_instance_type_*_e). @@ -38,14 +38,15 @@ extern "C" { * * - active: A read/write lock representing that something is currently using this (read locks = in use, write lock = begin deleting). * - lock: A read/write lock on the structure. - * - wait: A thread condition to tell a process waiting process that the rule has is done being processed. + * - wait: A thread condition to tell a process waiting process that the Rule has is done being processed. * - wait_lock: A mutex lock for working with "wait". * - * - child: The process id of a child process, if one is running (when forking to execute a child process). - * - path_pids: An array of paths representing PID files. - * - stack: A stack used to represent dependencies as Rule ID's to avoid circular Rule dependencies (If Rule A waits on Rule B, then Rule B must not wait on Rule A). + * - child: The process id of a child process, if one is running (when forking to execute a child process). + * - path_pids: An array of paths representing PID files. + * - environment: Environment data used when executing the instance. + * - stack: A stack used to represent dependencies as Rule ID's to avoid circular Rule dependencies (If Rule A waits on Rule B, then Rule B must not wait on Rule A). * - * - rule: A copy of the rule actively being executed. + * - rule: A copy of the Rule actively being executed. * - cache: The cache used by this Instance. * - main: The main program data. */ @@ -67,6 +68,7 @@ extern "C" { f_pids_t childs; f_string_dynamics_t path_pids; + f_string_maps_t environment; f_number_unsigneds_t stack; controller_rule_t rule; @@ -88,6 +90,7 @@ extern "C" { f_thread_mutex_t_initialize, \ f_pids_t_initialize, \ f_string_dynamics_t_initialize, \ + f_string_maps_t_initialize, \ f_number_unsigneds_t_initialize, \ controller_rule_t_initialize, \ controller_cache_t_initialize, \ diff --git a/sources/c/main/common/type/lock.h b/sources/c/main/common/type/lock.h index 727c0f4..32f749b 100644 --- a/sources/c/main/common/type/lock.h +++ b/sources/c/main/common/type/lock.h @@ -23,14 +23,14 @@ extern "C" { * The cancel lock is intended for preventing double cancellation calls (which can happen due to interrupts). * The print lock is intended to lock any activity printing to stdout/stderr. * The instance lock is intended to lock any activity on the instance structure. - * The rule lock is intended to lock any activity on the rules structure. + * The Rule lock is intended to lock any activity on the rules structure. * * Properties: * - alert: The alert mutex lock for waking up on alerts. * - cancel: The cancel mutex lock for locking the cancel operation. * - print: The print mutex lock. * - instance: The instance r/w lock. - * - rule: The rule r/w lock. + * - rule: The Rule r/w lock. * - alert_condition: The condition used to trigger alerts. */ #ifndef _di_controller_lock_t_ diff --git a/sources/c/main/common/type/process.h b/sources/c/main/common/type/process.h index a1a6d20..108f5d9 100644 --- a/sources/c/main/common/type/process.h +++ b/sources/c/main/common/type/process.h @@ -27,7 +27,7 @@ extern "C" { * * - failsafe_item_id: The Entry Item ID to execute when failsafe execution is enabled. * - * - name_entry: The name of the entry file. + * - name_entry: The name of the Entry file. * - path_cgroup: Directory path to the cgroup directory. * - path_control: File path to the control socket (used for printing the path). * - path_current: The current path. diff --git a/sources/c/main/common/type/rule.h b/sources/c/main/common/type/rule.h index 5371a2e..daa9489 100644 --- a/sources/c/main/common/type/rule.h +++ b/sources/c/main/common/type/rule.h @@ -379,7 +379,7 @@ extern "C" { * Fully de-allocate all memory for the given Rule without caring about return status. * * @param rule - * The rule to de-allocate. + * The Rule to de-allocate. * * @see f_capability_delete() * @see f_memory_array_resize() diff --git a/sources/c/main/convert.h b/sources/c/main/convert.h index 7241c68..7f26d45 100644 --- a/sources/c/main/convert.h +++ b/sources/c/main/convert.h @@ -77,10 +77,10 @@ extern "C" { #endif // _di_controller_convert_group_id_ /** - * Convert the rule action execute type code to the string representation. + * Convert the Rule Action execute type code to the string representation. * * @param type - * The rule action execute type code. + * The Rule Action execute type code. * * @return * The string with used > 0 on success. @@ -91,10 +91,10 @@ extern "C" { #endif // _di_controller_convert_rule_action_execute_type_string_ /** - * Convert the rule action type code to the string representation. + * Convert the Rule Action type code to the string representation. * * @param type - * The rule action type code. + * The Rule Action type code. * * @return * The string with used > 0 on success. diff --git a/sources/c/main/entry.h b/sources/c/main/entry.h index 18c4c23..c4b2f32 100644 --- a/sources/c/main/entry.h +++ b/sources/c/main/entry.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides entry functionality. + * Provides Entry functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -24,13 +24,13 @@ extern "C" { * * Must not be NULL. * @param entry - * The entry data. + * The Entry data. * * Must not be NULL. * * @return * F_okay on success. - * F_file_found_not on file not found for a an exit file (is_entry is FALSE). + * F_file_found_not on file not found for an Exit file (is_entry is FALSE). * * F_parameter (with error bit) if a parameter is invalid. * diff --git a/sources/c/main/entry/action.h b/sources/c/main/entry/action.h index 9ed95d5..dd55031 100644 --- a/sources/c/main/entry/action.h +++ b/sources/c/main/entry/action.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the entry action functionality. + * Provides the Entry Action functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,14 +17,14 @@ extern "C" { #endif /** - * Read the entry list, loading all items and values. + * Read the Entry list, loading all Items and values. * * @param main * The main program data. * * Must not be NULL. * @param entry - * The entry. + * The Entry. * * Must not be NULL. * @param range diff --git a/sources/c/main/entry/preprocess.c b/sources/c/main/entry/preprocess.c index 5fdfd56..4f0abde 100644 --- a/sources/c/main/entry/preprocess.c +++ b/sources/c/main/entry/preprocess.c @@ -22,7 +22,7 @@ extern "C" { uint8_t error_has = F_false; - // This effectively sets the read for an entry and resets the ready for an exit. + // This effectively sets the read for an Entry and resets the ready for an Exit. main->process.ready = controller_process_ready_no_e; cache->ats.used = 0; @@ -40,7 +40,7 @@ extern "C" { return status; } - // Utilize the ats cache as an item execution stack (at_i is for item index, and at_j (at_i + 1) is for action index). + // Utilize the ats cache as an item execution stack (at_i is for item index, and at_j (at_i + 1) is for Action index). cache->ats.array[0] = 0; cache->ats.array[1] = 0; cache->ats.used = 2; diff --git a/sources/c/main/entry/preprocess.h b/sources/c/main/entry/preprocess.h index 6a36e76..d92601b 100644 --- a/sources/c/main/entry/preprocess.h +++ b/sources/c/main/entry/preprocess.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the entry pre-process functionality. + * Provides the Entry pre-process functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,20 +17,20 @@ extern "C" { #endif /** - * Pre-process all items for the loaded entry. + * Pre-process all items for the loaded Entry. * * @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. + * If TRUE, then this operates as an Entry. + * If FALSE, then this operates as an Exit. * * @return * F_okay on success. * F_recurse (with error bit) on a recursion error. - * F_valid_not (with error bit) on invalid entry item, Entry Item Action, or Entry Item Action value. + * F_valid_not (with error bit) on invalid Entry Item, Entry Item Action, or Entry Item Action value. * * Errors (with error bit) from: macro_f_number_unsigneds_t_increase_by(). * Errors (with error bit) from: f_string_dynamic_append(). diff --git a/sources/c/main/entry/process.c b/sources/c/main/entry/process.c index dd3c522..bf6992c 100644 --- a/sources/c/main/entry/process.c +++ b/sources/c/main/entry/process.c @@ -21,7 +21,7 @@ extern "C" { controller_entry_action_t *entry_action = 0; controller_entry_actions_t *entry_actions = 0; - // An empty stack is used here because each rule here is the first rule run in the rule's scope. + // An empty stack is used here because each Rule here is the first Rule run in the Rule's scope. const f_number_unsigneds_t stack = f_number_unsigneds_t_initialize; cache->ats.used = 0; @@ -40,7 +40,7 @@ extern "C" { return status; } - // Utilize the "ats" cache as an item execution stack (at_i is for item index, and at_j (at_i + 1) is for action index). + // Utilize the "ats" cache as an item execution stack (at_i is for item index, and at_j (at_i + 1) is for Action index). cache->ats.array[0] = failsafe ? main->process.failsafe_item_id : 0; cache->ats.array[1] = 0; cache->ats.used = 2; @@ -60,7 +60,7 @@ extern "C" { controller_print_message_entry_item_process(&main->program.message, is_entry, failsafe ? controller_failsafe_s : f_string_empty_s, cache->action.name_item); } - // The pre-process determines if ready is explicitly specified within the entry file and if it is not start as ready. + // The pre-process determines if ready is explicitly specified within the Entry file and if it is not start as ready. if (main->process.ready == controller_process_ready_yes_e) { status = controller_perform_ready(main, is_entry); if (F_status_is_error(status)) return status; @@ -230,7 +230,7 @@ extern "C" { if (!controller_thread_is_enabled(is_entry, &main->thread)) break; - // The rule is not yet loaded, ensure that it is loaded. + // The Rule is not yet loaded, ensure that it is loaded. if (status != F_true) { // Rule execution will re-use the existing cache, so save the current cache. @@ -292,7 +292,7 @@ extern "C" { controller_unlock_print_flush(main->program.error.to, &main->thread); } - // Designate the action as failed. + // Designate the Action as failed. entry_action->status = controller_status_simplify_error(F_failure); if (!(main->setting.flag & controller_main_flag_simulate_e)) { diff --git a/sources/c/main/entry/process.h b/sources/c/main/entry/process.h index 75fc966..79962c9 100644 --- a/sources/c/main/entry/process.h +++ b/sources/c/main/entry/process.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the entry process functionality. + * Provides the Entry process functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -27,8 +27,8 @@ extern "C" { * If TRUE, operate in failsafe mode (starts at designated failsafe Item). * If FALSE, operate in normal mode (starts at "main" Item). * @param is_entry - * If TRUE, then this operates as an entry. - * If FALSE, then this operates as an exit. + * If TRUE, then this operates as an Entry. + * If FALSE, then this operates as an Exit. * * @return * F_okay on success. diff --git a/sources/c/main/entry/setting.h b/sources/c/main/entry/setting.h index 680c46c..b7e0641 100644 --- a/sources/c/main/entry/setting.h +++ b/sources/c/main/entry/setting.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the entry setting functionality. + * Provides the Entry setting functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,15 +17,15 @@ extern "C" { #endif /** - * Read the entry settings, loading all settings. + * Read the Entry settings, loading all settings. * * @param main * The main program data. * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param content_range * The range in the list buffer representing the content. * diff --git a/sources/c/main/instance/prepare.h b/sources/c/main/instance/prepare.h index bd75376..ade62d6 100644 --- a/sources/c/main/instance/prepare.h +++ b/sources/c/main/instance/prepare.h @@ -19,7 +19,7 @@ extern "C" { /** * Prepare the instance. * - * The instance is initialized with the instance id, the Rule alias, and the rule action type. + * The instance is initialized with the instance id, the Rule alias, and the Rule Action type. * These are the necessary parts for uniquely identifying the instance. * * If a instance by the given Rule alias and Rule Action already exists, then nothing is done. @@ -31,8 +31,8 @@ extern "C" { * * Must not be NULL. * @param is_normal - * If TRUE, then instance as if this operates during a normal operation (entry and control). - * If FALSE, then instance as if this operates during a an exit operation. + * If TRUE, then instance as if this operates during a normal operation (Entry and Control). + * If FALSE, then instance as if this operates during a an Exit operation. * @param action * The Rule Action to use. * @param alias @@ -65,7 +65,7 @@ extern "C" { /** * Prepare the instance for some instance type. * - * The instance is initialized with the instance id, the Rule alias, and the rule action type. + * The instance is initialized with the instance id, the Rule alias, and the Rule Action type. * These are the necessary parts for uniquely identifying the instance. * * If a instance by the given Rule alias and Rule Action already exists, then nothing is done. diff --git a/sources/c/main/lock.h b/sources/c/main/lock.h index 01b0752..f63f1a1 100644 --- a/sources/c/main/lock.h +++ b/sources/c/main/lock.h @@ -45,8 +45,8 @@ extern "C" { * Given a r/w lock, periodically check to see if main thread is disabled while waiting. * * @param is_normal - * If TRUE, then perform as if this operates during a normal operation (entry and control). - * If FALSE, then perform as if this operates during a an exit operation. + * If TRUE, then perform as if this operates during a normal operation (Entry and Control). + * If FALSE, then perform as if this operates during a an Exit operation. * @param thread * The thread data used to determine if the main thread is disabled or not. * @@ -134,8 +134,8 @@ extern "C" { * Given a r/w lock, periodically check to see if main thread is disabled while waiting. * * @param is_normal - * If TRUE, then perform as if this operates during a normal operation (entry and control). - * If FALSE, then perform as if this operates during a an exit operation. + * If TRUE, then perform as if this operates during a normal operation (Entry and Control). + * If FALSE, then perform as if this operates during a an Exit operation. * @param thread * The thread data used to determine if the main thread is disabled or not. * diff --git a/sources/c/main/perform.h b/sources/c/main/perform.h index 0ca3b59..b62af37 100644 --- a/sources/c/main/perform.h +++ b/sources/c/main/perform.h @@ -28,8 +28,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this operates as an entry. - * If FALSE, then this operates as an exit. + * If TRUE, then this operates as an Entry. + * If FALSE, then this operates as an Exit. * * @return * F_okay on success. diff --git a/sources/c/main/print/debug/perform/pid.h b/sources/c/main/print/debug/perform/pid.h index 2df94d7..455ee87 100644 --- a/sources/c/main/print/debug/perform/pid.h +++ b/sources/c/main/print/debug/perform/pid.h @@ -51,8 +51,8 @@ extern "C" { * @param function * The name of the function associated with the error. * @param is_entry - * If TRUE, then this operates as an entry. - * If FALSE, then this operates as an exit. + * If TRUE, then this operates as an Entry. + * If FALSE, then this operates as an Exit. * * @return * F_okay on success. diff --git a/sources/c/main/print/debug/rule/action.h b/sources/c/main/print/debug/rule/action.h index feb2038..73db9a6 100644 --- a/sources/c/main/print/debug/rule/action.h +++ b/sources/c/main/print/debug/rule/action.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry action debug functionality. + * Provides the print Entry Action debug functionality. * * This is auto-included and should not need to be explicitly included. */ diff --git a/sources/c/main/print/debug/rule/execute.h b/sources/c/main/print/debug/rule/execute.h index 9c827be..94f2bac 100644 --- a/sources/c/main/print/debug/rule/execute.h +++ b/sources/c/main/print/debug/rule/execute.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry action debug functionality. + * Provides the print Entry Action debug functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,7 +17,7 @@ extern "C" { #endif /** - * Print debug message about re-running the execution of some action. + * Print debug message about re-running the execution of some Action. * * @param print * The output structure to print to. @@ -36,7 +36,7 @@ extern "C" { * * Must not be NULL. * @param action - * The ID of the action being re-run. + * The ID of the Action being re-run. * * @return * F_okay on success. diff --git a/sources/c/main/print/error/entry.h b/sources/c/main/print/error/entry.h index 927341b..2cbf555 100644 --- a/sources/c/main/print/error/entry.h +++ b/sources/c/main/print/error/entry.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry error functionality. + * Provides the print Entry error functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,7 +17,7 @@ extern "C" { #endif /** - * Print the entry related error. + * Print the Entry related error. * * @param print * The output structure to print to. @@ -28,8 +28,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @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. @@ -52,7 +52,7 @@ extern "C" { #endif // _di_controller_print_error_entry_ /** - * Print additional error/warning information in addition to existing error that is found within the given action cache. + * Print additional error/warning information in addition to existing error that is found within the given Action cache. * * This is explicitly intended to be used in addition to the error message. * @@ -67,12 +67,12 @@ extern "C" { * * Must not be NULL. * @param action - * The action cache. + * The Action cache. * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * * @return * F_okay on success. @@ -85,7 +85,7 @@ extern "C" { #endif // _di_controller_print_error_entry_cache_ /** - * Print the entry related file error. + * Print the Entry related file error. * * @param print * The output structure to print to. @@ -96,8 +96,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @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. diff --git a/sources/c/main/print/error/entry/action.h b/sources/c/main/print/error/entry/action.h index 43c7e4d..6b4d809 100644 --- a/sources/c/main/print/error/entry/action.h +++ b/sources/c/main/print/error/entry/action.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry action error functionality. + * Provides the print Entry Action error functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -32,8 +32,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param code * The return code. * @@ -63,8 +63,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The program or script name. * @@ -96,8 +96,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param message * (optional) An additional message to add. * @@ -135,8 +135,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param message * (optional) An additional message to add. * @@ -176,8 +176,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param message * A message describing which parameter is empty. * @@ -207,8 +207,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param has * The second parameter value. * @param example @@ -240,8 +240,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The Action name. * @param at_least @@ -277,8 +277,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param has * The invalid value that is not supported. * @@ -308,8 +308,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param item * The reserved item that is not allowed to be used. * diff --git a/sources/c/main/print/error/entry/item.h b/sources/c/main/print/error/entry/item.h index 5ff9468..4c02952 100644 --- a/sources/c/main/print/error/entry/item.h +++ b/sources/c/main/print/error/entry/item.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry item error functionality. + * Provides the print Entry item error functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -32,8 +32,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The item name. * @param message @@ -65,8 +65,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param number * The index position of the invalid item. * @@ -96,8 +96,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param buffer * The buffer containing the setting name. * @param range diff --git a/sources/c/main/print/error/entry/setting.h b/sources/c/main/print/error/entry/setting.h index dc8f582..9d084e0 100644 --- a/sources/c/main/print/error/entry/setting.h +++ b/sources/c/main/print/error/entry/setting.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry setting error functionality. + * Provides the print Entry setting error functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,7 +17,7 @@ extern "C" { #endif /** - * Print a message about an entry setting problem, with additional messages about the value. + * Print a message about an Entry setting problem, with additional messages about the value. * * This is intended to be explicitly called by controller_entry_settings_read(). * This is intended only to be used for simple messages. @@ -35,8 +35,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param before * The string to add to the message being printed (before the value). * @param range @@ -55,7 +55,7 @@ extern "C" { #endif // _di_controller_print_error_entry_setting_with_range_ /** - * Print a message for when an entry setting is being ignored. + * Print a message for when an Entry setting is being ignored. * * @param print * The output structure to print to. @@ -70,8 +70,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * * @return * F_okay on success. @@ -84,7 +84,7 @@ extern "C" { #endif // _di_controller_print_error_entry_setting_ignored_ /** - * Print a message for when an entry setting action has the incorrect number of parameters when the required amount is between a range. + * Print a message for when an Entry setting Action has the incorrect number of parameters when the required amount is between a range. * * @param print * The output structure to print to. @@ -99,8 +99,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param minimum * The expected minimum number of arguments. * @param maximum @@ -117,7 +117,7 @@ extern "C" { #endif // _di_controller_print_error_entry_setting_requires_between_ /** - * Print a message for when an entry setting action has the incorrect number of parameters when the required amount is fixed. + * Print a message for when an Entry setting Action has the incorrect number of parameters when the required amount is fixed. * * @param print * The output structure to print to. @@ -132,8 +132,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param total * The expected number of arguments. * @@ -148,7 +148,7 @@ extern "C" { #endif // _di_controller_print_error_entry_setting_requires_exactly_ /** - * Print an error message about an entry setting value not being a supported number. + * Print an error message about an Entry setting value not being a supported number. * * This utilizes the buffer and range because the number is not supported and therefore the string cannot be converted to a number. * @@ -161,8 +161,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param buffer * The buffer containing the settings. * @param range diff --git a/sources/c/main/print/error/perform/pid.h b/sources/c/main/print/error/perform/pid.h index 3148616..6728a2f 100644 --- a/sources/c/main/print/error/perform/pid.h +++ b/sources/c/main/print/error/perform/pid.h @@ -33,8 +33,8 @@ extern "C" { * @param function * The name of the function associated with the error. * @param is_entry - * If TRUE, then this operates as an entry. - * If FALSE, then this operates as an exit. + * If TRUE, then this operates as an Entry. + * If FALSE, then this operates as an Exit. * * @return * F_okay on success. diff --git a/sources/c/main/print/error/rule.c b/sources/c/main/print/error/rule.c index 56dfe75..4ae7d1e 100644 --- a/sources/c/main/print/error/rule.c +++ b/sources/c/main/print/error/rule.c @@ -45,7 +45,7 @@ extern "C" { } if (action->name_item.used) { - fl_print_format("rule %r '%]", print->to, item ? controller_item_s : controller_settings_s, print->context); + fl_print_format("Rule %r '%]", print->to, item ? controller_item_s : controller_settings_s, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, action->name_item, print->notable); fl_print_format("%[' on line%] ", print->to, print->context, print->context); fl_print_format(f_string_format_un_single_s.string, print->to, print->notable, action->line_item, print->notable); @@ -53,7 +53,7 @@ extern "C" { } if (action->name_file.used) { - fl_print_format("rule file '%]%[%Q%]%['", print->to, print->context, print->notable, action->name_file, print->notable, print->context); + fl_print_format("Rule file '%]%[%Q%]%['", print->to, print->context, print->notable, action->name_file, print->notable, print->context); } fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); @@ -72,7 +72,7 @@ extern "C" { controller_lock_print(print->to, &main->thread); - fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable); fl_print_format("%[' is already on the execution dependency stack, this recursion is prohibited.%]%r", print->to, print->context, print->context, f_string_eol_s); diff --git a/sources/c/main/print/error/rule.h b/sources/c/main/print/error/rule.h index d03aeaa..55b606e 100644 --- a/sources/c/main/print/error/rule.h +++ b/sources/c/main/print/error/rule.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print rule error functionality. + * Provides the print Rule error functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -30,7 +30,7 @@ extern "C" { * * Must not be NULL. * @param action - * The action cache. + * The Action cache. * * Must not be NULL. * @param status @@ -43,7 +43,7 @@ extern "C" { * Set to F_true to print the fallback error message for unknown errors. * @param item * If TRUE, then this error is associated with an item. - * If FALSE, then this error is associated with a rule setting. + * If FALSE, then this error is associated with a Rule setting. * * @return * F_okay on success. @@ -71,7 +71,7 @@ extern "C" { * * Must not be NULL. * @param action - * The action cache. + * The Action cache. * * This uses: * - action.line_action @@ -83,7 +83,7 @@ extern "C" { * Must not be NULL. * @param item * If TRUE, then this error is associated with an item. - * If FALSE, then this error is associated with a rule setting. + * If FALSE, then this error is associated with a Rule setting. * * @return * F_okay on success. @@ -96,7 +96,7 @@ extern "C" { #endif // _di_controller_print_error_rule_cache_ /** - * Print error regarding the rule already being on the execution stack. + * Print error regarding the Rule already being on the execution stack. * * @param print * The output structure to print to. @@ -107,14 +107,14 @@ extern "C" { * * Must not be NULL. * @param action - * The action cache. + * The Action cache. * * Must not be NULL. * @param name - * The rule name. + * The Rule name. * @param item * If TRUE, then this error is associated with an item. - * If FALSE, then this error is associated with a rule setting. + * If FALSE, then this error is associated with a Rule setting. * * @return * F_okay on success. diff --git a/sources/c/main/print/error/rule/action.c b/sources/c/main/print/error/rule/action.c index 4f9be6d..ae59fb7 100644 --- a/sources/c/main/print/error/rule/action.c +++ b/sources/c/main/print/error/rule/action.c @@ -70,9 +70,9 @@ extern "C" { controller_lock_print(print->to, &main->thread); - fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, alias, print->notable); - fl_print_format("%[' is not designating a pid file.%]%r", print->to, print->context, print->context, f_string_eol_s); + fl_print_format("%[' is not designating a PID file.%]%r", print->to, print->context, print->context, f_string_eol_s); controller_print_error_rule_cache(print, action, F_true); @@ -160,7 +160,7 @@ extern "C" { controller_lock_print(print->to, &main->thread); - fl_print_format("%r%[%QUnsupported action type '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format("%r%[%QUnsupported Action type '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, type, print->notable); fl_print_format("%[' while attempting to %S.%]%r", print->to, print->context, message, print->context, f_string_eol_s); @@ -207,14 +207,14 @@ extern "C" { controller_lock_print(print->to, &main->thread); if (total) { - fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable); fl_print_format("%[' has no '%]", print->to, print->context, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, type, print->notable); - fl_print_format("%[' action to execute.%]%r", print->to, print->context, print->context, f_string_eol_s); + fl_print_format("%[' Action to execute.%]%r", print->to, print->context, print->context, f_string_eol_s); } else { - fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable); fl_print_format("%[ has no known '%]", print->to, print->context, print->context); fl_print_format("%[%r %r%]", print->to, print->notable, controller_rule_s, controller_type_s, print->notable); diff --git a/sources/c/main/print/error/rule/action.h b/sources/c/main/print/error/rule/action.h index e7a0422..a4f2cb3 100644 --- a/sources/c/main/print/error/rule/action.h +++ b/sources/c/main/print/error/rule/action.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry action error functionality. + * Provides the print Entry Action error functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -38,7 +38,7 @@ extern "C" { * @param buffer * The buffer containing the setting name. * @param range - * The range within the buffer representing the unknown action name. + * The range within the buffer representing the unknown Action name. * * @return * F_okay on success. @@ -79,7 +79,7 @@ extern "C" { #endif // _di_controller_print_error_rule_action_fss_0003_unsupported_ /** - * Print an error or warning message about some rule not having the PID file information. + * Print an error or warning message about some Rule not having the PID file information. * * @param print * The output structure to print to. @@ -184,13 +184,13 @@ extern "C" { * * Must not be NULL. * @param action - * The action cache. + * The Action cache. * * Must not be NULL. * @param type * The Action type name. * @param message - * A specific message on what is being attempted by the action. + * A specific message on what is being attempted by the Action. * * @return * F_okay on success. @@ -222,7 +222,7 @@ extern "C" { * @param buffer * The buffer containing the setting name. * @param range - * The range within the buffer representing the unknown action name. + * The range within the buffer representing the unknown Action name. * * @return * F_okay on success. @@ -246,7 +246,7 @@ extern "C" { * * Must not be NULL. * @param action - * The action cache. + * The Action cache. * * Must not be NULL. * @param name diff --git a/sources/c/main/print/error/rule/item.c b/sources/c/main/print/error/rule/item.c index 8dbe87c..ccfba01 100644 --- a/sources/c/main/print/error/rule/item.c +++ b/sources/c/main/print/error/rule/item.c @@ -276,6 +276,24 @@ extern "C" { } #endif // _di_controller_print_error_rule_item_execute_ +#ifndef _di_controller_print_error_rule_item_execute_none_ + f_status_t controller_print_error_rule_item_execute_none(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t alias) { + + if (!print || !print->custom) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; + + controller_t * const main = (controller_t *) print->custom; + + controller_lock_print(print->to, &main->thread); + + fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, alias, print->notable); + fl_print_format("%[' has no Items to execute.%]%r", print->to, print->context, print->context, f_string_eol_s); + + controller_unlock_print_flush(print->to, &main->thread); + } +#endif // _di_controller_print_error_rule_item_execute_none_ + #ifndef _di_controller_print_error_rule_item_need_want_wish_ f_status_t controller_print_error_rule_item_need_want_wish(fl_print_t * const print, const f_string_static_t need_want_wish, const f_string_static_t value, const f_string_t why) { @@ -286,7 +304,7 @@ extern "C" { if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not; - fl_print_format("%r%[%QThe %r rule '%]", print->to, f_string_eol_s, print->context, print->prefix, need_want_wish, print->context); + fl_print_format("%r%[%QThe %r Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, need_want_wish, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, value, print->notable); fl_print_format("%[' %S.%]%r", print->to, print->context, why, print->context, f_string_eol_s); @@ -304,7 +322,7 @@ extern "C" { controller_lock_print(print->to, &main->thread); - fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, alias, print->notable); fl_print_format("%[' is no longer loaded.%]%r", print->to, print->context, print->context, f_string_eol_s); diff --git a/sources/c/main/print/error/rule/item.h b/sources/c/main/print/error/rule/item.h index 8922df6..869cfb4 100644 --- a/sources/c/main/print/error/rule/item.h +++ b/sources/c/main/print/error/rule/item.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry item error functionality. + * Provides the print Entry Item error functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -35,7 +35,7 @@ extern "C" { * Must not be NULL. * @param item * If TRUE, then this error is associated with an item. - * If FALSE, then this error is associated with a rule setting. + * If FALSE, then this error is associated with a Rule setting. * @param status * The status code representing the failure (without the error bit set). * @@ -83,7 +83,35 @@ extern "C" { #endif // _di_controller_print_error_rule_item_execute_ /** - * Print an error or warning message related to need/want/wish settings of some rule. + * Print an error about a Rule have no Items to execute. + * + * @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 action + * The Action cache. + * + * Must not be NULL. + * @param alias + * The Rule alias of the Rule that has no Items. + * + * @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_error_rule_item_execute_none_ + extern f_status_t controller_print_error_rule_item_execute_none(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t alias); +#endif // _di_controller_print_error_rule_item_execute_none_ + +/** + * Print an error or warning message related to need/want/wish settings of some Rule. * * @param print * The output structure to print to. @@ -112,7 +140,7 @@ extern "C" { #endif // _di_controller_print_error_rule_item_need_want_wish_ /** - * Print an error or warning message about some rule not being loaded. + * Print an error or warning message about some Rule not being loaded. * * @param print * The output structure to print to. diff --git a/sources/c/main/print/error/rule/setting.c b/sources/c/main/print/error/rule/setting.c index 0e3d281..63cf5a9 100644 --- a/sources/c/main/print/error/rule/setting.c +++ b/sources/c/main/print/error/rule/setting.c @@ -151,7 +151,7 @@ extern "C" { controller_lock_print(print->to, &main->thread); - fl_print_format("%r%[%QThe first value for the rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format("%r%[%QThe first value for the Rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, controller_on_s, print->notable); fl_print_format("%[' has '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_range_single_s.string, print->to, print->notable, buffer, range, print->notable); @@ -176,7 +176,7 @@ extern "C" { controller_lock_print(print->to, &main->thread); - fl_print_format("%r%[%QThe second value for the rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format("%r%[%QThe second value for the Rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, controller_on_s, print->notable); fl_print_format("%[' has '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_range_single_s.string, print->to, print->notable, buffer, range, print->notable); @@ -233,7 +233,7 @@ extern "C" { controller_lock_print(print->to, &main->thread); - fl_print_format("%r%[%QThe first value for the rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format("%r%[%QThe first value for the Rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, controller_timeout_s, print->notable); fl_print_format("%[' has '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); fl_print_format(f_string_format_Q_range_single_s.string, print->to, print->notable, buffer, range, print->notable); diff --git a/sources/c/main/print/error/rule/setting.h b/sources/c/main/print/error/rule/setting.h index e05ff17..037636c 100644 --- a/sources/c/main/print/error/rule/setting.h +++ b/sources/c/main/print/error/rule/setting.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry setting error functionality. + * Provides the print Entry setting error functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,7 +17,7 @@ extern "C" { #endif /** - * Print a message about a rule setting problem. + * Print a message about a Rule setting problem. * * This is intended to be explicitly called by controller_rule_setting_read(). * This is intended only to be used for simple messages. @@ -50,7 +50,7 @@ extern "C" { #endif // _di_controller_print_error_rule_setting_ /** - * Print a message about a rule setting problem given a specified reason and providing the setting name or value. + * Print a message about a Rule setting problem given a specified reason and providing the setting name or value. * * @param print * The output structure to print to. @@ -80,7 +80,7 @@ extern "C" { #endif // _di_controller_print_error_rule_setting_reason_name_ /** - * Print a message about a rule setting problem, with additional messages about the value. + * Print a message about a Rule setting problem, with additional messages about the value. * * This is intended to be explicitly called by controller_rule_setting_read(). * This is intended only to be used for simple messages. diff --git a/sources/c/main/print/message.c b/sources/c/main/print/message.c index 840aa93..7b721eb 100644 --- a/sources/c/main/print/message.c +++ b/sources/c/main/print/message.c @@ -34,7 +34,7 @@ extern "C" { fll_program_print_help_usage(print, controller_program_name_s, f_string_empty_s); fl_print_format("%r When both the %[%r%r%] parameter and the", print->to, f_string_eol_s, print->set->notable, f_console_symbol_long_normal_s, controller_long_simulate_s, print->set->notable); - fl_print_format(" %[%r%r%] parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, controller_long_validate_s, print->set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%r%] parameter are specified, then additional information on each would be executed Rule is printed but no simulation is performed.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, controller_long_validate_s, print->set->notable, f_string_eol_s, f_string_eol_s); fl_print_format(" The default interrupt behavior is to operate as if the %[%r%r%] parameter is passed.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, uninterrupt ? controller_long_uninterruptible_s : controller_long_interruptible_s, print->set->notable, f_string_eol_s, f_string_eol_s); diff --git a/sources/c/main/print/message/entry.h b/sources/c/main/print/message/entry.h index c228911..543b666 100644 --- a/sources/c/main/print/message/entry.h +++ b/sources/c/main/print/message/entry.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry message functionality. + * Provides the print Entry message functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,7 +17,7 @@ extern "C" { #endif /** - * Print message about the specified entry being in the given state. + * Print message about the specified Entry being in the given state. * * This generally only applies to the "ready" Entry Item Action. * @@ -30,8 +30,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The name of the state. * diff --git a/sources/c/main/print/message/entry/action.h b/sources/c/main/print/message/entry/action.h index 0f60e84..171ac75 100644 --- a/sources/c/main/print/message/entry/action.h +++ b/sources/c/main/print/message/entry/action.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry action message functionality. + * Provides the print Entry Action message functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -28,7 +28,7 @@ extern "C" { * * Must not be NULL. * @param action - * The entry action. + * The Entry Action. * * Must not be NULL. * @@ -56,8 +56,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The item name. * @@ -72,7 +72,7 @@ extern "C" { #endif // _di_controller_print_message_entry_action_ready_ /** - * Print message about entry action state. + * Print message about Entry Action state. * * @param print * The output structure to print to. @@ -87,7 +87,7 @@ extern "C" { * * Must not be NULL. * @param action - * The entry action. + * The Entry Action. * * Must not be NULL. * @@ -102,7 +102,7 @@ extern "C" { #endif // _di_controller_print_message_entry_action_state_ /** - * Print message about entry action state having failed. + * Print message about Entry Action state having failed. * * @param print * The output structure to print to. @@ -117,12 +117,12 @@ extern "C" { * * Must not be NULL. * @param action - * The entry action. + * The Entry Action. * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * * @return * F_okay on success. @@ -148,8 +148,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The item name. * diff --git a/sources/c/main/print/message/entry/item.c b/sources/c/main/print/message/entry/item.c index a7c7adc..60a2a21 100644 --- a/sources/c/main/print/message/entry/item.c +++ b/sources/c/main/print/message/entry/item.c @@ -109,7 +109,7 @@ extern "C" { controller_lock_print(print->to, &main->thread); - 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("%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)) { diff --git a/sources/c/main/print/message/entry/item.h b/sources/c/main/print/message/entry/item.h index f2a08e4..f9b2ffb 100644 --- a/sources/c/main/print/message/entry/item.h +++ b/sources/c/main/print/message/entry/item.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry item message functionality. + * Provides the print Entry Item message functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -26,8 +26,8 @@ extern "C" { * * This does not alter print.custom.setting.state.status. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param failsafe * If TRUE, then running in failsafe. * If FALSE, then running normally. @@ -45,7 +45,7 @@ extern "C" { #endif // _di_controller_print_message_entry_item_done_ /** - * Print message about the entry item executing. + * Print message about the Entry Item executing. * * @param print * The output structure to print to. @@ -56,8 +56,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param parameters * The array of parameters. * @@ -83,11 +83,11 @@ extern "C" { * * This does not alter print.custom.setting.state.status. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param prepend - * A string to prepend before entry string in the message. - * When prepend.used is not 0, then a space is also printed between entry string and the prepend string. + * A string to prepend before Entry string in the message. + * When prepend.used is not 0, then a space is also printed between Entry string and the prepend string. * Set prepend.used to 0 to disable. * @param name * The item name. @@ -104,7 +104,7 @@ extern "C" { #endif // _di_controller_print_message_entry_item_process_ /** - * Print message about a problem with an entry item. + * Print message about a problem with an Entry Item. * * @param print * The output structure to print to. @@ -113,12 +113,12 @@ extern "C" { * * This does not alter print.custom.setting.state.status. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The item name. * @param reason - * The reason regarding the problem with the required entry item. + * The reason regarding the problem with the required Entry Item. * * @return * F_okay on success. @@ -142,16 +142,16 @@ extern "C" { * * Must not be NULL. * @param entry - * The entry. + * The Entry. * * Must not be NULL. * @param action - * The entry action. + * The Entry Action. * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param alias_rule * The Rule alias name. * diff --git a/sources/c/main/print/output/entry/setting.h b/sources/c/main/print/output/entry/setting.h index 91601eb..75e064d 100644 --- a/sources/c/main/print/output/entry/setting.h +++ b/sources/c/main/print/output/entry/setting.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry setting output functionality. + * Provides the print Entry setting output functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -28,8 +28,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this operates as an entry. - * If FALSE, then this operates as an exit. + * If TRUE, then this operates as an Entry. + * If FALSE, then this operates as an Exit. * @param name * The Object name of the setting being populated. * @param name_sub @@ -51,7 +51,7 @@ extern "C" { #endif // _di_controller_print_output_entry_setting_simulate_value_ /** - * Print a simulated execution of the given entry. + * Print a simulated execution of the given Entry. * * @param print * The output structure to print to. @@ -62,8 +62,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this is an entry. - * If FALSE, then this is an exit. + * If TRUE, then this is an Entry. + * If FALSE, then this is an Exit. * * @return * F_okay on success. diff --git a/sources/c/main/print/output/rule/execute.h b/sources/c/main/print/output/rule/execute.h index 303c318..63f8861 100644 --- a/sources/c/main/print/output/rule/execute.h +++ b/sources/c/main/print/output/rule/execute.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print output rule execute functionality. + * Provides the print output Rule execute functionality. * * This is auto-included and should not need to be explicitly included. */ diff --git a/sources/c/main/print/output/rule/setting.h b/sources/c/main/print/output/rule/setting.h index 277efc9..96ec760 100644 --- a/sources/c/main/print/output/rule/setting.h +++ b/sources/c/main/print/output/rule/setting.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print output rule "setting" functionality. + * Provides the print output Rule "setting" functionality. * * This is auto-included and should not need to be explicitly included. */ diff --git a/sources/c/main/print/output/rule/validate.c b/sources/c/main/print/output/rule/validate.c index db957bc..2ce32c7 100644 --- a/sources/c/main/print/output/rule/validate.c +++ b/sources/c/main/print/output/rule/validate.c @@ -14,7 +14,7 @@ extern "C" { f_number_unsigned_t i = 0; f_number_unsigned_t j = 0; - // Find at least one of the requested action. + // Find at least one of the requested Action. { bool missing = F_true; @@ -36,7 +36,7 @@ extern "C" { if (rule->items.used) { fl_print_format("%rRule '", print->to, f_string_eol_s); fl_print_format("%[%Q%]' has no '", print->to, print->set->title, rule->name, print->set->title); - fl_print_format("%[%r%]' action to execute and would '", print->to, print->set->title, controller_convert_rule_action_type_string(action), print->set->title); + fl_print_format("%[%r%]' Action to execute and would '", print->to, print->set->title, controller_convert_rule_action_type_string(action), print->set->title); fl_print_format("%[%r%]' because it is '", print->to, print->set->important, options & controller_instance_option_require_e ? controller_fail_s : controller_succeed_s, print->set->important); fl_print_format("%[%r%]'.%r", print->to, print->set->important, options & controller_instance_option_require_e ? controller_required_s : controller_optional_s, print->set->important, f_string_eol_s); } diff --git a/sources/c/main/print/output/rule/validate.h b/sources/c/main/print/output/rule/validate.h index 9cae51d..601565c 100644 --- a/sources/c/main/print/output/rule/validate.h +++ b/sources/c/main/print/output/rule/validate.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print output rule "validate" functionality. + * Provides the print output Rule "validate" functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,9 +17,9 @@ extern "C" { #endif /** - * Perform a simulated execution of the given rule. + * Perform a simulated execution of the given Rule. * - * This simply prints information about the rule. + * This simply prints information about the Rule. * * This automatically sets the rule's status to F_complete. * @@ -36,7 +36,7 @@ extern "C" { * * Must not be NULL. * @param rule - * The rule to process. + * The Rule to process. * * Must not be NULL. * @param action @@ -44,7 +44,7 @@ extern "C" { * @param options * A number using bits to represent specific boolean options. * If no bits set, then operate normally in a synchronous manner. - * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule). + * If bit controller_instance_option_simulate_e, then the Rule execution is in simulation mode (printing a message that the Rule would be executed but does not execute the rule). * If bit controller_instance_option_asynchronous_e, then run asynchronously. * * @return diff --git a/sources/c/main/print/warning/entry/action.h b/sources/c/main/print/warning/entry/action.h index 731de6f..8ee66c7 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 action warning functionality. + * Provides the print Entry Action warning functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -32,8 +32,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * * @return * F_okay on success. @@ -61,8 +61,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The item name. * diff --git a/sources/c/main/print/warning/entry/item.h b/sources/c/main/print/warning/entry/item.h index 26a7ca1..e4bab90 100644 --- a/sources/c/main/print/warning/entry/item.h +++ b/sources/c/main/print/warning/entry/item.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print entry item warning functionality. + * Provides the print Entry Item warning functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -32,8 +32,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The item name. * diff --git a/sources/c/main/print/warning/entry/setting.h b/sources/c/main/print/warning/entry/setting.h index 9baeada..2aa639f 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 setting warning functionality. + * Provides the print Entry setting warning functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -32,8 +32,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The parameter name whose value is unknown. * @@ -63,8 +63,8 @@ extern "C" { * * Must not be NULL. * @param is_entry - * If TRUE, then this loads as an entry. - * If FALSE, then this loads as an exit. + * If TRUE, then this loads as an Entry. + * If FALSE, then this loads as an Exit. * @param name * The parameter name whose value is unknown. * @param buffer diff --git a/sources/c/main/print/warning/rule/action.h b/sources/c/main/print/warning/rule/action.h index c4f2e8b..73b62c5 100644 --- a/sources/c/main/print/warning/rule/action.h +++ b/sources/c/main/print/warning/rule/action.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print rule action warning functionality. + * Provides the print Rule action warning functionality. * * This is auto-included and should not need to be explicitly included. */ diff --git a/sources/c/main/print/warning/rule/item.h b/sources/c/main/print/warning/rule/item.h index dc178ac..a45bdc0 100644 --- a/sources/c/main/print/warning/rule/item.h +++ b/sources/c/main/print/warning/rule/item.h @@ -28,7 +28,7 @@ extern "C" { * * Must not be NULL. * @param action - * The action cache. + * The Action cache. * * Must not be NULL. * @param name diff --git a/sources/c/main/print/warning/rule/setting.h b/sources/c/main/print/warning/rule/setting.h index 2d58a87..8a0ffff 100644 --- a/sources/c/main/print/warning/rule/setting.h +++ b/sources/c/main/print/warning/rule/setting.h @@ -28,7 +28,7 @@ extern "C" { * * Must not be NULL. * @param action - * The action cache. + * The Action cache. * * Must not be NULL. * @param name diff --git a/sources/c/main/process.c b/sources/c/main/process.c index 477c665..26a9a38 100644 --- a/sources/c/main/process.c +++ b/sources/c/main/process.c @@ -80,11 +80,11 @@ extern "C" { } } - // Only make the rule and control threads available once any/all pre-processing is complete. + // 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)) { - // Wait for the entry thread to complete before starting the rule thread. + // Wait for the Entry thread to complete before starting the Rule thread. controller_thread_join(&main->thread.id_rule); if (main->thread.enabled && main->process.mode == controller_process_mode_service_e) { diff --git a/sources/c/main/rule.c b/sources/c/main/rule.c index 0586021..0ff8d1e 100644 --- a/sources/c/main/rule.c +++ b/sources/c/main/rule.c @@ -262,8 +262,6 @@ extern "C" { if (F_status_is_error(status)) { controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status)); - - return status; } return status; diff --git a/sources/c/main/rule.h b/sources/c/main/rule.h index 447acb7..e47d124 100644 --- a/sources/c/main/rule.h +++ b/sources/c/main/rule.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides rule functionality. + * Provides Rule functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -19,12 +19,12 @@ extern "C" { /** * Copy a rule, allocating new space as necessary. * - * This does not do any locking or unlocking for the rule data, be sure to lock appropriately before and after calling this. + * This does not do any locking or unlocking for the Rule data, be sure to lock appropriately before and after calling this. * * @param source - * The source rule to copy from. + * The source Rule to copy from. * @param destination - * The destination rule to copy to. + * The destination Rule to copy to. * * Must not be NULL. * @@ -61,14 +61,14 @@ extern "C" { * @param rules * The rules to search through. * @param at - * (optional) The index the rule was found at. + * (optional) The index the Rule was found at. * * Set to NULL to disable. * * @return * F_okay on success, but the id.used is 0. - * F_true on success and rule was found, index is updated. - * F_false on success and rule was not found. + * F_true on success and Rule was found, index is updated. + * F_false on success and Rule was not found. */ #ifndef _di_controller_rule_find_ extern f_status_t controller_rule_find(const f_string_static_t alias, const controller_rules_t rules, f_number_unsigned_t * const at); @@ -84,9 +84,9 @@ extern "C" { * @param source * The source string that both the directory and basename are copied from. * @param directory - * A range within the source representing the directory part of a rule id. + * A range within the source representing the directory part of a Rule id. * @param basename - * A range within the source representing the basename part of a rule id. + * A range within the source representing the basename part of a Rule id. * @param alias * The constructed alias. * diff --git a/sources/c/main/rule/action.c b/sources/c/main/rule/action.c index 5f07b9f..06ed82b 100644 --- a/sources/c/main/rule/action.c +++ b/sources/c/main/rule/action.c @@ -32,12 +32,15 @@ extern "C" { #endif // _di_controller_rule_action_type_to_action_execute_type_ #ifndef _di_controller_rule_action_read_ - f_status_t controller_rule_action_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, const uint8_t type, const uint8_t method, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range) { + void controller_rule_action_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, const uint8_t type, const uint8_t method, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range, f_state_t * const state) { - if (!main || !item || !actions || !range) return F_status_set_error(F_parameter); + if (!state) return; - controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, main); - f_state_t state = macro_f_state_t_initialize_1(controller_allocation_large_d, controller_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); + if (!main || !cache || !item || !actions || !range) { + state->status = F_status_set_error(F_parameter); + + return; + } f_number_unsigned_t i = 0; @@ -62,157 +65,165 @@ extern "C" { cache->content_action.used = 0; if (method == controller_rule_action_method_extended_list_e) { - fl_fss_extended_list_content_read(cache->buffer_item, range, &cache->content_action, &cache->delimits, &cache->comments, &state); + fl_fss_extended_list_content_read(cache->buffer_item, range, &cache->content_action, &cache->delimits, &cache->comments, state); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(fl_fss_extended_list_content_read)); - return state.status; + return; } - if (state.status == F_fss_found_content) { - f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state); + if (state->status == F_fss_found_content) { + f_fss_apply_delimit(cache->delimits, &cache->buffer_item, state); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_fss_apply_delimit)); - return state.status; + return; } // The "script" and "utility" types use the entire content and can be directly passed through at index 0. if (item->type == controller_rule_item_type_script_e || item->type == controller_rule_item_type_utility_e) { actions->array[actions->used].parameters.used = 0; - state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size); + state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase)); - return state.status; + return; } - state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size); + state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase)); - return state.status; + return; } actions->array[actions->used].type = type; actions->array[actions->used].line = cache->action.line_action; actions->array[actions->used].status = F_known_not; - state.status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_action.array[0], &actions->array[actions->used].parameters.array[0]); + state->status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_action.array[0], &actions->array[actions->used].parameters.array[0]); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_string_dynamic_append_nulless)); - actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status)); + actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status)); - return state.status; + return; } if (actions->array[actions->used].parameters.array[0].used) { - state.step_large = controller_allocation_iki_large_d; - state.step_small = controller_allocation_iki_small_d; - state.interrupt = &controller_thread_signal_state_iki; + const uint16_t old_step_large = state->step_large; + const uint16_t old_step_small = state->step_small; + void * const old_interrupt = state->interrupt; + + state->step_large = controller_allocation_iki_large_d; + state->step_small = controller_allocation_iki_small_d; + state->interrupt = &controller_thread_signal_state_iki; f_range_t range_iki = macro_f_range_t_initialize_2(actions->array[actions->used].parameters.array[0].used); - fl_iki_read(&actions->array[actions->used].parameters.array[0], &range_iki, &actions->array[actions->used].ikis.array[0], &state); + fl_iki_read(&actions->array[actions->used].parameters.array[0], &range_iki, &actions->array[actions->used].ikis.array[0], state); + + state->step_large = old_step_large; + state->step_small = old_step_small; + state->interrupt = old_interrupt; - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(fl_iki_read)); - actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status)); + actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status)); - return state.status; + return; } } actions->array[actions->used].ikis.used = 1; actions->array[actions->used++].parameters.used = 1; - return state.status; + return; } cache->delimits.used = 0; - // The object_actions and content_actions caches are being used for the purposes of getting the parameters a given the action. - fll_fss_extended_read(cache->buffer_item, &cache->content_action.array[0], &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0, &state); + // The object_actions and content_actions caches are being used for the purposes of getting the parameters a given the Action. + fll_fss_extended_read(cache->buffer_item, &cache->content_action.array[0], &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0, state); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(fll_fss_extended_read)); - return state.status; + return; } - f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state); + f_fss_apply_delimit(cache->delimits, &cache->buffer_item, state); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_fss_apply_delimit)); - return state.status; + return; } for (i = 0; i < cache->object_actions.used; ++i) { - state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &actions->array, &actions->used, &actions->size); + state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &actions->array, &actions->used, &actions->size); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase)); - return state.status; + return; } - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &actions->array[actions->used].line, &state); + f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &actions->array[actions->used].line, state); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_fss_count_lines)); - return state.status; + return; } actions->array[actions->used].type = type; actions->array[actions->used].line += ++item->line; actions->array[actions->used].status = F_known_not; - state.status = controller_rule_parameters_read(main, cache->buffer_item, &cache->object_actions.array[i], &cache->content_actions.array[i], &actions->array[actions->used], &state); + controller_rule_parameters_read(main, cache->buffer_item, &cache->object_actions.array[i], &cache->content_actions.array[i], &actions->array[actions->used], state); - if (F_status_is_error(state.status)) { - actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status)); + if (F_status_is_error(state->status)) { + actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status)); - return state.status; + return; } - actions->array[actions->used++].status = state.status; + actions->array[actions->used++].status = state->status; } // for range->start = cache->content_action.array[0].start; } else { - state.status = F_data_not; + state->status = F_data_not; } } else { - fl_fss_extended_content_read(cache->buffer_item, range, &cache->content_action, 0, &cache->delimits, &state); + fl_fss_extended_content_read(cache->buffer_item, range, &cache->content_action, 0, &cache->delimits, state); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(fll_fss_extended_content_read)); } - else if (state.status == F_fss_found_content) { - f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state); + else if (state->status == F_fss_found_content) { + f_fss_apply_delimit(cache->delimits, &cache->buffer_item, state); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_fss_apply_delimit)); } else if (type == controller_rule_action_type_pid_file_e) { item->pid_file.used = 0; - state.status = f_rip_dynamic_partial(cache->buffer_item, cache->content_action.array[0], &item->pid_file); + state->status = f_rip_dynamic_partial(cache->buffer_item, cache->content_action.array[0], &item->pid_file); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_rip_dynamic_partial)); } } @@ -250,9 +261,11 @@ extern "C" { } if (!type_rerun) { + state->status = F_status_set_error(F_valid_not); + controller_print_error_rule_action_first(&main->program.error, &cache->action, cache->buffer_item, cache->content_action.array[0]); - return F_status_set_error(F_valid_not); + return; } controller_rule_rerun_item_t *rerun_item = 0; @@ -268,26 +281,30 @@ extern "C" { } } else { + state->status = F_status_set_error(F_valid_not); + controller_print_error_rule_action_second(&main->program.error, &cache->action, cache->buffer_item, cache->content_action.array[1]); - return F_status_set_error(F_valid_not); + return; } for (i = 2; i < cache->content_action.used; ++i) { if (f_compare_dynamic_partial_string(controller_delay_s.string, cache->buffer_item, controller_delay_s.used, cache->content_action.array[i]) == F_equal_to) { - state.status = controller_rule_action_read_rerun_number(main, cache, controller_delay_s, &i, &rerun_item->delay); + state->status = controller_rule_action_read_rerun_number(main, cache, controller_delay_s, &i, &rerun_item->delay); } else if (f_compare_dynamic_partial_string(controller_max_s.string, cache->buffer_item, controller_max_s.used, cache->content_action.array[i]) == F_equal_to) { - state.status = controller_rule_action_read_rerun_number(main, cache, controller_max_s, &i, &rerun_item->max); + state->status = controller_rule_action_read_rerun_number(main, cache, controller_max_s, &i, &rerun_item->max); } else if (f_compare_dynamic_partial_string(controller_reset_s.string, cache->buffer_item, controller_reset_s.used, cache->content_action.array[i]) == F_equal_to) { item->reruns[type_rerun].is |= rerun_item == &item->reruns[type_rerun].failure ? controller_rule_rerun_is_failure_reset_d : controller_rule_rerun_is_success_reset_d; } else { + state->status = F_status_set_error(F_valid_not); + controller_print_error_rule_action_unknown(&main->program.error, &cache->action, controller_rerun_s, cache->buffer_item, cache->content_action.array[i]); - return F_status_set_error(F_valid_not); + return; } } // for } @@ -312,27 +329,27 @@ extern "C" { else { controller_print_error_rule_action_unknown(&main->program.error, &cache->action, controller_with_s, cache->buffer_item, cache->content_action.array[i]); - state.status = F_status_set_error(F_valid_not); + state->status = F_status_set_error(F_valid_not); break; } } // for } else if (item->type == controller_rule_item_type_script_e || item->type == controller_rule_item_type_utility_e) { - state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size); + state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase)); - return state.status; + return; } - state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size); + state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase)); - return state.status; + return; } // The "script" types use the entire content as a single string piped to the script, so merge all arguments together. @@ -342,33 +359,41 @@ extern "C" { for (i = 0; i < cache->content_action.used; ++i) { - state.status = f_string_dynamic_partial_mash_nulless(f_string_space_s, cache->buffer_item, cache->content_action.array[i], &actions->array[actions->used].parameters.array[0]); - if (F_status_is_error(state.status)) break; + state->status = f_string_dynamic_partial_mash_nulless(f_string_space_s, cache->buffer_item, cache->content_action.array[i], &actions->array[actions->used].parameters.array[0]); + if (F_status_is_error(state->status)) break; } // for - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_string_dynamic_partial_mash_nulless)); - actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status)); + actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status)); - return state.status; + return; } if (actions->array[actions->used].parameters.array[0].used) { - state.step_large = controller_allocation_iki_large_d; - state.step_small = controller_allocation_iki_small_d; - state.interrupt = &controller_thread_signal_state_iki; + const uint16_t old_step_large = state->step_large; + const uint16_t old_step_small = state->step_small; + void * const old_interrupt = state->interrupt; + + state->step_large = controller_allocation_iki_large_d; + state->step_small = controller_allocation_iki_small_d; + state->interrupt = &controller_thread_signal_state_iki; f_range_t range_iki = macro_f_range_t_initialize_2(actions->array[actions->used].parameters.array[0].used); - fl_iki_read(&actions->array[actions->used].parameters.array[0], &range_iki, &actions->array[actions->used].ikis.array[0], &state); + fl_iki_read(&actions->array[actions->used].parameters.array[0], &range_iki, &actions->array[actions->used].ikis.array[0], state); + + state->step_large = old_step_large; + state->step_small = old_step_small; + state->interrupt = old_interrupt; - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(fl_iki_read)); - actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status)); + actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status)); - return state.status; + return; } } @@ -376,39 +401,37 @@ extern "C" { actions->array[actions->used++].parameters.used = 1; } else { - f_fss_count_lines(cache->buffer_item, range->start, &actions->array[actions->used].line, &state); + f_fss_count_lines(cache->buffer_item, range->start, &actions->array[actions->used].line, state); - if (F_status_is_error(state.status)) { + if (F_status_is_error(state->status)) { controller_print_error(&main->program.error, macro_controller_f(f_fss_count_lines)); - return state.status; + return; } actions->array[actions->used].type = type; actions->array[actions->used].line += ++item->line; actions->array[actions->used].status = F_known_not; - state.status = controller_rule_parameters_read(main, cache->buffer_item, 0, &cache->content_action, &actions->array[actions->used], &state); + controller_rule_parameters_read(main, cache->buffer_item, 0, &cache->content_action, &actions->array[actions->used], state); - if (F_status_is_error(state.status)) { - actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status)); + if (F_status_is_error(state->status)) { + actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status)); - return state.status; + return; } - actions->array[actions->used++].status = state.status; + actions->array[actions->used++].status = state->status; } } else { - state.status = F_data_not; + state->status = F_data_not; } } - if (F_status_is_error_not(state.status) && state.status == F_data_not) { + if (F_status_is_error_not(state->status) && state->status == F_data_not) { controller_print_debug_rule_action_empty(&main->program.debug, cache); } - - return state.status; } #endif // _di_controller_rule_action_read_ @@ -444,13 +467,13 @@ extern "C" { controller_print_error_rule_action_positive_number_not(&main->program.error, &cache->action, name, cache->buffer_item, cache->content_action, *index, status); } } - - return status; + } + else { + *number = (f_number_unsigned_t) parsed; + status = F_okay; } - *number = (f_number_unsigned_t) parsed; - - return F_okay; + return status; } #endif // _di_controller_rule_action_read_rerun_number_ diff --git a/sources/c/main/rule/action.h b/sources/c/main/rule/action.h index 1ea5ea3..9daeedb 100644 --- a/sources/c/main/rule/action.h +++ b/sources/c/main/rule/action.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the rule "action" functionality. + * Provides the Rule "action" functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,10 +17,10 @@ extern "C" { #endif /** - * Get a string representing the rule action method. + * Get a string representing the Rule Action method. * * @param type - * The rule action type code. + * The Rule Action type code. * * @return * The string with used > 0 on success. @@ -31,13 +31,13 @@ extern "C" { #endif // _di_controller_rule_action_method_name_ /** - * Convert the action type to an action execute type. + * Convert the Action type to an Action execute type. * * @param type - * The action type to convert from. + * The Action type to convert from. * * @return - * The converted action type, converted into an action execute type. + * The converted Action type, converted into an Action execute type. * * The code controller_rule_action_execute_type__enum_size_e is returned for unknown types. */ @@ -46,7 +46,7 @@ extern "C" { #endif // _di_controller_rule_action_type_to_action_execute_type_ /** - * Read the content within the buffer, processing the action (or a set of within a list) for the given item. + * Read the content within the buffer, processing the Action (or a set of within a list) for the given item. * * This will automatically increase the size of the actions array as needed. * @@ -61,12 +61,12 @@ extern "C" { * * Must not be NULL. * @param is_normal - * If TRUE, then process as if this operates during a normal operation (entry and control). - * If FALSE, then process as if this operates during a an exit operation. + * If TRUE, then process as if this operates during a normal operation (Entry and Control). + * If FALSE, then process as if this operates during a an Exit operation. * @param type - * The action type for this action or set of actions. + * The Action type for this Action or set of actions. * @param method - * The action method for this action or set of actions. + * The Action method for this Action or set of actions. * @param item * The processed item. * @@ -80,24 +80,28 @@ extern "C" { * This is expected to be set to a position immediately after a valid object read. * * Must not be NULL. + * @param state + * The state information. * - * @return - * F_okay on success. + * This alters state.status: + * F_okay on success. * - * Errors (with error bit) from: controller_rule_parameters_read(). - * Errors (with error bit) from: f_fss_count_lines(). - * Errors (with error bit) from: f_memory_array_increase_by(). + * Errors (with error bit) from: controller_rule_parameters_read(). + * Errors (with error bit) from: f_fss_count_lines(). + * Errors (with error bit) from: f_memory_array_increase_by(). + * + * Must not be NULL. * * @see controller_rule_parameters_read() * @see f_fss_count_lines() * @see f_memory_array_increase_by() */ #ifndef _di_controller_rule_action_read_ - extern f_status_t controller_rule_action_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, const uint8_t type, const uint8_t method, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range); + extern void controller_rule_action_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, const uint8_t type, const uint8_t method, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range, f_state_t * const state); #endif // _di_controller_rule_action_read_ /** - * Process a number from a rule file, incrementing index as necessary. + * Process a number from a Rule file, incrementing index as necessary. * * This prints error messages as necessary. * @@ -116,7 +120,7 @@ extern "C" { * @param name * The name representing the value whose number is being processed. * @param index - * The position within the content action array for some rule to process. + * The position within the content Action array for some Rule to process. * @param number * The processed number will be saved here. * diff --git a/sources/c/main/rule/execute.c b/sources/c/main/rule/execute.c index f73e1bb..9dc0fec 100644 --- a/sources/c/main/rule/execute.c +++ b/sources/c/main/rule/execute.c @@ -21,9 +21,9 @@ extern "C" { f_signal_set_empty(&signals.block); f_signal_set_fill(&signals.block_not); - f_string_maps_t environment = f_string_maps_t_initialize; + instance->environment.used = 0; - controller_execute_set_t execute_set = macro_controller_execute_set_t_initialize_1(0, 0, &environment, &signals, 0, fl_execute_as_t_initialize); + controller_execute_set_t execute_set = macro_controller_execute_set_t_initialize_1(0, 0, &instance->environment, &signals, 0, fl_execute_as_t_initialize); if (instance->rule.affinity.used) { execute_set.as.affinity = &instance->rule.affinity; @@ -72,152 +72,143 @@ extern "C" { execute_set.as.id_user = &instance->rule.user; } - if (instance->rule.has & controller_rule_has_environment_d) { - status = fl_environment_load_names(instance->rule.environment, &environment); + { + controller_entry_t * const entry = (instance->type == controller_instance_type_entry_e) + ? &main->process.entry + : (instance->type == controller_instance_type_exit_e) + ? &main->process.exit + : 0; - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(fl_environment_load_names), F_status_set_fine(status)); + if (instance->rule.has & controller_rule_has_environment_d) { + status = fl_environment_load_names(instance->rule.environment, &instance->environment); - return status; - } + if (F_status_is_error(status)) { + controller_print_error_status(&main->program.error, macro_controller_f(fl_environment_load_names), F_status_set_fine(status)); - // When a "define" from the entry/exit is in the "environment", add it to the exported environments (and overwrite any existing environment variable of the same name). - controller_entry_t *entry = 0; + return status; + } - if (instance->type == controller_instance_type_entry_e) { - entry = &main->process.entry; - } - else if (instance->type == controller_instance_type_exit_e) { - entry = &main->process.exit; - } + // When a "define" from the entry/exit is in the "environment", add it to the exported environments (and overwrite any existing environment variable of the same name). + if (entry) { + for (i = 0; i < entry->define.used; ++i) { - if (entry) { - for (i = 0; i < entry->define.used; ++i) { + for (j = 0; j < instance->rule.environment.used; ++j) { - for (j = 0; j < instance->rule.environment.used; ++j) { + if (f_compare_dynamic(entry->define.array[i].key, instance->rule.environment.array[j]) == F_equal_to) { + for (k = 0; k < instance->environment.used; ++k) { + + if (f_compare_dynamic(entry->define.array[i].key, instance->environment.array[k].key) == F_equal_to) { + instance->environment.array[k].value.used = 0; + + status = f_string_dynamic_append(entry->define.array[i].value, &instance->environment.array[k].value); + + 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)); - if (f_compare_dynamic(entry->define.array[i].key, instance->rule.environment.array[j]) == F_equal_to) { - for (k = 0; k < environment.used; ++k) { + return status; + } - if (f_compare_dynamic(entry->define.array[i].key, environment.array[k].key) == F_equal_to) { - environment.array[k].value.used = 0; + break; + } + } // for - status = f_string_dynamic_append(entry->define.array[i].value, &environment.array[k].value); + if (k == instance->environment.used) { + status = f_string_maps_append(entry->define.array[i], &instance->environment); 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_maps_append), F_status_set_fine(status)); return status; } - - break; } - } // for - if (k == environment.used) { - status = f_string_maps_append(entry->define.array[i], &environment); + break; + } + } // for + } // for + } - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status)); + // When a "define" is in the "environment", add it to the exported environments (and overwrite any existing environment variable of the same name). + for (i = 0; i < instance->rule.define.used; ++i) { - return status; - } - } + for (j = 0; j < instance->rule.environment.used; ++j) { - break; - } - } // for - } // for - } + if (f_compare_dynamic(instance->rule.define.array[i].key, instance->rule.environment.array[j]) == F_equal_to) { - // When a "define" is in the "environment", add it to the exported environments (and overwrite any existing environment variable of the same name). - for (i = 0; i < instance->rule.define.used; ++i) { + for (k = 0; k < instance->environment.used; ++k) { - for (j = 0; j < instance->rule.environment.used; ++j) { + if (f_compare_dynamic(instance->rule.define.array[i].key, instance->environment.array[k].key) == F_equal_to) { - if (f_compare_dynamic(instance->rule.define.array[i].key, instance->rule.environment.array[j]) == F_equal_to) { + instance->environment.array[k].value.used = 0; - for (k = 0; k < environment.used; ++k) { + status = f_string_dynamic_append(instance->rule.define.array[i].value, &instance->environment.array[k].value); - if (f_compare_dynamic(instance->rule.define.array[i].key, environment.array[k].key) == F_equal_to) { + 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)); - environment.array[k].value.used = 0; + return status; + } - status = f_string_dynamic_append(instance->rule.define.array[i].value, &environment.array[k].value); + break; + } + } // for + + if (k == instance->environment.used) { + status = f_string_maps_append(instance->rule.define.array[i], &instance->environment); 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_maps_append), F_status_set_fine(status)); return status; } - - break; } - } // for - - if (k == environment.used) { - status = f_string_maps_append(instance->rule.define.array[i], &environment); - - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status)); - return status; - } + break; } - - break; - } + } // for } // for - } // for - } - else { - controller_entry_t *entry = 0; - - if (instance->type == controller_instance_type_entry_e) { - entry = &main->process.entry; - } - else if (instance->type == controller_instance_type_exit_e) { - entry = &main->process.exit; } + else { - // When a custom define is specified, it needs to be exported into the environment. - if (entry->define.used || instance->rule.define.used) { + // When a custom define is specified, it needs to be exported into the environment. + if (entry->define.used || instance->rule.define.used) { - // Copy all environment variables over when a custom define is used. - status = f_environment_get_all(&environment); + // Copy all environment variables over when a custom define is used. + status = f_environment_get_all(&instance->environment); - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_environment_get_all), F_status_set_fine(status)); + if (F_status_is_error(status)) { + controller_print_error_status(&main->program.error, macro_controller_f(f_environment_get_all), F_status_set_fine(status)); - return status; - } + return status; + } - for (i = 0; i < entry->define.used; ++i) { + for (i = 0; i < entry->define.used; ++i) { - status = f_string_maps_append(entry->define.array[i], &environment); + status = f_string_maps_append(entry->define.array[i], &instance->environment); - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status)); + if (F_status_is_error(status)) { + controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status)); - return status; - } - } // for + return status; + } + } // for - for (i = 0; i < instance->rule.define.used; ++i) { + for (i = 0; i < instance->rule.define.used; ++i) { - status = f_string_maps_append(instance->rule.define.array[i], &environment); + status = f_string_maps_append(instance->rule.define.array[i], &instance->environment); - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status)); + if (F_status_is_error(status)) { + controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status)); - return status; - } - } // for - } - else { + return status; + } + } // for + } + else { - // When no custom environment variables are defined, just let the original environment pass through. - execute_set.parameter.environment = 0; + // When no custom environment variables are defined, just let the original environment pass through. + execute_set.parameter.environment = 0; + } } } @@ -414,8 +405,6 @@ extern "C" { } } // for - f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &environment.array, &environment.used, &environment.size, &f_string_maps_delete_callback); - // Lock failed, attempt to re-establish lock before returning. if (F_status_set_fine(status) == F_lock) { status = controller_lock_read(instance->type != controller_instance_type_exit_e, &main->thread, &instance->lock); @@ -424,6 +413,10 @@ extern "C" { success = F_false; } + if (success == false && !instance->rule.items.used) { + controller_print_error_rule_item_execute_none(&main->program.error, &instance->cache.action, instance->rule.alias); + } + if (!controller_thread_is_enabled_instance(instance)) return F_status_set_error(F_interrupt); if (status == F_child || F_status_is_error(status)) return status; if (success == F_false || success == F_failure) return F_status_set_error(F_failure); @@ -737,7 +730,7 @@ extern "C" { controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_true); } - // The child instance should perform the change into background, therefore it is safe to wait for the child to exit (another instance is spawned). + // The child instance should perform the change into background, therefore it is safe to wait for the child to Exit (another instance is spawned). if (F_status_set_fine(status_lock) != F_interrupt) { waitpid(id_child, &result.status, 0); } diff --git a/sources/c/main/rule/execute.h b/sources/c/main/rule/execute.h index c2d3e86..4fa12be 100644 --- a/sources/c/main/rule/execute.h +++ b/sources/c/main/rule/execute.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the rule "execute" functionality. + * Provides the Rule "execute" functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,7 +17,7 @@ extern "C" { #endif /** - * Perform an execution of the given rule. + * Perform an execution of the given Rule. * * This requires that a read lock be set on process->lock before being called. * @@ -28,9 +28,9 @@ extern "C" { * * This does not alter main.setting.state.status. * @param action - * The action to perform based on the action type codes. + * The Action to perform based on the Action type codes. * - * Only subset of the action type codes are supported: + * Only subset of the Action type codes are supported: * - controller_rule_action_type_kill_e * - controller_rule_action_type_pause_e * - controller_rule_action_type_reload_e @@ -40,29 +40,29 @@ extern "C" { * - controller_rule_action_type_stop_e * @param options * Process options to consider when executing. - * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule). + * If bit controller_instance_option_simulate_e, then the Rule execution is in simulation mode (printing a message that the Rule would be executed but does not execute the rule). * @param process - * The process data for processing this rule. + * The process data for processing this Rule. * * @return * F_okay on success. * F_child on child process exiting. - * F_ignore if the rule is unknown and nothing can be done. + * F_ignore if the Rule is unknown and nothing can be done. * * F_failure (with error bit) if failed to execute. * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. * F_lock (with error bit) if failed to re-establish read lock on process->lock while returning. * - * On success and the rule is run synchronously, then the individual status for the rule is set to F_complete. - * On success and the rule is run asynchronously, then the individual status for the rule is set to F_busy. - * On failure, the individual status for the rule is set to an appropriate error status. + * On success and the Rule is run synchronously, then the individual status for the Rule is set to F_complete. + * On success and the Rule is run asynchronously, then the individual status for the Rule is set to F_busy. + * On failure, the individual status for the Rule is set to an appropriate error status. */ #ifndef _di_controller_rule_execute_ extern f_status_t controller_rule_execute(controller_t * const main, const uint8_t action, const uint8_t options, controller_instance_t * const instance); #endif // _di_controller_rule_execute_ /** - * Perform an execution of the given rule in the foreground. + * Perform an execution of the given Rule in the foreground. * * This requires that a read lock be set on process->lock before being called. * @@ -74,11 +74,11 @@ extern "C" { * The arguments to pass to the program. * @param options * Process options to consider when executing. - * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule). + * If bit controller_instance_option_simulate_e, then the Rule execution is in simulation mode (printing a message that the Rule would be executed but does not execute the rule). * @param execute_set * The execute parameter and as settings. * @param process - * The process data for processing this rule. + * The process data for processing this Rule. * * @return * F_okay on success. @@ -96,12 +96,12 @@ extern "C" { #endif // _di_controller_rule_execute_foreground_ /** - * Perform an execution of the given rule in the foreground or background and creating a PID file. + * Perform an execution of the given Rule in the foreground or background and creating a PID file. * * This requires that a read lock be set on process->lock before being called. * * When this is synchronous, this will wait for the PID file to be generated before continuing. - * When this is asynchronous, this will continue on adding the rule id and action to the asynchronous list. + * When this is asynchronous, this will continue on adding the Rule id and Action to the asynchronous list. * * @param pid_file * The path to the PID file. @@ -113,13 +113,13 @@ extern "C" { * The arguments to pass to the program. * @param options * Process options to consider when executing. - * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule). + * If bit controller_instance_option_simulate_e, then the Rule execution is in simulation mode (printing a message that the Rule would be executed but does not execute the rule). * @param with * The "with" option flags. * @param execute_set * The execute parameter and as settings. * @param process - * The process data for processing this rule. + * The process data for processing this Rule. * * @return * F_okay on success. @@ -138,10 +138,10 @@ extern "C" { #endif // _di_controller_rule_execute_pid_with_ /** - * Determine whether or not an execute rule should be re-run, applying a delay as requested. + * Determine whether or not an execute Rule should be re-run, applying a delay as requested. * * @param instance - * The instance data for processing this rule. + * The instance data for processing this Rule. * * Must not be NULL. * @param item @@ -149,7 +149,7 @@ extern "C" { * * Must not be NULL. * @param action - * The action type. + * The Action type. * * @return * A positive number to designate re-run. diff --git a/sources/c/main/rule/expand.h b/sources/c/main/rule/expand.h index 97a819d..616b1e1 100644 --- a/sources/c/main/rule/expand.h +++ b/sources/c/main/rule/expand.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the rule "expand" functionality. + * Provides the Rule "expand" functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -26,7 +26,7 @@ extern "C" { * * This does not alter main.setting.state.status. * @param action - * The rule action data. + * The Rule Action data. * @param process * The process information. * diff --git a/sources/c/main/rule/instance.c b/sources/c/main/rule/instance.c index 47b7631..1ca940f 100644 --- a/sources/c/main/rule/instance.c +++ b/sources/c/main/rule/instance.c @@ -84,7 +84,7 @@ extern "C" { break; default: - controller_print_error_rule_action_type_unsupported(&main->program.error, &instance->cache.action, controller_convert_rule_action_type_string(instance->action), "validate rule execution"); + controller_print_error_rule_action_type_unsupported(&main->program.error, &instance->cache.action, controller_convert_rule_action_type_string(instance->action), "validate Fule execution"); break; } @@ -240,7 +240,7 @@ extern "C" { if (found) { - // The dependency may have write locks, which needs to be avoided, so copy the alias from the rule. + // The dependency may have write locks, which needs to be avoided, so copy the alias from the Rule. f_string_static_t alias_other_buffer = f_string_static_t_initialize; alias_other_buffer.used = main->process.rules.array[id_rule].alias.used; @@ -415,7 +415,7 @@ extern "C" { if (!(instance->options & controller_instance_option_validate_e) && F_status_is_error_not(status)) { - // Find at least one of the requested action when the rule is required. + // Find at least one of the requested Action when the Rule is required. if (instance->options & controller_instance_option_require_e) { bool missing = F_true; @@ -488,7 +488,7 @@ extern "C" { return F_status_set_error(F_lock); } - // Update the rule status, which is stored separately from the rule status for this instance. + // Update the Rule status, which is stored separately from the Rule status for this instance. if (controller_rule_find(instance->rule.alias, main->process.rules, &id_rule) == F_true) { controller_rule_t * const rule = &main->process.rules.array[id_rule]; @@ -498,7 +498,7 @@ extern "C" { controller_rule_item_t *rule_item = 0; - // Copy all Rule Item Action statuses from the rule instance to the rule. + // Copy all Rule Item Action statuses from the Rule instance to the Rule. for (i = 0; i < rule->items.used; ++i) { rule_item = &rule->items.array[i]; @@ -829,7 +829,7 @@ extern "C" { } else if (!instance->action) { - // This is a "consider" Action, so do not actually execute the rule. + // This is a "consider" Action, so do not actually execute the Rule. f_thread_unlock(&instance->lock); if (options_force & controller_instance_option_asynchronous_e) { diff --git a/sources/c/main/rule/instance.h b/sources/c/main/rule/instance.h index 5e9df5e..71b9455 100644 --- a/sources/c/main/rule/instance.h +++ b/sources/c/main/rule/instance.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the rule "instance" functionality. + * Provides the Rule "instance" functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,19 +17,19 @@ extern "C" { #endif /** - * Process and execute the given rule. + * Process and execute the given Rule. * - * Any dependent rules are processed and executed as per "need", "want", and "wish" rule settings. + * Any dependent rules are processed and executed as per "need", "want", and "wish" Rule settings. * All dependent rules must be already loaded, this function will not load any rules. * * This requires that a read lock be set on instance->lock before being called. * * This function is recursively called for each "need", "want", and "wish", and has a max recursion length of the max size of the f_number_unsigneds_t array. * - * The rule status will be updated by this function. + * The Rule status will be updated by this function. * * @param instance - * The instance data for processing this rule. + * The instance data for processing this Rule. * * Must not be NULL. * @@ -49,7 +49,7 @@ extern "C" { #endif // _di_controller_rule_instance_ /** - * Synchronously or asynchronously begin processing some rule. + * Synchronously or asynchronously begin processing some Rule. * * @param main * The main program data. @@ -69,20 +69,20 @@ extern "C" { * @param alias_rule * The alias of the rule, such as "boot/init". * @param action - * The action to perform based on the action type codes. + * The Action to perform based on the Action type codes. * @param options * The instance options to pass to the instance. * @param type * The instance type, such as controller_instance_type_entry_e. * @param stack - * A stack representing the instances already running in this rule instance dependency tree. + * A stack representing the instances already running in this Rule instance dependency tree. * This is used to prevent circular dependencies. * * @return * F_okay on success. * F_busy on success and the instance is found to already be running (nothing to do). * - * F_found_not (with error bit) if unable to for a instance for the given rule id. + * F_found_not (with error bit) if unable to for a instance for the given Rule ID. * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. * F_recurse (with error bit) on recursion error (the instance is already on the instance stack). * @@ -104,7 +104,7 @@ extern "C" { * Perform the work * * This does all the preparation work that needs to be synchronously performed within the same thread. - * This will copy the rule by the alias to the instance structure. + * This will copy the Rule by the alias to the instance structure. * * @param options_force * Force the given instance options, only supporting a subset of instance options. @@ -121,7 +121,7 @@ extern "C" { * F_found on the instance was found to already be running (nothing to do). * F_process_not if the instance was not executed because it is a "consider" Action. * - * F_found_not (with error bit) if unable to for a instance for the given rule id. + * F_found_not (with error bit) if unable to for a instance for the given Rule ID. * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. * * Status from: controller_rule_instance(). diff --git a/sources/c/main/rule/is.h b/sources/c/main/rule/is.h index cbd6705..83414f3 100644 --- a/sources/c/main/rule/is.h +++ b/sources/c/main/rule/is.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the rule "is" functionality. + * Provides the Rule "is" functionality. * * This is auto-included and should not need to be explicitly included. */ diff --git a/sources/c/main/rule/item.c b/sources/c/main/rule/item.c index 6822344..6d78242 100644 --- a/sources/c/main/rule/item.c +++ b/sources/c/main/rule/item.c @@ -5,32 +5,36 @@ extern "C" { #endif #ifndef _di_controller_rule_item_read_ - f_status_t controller_rule_item_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, controller_rule_item_t * const item) { + void controller_rule_item_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, controller_rule_item_t * const item, f_state_t * const state) { - if (!main || !cache || !item) return F_status_set_error(F_parameter); + if (!state) return; + + if (!main || !cache || !item) { + state->status = F_status_set_error(F_parameter); + + return; + } - controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, main); - f_state_t state = macro_f_state_t_initialize_1(controller_allocation_large_d, controller_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); f_range_t range = macro_f_range_t_initialize_2(cache->buffer_item.used); f_number_unsigned_t last = 0; uint8_t type = 0; uint8_t method = 0; - bool multiple = F_false; + uint8_t multiple = F_false; item->actions.used = 0; for (; range.start < cache->buffer_item.used && range.start <= range.stop; last = range.start, cache->delimits.used = 0, cache->comments.used = 0) { - fl_fss_extended_list_object_read(cache->buffer_item, &range, &cache->range_action, &cache->delimits, &state); + fl_fss_extended_list_object_read(cache->buffer_item, &range, &cache->range_action, &cache->delimits, state); - if (F_status_is_error(state.status)) { - controller_print_error_status(&main->program.error, macro_controller_f(fl_fss_extended_list_object_read), F_status_set_fine(state.status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, macro_controller_f(fl_fss_extended_list_object_read), F_status_set_fine(state->status)); break; } - if (state.status == F_fss_found_object) { + if (state->status == F_fss_found_object) { multiple = F_true; } else { @@ -39,30 +43,30 @@ extern "C" { cache->delimits.used = 0; // The current line is not an Extended List object, so the next possibility is a Basic List (and Extended List, both use the same Object structure). - fl_fss_extended_object_read(cache->buffer_item, &range, &cache->range_action, 0, &cache->delimits, &state); + fl_fss_extended_object_read(cache->buffer_item, &range, &cache->range_action, 0, &cache->delimits, state); - if (F_status_is_error(state.status)) { - controller_print_error_status(&main->program.error, macro_controller_f(fl_fss_extended_object_read), F_status_set_fine(state.status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, macro_controller_f(fl_fss_extended_object_read), F_status_set_fine(state->status)); break; } // Nothing of importance here, so continue onto the next line. - if (state.status != F_fss_found_object) continue; + if (state->status != F_fss_found_object) continue; } - f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state); + f_fss_apply_delimit(cache->delimits, &cache->buffer_item, state); - if (F_status_is_error(state.status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_fss_apply_delimit), F_status_set_fine(state.status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, macro_controller_f(f_fss_apply_delimit), F_status_set_fine(state->status)); break; } - f_fss_count_lines(cache->buffer_item, cache->range_action.start, &cache->action.line_action, &state); + f_fss_count_lines(cache->buffer_item, cache->range_action.start, &cache->action.line_action, state); - if (F_status_is_error(state.status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_fss_count_lines), F_status_set_fine(state.status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, macro_controller_f(f_fss_count_lines), F_status_set_fine(state->status)); break; } @@ -70,10 +74,10 @@ extern "C" { cache->action.line_action += ++item->line; cache->action.name_action.used = 0; - state.status = f_rip_dynamic_partial_nulless(cache->buffer_item, cache->range_action, &cache->action.name_action); + state->status = f_rip_dynamic_partial_nulless(cache->buffer_item, cache->range_action, &cache->action.name_action); - if (F_status_is_error(state.status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(state.status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(state->status)); break; } @@ -128,7 +132,7 @@ extern "C" { if (multiple) { if (type == controller_rule_action_type_group_e || type == controller_rule_action_type_pid_file_e || type == controller_rule_action_type_user_e) { - state.status = F_status_set_error(F_support_not); + state->status = F_status_set_error(F_support_not); controller_print_error_rule_action_fss_0003_unsupported(&main->program.error, &cache->action, cache->action.name_action); @@ -141,19 +145,17 @@ extern "C" { method = controller_rule_action_method_extended_e; } - state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &item->actions.array, &item->actions.used, &item->actions.size); + state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &item->actions.array, &item->actions.used, &item->actions.size); - if (F_status_is_error(state.status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(state.status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(state->status)); break; } - state.status = controller_rule_action_read(main, cache, is_normal, type, method, item, &item->actions, &range); - if (F_status_is_error(state.status)) break; + controller_rule_action_read(main, cache, is_normal, type, method, item, &item->actions, &range, state); + if (F_status_is_error(state->status)) break; } // for - - return state.status; } #endif // _di_controller_rule_item_read_ diff --git a/sources/c/main/rule/item.h b/sources/c/main/rule/item.h index 41114bb..b0317ca 100644 --- a/sources/c/main/rule/item.h +++ b/sources/c/main/rule/item.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the rule "item" functionality. + * Provides the Rule "item" functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,7 +17,7 @@ extern "C" { #endif /** - * Read the content within the buffer, extracting all valid items after determining their type for some rule file. + * Read the content within the buffer, extracting all valid items after determining their type for some Rule file. * * This will perform additional FSS read functions as appropriate. * @@ -28,26 +28,30 @@ extern "C" { * * This does not alter main.setting.state.status. * @param is_normal - * If TRUE, then process as if this operates during a normal operation (entry and control). - * If FALSE, then process as if this operates during a an exit operation. + * If TRUE, then process as if this operates during a normal operation (Entry and Control). + * If FALSE, then process as if this operates during a an Exit operation. * @param cache * A structure for containing and caching relevant data. * @param item * The processed item. + * @param state + * The state information. * - * @return - * F_okay on success. - * F_valid_not (with error bit) on invalid data. + * This alters state.status: + * F_okay on success. + * F_valid_not (with error bit) on invalid data. * - * Errors (with error bit) from: f_fss_count_lines(). - * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * Errors (with error bit) from: f_fss_count_lines(). + * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * + * Must not be NULL. * * @see controller_rule_action_read() * @see f_fss_count_lines() * @see f_string_dynamic_partial_append_nulless() */ #ifndef _di_controller_rule_item_read_ - extern f_status_t controller_rule_item_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, controller_rule_item_t * const item); + extern void controller_rule_item_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, controller_rule_item_t * const item, f_state_t * const state); #endif // _di_controller_rule_item_read_ #ifdef __cplusplus diff --git a/sources/c/main/rule/parameter.c b/sources/c/main/rule/parameter.c index 1401e41..303b702 100644 --- a/sources/c/main/rule/parameter.c +++ b/sources/c/main/rule/parameter.c @@ -5,36 +5,40 @@ extern "C" { #endif #ifndef _di_controller_rule_parameters_read_ - f_status_t controller_rule_parameters_read(controller_t * const main, const f_string_static_t buffer, f_range_t * const object, f_ranges_t * const content, controller_rule_action_t * const action, f_state_t * const state) { + void controller_rule_parameters_read(controller_t * const main, const f_string_static_t buffer, f_range_t * const object, f_ranges_t * const content, controller_rule_action_t * const action, f_state_t * const state) { - if (!main || !object || !content || !action || !state) return F_status_set_error(F_parameter); + if (!state) return; - f_status_t status = F_okay; + if (!main || !action) { + state->status = F_status_set_error(F_parameter); + + return; + } action->parameters.used = 0; action->ikis.used = 0; if (object && object->start <= object->stop) { if (content) { - status = f_memory_array_increase_by(content->used + 1, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); + state->status = f_memory_array_increase_by(content->used + 1, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); } else { - status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); + state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); } - if (F_status_is_error_not(status)) { + if (F_status_is_error_not(state->status)) { if (content) { - status = f_memory_array_increase_by(content->used + 1, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); + state->status = f_memory_array_increase_by(content->used + 1, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); } else { - status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); + state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); } } - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, content ? macro_controller_f(f_memory_array_increase_by) : macro_controller_f(f_memory_array_increase), F_status_set_fine(status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, content ? macro_controller_f(f_memory_array_increase_by) : macro_controller_f(f_memory_array_increase), F_status_set_fine(state->status)); - return status; + return; } action->parameters.array[action->parameters.used].used = 0; @@ -43,12 +47,12 @@ extern "C" { action->ikis.array[action->ikis.used].variable.used = 0; action->ikis.array[action->ikis.used].vocabulary.used = 0; - status = f_string_dynamic_partial_append_nulless(buffer, *object, &action->parameters.array[0]); + state->status = f_string_dynamic_partial_append_nulless(buffer, *object, &action->parameters.array[0]); - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(state->status)); - return status; + return; } ++action->parameters.used; @@ -56,18 +60,26 @@ extern "C" { } if (content && content->used) { - status = f_memory_array_increase_by(content->used, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); + state->status = f_memory_array_increase_by(content->used, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); - if (F_status_is_error_not(status)) { - status = f_memory_array_increase_by(content->used, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); + if (F_status_is_error_not(state->status)) { + state->status = f_memory_array_increase_by(content->used, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); } - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(state->status)); - return status; + return; } + const uint16_t old_step_large = state->step_large; + const uint16_t old_step_small = state->step_small; + void * const old_interrupt = state->interrupt; + + state->step_large = controller_allocation_iki_large_d; + state->step_small = controller_allocation_iki_small_d; + state->interrupt = &controller_thread_signal_state_iki; + f_range_t range = f_range_t_initialize; for (f_number_unsigned_t i = 0; i < content->used; ++i) { @@ -80,12 +92,12 @@ extern "C" { action->ikis.array[action->ikis.used].variable.used = 0; action->ikis.array[action->ikis.used].vocabulary.used = 0; - status = f_string_dynamic_partial_append_nulless(buffer, content->array[i], &action->parameters.array[action->parameters.used]); + state->status = f_string_dynamic_partial_append_nulless(buffer, content->array[i], &action->parameters.array[action->parameters.used]); - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(state->status)); - return status; + break; } if (action->parameters.array[action->parameters.used].used) { @@ -94,21 +106,27 @@ extern "C" { fl_iki_read(&action->parameters.array[action->parameters.used], &range, &action->ikis.array[action->ikis.used], state); - if (F_status_is_error(status)) { - controller_print_error_status(&main->program.error, macro_controller_f(fl_iki_read), F_status_set_fine(status)); + if (F_status_is_error(state->status)) { + controller_print_error_status(&main->program.error, macro_controller_f(fl_iki_read), F_status_set_fine(state->status)); action->parameters.array[action->parameters.used].used = 0; - return status; + break; } } ++action->parameters.used; ++action->ikis.used; } // for + + state->step_large = old_step_large; + state->step_small = old_step_small; + state->interrupt = old_interrupt; } - return F_okay; + if (F_status_is_error_not(state->status)) { + state->status = F_okay; + } } #endif // _di_controller_rule_parameters_read_ diff --git a/sources/c/main/rule/parameter.h b/sources/c/main/rule/parameter.h index 4924207..87ac350 100644 --- a/sources/c/main/rule/parameter.h +++ b/sources/c/main/rule/parameter.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the rule "parameter" functionality. + * Provides the Rule "parameter" functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,7 +17,7 @@ extern "C" { #endif /** - * Read the parameters for some rule action. + * Read the parameters for some Rule Action. * * The object and content ranges are merged together (in that order) as the action parameters. * @@ -31,24 +31,26 @@ extern "C" { * The buffer containing the content. * @param object * (optional) The range representing where the object is found within the buffer. - * Set pointer address to 0 to disable. + * + * Set to NULL to disable. * @param content * (optional) The ranges representing where the content is found within the buffer. - * Set pointer address to 0 to disable. + * + * Set to NULL to disable. * @param action - * The rule action. + * The Rule Action. * @param state * The state data for passing to fl_iki_read(). * - * @return - * F_okay on success. + * This alters state.status: + * F_okay on success. * - * Errors (with error bit) from: f_fss_count_lines(). - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: fl_iki_read(). + * Errors (with error bit) from: f_fss_count_lines(). + * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_memory_array_increase_by(). + * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). + * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: fl_iki_read(). * * @see f_fss_count_lines() * @see f_memory_array_increase() @@ -59,7 +61,7 @@ extern "C" { * @see fl_iki_read() */ #ifndef _di_controller_rule_parameters_read_ - extern f_status_t controller_rule_parameters_read(controller_t * const main, const f_string_static_t buffer, f_range_t * const object, f_ranges_t * const content, controller_rule_action_t * const action, f_state_t * const state); + extern void controller_rule_parameters_read(controller_t * const main, const f_string_static_t buffer, f_range_t * const object, f_ranges_t * const content, controller_rule_action_t * const action, f_state_t * const state); #endif // _di_controller_rule_parameters_read_ #ifdef __cplusplus diff --git a/sources/c/main/rule/read.c b/sources/c/main/rule/read.c index 24b6450..90c0e00 100644 --- a/sources/c/main/rule/read.c +++ b/sources/c/main/rule/read.c @@ -296,7 +296,7 @@ extern "C" { rule->items.array[rule->items.used].with |= controller_with_session_same_d; } - state.status = controller_rule_item_read(main, cache, is_normal, &rule->items.array[rule->items.used]); + controller_rule_item_read(main, cache, is_normal, &rule->items.array[rule->items.used], &state); if (F_status_is_error(state.status)) break; ++rule->items.used; diff --git a/sources/c/main/rule/read.h b/sources/c/main/rule/read.h index 5c23160..3133c1b 100644 --- a/sources/c/main/rule/read.h +++ b/sources/c/main/rule/read.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the rule "read" functionality. + * Provides the Rule "read" functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -17,7 +17,7 @@ extern "C" { #endif /** - * Read the rule file, extracting all valid items. + * Read the Rule file, extracting all valid items. * * @param main * The main program data. @@ -26,19 +26,19 @@ extern "C" { * * This does not alter main.setting.state.status. * @param is_normal - * If TRUE, then process as if this operates during a normal operation (entry and control). - * If FALSE, then process as if this operates during a an exit operation. + * If TRUE, then process as if this operates during a normal operation (Entry and Control). + * If FALSE, then process as if this operates during a an Exit operation. * @param alias - * The string identifying the rule. + * The string identifying the Rule. * This is constructed from the path parts to the file without the file extension and without the settings directory prefix. - * "/etc/controller/rules/example/my.rule" would have a rule id of "example/my". + * "/etc/controller/rules/example/my.rule" would have a Rule id of "example/my". * @param cache * A structure for containing and caching relevant data. * @param entry - * The entry containing the rule being read. + * The Entry containing the Rule being read. * @param rule - * The processed rule. - * The rule status will be updated by this function. + * The processed Rule. + * The Rule status will be updated by this function. * * @return * F_okay on success. diff --git a/sources/c/main/rule/setting.h b/sources/c/main/rule/setting.h index 7541cec..c0d3b7d 100644 --- a/sources/c/main/rule/setting.h +++ b/sources/c/main/rule/setting.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the rule "setting" functionality. + * Provides the Rule "setting" functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -20,7 +20,7 @@ extern "C" { * Identify the Rule Item code the given name represents. * * @param item - * The string representing an rule action. + * The string representing an Rule Action. * * @return * The Rule Item type code on success. @@ -31,10 +31,10 @@ extern "C" { #endif // _di_controller_rule_setting_limit_type_identify_ /** - * Get a string representing the rule setting limit type. + * Get a string representing the Rule setting limit type. * * @param type - * The rule setting limit type code. + * The Rule setting limit type code. * * @return * The string with used > 0 on success. @@ -93,12 +93,12 @@ extern "C" { * * This does not alter main.setting.state.status. * @param is_normal - * If TRUE, then process as if this operates during a normal operation (entry and control). - * If FALSE, then process as if this operates during a an exit operation. + * If TRUE, then process as if this operates during a normal operation (Entry and Control). + * If FALSE, then process as if this operates during a an Exit operation. * @param cache * A structure for containing and caching relevant data. * @param rule - * The processed rule. + * The processed Rule. * * @return * F_okay on success. diff --git a/sources/c/main/rule/wait.h b/sources/c/main/rule/wait.h index 913f68d..72d555a 100644 --- a/sources/c/main/rule/wait.h +++ b/sources/c/main/rule/wait.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the rule "wait" functionality. + * Provides the Rule "wait" functionality. * * This is auto-included and should not need to be explicitly included. */ @@ -26,17 +26,17 @@ extern "C" { * * This does not alter main.setting.state.status. * @param is_normal - * If TRUE, then process as if this operates during a normal operation (entry and control). - * If FALSE, then process as if this operates during a an exit operation. + * If TRUE, then process as if this operates during a normal operation (Entry and Control). + * If FALSE, then process as if this operates during an Exit operation. * This is ignored when caller is not NULL. * @param required - * If TRUE, then only process required rules and if a required rule has failed, return. + * If TRUE, then only process required rules and if a required Rule has failed, return. * If FALSE, process all waits, returning normally (required rules still result in failure). * * @return * F_okay on success. * F_data_not on success and nothing to do. - * F_require on success, but a required rule has not been run yet. + * F_require on success, but a required Rule has not been run yet. * * F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal. * F_require (with error bit set) if a required process is in failed status when required is TRUE. @@ -57,7 +57,7 @@ extern "C" { * @param type * The process type to use when checking if thread is enabled. * @param required - * If TRUE, then only process required rules and if a required rule has failed, return. + * If TRUE, then only process required rules and if a required Rule has failed, return. * If FALSE, process all waits, returning normally. * * @return diff --git a/sources/c/main/thread/entry.h b/sources/c/main/thread/entry.h index 04a02b3..5879e69 100644 --- a/sources/c/main/thread/entry.h +++ b/sources/c/main/thread/entry.h @@ -17,10 +17,10 @@ extern "C" { #endif /** - * Thread for handling entry processing. + * Thread for handling Entry processing. * - * This acts as the main rule thread during entry processing. - * This runs all synchronous rules or spawns asynchronous rules. + * This acts as the main Rule thread during Entry processing. + * This runs all synchronous Rules or spawns asynchronous rules. * * @param arguments * The main program data. @@ -36,12 +36,12 @@ extern "C" { #endif // _di_controller_thread_entry_ /** - * Thread for handling exit file processing. + * Thread for handling Exit file processing. * - * This acts as the main rule thread during exit processing. - * This runs all synchronous rules or spawns asynchronous rules. + * This acts as the main Rule thread during Exit processing. + * This runs all synchronous Rules or spawns asynchronous rules. * - * Do not confuse this with exiting a thread, this is the what process the exit files (similar to that of an entry file). + * Do not confuse this with exiting a thread, this is the what process the Exit files (similar to that of an Entry file). * Exit files process the "stop" action, whereas the Entry files process the "start" Action * * @param argument diff --git a/sources/c/main/thread/instance.c b/sources/c/main/thread/instance.c index 8d484d0..c486694 100644 --- a/sources/c/main/thread/instance.c +++ b/sources/c/main/thread/instance.c @@ -125,7 +125,7 @@ extern "C" { instance = main->thread.instances.array[i]; - // Do not cancel exit instances, when not performing "execute" during exit. + // Do not cancel Exit instances, when not performing "execute" during exit. if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) { continue; } @@ -219,7 +219,7 @@ extern "C" { instance = main->thread.instances.array[i]; - // Do not kill exit instances, when not performing "execute" during exit. + // Do not kill Exit instances, when not performing "execute" during exit. if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) continue; if (instance->id_thread) { @@ -247,7 +247,7 @@ extern "C" { if (!(entry->flag & controller_entry_flag_timeout_exit_no_e)) { for (j = 0; j < instance->childs.size; ++j) { - // Do not kill exit processes, when not performing "execute" during exit. + // Do not kill Exit processes, when not performing "execute" during exit. if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) continue; if (instance->childs.array[j]) { @@ -265,7 +265,7 @@ extern "C" { if (!(entry->flag & controller_entry_flag_timeout_exit_no_e)) { for (j = 0; j < instance->path_pids.used; ++j) { - // Do not kill exit processes, when not performing "execute" during exit. + // Do not kill Exit processes, when not performing "execute" during exit. if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) continue; if (f_file_exists(instance->path_pids.array[j], F_true) == F_true) { @@ -284,7 +284,7 @@ extern "C" { // Shrink the child pids as much as possible. while (instance->childs.used) { - // Do not shrink below an exit instances, when not performing "execute" during exit. + // Do not shrink below an Exit instances, when not performing "execute" during exit. if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) break; if (instance->childs.array[j] > 0) break; @@ -294,7 +294,7 @@ extern "C" { // Shrink the path pids as much as possible. while (instance->path_pids.used) { - // Do not shrink below an exit instances, when not performing "execute" during exit. + // Do not shrink below an Exit instances, when not performing "execute" during exit. if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) break; if (instance->path_pids.array[j].used) break; @@ -313,7 +313,7 @@ extern "C" { if (main->process.ready == controller_process_ready_done_e) { - // The exit processing runs using the entry thread. + // The Exit processing runs using the Entry thread. if (main->thread.id_entry) { f_thread_cancel(main->thread.id_entry); f_thread_join(main->thread.id_entry, 0); @@ -338,21 +338,13 @@ extern "C" { f_thread_mutex_unlock(&main->thread.lock.alert); } - else { - main->thread.enabled = controller_thread_enabled_not_e; - } } else { f_time_spec_t time = f_time_spec_t_initialize; do { status = f_thread_mutex_lock(&main->thread.lock.alert); - - if (F_status_is_error(status)) { - main->thread.enabled = controller_thread_enabled_not_e; - - break; - } + if (F_status_is_error(status)) break; controller_time_now(controller_thread_exit_ready_timeout_seconds_d, controller_thread_exit_ready_timeout_nanoseconds_d, &time); @@ -368,9 +360,6 @@ extern "C" { f_thread_mutex_unlock(&main->thread.lock.alert); } - else { - main->thread.enabled = controller_thread_enabled_not_e; - } } } @@ -390,9 +379,6 @@ extern "C" { f_thread_mutex_unlock(&main->thread.lock.alert); } - else { - main->thread.enabled = controller_thread_enabled_not_e; - } } } #endif // _di_controller_thread_instance_exit_ diff --git a/sources/c/main/thread/instance.h b/sources/c/main/thread/instance.h index 273045f..35fc742 100644 --- a/sources/c/main/thread/instance.h +++ b/sources/c/main/thread/instance.h @@ -20,8 +20,8 @@ extern "C" { * Asynchronously execute a Rule process. * * @param is_normal - * If F_true, then process as if this operates during a normal operation (entry and control). - * If F_false, then process as if this operates during a an exit operation. + * If F_true, then process as if this operates during a normal operation (Entry and Control). + * If F_false, then process as if this operates during an Exit operation. * @param instance * The instance data. * @@ -43,8 +43,8 @@ extern "C" { * * This does not alter main.setting.state.status. * @param is_normal - * If F_true, then process as if this operates during a normal operation (entry and control). - * If F_false, then process as if this operates during a an exit operation. + * If F_true, then process as if this operates during a normal operation (Entry and Control). + * If F_false, then process as if this operates during an Exit operation. * @param by * Designate the way in which the cancellation should operate. * diff --git a/sources/c/main/thread/is.h b/sources/c/main/thread/is.h index c240adb..a5dc028 100644 --- a/sources/c/main/thread/is.h +++ b/sources/c/main/thread/is.h @@ -17,11 +17,11 @@ extern "C" { #endif /** - * Check to see if thread is enabled for the normal operations like entry and control or for exit operations. + * Check to see if thread is enabled for the normal operations like Entry and Control or for Exit operations. * * @param is_normal - * If TRUE, then instance as if this operates during a normal operation (entry and control). - * If FALSE, then instance as if this operates during a an exit operation. + * If TRUE, then instance as if this operates during a normal operation (Entry and Control). + * If FALSE, then instance as if this operates during an Exit operation. * @param thread * The thread data. * @@ -36,7 +36,7 @@ extern "C" { #endif // _di_controller_thread_is_enabled_ /** - * Check to see if thread is enabled for the normal operations like entry and control or for exit operations for some instance. + * Check to see if thread is enabled for the normal operations like Entry and Control or for Exit operations for some instance. * * @param instance * The instance to use when checking if thread is enabled. @@ -54,7 +54,7 @@ extern "C" { #endif // _di_controller_thread_is_enabled_instance_ /** - * Check to see if thread is enabled for the normal operations like entry and control or for exit operations for some instance type. + * Check to see if thread is enabled for the normal operations like Entry and Control or for Exit operations for some instance type. * * @param type * The instance type to use when checking if thread is enabled. diff --git a/sources/c/main/thread/rule.h b/sources/c/main/thread/rule.h index 4e4eb8b..897f41b 100644 --- a/sources/c/main/thread/rule.h +++ b/sources/c/main/thread/rule.h @@ -17,10 +17,10 @@ extern "C" { #endif /** - * Thread for handling rule processing. + * Thread for handling Rule processing. * - * This acts as the main rule thread after entry processing. - * This runs all synchronous rules or spawns asynchronous rules. + * This acts as the main Rule thread after Entry processing. + * This runs all synchronous Rules or spawns asynchronous rules. * * @todo the control thread should send commands to this thread, somehow. * diff --git a/sources/c/main/thread/signal.h b/sources/c/main/thread/signal.h index b1bbd63..ea2e925 100644 --- a/sources/c/main/thread/signal.h +++ b/sources/c/main/thread/signal.h @@ -20,8 +20,8 @@ * * Must not be NULL. * @param is_normal - * If TRUE, then process as if this operates during a normal operation (entry and control). - * If FALSE, then process as if this operates during a an exit operation. + * If TRUE, then process as if this operates during a normal operation (Entry and Control). + * If FALSE, then process as if this operates during an Exit operation. */ #ifndef _di_controller_thread_signal_ extern void controller_thread_signal(controller_t * const main, const uint8_t is_normal); -- 1.8.3.1