]> Kevux Git Server - controller/commitdiff
Progress: Continue migrating the project, notably refactoring out controller_global_t.
authorKevin Day <Kevin@kevux.org>
Sun, 2 Jun 2024 23:51:58 +0000 (18:51 -0500)
committerKevin Day <Kevin@kevux.org>
Sun, 2 Jun 2024 23:51:58 +0000 (18:51 -0500)
A lot of the changes made it possible to remove th controller_global_t.
Restructure the code to do this.

Most of the compile errors are fixed.

I still need to go over the logic and fix things.
I still need to copy over some functions.
I still need to move the print functions around.
I still need to do runtime tests once all of the above is completed.

79 files changed:
data/build/settings
sources/c/controller/main.c
sources/c/init/main.c
sources/c/main/common.c
sources/c/main/common.h
sources/c/main/common/enumeration/instance.h
sources/c/main/common/enumeration/process.h [new file with mode: 0644]
sources/c/main/common/enumeration/program.h [deleted file]
sources/c/main/common/print.c
sources/c/main/common/print.h
sources/c/main/common/type.c
sources/c/main/common/type.h
sources/c/main/common/type/defs.h
sources/c/main/common/type/global.h [deleted file]
sources/c/main/common/type/instance.h
sources/c/main/common/type/interrupt.c [moved from sources/c/main/common/type/global.c with 100% similarity]
sources/c/main/common/type/interrupt.h [new file with mode: 0644]
sources/c/main/common/type/process.c [new file with mode: 0644]
sources/c/main/common/type/process.h [moved from sources/c/main/common/type/program.h with 77% similarity]
sources/c/main/common/type/program.c [deleted file]
sources/c/main/controller.h
sources/c/main/file.c
sources/c/main/file.h
sources/c/main/instance/prepare.c
sources/c/main/instance/prepare.h
sources/c/main/instance/wait.c
sources/c/main/lock.c
sources/c/main/print/lock.c
sources/c/main/print/lock.h
sources/c/main/print/rule.c
sources/c/main/print/rule.h
sources/c/main/print/rule/action.c
sources/c/main/print/rule/action.h
sources/c/main/print/rule/item.c
sources/c/main/print/rule/item.h
sources/c/main/print/rule/setting.c
sources/c/main/print/rule/setting.h
sources/c/main/process.c
sources/c/main/process.h
sources/c/main/rule.c
sources/c/main/rule.h
sources/c/main/rule/action.c
sources/c/main/rule/action.h
sources/c/main/rule/execute.c
sources/c/main/rule/execute.h
sources/c/main/rule/expand.c
sources/c/main/rule/expand.h
sources/c/main/rule/instance.c
sources/c/main/rule/instance.h
sources/c/main/rule/is.h
sources/c/main/rule/item.c
sources/c/main/rule/item.h
sources/c/main/rule/parameter.c
sources/c/main/rule/parameter.h
sources/c/main/rule/read.c
sources/c/main/rule/read.h
sources/c/main/rule/setting.c
sources/c/main/rule/setting.h
sources/c/main/rule/validate.c
sources/c/main/rule/validate.h
sources/c/main/rule/wait.c
sources/c/main/rule/wait.h
sources/c/main/thread/cleanup.c
sources/c/main/thread/cleanup.h
sources/c/main/thread/control.c
sources/c/main/thread/control.h
sources/c/main/thread/entry.c
sources/c/main/thread/entry.h
sources/c/main/thread/instance.c
sources/c/main/thread/instance.h
sources/c/main/thread/is.c
sources/c/main/thread/rule.c
sources/c/main/thread/rule.h
sources/c/main/thread/signal.c
sources/c/main/thread/signal.h
sources/c/main/time.c
sources/c/main/time.h
sources/c/main/validate.c [new file with mode: 0644]
sources/c/main/validate.h [new file with mode: 0644]

index 3550b860c95f62e7e45da1a22439391617e40ab3..256af7105beea98ff977eb3693a8a918b8ad3be6 100644 (file)
@@ -41,7 +41,7 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0
 build_libraries-monolithic -lfll
 
 build_sources_library main/common.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c
-build_sources_library main/common/type/cache.c main/common/type/control.c main/common/type/entry.c main/common/type/execute.c main/common/type/global.c main/common/type/lock.c main/common/type/instance.c main/common/type/program.c main/common/type/rule.c main/common/type/thread.c
+build_sources_library main/common/type/cache.c main/common/type/control.c main/common/type/entry.c main/common/type/execute.c main/common/type/instance.c main/common/type/interrupt.c main/common/type/lock.c main/common/type/process.c main/common/type/rule.c main/common/type/thread.c
 build_sources_library main/common/string/general.c main/common/string/rule.c
 build_sources_library main/convert.c main/instance.c main/instance/prepare.c main/instance/wait.c
 build_sources_library main/file.c main/lock.c main/path.c main/process.c
@@ -50,12 +50,13 @@ build_sources_library main/print/action.c main/print/data.c main/print/debug.c m
 build_sources_library main/print/rule/action.c main/print/rule/item.c main/print/rule/setting.c
 build_sources_library main/signal.c main/time.c
 build_sources_library main/thread.c main/thread/cleanup.c main/thread/control.c main/thread/entry.c main/thread/instance.c main/thread/is.c main/thread/rule.c main/thread/signal.c
+build_sources_library main/validate.c
 
 build_sources_headers main/common.h main/controller.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/string.h main/common/thread.h main/common/type.h
 build_sources_headers main/common/define/control.h main/common/define/entry.h main/common/define/rule.h main/common/define/thread.h
-build_sources_headers main/common/enumeration/control.h main/common/enumeration/entry.h main/common/enumeration/instance.h main/common/enumeration/program.h main/common/enumeration/rule.h main/common/enumeration/thread.h
+build_sources_headers main/common/enumeration/control.h main/common/enumeration/entry.h main/common/enumeration/instance.h main/common/enumeration/process.h main/common/enumeration/rule.h main/common/enumeration/thread.h
 build_sources_headers main/common/string/general.h main/common/string/rule.h
-build_sources_headers main/common/type/cache.h main/common/type/control.h main/common/type/defs.h main/common/type/entry.h main/common/type/execute.h main/common/type/global.h main/common/type/lock.h main/common/type/instance.h main/common/type/program.h main/common/type/rule.h main/common/type/thread.h
+build_sources_headers main/common/type/cache.h main/common/type/control.h main/common/type/defs.h main/common/type/entry.h main/common/type/execute.h main/common/type/instance.h main/common/type/interrupt.h main/common/type/lock.h main/common/type/process.h main/common/type/rule.h main/common/type/thread.h
 build_sources_headers main/convert.h main/instance.h main/instance/prepare.h main/instance/wait.h
 build_sources_headers main/file.h main/lock.h main/path.h main/process.h
 build_sources_headers main/rule.h main/rule/action.h main/rule/execute.h main/rule/expand.h main/rule/instance.h main/rule/is.h main/rule/item.h main/rule/parameter.h main/rule/read.h main/rule/setting.h main/rule/validate.h main/rule/wait.h
@@ -63,6 +64,7 @@ build_sources_headers main/print/action.h main/print/data.h main/print/debug.h m
 build_sources_headers main/print/rule/action.h main/print/rule/item.h main/print/rule/setting.h
 build_sources_headers main/signal.h main/time.h
 build_sources_headers main/thread.h main/thread/cleanup.h main/thread/control.h main/thread/entry.h main/thread/instance.h main/thread/is.h main/thread/rule.h main/thread/signal.h
+build_sources_headers main/validate.h
 
 build_sources_documentation man
 
index a1fb0a776a3dcefae8efde2d1540289159e56d5c..dfcdf1433bc6f1d2875b27327378ea8a40121647 100644 (file)
@@ -3,7 +3,8 @@
 int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   controller_t data = controller_t_initialize;
-  controller_program_t program = controller_program_t_initialize;
+  controller_process_t process = controller_process_t_initialize;
+  controller_thread_t thread = controller_thread_t_initialize;
 
   data.program.debug.flag |= controller_print_flag_debug_e | controller_print_flag_out_e;
   data.program.error.flag |= controller_print_flag_error_e | controller_print_flag_out_e;
@@ -26,7 +27,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
     data.program.pipe = fll_program_data_pipe_input_e;
   }
 
+  data.process = &process;
   data.setting.flag |= controller_main_flag_interruptible_e;
+  data.thread = &thread;
 
   fll_program_standard_set_up(&data.program);
 
@@ -35,10 +38,10 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize_1(argc, argv, envp);
 
-    controller_setting_load(arguments, &data, &program);
+    controller_setting_load(arguments, &data);
   }
 
-  controller_process(&data, &program);
+  controller_process(&data);
 
   controller_delete(&data);
 
index c24452814bf6baaef4885163fc0218c54cff32bb..77cadd0f2f63e8fb41ae9af5a12d552e226ae7f9 100644 (file)
@@ -3,7 +3,8 @@
 int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   controller_t data = controller_t_initialize;
-  controller_program_t program = controller_program_t_initialize;
+  controller_process_t process = controller_process_t_initialize;
+  controller_thread_t thread = controller_thread_t_initialize;
 
   data.program.debug.flag |= controller_print_flag_debug_e | controller_print_flag_out_e;
   data.program.error.flag |= controller_print_flag_error_e | controller_print_flag_out_e;
@@ -26,10 +27,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
     data.program.pipe = fll_program_data_pipe_input_e;
   }
 
+  data.process = &process;
   data.setting.flag &= ~controller_main_flag_interruptible_e;
-  program.entry.pid = controller_entry_pid_disable_e;
-  program.entry.show = controller_entry_show_init_e;
-  program.mode = controller_program_mode_service_e;
+  data.thread = &thread;
+
+  process.entry.pid = controller_entry_pid_disable_e;
+  process.entry.show = controller_entry_show_init_e;
+  process.mode = controller_process_mode_service_e;
 
   fll_program_standard_set_up(&data.program);
 
@@ -38,10 +42,10 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   {
     const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize_1(argc, argv, envp);
 
-    controller_setting_load(arguments, &data, &program);
+    controller_setting_load(arguments, &data);
   }
 
-  controller_process(&data, &program);
+  controller_process(&data);
 
   fll_program_standard_set_down(&data.program);
 
index 252726342f836a345a0ea61667d498fff9b531ce..c41c5ecac66f5f49eb90182acd55c06555c5ceee 100644 (file)
@@ -60,9 +60,9 @@ extern "C" {
 #endif // _di_controller_range_after_number_sign_
 
 #ifndef _di_controller_setting_load_
-  void controller_setting_load(const f_console_arguments_t arguments, controller_t * const main, controller_program_t * const program) {
+  void controller_setting_load(const f_console_arguments_t arguments, controller_t * const main) {
 
-    if (!main || !program) return;
+    if (!main) return;
 
     main->setting.state.step_small = controller_allocation_console_d;
 
@@ -120,11 +120,11 @@ extern "C" {
     f_string_static_t * const args = main->program.parameters.arguments.array;
     f_number_unsigned_t index = 0;
 
-    program->control.server.domain = f_socket_protocol_family_local_e;
-    program->control.server.type = f_socket_type_stream_e;
-    program->control.server.form = f_socket_address_form_local_e;
+    main->process.control.server.domain = f_socket_protocol_family_local_e;
+    main->process.control.server.type = f_socket_type_stream_e;
+    main->process.control.server.form = f_socket_address_form_local_e;
 
-    memset(&program->control.server.address, 0, sizeof(f_socket_address_t));
+    memset(&main->process.control.server.address, 0, sizeof(f_socket_address_t));
 
     {
       const uint8_t codes[] = {
@@ -154,7 +154,7 @@ extern "C" {
     }
 
     // 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, &program->name_entry);
+    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)) {
       controller_print_error(&main->program.error, macro_controller_f(fll_program_parameter_process_verbosity_standard));
@@ -162,7 +162,7 @@ extern "C" {
       return;
     }
 
-    main->setting.state.status = f_path_current(F_false, &program->path_current);
+    main->setting.state.status = f_path_current(F_false, &main->process.path_current);
 
     if (F_status_is_error(main->setting.state.status)) {
       controller_print_error(&main->program.error, macro_controller_f(f_path_current));
@@ -170,12 +170,12 @@ extern "C" {
       return;
     }
 
-    program->path_setting.used = 0;
+    main->process.path_setting.used = 0;
 
     if (main->program.parameters.array[controller_parameter_settings_e].locations.used) {
       index = main->program.parameters.array[controller_parameter_settings_e].values.array[main->program.parameters.array[controller_parameter_settings_e].values.used - 1];
 
-      controller_path_canonical_relative(main, program->path_current, args[index], &program->path_setting);
+      controller_path_canonical_relative(main, main->process.path_current, args[index], &main->process.path_setting);
 
       if (F_status_is_error(main->setting.state.status)) {
         controller_print_error_file(&main->program.error, macro_controller_f(controller_path_canonical_relative), args[index], f_file_operation_verify_s, fll_error_file_type_path_e);
@@ -184,7 +184,7 @@ extern "C" {
       }
     }
     else {
-      main->setting.state.status = f_string_dynamic_append(controller_default_path_settings_s, &program->path_setting);
+      main->setting.state.status = f_string_dynamic_append(controller_default_path_settings_s, &main->process.path_setting);
 
       if (F_status_is_error(main->setting.state.status)) {
         controller_print_error(&main->program.error, macro_controller_f(f_string_dynamic_append));
@@ -193,23 +193,23 @@ extern "C" {
       }
     }
 
-    if (!program->path_pid.used && !main->program.parameters.array[controller_parameter_pid_e].locations.used) {
-      main->setting.state.status = f_string_dynamic_append(controller_default_path_pid_s, &program->path_pid);
+    if (!main->process.path_pid.used && !main->program.parameters.array[controller_parameter_pid_e].locations.used) {
+      main->setting.state.status = f_string_dynamic_append(controller_default_path_pid_s, &main->process.path_pid);
 
       if (F_status_is_error_not(main->setting.state.status)) {
-        main->setting.state.status = f_string_dynamic_append(f_path_separator_s, &program->path_pid);
+        main->setting.state.status = f_string_dynamic_append(f_path_separator_s, &main->process.path_pid);
       }
 
       if (F_status_is_error_not(main->setting.state.status)) {
-        main->setting.state.status = f_string_dynamic_append(controller_default_path_pid_prefix_s, &program->path_pid);
+        main->setting.state.status = f_string_dynamic_append(controller_default_path_pid_prefix_s, &main->process.path_pid);
       }
 
       if (F_status_is_error_not(main->setting.state.status)) {
-        main->setting.state.status = f_string_dynamic_append(program->name_entry, &program->path_pid);
+        main->setting.state.status = f_string_dynamic_append(main->process.name_entry, &main->process.path_pid);
       }
 
       if (F_status_is_error_not(main->setting.state.status)) {
-        main->setting.state.status = f_string_dynamic_append(controller_default_path_pid_suffix_s, &program->path_pid);
+        main->setting.state.status = f_string_dynamic_append(controller_default_path_pid_suffix_s, &main->process.path_pid);
       }
 
       if (F_status_is_error(main->setting.state.status)) {
@@ -223,7 +223,7 @@ extern "C" {
       index = main->program.parameters.array[controller_parameter_cgroup_e].values.array[main->program.parameters.array[controller_parameter_cgroup_e].values.used - 1];
 
       if (args[index].used) {
-        controller_path_canonical_relative(main, program->path_current, args[index], &program->path_cgroup);
+        controller_path_canonical_relative(main, main->process.path_current, args[index], &main->process.path_cgroup);
 
         if (F_status_is_error(main->setting.state.status)) {
           controller_print_error_file(&main->program.error, macro_controller_f(controller_path_canonical_relative), args[index], f_file_operation_verify_s, fll_error_file_type_path_e);
@@ -231,7 +231,7 @@ extern "C" {
           return;
         }
 
-        main->setting.state.status = f_string_append_assure(F_path_separator_s, 1, &program->path_cgroup);
+        main->setting.state.status = f_string_append_assure(F_path_separator_s, 1, &main->process.path_cgroup);
 
         if (F_status_is_error(main->setting.state.status)) {
           controller_print_error(&main->program.error, macro_controller_f(f_string_append_assure));
@@ -244,10 +244,10 @@ extern "C" {
       }
     }
     else {
-      main->setting.state.status = f_string_dynamic_append_nulless(f_control_group_path_system_prefix_s, &program->path_cgroup);
+      main->setting.state.status = f_string_dynamic_append_nulless(f_control_group_path_system_prefix_s, &main->process.path_cgroup);
 
       if (F_status_is_error_not(main->setting.state.status)) {
-        main->setting.state.status = f_string_dynamic_append_nulless(f_control_group_path_system_default_s, &program->path_cgroup);
+        main->setting.state.status = f_string_dynamic_append_nulless(f_control_group_path_system_default_s, &main->process.path_cgroup);
       }
 
       if (F_status_is_error(main->setting.state.status)) {
@@ -256,7 +256,7 @@ extern "C" {
         return;
       }
 
-      main->setting.state.status = f_string_dynamic_append_assure(f_path_separator_s, &program->path_cgroup);
+      main->setting.state.status = f_string_dynamic_append_assure(f_path_separator_s, &main->process.path_cgroup);
 
       if (F_status_is_error(main->setting.state.status)) {
         controller_print_error(&main->program.error, macro_controller_f(f_string_dynamic_append_assure));
index e15e40fc338cb16e03cfa2a446a7e8e404df116d..c26574bc44d8b5230dd1f2d2f0c20b0b88e92fbe 100644 (file)
@@ -68,16 +68,12 @@ extern "C" {
  *
  *     Errors (with error bit) from: f_console_parameter_process().
  *     Errors (with error bit) from: fll_program_parameter_process_context().
- * @param program
- *   A pointer to the current program settings.
- *
- *   Must not be NULL.
  *
  * @see f_console_parameter_process()
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_controller_setting_load_
-  extern void controller_setting_load(const f_console_arguments_t arguments, controller_t * const main, controller_program_t * const program);
+  extern void controller_setting_load(const f_console_arguments_t arguments, controller_t * const main);
 #endif // _di_controller_setting_load_
 
 #ifdef __cplusplus
index a54d95484c68bc24db95a6c2c3bcc863ef136afa..cd982a46e6fc45e742d189b7e307ed638a8e0410 100644 (file)
@@ -20,19 +20,21 @@ extern "C" {
  * Instance options.
  *
  * controller_instance_option_*_e:
- *   - asynchronous: The Instance runs asynchronously.
- *   - require:      The Instance is required.
- *   - simulate:     The Instance is being simulated.
- *   - validate:     The Instance is being validated.
- *   - wait:         The Instance is blocking (waiting) for all asynchronous Instances before it to complete before running.
+ *   - asynchronous:      The Instance runs asynchronously.
+ *   - require:           The Instance is required.
+ *   - simulate:          The Instance is being simulated.
+ *   - validate:          The Instance is being validated.
+ *   - wait:              The Instance is blocking (waiting) for all asynchronous Instances before it to complete before running.
+ *   - simulate_validate: A helper flag representing simulate and validate flag bits being set.
  */
 #ifndef _di_controller_instance_option_e_
   enum {
-    controller_instance_option_asynchronous_e = 0x1,
-    controller_instance_option_require_e      = 0x2,
-    controller_instance_option_simulate_e     = 0x4,
-    controller_instance_option_validate_e     = 0x8,
-    controller_instance_option_wait_e         = 0x10,
+    controller_instance_option_asynchronous_e      = 0x1,
+    controller_instance_option_require_e           = 0x2,
+    controller_instance_option_simulate_e          = 0x4,
+    controller_instance_option_validate_e          = 0x8,
+    controller_instance_option_wait_e              = 0x10,
+    controller_instance_option_simulate_validate_e = 0xc,
   }; // enum
 #endif // _di_controller_instance_option_e_
 
diff --git a/sources/c/main/common/enumeration/process.h b/sources/c/main/common/enumeration/process.h
new file mode 100644 (file)
index 0000000..f79defc
--- /dev/null
@@ -0,0 +1,77 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common process enumerations.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_common_enumeration_process_h
+#define _controller_main_common_enumeration_process_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Controller process flags.
+ *
+ * controller_process_flag_*_e:
+ *   - interruptible: When specified, process responds to interrupt signals, otherwise block/ignore interrupt signals.
+ *   - pid_created:   When specified, the process responds to interrupt signals, otherwise block/ignore interrupt signals.
+ *   - failsafe:      When specified, failsafe mode is enabled, otherwise failsafe mode is disabled.
+ */
+#ifndef _di_controller_process_flag_e_
+  enum {
+    controller_process_flag_interruptible_e = 0x1,
+    controller_process_flag_pid_created_e   = 0x2,
+    controller_process_flag_failsafe_e      = 0x4,
+  }; // enum
+#endif // _di_controller_process_flag_e_
+
+/**
+ * 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.
+ */
+#ifndef _di_controller_process_mode_e_
+  enum {
+    controller_process_mode_service_e = 0,
+    controller_process_mode_helper_e,
+    controller_process_mode_program_e,
+  }; // enum
+#endif // _di_controller_process_mode_e_
+
+/**
+ * Controller process ready enumeration.
+ *
+ * controller_process_ready_*_e:
+ *   - no:    Entry/Exit is not ready.
+ *   - wait:  Entry/Exit has "ready" somewhere in the file but is not yet ready.
+ *   - yes:   Entry/Exit is now ready (Entry/Exit is still being processed).
+ *   - done:  Entry/Exit is ready and processing is complete.
+ *   - fail:  Entry/Exit processing failed.
+ *   - abort: Abort received before finished processing Entry/Exit.
+ */
+#ifndef _di_controller_process_ready_e_
+  enum {
+    controller_process_ready_no_e = 0,
+    controller_process_ready_wait_e,
+    controller_process_ready_yes_e,
+    controller_process_ready_done_e,
+    controller_process_ready_fail_e,
+    controller_process_ready_abort_e,
+  }; // enum
+#endif // _di_controller_process_ready_e_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_common_enumeration_process_h
diff --git a/sources/c/main/common/enumeration/program.h b/sources/c/main/common/enumeration/program.h
deleted file mode 100644 (file)
index 0d1f19e..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * FLL - Level 3
- *
- * Project: Controller
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Provides the common program enumerations.
- *
- * This is auto-included and should not need to be explicitly included.
- */
-#ifndef _controller_main_common_enumeration_program_h
-#define _controller_main_common_enumeration_program_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Controller program flags.
- *
- * controller_setting_flag_*_e:
- *   - interruptible: When specified, program responds to interrupt signals, otherwise block/ignore interrupt signals.
- *   - pid_created:   When specified, the program responds to interrupt signals, otherwise block/ignore interrupt signals.
- *   - failsafe:      When specified, failsafe mode is enabled, otherwise failsafe mode is disabled.
- */
-#ifndef _di_controller_program_flag_e_
-  enum {
-    controller_program_flag_interruptible_e = 0x1,
-    controller_program_flag_pid_created_e   = 0x2,
-    controller_program_flag_failsafe_e      = 0x4,
-  }; // enum
-#endif // _di_controller_program_flag_e_
-
-/**
- * Controller program mode enumeration.
- *
- * controller_program_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.
- */
-#ifndef _di_controller_program_mode_e_
-  enum {
-    controller_program_mode_service_e = 0,
-    controller_program_mode_helper_e,
-    controller_program_mode_program_e,
-  }; // enum
-#endif // _di_controller_program_mode_e_
-
-/**
- * Controller Process ready enumeration.
- *
- * controller_program_ready_*_e:
- *   - no:    Entry/Exit is not ready.
- *   - wait:  Entry/Exit has "ready" somewhere in the file but is not yet ready.
- *   - yes:   Entry/Exit is now ready (Entry/Exit is still being processed).
- *   - done:  Entry/Exit is ready and processing is complete.
- *   - fail:  Entry/Exit processing failed.
- *   - abort: Abort received before finished processing Entry/Exit.
- */
-#ifndef _di_controller_program_ready_e_
-  enum {
-    controller_program_ready_no_e = 0,
-    controller_program_ready_wait_e,
-    controller_program_ready_yes_e,
-    controller_program_ready_done_e,
-    controller_program_ready_fail_e,
-    controller_program_ready_abort_e,
-  }; // enum
-#endif // _di_controller_program_ready_e_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _controller_main_common_enumeration_program_h
index e32df440cb6a0f842116a4eb94fc8054560f718e..999d311cbfe842a17c73a69127febc6c4d052a4d 100644 (file)
@@ -12,6 +12,7 @@ extern "C" {
     "f_console_parameter_process",
     "f_environment_get_all",
     "f_file_exists",
+    "f_file_stat",
     "f_file_stream_open",
     "f_file_stream_read",
     "f_fss_apply_delimit",
@@ -19,6 +20,7 @@ extern "C" {
     "f_memory_array_increase",
     "f_memory_array_increase_by",
     "f_memory_array_resize",
+    "f_memory_arrays_resize",
     "f_path_current",
     "f_rip_dynamic_partial",
     "f_rip_dynamic_partial_nulless",
index bd99a161e5b3ba47fc8c5764e40bfff0447611f9..a8b6feb02eedea86adeb228abc27aa2a86bc5c26 100644 (file)
@@ -45,6 +45,7 @@ extern "C" {
     controller_f_f_console_parameter_process_e,
     controller_f_f_environment_get_all_e,
     controller_f_f_file_exists_e,
+    controller_f_f_file_stat_e,
     controller_f_f_file_stream_open_e,
     controller_f_f_file_stream_read_e,
     controller_f_f_fss_apply_delimit_e,
@@ -52,6 +53,7 @@ extern "C" {
     controller_f_f_memory_array_increase_e,
     controller_f_f_memory_array_increase_by_e,
     controller_f_f_memory_array_resize_e,
+    controller_f_f_memory_arrays_resize_e,
     controller_f_f_path_current_e,
     controller_f_f_rip_dynamic_partial_e,
     controller_f_f_rip_dynamic_partial_nulless_e,
index a624d913449aadb7c3a65c8646521eb1747d677a..ba9d40db9294e0e3f2e616bfa3dae3142b5c9e01 100644 (file)
@@ -10,7 +10,11 @@ extern "C" {
     if (!main) return;
 
     fll_program_data_delete(&main->program);
+
+    controller_cache_delete(&main->cache);
+    controller_process_delete(&main->process);
     controller_setting_delete(&main->setting);
+    controller_thread_delete(&main->thread);
   }
 #endif // _di_controller_delete_
 
index 4e0f4d06e247eff8a3f3aa40ec8b94076dcbcc54..6c5e754b582906f682f457c733a44af5dd1e11ad 100644 (file)
@@ -53,26 +53,35 @@ extern "C" {
 #endif // _di_controller_setting_t_
 
 /**
- * The main program data as a single structure.
+ * The main program data.
  *
  * The typedef for this is located in the defs.h header.
  *
  * Properties:
  *   - program: The main program data.
+ *
+ *   - cache:   The cache.
+ *   - process: The process data.
  *   - setting: The settings data.
+ *   - thread:  The thread data.
  */
 #ifndef _di_controller_t_
   struct controller_t_ {
     fll_program_data_t program;
-    controller_setting_t setting;
+
     controller_cache_t cache;
+    controller_process_t process;
+    controller_setting_t setting;
+    controller_thread_t thread;
   };
 
   #define controller_t_initialize \
     { \
       fll_program_data_t_initialize, \
-      controller_setting_t_initialize, \
       controller_cache_t_initialize, \
+      controller_process_t_initialize, \
+      controller_setting_t_initialize, \
+      controller_thread_t_initialize, \
     }
 #endif // _di_controller_t_
 
@@ -87,7 +96,10 @@ extern "C" {
  *   This does not alter main.setting.state.status.
  *
  * @see controller_cache_delete()
+ * @see controller_process_delete()
  * @see controller_setting_delete()
+ * @see controller_thread_delete()
+ *
  * @see fll_program_data_delete()
  */
 #ifndef _di_controller_delete_
index fdfad2fd74159259c5dc7b7a8f54c921128a7a82..26a5683cf15bff4748cfc099ff9e33af642e5f17 100644 (file)
@@ -17,13 +17,6 @@ extern "C" {
 #endif
 
 /**
- * The controller global typedef.
- */
- #ifndef _di_controller_global_t_
-  typedef struct controller_global_t_ controller_global_t;
-#endif // _di_controller_global_t_
-
-/**
  * The controller instance typedef.
  */
  #ifndef _di_controller_instance_t_
@@ -47,9 +40,9 @@ extern "C" {
 /**
  * The controller program typedef.
  */
-#ifndef _di_controller_program_t_
-  typedef struct controller_program_t_ controller_program_t;
-#endif // _di_controller_program_t_
+#ifndef _di_controller_process_t
+  typedef struct controller_process_t_ controller_process_t;
+#endif // _di_controller_process_t
 
 /**
  * The controller thread typedef.
diff --git a/sources/c/main/common/type/global.h b/sources/c/main/common/type/global.h
deleted file mode 100644 (file)
index b1a2417..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * FLL - Level 3
- *
- * Project: Controller
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Provides the common global type structures.
- *
- * This is auto-included and should not need to be explicitly included.
- */
-#ifndef _controller_main_common_type_global_h
-#define _controller_main_common_type_global_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * A wrapper used for passing a common set of all data, particularly for sharing between threads.
- *
- * The typedef for this is located in the defs.h header.
- *
- * Properties:
- *   - main:    The main program data.
- *   - program: The program data.
- *   - thread:  The thread data for a specific thread.
- *
- *   - message: The output file for normal output messages (often stdout), but with custom set to (controller_global_t *).
- *   - output:  The output file for normal/non-message output, aka data output (often stdout or a file), but with custom set to (controller_global_t *).
- *   - error:   The output file for error output messages, but with custom set to (controller_global_t *).
- *   - warning: The output file for warning output messages, but with custom set to (controller_global_t *).
- *   - debug:   The output file for debug output messages, but with custom set to (controller_global_t *).
- */
-#ifndef _di_controller_global_t_
-  struct controller_global_t_ {
-    controller_t *main;
-    controller_program_t *program;
-    controller_thread_t *thread;
-
-    fl_print_t *message;
-    fl_print_t *output;
-    fl_print_t *error;
-    fl_print_t *warning;
-    fl_print_t *debug;
-  };
-
-  #define controller_global_t_initialize { 0, 0, 0, 0, 0, 0, 0, 0 }
-
-  #define macro_controller_global_t_initialize_1(main, program, thread, message, output, error, warning, debug) { \
-    main, \
-    program, \
-    thread, \
-    message, \
-    output, \
-    error, \
-    warning, \
-    debug, \
-  }
-#endif // _di_controller_global_t_
-
-/**
- * A structure for passing data to the interrupt state function.
- *
- * Properties:
- *   - is_normal: Boolean designating if this is operating in a normal state.
- *   - global:    The global data.
- */
-#ifndef _di_controller_interrupt_t_
-  typedef struct {
-    bool is_normal;
-
-    controller_global_t *global;
-  } controller_interrupt_t;
-
-  #define controller_interrupt_t_initialize { \
-    F_true, \
-    0, \
-  }
-
-  #define macro_controller_interrupt_t_initialize_1(is_normal, global) { \
-    is_normal, \
-    global, \
-  }
-#endif // _di_controller_interrupt_t_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _controller_main_common_type_global_h
index 5e90dc99162baf5330996a488f9612b94ab8c8b0..237009769cd8aadf8ea7df77be6739309e67b6d9 100644 (file)
@@ -45,9 +45,9 @@ extern "C" {
  *   - 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).
  *
- *   - rule:   A copy of the rule actively being executed.
- *   - cache:  The cache used by this Instance.
- *   - global: The global data.
+ *   - rule:  A copy of the rule actively being executed.
+ *   - cache: The cache used by this Instance.
+ *   - main:  The main program data.
  */
 #ifndef _di_controller_instance_t_
   struct controller_instance_t_ {
@@ -71,7 +71,7 @@ extern "C" {
 
     controller_rule_t rule;
     controller_cache_t cache;
-    controller_global_t *global;
+    controller_t *main;
   };
 
   #define controller_instance_t_initialize { \
diff --git a/sources/c/main/common/type/interrupt.h b/sources/c/main/common/type/interrupt.h
new file mode 100644 (file)
index 0000000..7e4454b
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common interrupt type structures.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_common_type_interrupt_h
+#define _controller_main_common_type_interrupt_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * A structure for passing data to the interrupt state function.
+ *
+ * Properties:
+ *   - is_normal: Boolean designating if this is operating in a normal state.
+ *   - main:      The main program data.
+ */
+#ifndef _di_controller_interrupt_t_
+  typedef struct {
+    bool is_normal;
+
+    controller_t *main;
+  } controller_interrupt_t;
+
+  #define controller_interrupt_t_initialize { \
+    F_true, \
+    0, \
+  }
+
+  #define macro_controller_interrupt_t_initialize_1(is_normal, main) { \
+    is_normal, \
+    main, \
+  }
+#endif // _di_controller_interrupt_t_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_common_type_interrupt_h
diff --git a/sources/c/main/common/type/process.c b/sources/c/main/common/type/process.c
new file mode 100644 (file)
index 0000000..8e0eefe
--- /dev/null
@@ -0,0 +1,33 @@
+#include "../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_process_delete_
+  void controller_process_delete(controller_process_t * const process) {
+
+    if (!process) return;
+
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->name_entry.string, &process->name_entry.used, &process->name_entry.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->path_cgroup.string, &process->path_cgroup.used, &process->path_cgroup.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->path_control.string, &process->path_control.used, &process->path_control.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->path_current.string, &process->path_current.used, &process->path_current.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->path_pid.string, &process->path_pid.used, &process->path_pid.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->path_setting.string, &process->path_setting.used, &process->path_setting.size);
+
+    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &process->entry.define.array, &process->entry.define.used, &process->entry.define.size, &f_string_maps_delete_callback);
+    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &process->entry.parameter.array, &process->entry.parameter.used, &process->entry.parameter.size, &f_string_maps_delete_callback);
+    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &process->exit.define.array, &process->exit.define.used, &process->exit.define.size, &f_string_maps_delete_callback);
+    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &process->exit.parameter.array, &process->exit.parameter.used, &process->exit.parameter.size, &f_string_maps_delete_callback);
+
+    controller_control_delete(&process->control);
+    controller_entry_items_delete(&process->entry.items);
+    controller_entry_items_delete(&process->exit.items);
+    controller_rules_delete(&process->rules);
+  }
+#endif // _di_controller_process_delete_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
similarity index 77%
rename from sources/c/main/common/type/program.h
rename to sources/c/main/common/type/process.h
index f705531cff2e059f996607b82c5c5efc0fb8c670..69b1b3355ecaf767055a554d1fd69e5eee98465b 100644 (file)
@@ -5,12 +5,12 @@
  * API Version: 0.7
  * Licenses: lgpl-2.1-or-later
  *
- * Provides the common program type structures.
+ * Provides the common process type structures.
  *
  * This is auto-included and should not need to be explicitly included.
  */
-#ifndef _controller_main_common_type_program_h
-#define _controller_main_common_type_program_h
+#ifndef _controller_main_common_type_process_h
+#define _controller_main_common_type_process_h
 
 #ifdef __cplusplus
 extern "C" {
@@ -39,8 +39,8 @@ extern "C" {
  *   - exit:    The Exit settings.
  *   - rules:   All rules and their respective settings.
  */
-#ifndef _di_controller_program_t_
-  struct controller_program_t_ {
+#ifndef _di_controller_process_t
+  struct controller_process_t_ {
     uint8_t ready;
     uint8_t mode;
 
@@ -59,7 +59,7 @@ extern "C" {
     controller_rules_t rules;
   };
 
-  #define controller_program_t_initialize { \
+  #define controller_process_tinitialize { \
     0, \
     0, \
     0, \
@@ -74,22 +74,22 @@ extern "C" {
     controller_entry_t_initialize, \
     controller_rules_t_initialize, \
   }
-#endif // _di_controller_program_t_
+#endif // _di_controller_process_t
 
 /**
- * Delete the Controller program data.
+ * Delete the Controller process data.
  *
- * @param program
- *   A pointer to the current program settings.
+ * @param process
+ *   A pointer to the current process data.
  *
  *   Must not be NULL.
  */
-#ifndef _di_controller_program_delete_
-  extern void controller_program_delete(controller_program_t * const program);
-#endif // _di_controller_program_delete_
+#ifndef _di_controller_process_delete_
+  extern void controller_process_delete(controller_process_t * const process);
+#endif // _di_controller_process_delete_
 
 #ifdef __cplusplus
 } // extern "C"
 #endif
 
-#endif // _controller_main_common_type_program_h
+#endif // _controller_main_common_type_process_h
diff --git a/sources/c/main/common/type/program.c b/sources/c/main/common/type/program.c
deleted file mode 100644 (file)
index 6a21a67..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "../../controller.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _di_controller_program_delete_
-  void controller_program_delete(controller_program_t * const program) {
-
-    if (!program) return;
-
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &program->name_entry.string, &program->name_entry.used, &program->name_entry.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &program->path_cgroup.string, &program->path_cgroup.used, &program->path_cgroup.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &program->path_control.string, &program->path_control.used, &program->path_control.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &program->path_current.string, &program->path_current.used, &program->path_current.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &program->path_pid.string, &program->path_pid.used, &program->path_pid.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &program->path_setting.string, &program->path_setting.used, &program->path_setting.size);
-
-    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &program->entry.define.array, &program->entry.define.used, &program->entry.define.size, &f_string_maps_delete_callback);
-    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &program->entry.parameter.array, &program->entry.parameter.used, &program->entry.parameter.size, &f_string_maps_delete_callback);
-    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &program->exit.define.array, &program->exit.define.used, &program->exit.define.size, &f_string_maps_delete_callback);
-    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &program->exit.parameter.array, &program->exit.parameter.used, &program->exit.parameter.size, &f_string_maps_delete_callback);
-
-    controller_control_delete(&program->control);
-    controller_entry_items_delete(&program->entry.items);
-    controller_entry_items_delete(&program->exit.items);
-    controller_rules_delete(&program->rules);
-  }
-#endif // _di_controller_program_delete_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
index 7e317be4bc9ce1bbe1a56f6c334645330fd3242b..b1a004775554f85eb187fccb8353dc6d482b7c20 100644 (file)
@@ -86,7 +86,7 @@
 #include <program/controller/main/common/enumeration/entry.h>
 #include <program/controller/main/common/enumeration/instance.h>
 #include <program/controller/main/common/enumeration/rule.h>
-#include <program/controller/main/common/enumeration/program.h>
+#include <program/controller/main/common/enumeration/process.h>
 #include <program/controller/main/common/enumeration/thread.h>
 #include <program/controller/main/common/type/cache.h>
 #include <program/controller/main/common/type/control.h>
 #include <program/controller/main/common/type/lock.h>
 #include <program/controller/main/common/type/rule.h>
 #include <program/controller/main/common/type/defs.h>
-#include <program/controller/main/common/type/global.h>
-#include <program/controller/main/common/type/program.h>
+#include <program/controller/main/common/type/process.h>
 #include <program/controller/main/common/type/instance.h>
 #include <program/controller/main/common/type/thread.h>
+#include <program/controller/main/common/type/interrupt.h>
 #include <program/controller/main/common/type.h>
 #include <program/controller/main/common.h>
 #include <program/controller/main/convert.h>
 #include <program/controller/main/rule/validate.h>
 #include <program/controller/main/rule/wait.h>
 #include <program/controller/main/process.h>
+#include <program/controller/main/validate.h>
 
 #ifdef __cplusplus
 extern "C" {
index d31f75ed083ecb15cdb3c8eb062c1bc85c167e2e..71420f9888622d5535a095695bd6b3de4206921e 100644 (file)
@@ -5,9 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_file_load_
-  f_status_t controller_file_load(controller_global_t * const global, controller_cache_t * const cache, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix) {
+  f_status_t controller_file_load(controller_t * const main, controller_cache_t * const cache, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix) {
 
-    if (!global || !cache) return F_status_set_error(F_parameter);
+    if (!main || !cache) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
     f_file_t file = f_file_t_initialize;
@@ -36,15 +36,15 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
+      controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
 
       return status;
     }
 
     f_string_static_t path = f_string_static_t_initialize;
 
-    if (global->setting->path_setting.used) {
-      path.used = global->setting->path_setting.used + F_path_separator_s_length + cache->action.name_file.used;
+    if (main->setting.path_setting.used) {
+      path.used = main->setting.path_setting.used + F_path_separator_s_length + cache->action.name_file.used;
     }
     else {
       path.used = cache->action.name_file.used;
@@ -53,11 +53,11 @@ extern "C" {
     f_char_t path_string[path.used + 1];
     path.string = path_string;
 
-    if (global->setting->path_setting.used) {
-      memcpy(path_string, global->setting->path_setting.string, sizeof(f_char_t) * global->setting->path_setting.used);
-      memcpy(path_string + global->setting->path_setting.used + F_path_separator_s_length, cache->action.name_file.string, sizeof(f_char_t) * cache->action.name_file.used);
+    if (main->setting.path_setting.used) {
+      memcpy(path_string, main->setting.path_setting.string, sizeof(f_char_t) * main->setting.path_setting.used);
+      memcpy(path_string + main->setting.path_setting.used + F_path_separator_s_length, cache->action.name_file.string, sizeof(f_char_t) * cache->action.name_file.used);
 
-      path_string[global->setting->path_setting.used] = f_path_separator_s.string[0];
+      path_string[main->setting.path_setting.used] = f_path_separator_s.string[0];
     }
     else {
       memcpy(path_string, cache->action.name_file.string, sizeof(f_char_t) * cache->action.name_file.used);
@@ -76,17 +76,15 @@ extern "C" {
         return F_file_found_not;
       }
 
-      if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-        controller_print_error_file_status(&global->main->program.error, macro_controller_f(f_file_stream_open), F_true, path, f_file_operation_open_s, fll_error_file_type_file_e, F_status_set_fine(status));
+      if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+        controller_print_error_file_status(&main->program.error, macro_controller_f(f_file_stream_open), path, f_file_operation_open_s, fll_error_file_type_file_e, F_status_set_fine(status));
       }
     }
     else {
       status = f_file_stream_read(file, &cache->buffer_file);
 
       if (F_status_is_error(status)) {
-        if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-          controller_print_error_file(global->thread, &global->main->program.error, F_status_set_fine(status), "f_file_stream_read", F_true, path, f_file_operation_read_s, fll_error_file_type_file_e);
-        }
+        controller_print_error_file_status(&main->program.error, macro_controller_f(f_file_stream_read), path, f_file_operation_read_s, fll_error_file_type_file_e, F_status_set_fine(status));
       }
     }
 
@@ -99,9 +97,7 @@ extern "C" {
       status = f_file_stat(path, F_true, &stat_file);
 
       if (F_status_is_error(status)) {
-        if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-          controller_print_error_file(global->thread, &global->main->program.error, F_status_set_fine(status), "f_file_stat", F_true, path, f_file_operation_stat_s, fll_error_file_type_file_e);
-        }
+        controller_print_error_file_status(&main->program.error, macro_controller_f(f_file_stat), path, f_file_operation_stat_s, fll_error_file_type_file_e, F_status_set_fine(status));
       }
       else {
         cache->timestamp.seconds = stat_file.st_ctim.tv_sec;
index b250539e29a19660f84fe160c29016a2e980cbc6..59ec8f0f91f332ccd8f34bd6458424e5a82d2324 100644 (file)
@@ -19,8 +19,8 @@ extern "C" {
 /**
  * Load a file from the controller settings directory.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  * @param cache
@@ -56,7 +56,7 @@ extern "C" {
  * @see f_string_append()
  */
 #ifndef _di_controller_file_load_
-  extern f_status_t controller_file_load(controller_global_t * const global, controller_cache_t * const cache, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix);
+  extern f_status_t controller_file_load(controller_t * const main, controller_cache_t * const cache, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix);
 #endif // _di_controller_file_load_
 
 /**
index 4403f5f54a61e3eb99345a78ad74ef79bd4a46df..760811e84f98ed34830ff2809746b8a61cf4e4f0 100644 (file)
@@ -5,42 +5,42 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_instance_prepare_
-  f_status_t controller_instance_prepare(controller_global_t * const global, const bool is_normal, const uint8_t action, const f_string_static_t alias, f_number_unsigned_t *id) {
+  f_status_t controller_instance_prepare(controller_t * const main, const bool is_normal, const uint8_t action, const f_string_static_t alias, f_number_unsigned_t *id) {
 
-    if (!global) return F_status_set_error(F_parameter);
+    if (!main) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
 
-    if (controller_instance_find(action, alias, global->thread->instances, id) == F_false) {
-      f_thread_unlock(&global->thread->lock.instance);
+    if (controller_instance_find(action, alias, main->thread.instances, id) == F_false) {
+      f_thread_unlock(&main->thread.lock.instance);
 
-      status = controller_lock_write(is_normal, global->thread, &global->thread->lock.instance);
+      status = controller_lock_write(is_normal, &main->thread, &main->thread.lock.instance);
 
       if (F_status_is_error(status)) {
-        controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status), F_false, global->thread);
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status), F_false);
       }
       else {
-        status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_instance_t), (void **) &global->thread->instances.array, &global->thread->instances.used, &global->thread->instances.size);
+        status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_instance_t), (void **) &main->thread.instances.array, &main->thread.instances.used, &main->thread.instances.size);
       }
 
-      if (F_status_is_error_not(status) && global->thread->instances.array[global->thread->instances.used]) {
+      if (F_status_is_error_not(status) && main->thread.instances.array[main->thread.instances.used]) {
 
-        controller_instance_t * const instance = global->thread->instances.array[global->thread->instances.used];
+        controller_instance_t * const instance = main->thread.instances.array[main->thread.instances.used];
 
-        status = controller_lock_write(is_normal, global->thread, &instance->lock);
+        status = controller_lock_write(is_normal, &main->thread, &instance->lock);
 
         if (F_status_is_error(status)) {
-          controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status), F_false, global->thread);
+          controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status), F_false);
         }
         else {
           instance->action = action;
           instance->rule.alias.used = 0;
-          instance->global = global;
+          instance->main = main;
 
           status = f_string_dynamic_append(alias, &instance->rule.alias);
 
           if (F_status_is_error_not(status)) {
-            instance->id = global->thread->instances.used++;
+            instance->id = main->thread.instances.used++;
             status = F_okay;
 
             if (id) {
@@ -52,10 +52,10 @@ extern "C" {
         }
       }
 
-      f_thread_unlock(&global->thread->lock.instance);
+      f_thread_unlock(&main->thread.lock.instance);
 
       // The read lock must be restored on return.
-      status = F_status_is_error(controller_lock_read(is_normal, global->thread, &global->thread->lock.instance))
+      status = F_status_is_error(controller_lock_read(is_normal, &main->thread, &main->thread.lock.instance))
         ? F_status_set_error(F_lock)
         : F_okay;
     }
@@ -68,9 +68,9 @@ extern "C" {
 #endif // _di_controller_instance_prepare_
 
 #ifndef _di_controller_instance_prepare_instance_type_
-  f_status_t controller_instance_prepare_instance_type(controller_global_t * const global, const uint8_t type, const uint8_t action, const f_string_static_t alias, f_number_unsigned_t *id) {
+  f_status_t controller_instance_prepare_instance_type(controller_t * const main, const uint8_t type, const uint8_t action, const f_string_static_t alias, f_number_unsigned_t *id) {
 
-    return controller_instance_prepare(global, type != controller_instance_type_exit_e, action, alias, id);
+    return controller_instance_prepare(main, type != controller_instance_type_exit_e, action, alias, id);
   }
 #endif // _di_controller_instance_prepare_instance_type_
 
index ff3131537024533356a1941e3be6167b360b9ffa..2e583ee181786c18bbfaa824c70398a1f6c40534 100644 (file)
@@ -24,10 +24,10 @@ extern "C" {
  *
  * If a instance by the given Rule alias and Rule Action already exists, then nothing is done.
  *
- * This requires that a global.thread->lock.instance lock be set on instance->lock before being called.
+ * This requires that a main.thread.lock.instance lock be set on instance.lock before being called.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  * @param is_normal
@@ -46,7 +46,7 @@ extern "C" {
  *   F_okay on success.
  *   F_found on success, but nothing was done because an existing instance was found.
  *
- *   F_lock (with error bit) if failed to re-establish read lock on global.thread->lock.instance while returning.
+ *   F_lock (with error bit) if failed to re-establish read lock on main.thread.lock.instance while returning.
  *   F_parameter (with error bit) if a parameter is invalid.
  *
  *   Errors (with error bit) from: f_string_dynamic_append().
@@ -59,7 +59,7 @@ extern "C" {
  * @see controller_lock_write()
  */
 #ifndef _di_controller_instance_prepare_
-  extern f_status_t controller_instance_prepare(controller_global_t * const global, const bool is_normal, const uint8_t action, const f_string_static_t alias, f_number_unsigned_t *id);
+  extern f_status_t controller_instance_prepare(controller_t * const main, const bool is_normal, const uint8_t action, const f_string_static_t alias, f_number_unsigned_t *id);
 #endif // _di_controller_instance_prepare_
 
 /**
@@ -70,10 +70,10 @@ extern "C" {
  *
  * If a instance by the given Rule alias and Rule Action already exists, then nothing is done.
  *
- * This requires that a global.thread->lock.instance lock be set on instance->lock before being called.
+ * This requires that a main.thread.lock.instance lock be set on instance->lock before being called.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  * @param type
@@ -95,7 +95,7 @@ extern "C" {
  * @see controller_instance_prepare()
  */
 #ifndef _di_controller_instance_prepare_instance_type_
-  extern f_status_t controller_instance_prepare_instance_type(controller_global_t * const global, const uint8_t type, const uint8_t action, const f_string_static_t alias, f_number_unsigned_t *id);
+  extern f_status_t controller_instance_prepare_instance_type(controller_t * const main, const uint8_t type, const uint8_t action, const f_string_static_t alias, f_number_unsigned_t *id);
 #endif // _di_controller_instance_prepare_instance_type_
 
 #ifdef __cplusplus
index 0b2c523f9ae8cd96e4cff8e1daea645e133a689e..42a8a44b6104413c2a6c1f8e532ebffc307c6e46 100644 (file)
@@ -7,7 +7,7 @@ extern "C" {
 #ifndef _di_controller_instance_wait_
   f_status_t controller_instance_wait(controller_instance_t * const instance) {
 
-    if (!instance || !instance->global || !instance->global->main || !instance->global->thread) return F_status_set_error(F_parameter);
+    if (!instance || !instance->main) return F_status_set_error(F_parameter);
     if (!controller_thread_is_enabled_instance(instance)) return F_status_set_error(F_interrupt);
 
     f_time_spec_t time;
@@ -43,7 +43,7 @@ extern "C" {
       status_lock = controller_lock_read_instance(instance, &instance->lock);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&instance->global->main->program.error, F_status_set_fine(status_lock), F_true, instance->global->thread);
+        controller_lock_print_error_critical(&instance->main->program.error, F_status_set_fine(status_lock), F_true);
 
         break;
       }
index 440ba788234d654684a51cbb5d2ade0dd97b90cc..bfb189bd0d86c5fa1fb5f086fe2ae713aecfb5b6 100644 (file)
@@ -67,9 +67,9 @@ extern "C" {
 #ifndef _di_controller_lock_read_instance_
   f_status_t controller_lock_read_instance(controller_instance_t * const instance, f_thread_lock_t * const lock) {
 
-    if (!instance || !lock) return F_status_set_error(F_parameter);
+    if (!instance || !instance->main || !lock) return F_status_set_error(F_parameter);
 
-    return controller_lock_read_instance_type(instance->type, instance->global->thread, lock);
+    return controller_lock_read_instance_type(instance->type, &instance->main->thread, lock);
   }
 #endif // _di_controller_lock_read_instance_
 
@@ -112,7 +112,7 @@ extern "C" {
 
     if (!instance || !lock) return F_status_set_error(F_parameter);
 
-    return controller_lock_write_instance_type(instance->type, instance->global->thread, lock);
+    return controller_lock_write_instance_type(instance->type, &instance->main->thread, lock);
   }
 #endif // _di_controller_lock_write_instance_
 
index 4ff7b1382f53d92b45b1d155f64f49eb4136c85d..09855a2244c535a447f418b169aebdfbfc57b4ce 100644 (file)
@@ -5,13 +5,15 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_lock_print_error_critical_
-  void controller_lock_print_error_critical(fl_print_t * const print, const f_status_t status, const uint8_t is_read, controller_thread_t *thread) {
+  void controller_lock_print_error_critical(fl_print_t * const print, const f_status_t status, const uint8_t is_read) {
 
     // A signal is not an error.
-    if (status == F_interrupt) return;
+    if (!print || !print->custom || status == F_interrupt) return;
+
+    controller_t * const main = (controller_t *) print->custom;
 
     if (print->verbosity != f_console_verbosity_quiet_e) {
-      controller_lock_print(print->to, thread);
+      controller_lock_print(print->to, &main->thread);
 
       fl_print_format("%r%[%QThe pid file '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
       fl_print_format("%['Critical failure while attempting to establish '%]", print->to, print->context, print->context);
@@ -36,7 +38,7 @@ extern "C" {
 
       fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
 
-      controller_unlock_print_flush(print->to, thread);
+      controller_unlock_print_flush(print->to, &main->thread);
     }
   }
 #endif // _di_controller_lock_print_error_critical_
index 2d7f095f77a0427a7d79362f48eb8a935dcc3ba8..c6555835747529b2eefbce5d6ba0850a3068e45b 100644 (file)
@@ -33,11 +33,9 @@ extern "C" {
  * @param is_read
  *   If TRUE, then this is for a read lock.
  *   If FALSE, then this is for a write lock.
- * @param thread
- *   The thread data.
  */
 #ifndef _di_controller_lock_print_error_critical_
-  extern void controller_lock_print_error_critical(fl_print_t * const print, const f_status_t status, const uint8_t is_read, controller_thread_t *thread);
+  extern void controller_lock_print_error_critical(fl_print_t * const print, const f_status_t status, const uint8_t is_read);
 #endif // _di_controller_lock_print_error_critical_
 
 /**
index f6557aad2c43d1b0f84558704829b87e8c4d011a..52ddcbf06bbbf7e59d495d47bcc83037c6046934 100644 (file)
@@ -11,10 +11,10 @@ extern "C" {
     if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
     if (status == F_interrupt) return F_status_set_error(F_output_not);
 
-    controller_global_t * const global = (controller_global_t *) print->custom;
+    controller_t * const main = (controller_t *) print->custom;
 
     // fll_error_print() automatically locks, so manually handle only the mutex locking and flushing rather than calling controller_lock_print().
-    f_thread_mutex_lock(&global->thread->lock.print);
+    f_thread_mutex_lock(&main->thread.lock.print);
 
     fll_error_print(print, status, function, fallback);
 
@@ -22,7 +22,7 @@ extern "C" {
 
     controller_print_rule_error_cache(print, cache, item);
 
-    controller_unlock_print_flush(print->to, global->thread);
+    controller_unlock_print_flush(print->to, &main->thread);
 
     return F_okay;
   }
@@ -48,7 +48,7 @@ extern "C" {
       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, cache.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, cache.line_item, print->notable);
+      fl_print_format(f_string_format_un_single_s.string, print->to, print->notable, cache.line_item, print->notable);
       fl_print_format("%[ for ", print->to, print->context);
     }
 
index 59798e03ce9358b690f687a305c2e9e693645849..77031edc41df059aa6386c7aaf8f31d6c88b3649 100644 (file)
@@ -41,7 +41,7 @@ extern "C" {
  * @see controller_print_rule_error_cache()
  */
 #ifndef _di_controller_print_rule_error_
-  extern void controller_print_rule_error(fl_print_t * const print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, const bool item);
+  extern f_status_t controller_print_rule_error(fl_print_t * const print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, const bool item);
 #endif // _di_controller_print_rule_error_
 
 /**
@@ -66,7 +66,7 @@ extern "C" {
  * @see controller_rule_setting_read()
  */
 #ifndef _di_controller_print_rule_error_cache_
-  extern void controller_print_rule_error_cache(fl_print_t * const print, const controller_cache_action_t cache, const bool item);
+  extern f_status_t controller_print_rule_error_cache(fl_print_t * const print, const controller_cache_action_t cache, const bool item);
 #endif // _di_controller_print_rule_error_cache_
 
 #ifdef __cplusplus
index e670597d2dcb9d7e29864a2815ab2c07e6db7919..d8f7cf490a498d8af282e3d6f746876ff06a2a33 100644 (file)
@@ -5,13 +5,15 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_print_rule_action_error_missing_pid_
-  void controller_print_rule_action_error_missing_pid(fl_print_t * const print, const f_string_static_t alias) {
+  f_status_t controller_print_rule_action_error_missing_pid(fl_print_t * const print, const f_string_static_t alias) {
 
     if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
 
     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);
+
+    return F_okay;
   }
 #endif // _di_controller_print_rule_action_error_missing_pid_
 
index 8a7197d84bb45f60531f94e5864b50ebe4b25728..1875a894ee12c118df2cdb4a637509b51720eee2 100644 (file)
@@ -23,9 +23,15 @@ extern "C" {
  *   The error or warning output structure.
  * @param alias
  *   The rule alias of the rule that is missing the pid file designation.
+ *
+ * @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_rule_action_error_missing_pid_
-  extern void controller_print_rule_action_error_missing_pid(fl_print_t * const print, const f_string_static_t alias);
+  extern f_status_t controller_print_rule_action_error_missing_pid(fl_print_t * const print, const f_string_static_t alias);
 #endif // _di_controller_print_rule_action_error_missing_pid_
 
 #ifdef __cplusplus
index 0113cc1e6b61259dc1270202417a335cf396c258..47a9689f8dcad50d070777dd7dfbd450e89eb983 100644 (file)
@@ -10,37 +10,39 @@ extern "C" {
     if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
     if (print->verbosity < f_console_verbosity_debug_e) return F_output_not;
 
-    controller_global_t * const global = (controller_global_t *) print->custom;
+    controller_t * const main = (controller_t *) print->custom;
 
-    controller_lock_print(print->to, global->thread);
+    controller_lock_print(print->to, &main->thread);
 
-    fl_print_format("%r%[%QAction is empty, nothing to do.%]%r", primt->to, f_string_eol_s, print->context, print->prefix, print->context, f_string_eol_s);
+    fl_print_format("%r%[%QAction is empty, nothing to do.%]%r", print->to, f_string_eol_s, print->context, print->prefix, print->context, f_string_eol_s);
 
     controller_print_rule_error_cache(print, cache->action, F_true);
 
-    controller_unlock_print_flush(print->to, global->thread);
+    controller_unlock_print_flush(print->to, &main->thread);
 
     return F_okay;
   }
 #endif // _di_controller_print_rule_item_debug_action_empty_
 
 #ifndef _di_controller_print_rule_item_error_
-  void controller_print_rule_item_error(fl_print_t * const print, const controller_cache_action_t cache, const bool item, const f_status_t status) {
+  f_status_t controller_print_rule_item_error(fl_print_t * const print, const controller_cache_action_t cache, const bool item, const f_status_t status) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
     if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
     if (status == F_interrupt) return F_status_set_error(F_output_not);
 
-    controller_global_t * const global = (controller_global_t *) print->custom;
+    controller_t * const main = (controller_t *) print->custom;
 
     // fll_error_print() automatically locks, so manually handle only the mutex locking and flushing rather than calling controller_lock_print().
-    f_thread_mutex_lock(&global->thread->lock.print);
+    f_thread_mutex_lock(&main->thread.lock.print);
 
     controller_print_rule_error_cache(print, cache, item);
 
     f_file_stream_lock(print->to);
 
-    controller_unlock_print_flush(print->to, global->thread);
+    controller_unlock_print_flush(print->to, &main->thread);
+
+    return F_okay;
   }
 #endif // _di_controller_print_rule_item_error_
 
@@ -50,9 +52,9 @@ extern "C" {
     if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
     if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
 
-    controller_global_t * const global = (controller_global_t *) print->custom;
+    controller_t * const main = (controller_t *) print->custom;
 
-    controller_lock_print(print->to, global->thread);
+    controller_lock_print(print->to, &main->thread);
 
     fl_print_format("%r%[%QRule item action '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
     fl_print_format(f_string_format_r_single_s.string, print->to, print->notable, controller_rerun_s, print->notable);
@@ -72,7 +74,7 @@ extern "C" {
 
     controller_print_rule_error_cache(print, cache->action, F_true);
 
-    controller_unlock_print_flush(print->to, global->thread);
+    controller_unlock_print_flush(print->to, &main->thread);
 
     return F_okay;
   }
@@ -84,9 +86,9 @@ extern "C" {
     if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
     if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
 
-    controller_global_t * const global = (controller_global_t *) print->custom;
+    controller_t * const main = (controller_t *) print->custom;
 
-    controller_lock_print(print->to, global->thread);
+    controller_lock_print(print->to, &main->thread);
 
     fl_print_format("%r%[%QRule item action '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
     fl_print_format(f_string_format_r_single_s.string, print->to, print->notable, controller_rerun_s, print->notable);
@@ -99,7 +101,7 @@ extern "C" {
 
     controller_print_rule_error_cache(print, cache->action, F_true);
 
-    controller_unlock_print_flush(print->to, global->thread);
+    controller_unlock_print_flush(print->to, &main->thread);
 
     return F_okay;
   }
@@ -111,9 +113,9 @@ extern "C" {
     if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
     if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
 
-    controller_global_t * const global = (controller_global_t *) print->custom;
+    controller_t * const main = (controller_t *) print->custom;
 
-    controller_lock_print(print->to, global->thread);
+    controller_lock_print(print->to, &main->thread);
 
     fl_print_format("%r%[%QRule item action '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
     fl_print_format(f_string_format_r_single_s.string, print->to, print->notable, name, print->notable);
@@ -123,21 +125,19 @@ extern "C" {
 
     controller_print_rule_error_cache(print, cache->action, F_true);
 
-    controller_unlock_print_flush(print->to, global->thread);
+    controller_unlock_print_flush(print->to, &main->thread);
 
     return F_okay;
   }
 #endif // _di_controller_print_rule_item_error_action_unknown_
 
 #ifndef _di_controller_print_rule_item_error_execute_
-  void controller_print_rule_item_error_execute(fl_print_t * const print, controller_instance_t * const instance, const bool script_is, const f_string_static_t name, const f_status_t status) {
+  f_status_t controller_print_rule_item_error_execute(fl_print_t * const print, controller_instance_t * const instance, const bool script_is, const f_string_static_t name, const f_status_t status) {
 
-    if (!print || !print->custom) return F_status_set_error(F_output_not);
+    if (!print || !instance || !instance->main) return F_status_set_error(F_output_not);
     if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
 
-    controller_global_t * const global = (controller_global_t *) print->custom;
-
-    controller_lock_print(print->to, global->thread);
+    controller_lock_print(print->to, &instance->main->thread);
 
     fl_print_format("%r%[%QThe %r '%]", print->to, f_string_eol_s, print->context, print->prefix, script_is ? controller_engine_s : controller_program_s, print->context);
     fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
@@ -160,8 +160,8 @@ extern "C" {
 
       fl_print_format("%]%['.%]%r", print->to, print->notable, print->context, print->context, f_string_eol_s);
     }
-    else if (WIFEXITED(process->result) ? WEXITSTATUS(process->result) : 0) {
-      const uint8_t code = WIFEXITED(process->result) ? WEXITSTATUS(process->result) : 0;
+    else if (WIFEXITED(instance->result) ? WEXITSTATUS(instance->result) : 0) {
+      const uint8_t code = WIFEXITED(instance->result) ? WEXITSTATUS(instance->result) : 0;
 
       if (code == F_execute_access) {
         fl_print_format("%[' failed, access is denied.%]%r", print->to, print->context, print->context, f_string_eol_s);
@@ -377,29 +377,35 @@ extern "C" {
       fl_print_format("%[' failed.%]%r", print->to, print->context, print->context, f_string_eol_s);
     }
 
-    controller_unlock_print_flush(print->to, global->thread);
+    controller_unlock_print_flush(print->to, &instance->main->thread);
+
+    return F_okay;
   }
 #endif // _di_controller_print_rule_item_error_execute_
 
 #ifndef _di_controller_print_rule_item_error_need_want_wish_
-  void controller_print_rule_item_error_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) {
+  f_status_t controller_print_rule_item_error_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) {
 
-    if (print->verbosity == f_console_verbosity_quiet_e) return;
+    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(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);
+
+    return F_okay;
   }
 #endif // _di_controller_print_rule_item_error_need_want_wish_
 
 #ifndef _di_controller_print_rule_item_error_rule_not_loaded_
-  void controller_print_rule_item_error_rule_not_loaded(fl_print_t * const print, const f_string_static_t alias) {
+  f_status_t controller_print_rule_item_error_rule_not_loaded(fl_print_t * const print, const f_string_static_t alias) {
 
-    if (print->verbosity == f_console_verbosity_quiet_e) return;
+    if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
 
     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);
+
+    return F_okay;
   }
 #endif // _di_controller_print_rule_item_error_rule_not_loaded_
 
index 6c8f960895e527d830bf84a36f5eddbb1c76d3d4..f51f212cbdc3fa00f1778b90e18379745129f88e 100644 (file)
@@ -60,10 +60,16 @@ extern "C" {
  * @param status
  *   The status code representing the failure (without the error bit set).
  *
+ * @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.
+ *
  * @see controller_print_rule_error_cache()
  */
 #ifndef _di_controller_print_rule_item_error_
-  extern void controller_print_rule_item_error(fl_print_t * const print, const controller_cache_action_t cache, const bool item, const f_status_t status);
+  extern f_status_t controller_print_rule_item_error(fl_print_t * const print, const controller_cache_action_t cache, const bool item, const f_status_t status);
 #endif // _di_controller_print_rule_item_error_
 
 /**
@@ -177,9 +183,15 @@ extern "C" {
  *   The code returned by the executed program or script.
  * @param status
  *   The status code representing the failure (without the error bit set).
+ *
+ * @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_rule_item_error_execute_
-  extern void controller_print_rule_item_error_execute(fl_print_t * const print, controller_instance_t * const instance, const bool script_is, const f_string_static_t name, const f_status_t status);
+  extern f_status_t controller_print_rule_item_error_execute(fl_print_t * const print, controller_instance_t * const instance, const bool script_is, const f_string_static_t name, const f_status_t status);
 #endif // _di_controller_print_rule_item_error_execute_
 
 /**
@@ -194,9 +206,15 @@ extern "C" {
  *   The value that is the error or warning.
  * @param why
  *   A short explanation on why this is an error or warning.
+ *
+ * @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_rule_item_error_need_want_wish_
-  extern void controller_print_rule_item_error_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);
+  extern f_status_t controller_print_rule_item_error_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);
 #endif // _di_controller_print_rule_item_error_need_want_wish_
 
 /**
@@ -206,9 +224,15 @@ extern "C" {
  *   The error or warning output structure.
  * @param alias
  *   The rule alias of the rule that is not loaded.
+ *
+ * @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_rule_item_error_rule_not_loaded_
-  extern void controller_print_rule_item_error_rule_not_loaded(fl_print_t * const print, const f_string_static_t alias);
+  extern f_status_t controller_print_rule_item_error_rule_not_loaded(fl_print_t * const print, const f_string_static_t alias);
 #endif // _di_controller_print_rule_item_error_rule_not_loaded_
 
 #ifdef __cplusplus
index 104dd7086b43478cf87694c0f3d2ce79923342e0..b4e8ca141bba5a1b4a9fce5114c6a6e69e896db5 100644 (file)
@@ -5,10 +5,10 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_print_rule_setting_read_error_
-  void controller_print_rule_setting_read_error(fl_print_t * const print, const f_string_t message, const f_number_unsigned_t index, const f_number_unsigned_t line_item, controller_thread_t * const thread, controller_cache_t * const cache) {
+  f_status_t controller_print_rule_setting_read_error(fl_print_t * const print, const f_string_t message, const f_number_unsigned_t index, const f_number_unsigned_t line_item, controller_thread_t * const thread, controller_cache_t * const cache) {
 
-    if (!print->custom) return;
-    if (print->verbosity == f_console_verbosity_quiet_e) return;
+    if (!print->custom) return F_status_set_error(F_output_not);
+    if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
 
     controller_t * const main = (controller_t *) print->custom;
 
@@ -27,14 +27,16 @@ extern "C" {
     controller_print_rule_error_cache(print, cache->action, F_false);
 
     controller_unlock_print_flush(print->to, thread);
+
+    return F_okay;
   }
 #endif // _di_controller_print_rule_setting_read_error_
 
 #ifndef _di_controller_print_rule_setting_read_error_with_range_
-  void controller_print_rule_setting_read_error_with_range(fl_print_t * const print, const f_string_t before, const f_range_t range, const f_string_t after, const f_number_unsigned_t index, const f_number_unsigned_t line_item, controller_thread_t * const thread, controller_cache_t * const cache) {
+  f_status_t controller_print_rule_setting_read_error_with_range(fl_print_t * const print, const f_string_t before, const f_range_t range, const f_string_t after, const f_number_unsigned_t index, const f_number_unsigned_t line_item, controller_thread_t * const thread, controller_cache_t * const cache) {
 
-    if (!print->custom) return;
-    if (print->verbosity == f_console_verbosity_quiet_e) return;
+    if (!print->custom) return F_status_set_error(F_output_not);
+    if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
 
     controller_t * const main = (controller_t *) print->custom;
 
@@ -55,87 +57,95 @@ extern "C" {
     controller_print_rule_error_cache(print, cache->action, F_false);
 
     controller_unlock_print_flush(print->to, thread);
+
+    return F_okay;
   }
 #endif // _di_controller_print_rule_setting_read_error_with_range_
 
 #ifndef _di_controller_print_rule_setting_read_mapping_
-  void controller_print_rule_setting_read_mapping(const controller_global_t global, const f_string_static_t name, const f_string_map_t map) {
+  f_status_t controller_print_rule_setting_read_mapping(controller_t * const main, const f_string_static_t name, const f_string_map_t map) {
 
-    if (global.main->program.error.verbosity != f_console_verbosity_debug_e) {
-      if (!(global.main->program.error.verbosity == f_console_verbosity_verbose_e && (global.main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
-        return;
+    if (main->program.error.verbosity != f_console_verbosity_debug_e) {
+      if (!(main->program.error.verbosity == f_console_verbosity_verbose_e && (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
+        return F_output_not;
       }
     }
 
-    controller_lock_print(global.main->program.output.to, global.thread);
+    controller_lock_print(main->program.output.to, &main->thread);
+
+    fl_print_format("%rProcessing rule item action '%[%Q%]'", main->program.output.to, f_string_eol_s, main->program.context.set.title, name, main->program.context.set.title);
+    fl_print_format(" mapping '%[%Q%]'", main->program.output.to, main->program.context.set.important, map.key, main->program.context.set.important);
+    fl_print_format(" to value '%[%Q%]'.%r", main->program.output.to, main->program.context.set.important, map.value, main->program.context.set.important, f_string_eol_s);
 
-    fl_print_format("%rProcessing rule item action '%[%Q%]'", global.main->program.output.to, f_string_eol_s, global.main->program.context.set.title, name, global.main->program.context.set.title);
-    fl_print_format(" mapping '%[%Q%]'", global.main->program.output.to, global.main->program.context.set.important, map.key, global.main->program.context.set.important);
-    fl_print_format(" to value '%[%Q%]'.%r", global.main->program.output.to, global.main->program.context.set.important, map.value, global.main->program.context.set.important, f_string_eol_s);
+    controller_unlock_print_flush(main->program.output.to, &main->thread);
 
-    controller_unlock_print_flush(global.main->program.output.to, global.thread);
+    return F_okay;
   }
 #endif // _di_controller_print_rule_setting_read_mapping_
 
 #ifndef _di_controller_print_rule_setting_read_value_
-  void controller_print_rule_setting_read_value(const controller_global_t global, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_t suffix) {
+  f_status_t controller_print_rule_setting_read_value(controller_t * const main, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_t suffix) {
 
-    if (global.main->program.error.verbosity != f_console_verbosity_debug_e) {
-      if (!(global.main->program.error.verbosity == f_console_verbosity_verbose_e && (global.main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
-        return;
+    if (main->program.error.verbosity != f_console_verbosity_debug_e) {
+      if (!(main->program.error.verbosity == f_console_verbosity_verbose_e && (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
+        return F_output_not;
       }
     }
 
-    controller_lock_print(global.main->program.output.to, global.thread);
+    controller_lock_print(main->program.output.to, &main->thread);
 
-    fl_print_format("%rProcessing rule item action '%[%Q%]' setting ", global.main->program.output.to, f_string_eol_s, global.main->program.context.set.title, name, global.main->program.context.set.title);
+    fl_print_format("%rProcessing rule item action '%[%Q%]' setting ", main->program.output.to, f_string_eol_s, main->program.context.set.title, name, main->program.context.set.title);
 
     if (name_sub.used) {
-      fl_print_format("'%[%Q%]'", global.main->program.output.to, global.main->program.context.set.notable, name_sub, global.main->program.context.set.notable);
+      fl_print_format("'%[%Q%]'", main->program.output.to, main->program.context.set.notable, name_sub, main->program.context.set.notable);
     }
     else {
-      f_print_terminated("value", global.main->program.output.to);
+      f_print_terminated("value", main->program.output.to);
     }
 
-    fl_print_format(" to '%[%Q%]'", global.main->program.output.to, global.main->program.context.set.important, value, global.main->program.context.set.important);
-    fl_print_format("%S.%r", global.main->program.output.to, suffix, f_string_eol_s);
+    fl_print_format(" to '%[%Q%]'", main->program.output.to, main->program.context.set.important, value, main->program.context.set.important);
+    fl_print_format("%S.%r", main->program.output.to, suffix, f_string_eol_s);
 
-    controller_unlock_print_flush(global.main->program.output.to, global.thread);
+    controller_unlock_print_flush(main->program.output.to, &main->thread);
+
+    return F_okay;
   }
 #endif // _di_controller_print_rule_setting_read_value_
 
 #ifndef _di_controller_print_rule_setting_read_values_
-  void controller_print_rule_setting_read_values(const controller_global_t global, const f_string_static_t name, const f_number_unsigned_t index, controller_cache_t * const cache) {
+  f_status_t controller_print_rule_setting_read_values(controller_t * const main, const f_string_static_t name, const f_number_unsigned_t index, controller_cache_t * const cache) {
 
-    if (global.main->program.error.verbosity != f_console_verbosity_debug_e) {
-      if (!(global.main->program.error.verbosity == f_console_verbosity_verbose_e && (global.main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
-        return;
+    if (main->program.error.verbosity != f_console_verbosity_debug_e) {
+      if (!(main->program.error.verbosity == f_console_verbosity_verbose_e && (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
+        return F_output_not;
       }
     }
 
-    controller_lock_print(global.main->program.output.to, global.thread);
+    controller_lock_print(main->program.output.to, &main->thread);
 
-    fl_print_format("%rProcessing rule item action '%[%Q%]' setting value to", global.main->program.output.to, f_string_eol_s, global.main->program.context.set.title, name, global.main->program.context.set.title);
+    fl_print_format("%rProcessing rule item action '%[%Q%]' setting value to", main->program.output.to, f_string_eol_s, main->program.context.set.title, name, main->program.context.set.title);
 
     for (f_number_unsigned_t j = 0; j < cache->content_actions.array[index].used; ++j) {
 
-      fl_print_format(" '%[%/Q%]'", global.main->program.output.to, global.main->program.context.set.important, cache->buffer_item, cache->content_actions.array[index].array[j], global.main->program.context.set.important);
+      fl_print_format(" '%[%/Q%]'", main->program.output.to, main->program.context.set.important, cache->buffer_item, cache->content_actions.array[index].array[j], main->program.context.set.important);
 
       if (j + 2 == cache->content_actions.array[index].used) {
         if (cache->content_actions.array[index].used > 2) {
-          f_print_terminated(",", global.main->program.output.to);
+          f_print_terminated(",", main->program.output.to);
         }
 
-        f_print_terminated(" and", global.main->program.output.to);
+        f_print_terminated(" and", main->program.output.to);
       }
       else if (j + 1 < cache->content_actions.array[index].used) {
-        f_print_terminated(",", global.main->program.output.to);
+        f_print_terminated(",", main->program.output.to);
       }
     } // for
 
-    fl_print_format(".%r", global.main->program.output.to, f_string_eol_s);
+    fl_print_format(".%r", main->program.output.to, f_string_eol_s);
+
+    controller_unlock_print_flush(main->program.output.to, &main->thread);
 
-    controller_unlock_print_flush(global.main->program.output.to, global.thread);
+    return F_okay;
   }
 #endif // _di_controller_print_rule_setting_read_value_
 
index a7d99f76c1732d1186a91f48b62496e8f9becc1f..1d856a440afa4264bfe38cb0418aad68da203b23 100644 (file)
@@ -35,10 +35,16 @@ extern "C" {
  * @param cache
  *   A structure for containing and caching relevant data.
  *
+ * @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.
+ *
  * @see controller_rule_setting_read()
  */
 #ifndef _di_controller_print_rule_setting_read_error_
-  extern void controller_print_rule_setting_read_error(fl_print_t * const print, const f_string_t message, const f_number_unsigned_t index, const f_number_unsigned_t line_item, controller_thread_t * const thread, controller_cache_t * const cache);
+  extern f_status_t controller_print_rule_setting_read_error(fl_print_t * const print, const f_string_t message, const f_number_unsigned_t index, const f_number_unsigned_t line_item, controller_thread_t * const thread, controller_cache_t * const cache);
 #endif // _di_controller_print_rule_setting_read_error_
 
 /**
@@ -64,31 +70,47 @@ extern "C" {
  * @param cache
  *   A structure for containing and caching relevant data.
  *
+ * @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.
+ *
  * @see controller_rule_setting_read()
  */
 #ifndef _di_controller_print_rule_setting_read_error_with_range_
-  extern void controller_print_rule_setting_read_error_with_range(fl_print_t * const print, const f_string_t before, const f_range_t range, const f_string_t after, const f_number_unsigned_t index, const f_number_unsigned_t line_item, controller_thread_t * const thread, controller_cache_t * const cache);
+  extern f_status_t controller_print_rule_setting_read_error_with_range(fl_print_t * const print, const f_string_t before, const f_range_t range, const f_string_t after, const f_number_unsigned_t index, const f_number_unsigned_t line_item, controller_thread_t * const thread, controller_cache_t * const cache);
 #endif // _di_controller_print_rule_setting_read_error_with_range_
 
 /**
  * Print message regarding the mapping of a setting when in simulation or verbose mode.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
+ *
+ *   Must not be NULL.
  * @param name
  *   The Object name of the setting being populated.
  * @param map
  *   The map being applied.
+ *
+ * @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_rule_setting_read_mapping_
-  extern void controller_print_rule_setting_read_mapping(const controller_global_t global, const f_string_static_t name, const f_string_map_t map);
+  extern f_status_t controller_print_rule_setting_read_mapping(controller_t * const main, const f_string_static_t name, const f_string_map_t map);
 #endif // _di_controller_print_rule_setting_read_mapping_
 
 /**
  * Print message regarding the population of a setting when in simulation or verbose mode.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
+ *
+ *   Must not be NULL.
  * @param name
  *   The Object name of the setting being populated.
  * @param name_sub
@@ -98,9 +120,15 @@ extern "C" {
  *   The value being set.
  * @param suffix
  *   An additional message to append at the end (before the final period).
+ *
+ * @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_rule_setting_read_value_
-  extern void controller_print_rule_setting_read_value(const controller_global_t global, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_t suffix);
+  extern f_status_t controller_print_rule_setting_read_value(controller_t * const main, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_t suffix);
 #endif // _di_controller_print_rule_setting_read_value_
 
 /**
@@ -108,17 +136,25 @@ extern "C" {
  *
  * This handles the case where there are multiple values stored in the buffer_item at a given content_actions position.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
+ *
+ *   Must not be NULL.
  * @param name
  *   The Object name of the setting being populated.
  * @param index
  *   Position within the content_actions range cache array.
  * @param cache
  *   A structure for containing and caching relevant data.
+ *
+ * @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_rule_setting_read_values_
-  extern void controller_print_rule_setting_read_values(const controller_global_t global, const f_string_static_t name, const f_number_unsigned_t index, controller_cache_t * const cache);
+  extern f_status_t controller_print_rule_setting_read_values(controller_t * const main, const f_string_static_t name, const f_number_unsigned_t index, controller_cache_t * const cache);
 #endif // _di_controller_print_rule_setting_read_values_
 
 #ifdef __cplusplus
index 20e4130d5709bf003ca635af0cc069252862e7fe..3d46a91a114b9e9e416ee874214a5b537d5dd0bf 100644 (file)
@@ -5,9 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_process_
-  void controller_process(controller_t * const main, controller_program_t * const program) {
+  void controller_process(controller_t * const main) {
 
-    if (!main || !program || F_status_is_error(main->setting.state.status)) return;
+    if (!main || F_status_is_error(main->setting.state.status)) return;
 
     main->setting.state.status = F_okay;
 
@@ -25,24 +25,13 @@ extern "C" {
       return;
     }
 
-    fl_print_t message = main->program.message;
-    fl_print_t output = main->program.output;
-    fl_print_t error = main->program.error;
-    fl_print_t warning = main->program.warning;
-    fl_print_t debug = main->program.debug;
-
-    controller_thread_t thread = controller_thread_t_initialize;
-    controller_global_t global = macro_controller_global_t_initialize_1(main, program, &thread, &message, &output, &error, &warning, &debug);
-
-    message.custom = output.custom = error.custom = warning.custom = debug.custom = (void *) &global;
-
-    // The global locks must be initialized, but only once, so initialize immediately upon allocation.
-    f_status_t status = controller_lock_create(&thread.lock);
+    // The locks must be initialized, but only once, so initialize immediately upon allocation.
+    f_status_t status = controller_lock_create(&main->thread.lock);
 
     if (F_status_is_error(status)) {
       controller_print_error_status(&main->program.error, macro_controller_f(controller_lock_create), status);
     } else {
-      status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_instance_t), (void **) &thread.instances.array, &thread.instances.used, &thread.instances.size);
+      status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_instance_t), (void **) &main->thread.instances.array, &main->thread.instances.used, &main->thread.instances.size);
 
       if (F_status_is_error(status)) {
         controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase), status);
@@ -50,59 +39,59 @@ extern "C" {
     }
 
     if (F_status_is_error_not(status)) {
-      status = f_thread_create(0, &thread.id_signal, &controller_thread_signal_normal, (void *) &global);
+      status = f_thread_create(0, &main->thread.id_signal, &controller_thread_signal_normal, (void *) &main);
     }
 
     if (F_status_is_error(status)) {
-      thread.id_signal = 0;
+      main->thread.id_signal = 0;
 
       controller_print_error_status(&main->program.error, macro_controller_f(f_thread_create), status);
     }
     else {
       if (main->setting.flag & controller_main_flag_daemon_e) {
-        program->ready = controller_program_ready_done_e;
+        main->process.ready = controller_process_ready_done_e;
 
-        if (f_file_exists(program->path_pid, F_true) == F_true) {
+        if (f_file_exists(main->process.path_pid, F_true) == F_true) {
           status = F_status_set_error(F_available_not);
-          program->ready = controller_program_ready_abort_e;
+          main->process.ready = controller_process_ready_abort_e;
 
-          controller_print_error_file_pid_exists(&main->program.error, &thread, program->path_pid);
+          controller_print_error_file_pid_exists(&main->program.error, &main->thread, main->process.path_pid);
         }
       }
-      else if (program->name_entry.used) {
-        status = f_thread_create(0, &thread.id_entry, &controller_thread_entry, (void *) &global);
+      else if (main->process.name_entry.used) {
+        status = f_thread_create(0, &main->thread.id_entry, &controller_thread_entry, (void *) &main);
 
         if (F_status_is_error(status)) {
           controller_print_error_status(&main->program.error, macro_controller_f(f_thread_create), status);
         }
         else {
-          controller_thread_join(&thread.id_entry);
+          controller_thread_join(&main->thread.id_entry);
 
-          status = thread.status;
-          thread.id_entry = 0;
+          status = main->thread.status;
+          main->thread.id_entry = 0;
         }
       }
     }
 
     // Only make the rule and control threads available once any/all pre-processing are complete.
-    if (F_status_is_error_not(status) && status != F_failure && status != F_child && thread.enabled == controller_thread_enabled_e) {
+    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.
-        controller_thread_join(&thread.id_rule);
+        controller_thread_join(&main->thread.id_rule);
 
-        if (thread.enabled && program->mode == controller_program_mode_service_e) {
-          status = f_thread_create(0, &thread.id_rule, &controller_thread_rule, (void *) &global);
+        if (main->thread.enabled && main->process.mode == controller_process_mode_service_e) {
+          status = f_thread_create(0, &main->thread.id_rule, &controller_thread_rule, (void *) &main);
 
           if (F_status_is_error(status)) {
-            thread.id_rule = 0;
+            main->thread.id_rule = 0;
           }
           else {
-            status = f_thread_create(0, &thread.id_cleanup, &controller_thread_cleanup, (void *) &global);
+            status = f_thread_create(0, &main->thread.id_cleanup, &controller_thread_cleanup, (void *) &main);
           }
 
           if (F_status_is_error(status)) {
-            thread.id_cleanup = 0;
+            main->thread.id_cleanup = 0;
 
             controller_print_error_status(&main->program.error, macro_controller_f(f_thread_create), status);
           }
@@ -113,40 +102,40 @@ extern "C" {
     if (status == F_child) {
       main->setting.state.status = F_child;
 
-      controller_thread_delete(&thread);
+      controller_thread_delete(&main->thread);
 
       return;
     }
 
-    if (F_status_is_error_not(status) && status != F_failure && !(main->setting.flag & controller_main_flag_validate_e) && controller_thread_is_enabled(F_true, &thread)) {
-      if (program->mode == controller_program_mode_service_e) {
-        controller_thread_join(&thread.id_signal);
+    if (F_status_is_error_not(status) && status != F_failure && !(main->setting.flag & controller_main_flag_validate_e) && controller_thread_is_enabled(F_true, &main->thread)) {
+      if (main->process.mode == controller_process_mode_service_e) {
+        controller_thread_join(&main->thread.id_signal);
       }
-      else if (program->mode == controller_program_mode_helper_e || program->mode == controller_program_mode_program_e) {
-        status = controller_rule_wait_all(&global, F_true, F_false);
+      else if (main->process.mode == controller_process_mode_helper_e || main->process.mode == controller_process_mode_program_e) {
+        status = controller_rule_wait_all(main, F_true, F_false);
       }
     }
 
-    controller_thread_instance_cancel(&global, F_true, controller_thread_cancel_call_e);
+    controller_thread_instance_cancel(main, F_true, controller_thread_cancel_call_e);
 
-    controller_thread_instance_exit(&global);
+    controller_thread_instance_exit(main);
 
-    if (thread.id_signal) f_thread_join(thread.id_signal, 0);
-    if (thread.id_cleanup) f_thread_join(thread.id_cleanup, 0);
-    if (thread.id_control) f_thread_join(thread.id_control, 0);
-    if (thread.id_entry) f_thread_join(thread.id_entry, 0);
-    if (thread.id_rule) f_thread_join(thread.id_rule, 0);
+    if (main->thread.id_signal) f_thread_join(main->thread.id_signal, 0);
+    if (main->thread.id_cleanup) f_thread_join(main->thread.id_cleanup, 0);
+    if (main->thread.id_control) f_thread_join(main->thread.id_control, 0);
+    if (main->thread.id_entry) f_thread_join(main->thread.id_entry, 0);
+    if (main->thread.id_rule) f_thread_join(main->thread.id_rule, 0);
 
-    thread.id_cleanup = 0;
-    thread.id_control = 0;
-    thread.id_entry = 0;
-    thread.id_rule = 0;
-    thread.id_signal = 0;
+    main->thread.id_cleanup = 0;
+    main->thread.id_control = 0;
+    main->thread.id_entry = 0;
+    main->thread.id_rule = 0;
+    main->thread.id_signal = 0;
 
-    controller_thread_delete(&thread);
+    controller_thread_delete(&main->thread);
 
     if (F_status_set_fine(status) == F_interrupt) {
-      fll_program_print_signal_received(&main->program.warning, thread.signal);
+      fll_program_print_signal_received(&main->program.warning, main->thread.signal);
 
       if (main->program.output.verbosity > f_console_verbosity_quiet_e) {
         fll_print_dynamic_raw(f_string_eol_s, main->program.output.to);
index 0928595bded5284fa81da86497885777248b0674..2e4abd3ae3f56a870bc2366dd47ad344149a7965 100644 (file)
@@ -39,13 +39,9 @@ extern "C" {
  *     F_interrupt on (exit) signal received.
  *
  *     F_parameter (with error bit) if main is NULL or setting is NULL.
- * @param program
- *   A pointer to the current program settings.
- *
- *   Must not be NULL.
  */
 #ifndef controller_process
-  extern void controller_process(controller_t * const main, controller_program_t * const program);
+  extern void controller_process(controller_t * const main);
 #endif // controller_process
 
 #ifdef __cplusplus
index d3faf04fee4146f149c8d59bfef3e5835c02b3b6..6916248264dae4f90550d7621d6048c4f8691e82 100644 (file)
@@ -233,16 +233,16 @@ extern "C" {
 #endif // _di_controller_rule_find_
 
 #ifndef _di_controller_rule_id_construct_
-  f_status_t controller_rule_id_construct(controller_global_t * const global, const f_string_static_t source, const f_range_t directory, const f_range_t basename, f_string_dynamic_t * const alias) {
+  f_status_t controller_rule_id_construct(controller_t * const main, const f_string_static_t source, const f_range_t directory, const f_range_t basename, f_string_dynamic_t * const alias) {
 
-    if (!global || !global->main || !global->thread) return F_status_set_error(F_parameter);
+    if (!main || !alias) return F_status_set_error(F_parameter);
 
     alias->used = 0;
 
     f_status_t status = f_string_dynamic_partial_append_nulless(source, directory, alias);
 
     if (F_status_is_error(status)) {
-      controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
+      controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
 
       return status;
     }
@@ -250,7 +250,7 @@ extern "C" {
     status = f_string_dynamic_append(f_path_separator_s, alias);
 
     if (F_status_is_error(status)) {
-      controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
+      controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
 
       return status;
     }
@@ -258,7 +258,7 @@ extern "C" {
     status = f_string_dynamic_partial_append_nulless(source, basename, alias);
 
     if (F_status_is_error(status)) {
-      controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
+      controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
 
       return status;
     }
index 8f95ac3448d7c6cb94f5289bf6f2bd8edd4cda10..bc148ee59382dc85ab3deb32644aeddcbb47dc62 100644 (file)
@@ -74,8 +74,10 @@ extern "C" {
 /**
  * Construct an id from two distinct strings found within a single given source.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
+ *
+ *   Must not be NULL.
  * @param source
  *   The source string that both the directory and basename are copied from.
  * @param directory
@@ -85,6 +87,8 @@ extern "C" {
  * @param alias
  *   The constructed alias.
  *
+ *   Must not be NULL.
+ *
  * @return
  *   F_okay on success.
  *
@@ -94,7 +98,7 @@ extern "C" {
  * @see f_string_dynamic_partial_append_nulless()
  */
 #ifndef _di_controller_rule_id_construct_
-  extern f_status_t controller_rule_id_construct(controller_global_t * const global, const f_string_static_t source, const f_range_t directory, const f_range_t basename, f_string_dynamic_t * const alias);
+  extern f_status_t controller_rule_id_construct(controller_t * const main, const f_string_static_t source, const f_range_t directory, const f_range_t basename, f_string_dynamic_t * const alias);
 #endif // _di_controller_rule_id_construct_
 
 #ifdef __cplusplus
index 3f6538f49661e50a580f0e47d27cd941227061d8..053ac876aa632df79e759eb3a64d08839a173e83 100644 (file)
@@ -32,13 +32,13 @@ 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_global_t * const global, const bool is_normal, const uint8_t type, const uint8_t method, controller_cache_t * const cache, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range) {
+  f_status_t controller_rule_action_read(controller_t * const main, const bool is_normal, const uint8_t type, const uint8_t method, controller_cache_t * const cache, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range) {
 
-    if (!global || !item || !actions || !range) return F_status_set_error(F_parameter);
+    if (!main || !item || !actions || !range) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
 
-    controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, global);
+    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_number_unsigned_t i = 0;
@@ -67,7 +67,7 @@ extern "C" {
       fl_fss_extended_list_content_read(cache->buffer_item, range, &cache->content_action, &cache->delimits, &cache->comments, &state);
 
       if (F_status_is_error(status)) {
-        controller_print_error(&global->main->program.error, macro_controller_f(fl_fss_extended_list_content_read));
+        controller_print_error(&main->program.error, macro_controller_f(fl_fss_extended_list_content_read));
 
         return status;
       }
@@ -76,7 +76,7 @@ extern "C" {
         f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state);
 
         if (F_status_is_error(status)) {
-          controller_print_error(&global->main->program.error, macro_controller_f(f_fss_apply_delimit));
+          controller_print_error(&main->program.error, macro_controller_f(f_fss_apply_delimit));
 
           return status;
         }
@@ -88,7 +88,7 @@ extern "C" {
           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(status)) {
-            controller_print_error(&global->main->program.error, macro_controller_f(f_memory_array_increase));
+            controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase));
 
             return status;
           }
@@ -96,7 +96,7 @@ extern "C" {
           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(status)) {
-            controller_print_error(&global->main->program.error, macro_controller_f(f_memory_array_increase));
+            controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase));
 
             return status;
           }
@@ -108,7 +108,7 @@ extern "C" {
           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(status)) {
-            controller_print_error(&global->main->program.error, macro_controller_f(f_string_dynamic_append_nulless));
+            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(status));
 
@@ -125,7 +125,7 @@ extern "C" {
             fl_iki_read(&actions->array[actions->used].parameters.array[0], &range_iki, &actions->array[actions->used].ikis.array[0], &state);
 
             if (F_status_is_error(status)) {
-              controller_print_error(&global->main->program.error, macro_controller_f(fl_iki_read));
+              controller_print_error(&main->program.error, macro_controller_f(fl_iki_read));
 
               actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(status));
 
@@ -145,7 +145,7 @@ extern "C" {
         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(status)) {
-          controller_print_error(&global->main->program.error, macro_controller_f(fll_fss_extended_read));
+          controller_print_error(&main->program.error, macro_controller_f(fll_fss_extended_read));
 
           return status;
         }
@@ -153,7 +153,7 @@ extern "C" {
         f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state);
 
         if (F_status_is_error(status)) {
-          controller_print_error(&global->main->program.error, macro_controller_f(f_fss_apply_delimit));
+          controller_print_error(&main->program.error, macro_controller_f(f_fss_apply_delimit));
 
           return status;
         }
@@ -163,7 +163,7 @@ extern "C" {
           status = f_memory_array_increase_by(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &actions->array, &actions->used, &actions->size);
 
           if (F_status_is_error(status)) {
-            controller_print_error(&global->main->program.error, macro_controller_f(f_memory_array_increase_by));
+            controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase_by));
 
             return status;
           }
@@ -171,7 +171,7 @@ extern "C" {
           f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &actions->array[actions->used].line, &state);
 
           if (F_status_is_error(status)) {
-            controller_print_error(&global->main->program.error, macro_controller_f(f_fss_count_lines));
+            controller_print_error(&main->program.error, macro_controller_f(f_fss_count_lines));
 
             return status;
           }
@@ -180,7 +180,7 @@ extern "C" {
           actions->array[actions->used].line += ++item->line;
           actions->array[actions->used].status = F_known_not;
 
-          status = controller_rule_parameters_read(global, cache->buffer_item, &cache->object_actions.array[i], &cache->content_actions.array[i], &actions->array[actions->used], &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);
 
           if (F_status_is_error(status)) {
             actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(status));
@@ -201,13 +201,13 @@ extern "C" {
       fl_fss_extended_content_read(cache->buffer_item, range, &cache->content_action, 0, &cache->delimits, &state);
 
       if (F_status_is_error(status)) {
-        controller_print_error(&global->main->program.error, macro_controller_f(fll_fss_extended_content_read));
+        controller_print_error(&main->program.error, macro_controller_f(fll_fss_extended_content_read));
       }
       else if (status == F_fss_found_content) {
         f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state);
 
         if (F_status_is_error(status)) {
-          controller_print_error(&global->main->program.error, macro_controller_f(f_fss_apply_delimit));
+          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;
@@ -215,7 +215,7 @@ extern "C" {
           status = f_rip_dynamic_partial(cache->buffer_item, cache->content_action.array[0], &item->pid_file);
 
           if (F_status_is_error(status)) {
-            controller_print_error(&global->main->program.error, macro_controller_f(f_rip_dynamic_partial));
+            controller_print_error(&main->program.error, macro_controller_f(f_rip_dynamic_partial));
           }
         }
         else if (type == controller_rule_action_type_rerun_e) {
@@ -252,7 +252,7 @@ extern "C" {
           }
 
           if (!type_rerun) {
-            controller_print_rule_item_error_action_first(&global->main->program.error, cache);
+            controller_print_rule_item_error_action_first(&main->program.error, cache);
 
             return F_status_set_error(F_valid_not);
           }
@@ -270,7 +270,7 @@ extern "C" {
             }
           }
           else {
-            controller_print_rule_item_error_action_second(&global->main->program.error, cache);
+            controller_print_rule_item_error_action_second(&main->program.error, cache);
 
             return F_status_set_error(F_valid_not);
           }
@@ -278,16 +278,16 @@ extern "C" {
           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) {
-              status = controller_rule_action_read_rerun_number(global, controller_delay_s.string, cache, &i, &rerun_item->delay);
+              status = controller_rule_action_read_rerun_number(main, controller_delay_s.string, cache, &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) {
-              status = controller_rule_action_read_rerun_number(global, controller_max_s.string, cache, &i, &rerun_item->max);
+              status = controller_rule_action_read_rerun_number(main, controller_max_s.string, cache, &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 {
-              controller_print_rule_item_error_action_unknown(&global->main->program.error, cache, controller_rerun_s, i);
+              controller_print_rule_item_error_action_unknown(&main->program.error, cache, controller_rerun_s, i);
 
               return F_status_set_error(F_valid_not);
             }
@@ -312,7 +312,7 @@ extern "C" {
               item->with &= ~controller_with_session_new_d;
             }
             else {
-              controller_print_rule_item_error_action_unknown(&global->main->program.error, cache, controller_with_s, i);
+              controller_print_rule_item_error_action_unknown(&main->program.error, cache, controller_with_s, i);
 
               status = F_status_set_error(F_valid_not);
 
@@ -324,7 +324,7 @@ extern "C" {
           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(status)) {
-            controller_print_error(&global->main->program.error, macro_controller_f(f_memory_array_increase));
+            controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase));
 
             return status;
           }
@@ -332,7 +332,7 @@ extern "C" {
           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(status)) {
-            controller_print_error(&global->main->program.error, macro_controller_f(f_memory_array_increase));
+            controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase));
 
             return status;
           }
@@ -349,7 +349,7 @@ extern "C" {
           } // for
 
           if (F_status_is_error(status)) {
-            controller_print_error(&global->main->program.error, macro_controller_f(f_string_dynamic_partial_mash_nulless));
+            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(status));
 
@@ -366,7 +366,7 @@ extern "C" {
             fl_iki_read(&actions->array[actions->used].parameters.array[0], &range_iki, &actions->array[actions->used].ikis.array[0], &state);
 
             if (F_status_is_error(status)) {
-              controller_print_error(&global->main->program.error, macro_controller_f(fl_iki_read));
+              controller_print_error(&main->program.error, macro_controller_f(fl_iki_read));
 
               actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(status));
 
@@ -381,7 +381,7 @@ extern "C" {
           f_fss_count_lines(cache->buffer_item, range->start, &actions->array[actions->used].line, &state);
 
           if (F_status_is_error(status)) {
-            controller_print_error(&global->main->program.error, macro_controller_f(f_fss_count_lines));
+            controller_print_error(&main->program.error, macro_controller_f(f_fss_count_lines));
 
             return status;
           }
@@ -390,7 +390,7 @@ extern "C" {
           actions->array[actions->used].line += ++item->line;
           actions->array[actions->used].status = F_known_not;
 
-          status = controller_rule_parameters_read(global, cache->buffer_item, 0, &cache->content_action, &actions->array[actions->used], &state);
+          status = controller_rule_parameters_read(main, cache->buffer_item, 0, &cache->content_action, &actions->array[actions->used], &state);
 
           if (F_status_is_error(status)) {
             actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(status));
@@ -407,7 +407,7 @@ extern "C" {
     }
 
     if (F_status_is_error_not(status) && status == F_data_not) {
-      controller_print_rule_item_debug_action_empty(global->debug, cache);
+      controller_print_rule_item_debug_action_empty(&main->program.debug, cache);
     }
 
     return status;
@@ -415,7 +415,7 @@ extern "C" {
 #endif // _di_controller_rule_action_read_
 
 #ifndef _di_controller_rule_action_read_rerun_number_
-  f_status_t controller_rule_action_read_rerun_number(controller_global_t * const global, const f_string_t name, controller_cache_t * const cache, f_number_unsigned_t * const index, f_number_unsigned_t * const number) {
+  f_status_t controller_rule_action_read_rerun_number(controller_t * const main, const f_string_t name, controller_cache_t * const cache, f_number_unsigned_t * const index, f_number_unsigned_t * const number) {
 
     f_status_t status = F_okay;
     f_number_signed_t parsed = 0;
@@ -436,41 +436,41 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
+      if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
         status = F_status_set_fine(status);
 
         if (status != F_valid_not && status != F_number && status != F_number_decimal && status != F_number_overflow && status != F_number_underflow && status != F_number_negative) {
-          controller_print_error(&global->main->program.error, macro_controller_f(fl_conversion_dynamic_partial_to_signed_detect));
+          controller_print_error(&main->program.error, macro_controller_f(fl_conversion_dynamic_partial_to_signed_detect));
         }
         else {
-          controller_lock_print(global->main->program.error.to, global->thread);
+          controller_lock_print(main->program.error.to, &main->thread);
 
-          fl_print_format("%r%[%QRule item action '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-          fl_print_format(f_string_format_r_single_s.string, global->main->program.error.to, global->main->program.error.notable, controller_rerun_s, global->main->program.error.notable);
-          fl_print_format("%[' requires a positive whole number or 0 for the '%]", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-          fl_print_format("%[%S%]", global->main->program.error.to, global->main->program.error.notable, name, global->main->program.error.notable);
-          fl_print_format("%[' value", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
+          fl_print_format("%r%[%QRule item action '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+          fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_rerun_s, main->program.error.notable);
+          fl_print_format("%[' requires a positive whole number or 0 for the '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+          fl_print_format("%[%S%]", main->program.error.to, main->program.error.notable, name, main->program.error.notable);
+          fl_print_format("%[' value", main->program.error.to, main->program.error.context, main->program.error.context);
 
           if (*index + 1 == cache->content_action.used) {
-            fl_print_format(", but none were given.%]%r", global->main->program.error.to, global->main->program.error.context, f_string_eol_s);
+            fl_print_format(", but none were given.%]%r", main->program.error.to, main->program.error.context, f_string_eol_s);
           }
           else {
-            fl_print_format(", but '%]%[%/Q%]", global->main->program.error.to, global->main->program.error.context, global->main->program.error.notable, cache->buffer_item, cache->content_action.array[*index], global->main->program.error.notable);
+            fl_print_format(", but '%]%[%/Q%]", main->program.error.to, main->program.error.context, main->program.error.notable, cache->buffer_item, cache->content_action.array[*index], main->program.error.notable);
 
             if (status == F_number || status == F_number_decimal) {
-              fl_print_format("%[' was given.%]%r", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+              fl_print_format("%[' was given.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
             }
             else if (status == F_number_overflow) {
-              fl_print_format("%[' is too large.%]%r", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+              fl_print_format("%[' is too large.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
             }
             else {
-              fl_print_format("%[' is negative.%]%r", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+              fl_print_format("%[' is negative.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
             }
           }
 
-          controller_print_rule_error_cache(global->error, cache->action, F_true);
+          controller_print_rule_error_cache(&main->program.error, cache->action, F_true);
 
-          controller_unlock_print_flush(global->main->program.error.to, global->thread);
+          controller_unlock_print_flush(main->program.error.to, &main->thread);
         }
       }
 
index ff8cf7a62a57f9d367afebc0d1221edafd991862..e94cf5912063f432e53d30021118b9054bbe7bb4 100644 (file)
@@ -50,12 +50,12 @@ extern "C" {
  *
  * This will automatically increase the size of the actions array as needed.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   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.
@@ -93,7 +93,7 @@ extern "C" {
  * @see f_memory_array_increase_by()
  */
 #ifndef _di_controller_rule_action_read_
-  extern f_status_t controller_rule_action_read(controller_global_t * const global, const bool is_normal, const uint8_t type, const uint8_t method, controller_cache_t * const cache, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range);
+  extern f_status_t controller_rule_action_read(controller_t * const main, const bool is_normal, const uint8_t type, const uint8_t method, controller_cache_t * const cache, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range);
 #endif // _di_controller_rule_action_read_
 
 /**
@@ -103,12 +103,12 @@ extern "C" {
  *
  * This is intended to be called by controller_rule_action_read().
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   This does not alter main.setting.state.status.
  * @param name
  *   The name representing the value whose number is being processed.
  * @param cache
@@ -129,7 +129,7 @@ extern "C" {
  * @see fl_conversion_dynamic_partial_to_signed_detect()
  */
 #ifndef _di_controller_rule_action_read_rerun_number_
-  extern f_status_t controller_rule_action_read_rerun_number(controller_global_t * const global, const f_string_t name, controller_cache_t * const cache, f_number_unsigned_t * const index, f_number_unsigned_t * const number);
+  extern f_status_t controller_rule_action_read_rerun_number(controller_t * const main, const f_string_t name, controller_cache_t * const cache, f_number_unsigned_t * const index, f_number_unsigned_t * const number);
 #endif // _di_controller_rule_action_read_rerun_number_
 
 
index bfdad9210e48a8105603e401b43d022633b7dcb0..105d5c9f565ad9f8cca24d3b60852abd93e0982d 100644 (file)
@@ -5,9 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_rule_execute_
-  f_status_t controller_rule_execute(controller_global_t * const global, const uint8_t action, const uint8_t options, controller_instance_t * const instance) {
+  f_status_t controller_rule_execute(controller_t * const main, const uint8_t action, const uint8_t options, controller_instance_t * const instance) {
 
-    if (!global || !instance) return F_status_set_error(F_parameter);
+    if (!main || !instance) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
     f_status_t success = F_false;
@@ -41,7 +41,7 @@ extern "C" {
         status = fll_control_group_prepare(instance->rule.cgroup);
 
         if (F_status_is_error(status)) {
-          controller_print_error_file(&global->main->program.error, macro_controller_f(fll_control_group_prepare), instance->rule.cgroup.path, controller_print_rule_control_groups_prepare_s, fll_error_file_type_directory_e);
+          controller_print_error_file(&main->program.error, macro_controller_f(fll_control_group_prepare), instance->rule.cgroup.path, controller_print_rule_control_groups_prepare_s, fll_error_file_type_directory_e);
 
           return status;
         }
@@ -76,7 +76,7 @@ extern "C" {
       status = fl_environment_load_names(instance->rule.environment, &environment);
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(fl_environment_load_names), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(fl_environment_load_names), F_status_set_fine(status));
 
         return status;
       }
@@ -85,10 +85,10 @@ extern "C" {
       controller_entry_t *entry = 0;
 
       if (instance->type == controller_instance_type_entry_e) {
-        entry = &global->program->entry;
+        entry = &main->process.entry;
       }
       else if (instance->type == controller_instance_type_exit_e) {
-        entry = &global->program->exit;
+        entry = &main->process.exit;
       }
 
       if (entry) {
@@ -107,7 +107,7 @@ extern "C" {
                   status = f_string_dynamic_append(entry->define.array[i].value, &environment.array[k].value);
 
                   if (F_status_is_error(status)) {
-                    controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
+                    controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
 
                     return status;
                   }
@@ -120,7 +120,7 @@ extern "C" {
                 status = f_string_maps_append(entry->define.array[i], &environment);
 
                 if (F_status_is_error(status)) {
-                  controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_maps_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;
                 }
@@ -148,7 +148,7 @@ extern "C" {
                 status = f_string_dynamic_append(instance->rule.define.array[i].value, &environment.array[k].value);
 
                 if (F_status_is_error(status)) {
-                  controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
+                  controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
 
                   return status;
                 }
@@ -161,7 +161,7 @@ extern "C" {
               status = f_string_maps_append(instance->rule.define.array[i], &environment);
 
               if (F_status_is_error(status)) {
-                controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_maps_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;
               }
@@ -176,10 +176,10 @@ extern "C" {
       controller_entry_t *entry = 0;
 
       if (instance->type == controller_instance_type_entry_e) {
-        entry = &global->program->entry;
+        entry = &main->process.entry;
       }
       else if (instance->type == controller_instance_type_exit_e) {
-        entry = &global->program->exit;
+        entry = &main->process.exit;
       }
 
       // When a custom define is specified, it needs to be exported into the environment.
@@ -189,7 +189,7 @@ extern "C" {
         status = f_environment_get_all(&environment);
 
         if (F_status_is_error(status)) {
-          controller_print_error_status(&global->main->program.error, macro_controller_f(f_environment_get_all), F_status_set_fine(status));
+          controller_print_error_status(&main->program.error, macro_controller_f(f_environment_get_all), F_status_set_fine(status));
 
           return status;
         }
@@ -199,7 +199,7 @@ extern "C" {
           status = f_string_maps_append(entry->define.array[i], &environment);
 
           if (F_status_is_error(status)) {
-            controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_maps_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;
           }
@@ -210,7 +210,7 @@ extern "C" {
           status = f_string_maps_append(instance->rule.define.array[i], &environment);
 
           if (F_status_is_error(status)) {
-            controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_maps_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;
           }
@@ -249,10 +249,10 @@ extern "C" {
         }
 
         if (instance->rule.items.array[i].type == controller_rule_item_type_command_e) {
-          status = controller_rule_expand(global, instance->rule.items.array[i].actions.array[j], instance);
+          status = controller_rule_expand(main, instance->rule.items.array[i].actions.array[j], instance);
 
           if (F_status_is_error(status)) {
-            controller_print_rule_error(global->error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
+            controller_print_rule_error(&main->program.error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
 
             break;
           }
@@ -279,10 +279,10 @@ extern "C" {
           }
         }
         else if (instance->rule.items.array[i].type == controller_rule_item_type_script_e) {
-          status = controller_rule_expand(global, instance->rule.items.array[i].actions.array[j], instance);
+          status = controller_rule_expand(main, instance->rule.items.array[i].actions.array[j], instance);
 
           if (F_status_is_error(status)) {
-            controller_print_rule_error(global->error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
+            controller_print_rule_error(&main->program.error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
 
             break;
           }
@@ -321,10 +321,10 @@ extern "C" {
           }
         }
         else if (instance->rule.items.array[i].type == controller_rule_item_type_service_e) {
-          status = controller_rule_expand(global, instance->rule.items.array[i].actions.array[j], instance);
+          status = controller_rule_expand(main, instance->rule.items.array[i].actions.array[j], instance);
 
           if (F_status_is_error(status)) {
-            controller_print_rule_error(global->error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
+            controller_print_rule_error(&main->program.error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
 
             break;
           }
@@ -354,15 +354,15 @@ extern "C" {
           else {
             success = F_status_set_error(F_failure);
 
-            controller_print_rule_action_error_missing_pid(global->error, instance->rule.alias);
+            controller_print_rule_action_error_missing_pid(&main->program.error, instance->rule.alias);
           }
         }
         else if (instance->rule.items.array[i].type == controller_rule_item_type_utility_e) {
           if (instance->rule.items.array[i].pid_file.used) {
-            status = controller_rule_expand(global, instance->rule.items.array[i].actions.array[j], instance);
+            status = controller_rule_expand(main, instance->rule.items.array[i].actions.array[j], instance);
 
             if (F_status_is_error(status)) {
-              controller_print_rule_error(global->error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
+              controller_print_rule_error(&main->program.error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
 
               break;
             }
@@ -398,18 +398,18 @@ extern "C" {
           else {
             success = F_status_set_error(F_failure);
 
-            controller_print_rule_action_error_missing_pid(global->error, instance->rule.alias);
+            controller_print_rule_action_error_missing_pid(&main->program.error, instance->rule.alias);
           }
         }
         else {
-          if (global->main->program.warning.verbosity == f_console_verbosity_debug_e) {
-            controller_lock_print(global->main->program.warning.to, global->thread);
+          if (main->program.warning.verbosity == f_console_verbosity_debug_e) {
+            controller_lock_print(main->program.warning.to, &main->thread);
 
-            fl_print_format("%r%[%QAction type is unknown, ignoring.%]%r", global->main->program.warning.to, f_string_eol_s, global->main->program.warning.context, global->main->program.warning.prefix, global->main->program.warning.context, f_string_eol_s);
+            fl_print_format("%r%[%QAction type is unknown, ignoring.%]%r", main->program.warning.to, f_string_eol_s, main->program.warning.context, main->program.warning.prefix, main->program.warning.context, f_string_eol_s);
 
-            controller_print_rule_error_cache(&global->main->program.warning, instance->cache.action, F_true);
+            controller_print_rule_error_cache(&main->program.warning, instance->cache.action, F_true);
 
-            controller_unlock_print_flush(global->main->program.warning.to, global->thread);
+            controller_unlock_print_flush(main->program.warning.to, &main->thread);
           }
 
           if (success == F_false) {
@@ -429,7 +429,7 @@ extern "C" {
 
     // Lock failed, attempt to re-establish lock before returning.
     if (F_status_set_fine(status) == F_lock) {
-      status = controller_lock_read(instance, global->thread, &instance->lock);
+      status = controller_lock_read(instance, &main->thread, &instance->lock);
       if (F_status_is_error(status)) return F_status_set_error(F_lock);
 
       success = F_false;
@@ -458,13 +458,12 @@ extern "C" {
 #ifndef _di_controller_rule_execute_foreground_
   f_status_t controller_rule_execute_foreground(const uint8_t type, const f_string_static_t program, const f_string_statics_t arguments, const uint8_t options, controller_execute_set_t * const execute_set, controller_instance_t * const instance) {
 
-    if (!instance) return F_status_set_error(F_parameter);
+    if (!instance || !instance->main) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
     f_status_t status_lock = F_okay;
 
-    controller_t * const main = instance->global->main;
-    controller_thread_t * const thread = instance->global->thread;
+    controller_t * const main = instance->main;
 
     f_execute_result_t result = f_execute_result_t_initialize;
 
@@ -494,7 +493,7 @@ extern "C" {
 
     if (options & controller_instance_option_simulate_e) {
       if (main->program.output.verbosity != f_console_verbosity_quiet_e) {
-        controller_lock_print(main->program.output.to, thread);
+        controller_lock_print(main->program.output.to, &instance->main->thread);
 
         fl_print_format("%rSimulating execution of '%[", main->program.output.to, f_string_eol_s, main->program.context.set.title);
 
@@ -519,7 +518,7 @@ extern "C" {
         fl_print_format("%]' from '", main->program.output.to, main->program.context.set.important);
         fl_print_format("%[%Q%]'.%r", main->program.output.to, main->program.context.set.notable, instance->rule.name, main->program.context.set.notable, f_string_eol_s);
 
-        controller_unlock_print_flush(main->program.output.to, thread);
+        controller_unlock_print_flush(main->program.output.to, &instance->main->thread);
       }
 
       // Sleep for less than a second to better show simulation of synchronous vs asynchronous.
@@ -532,7 +531,7 @@ extern "C" {
           controller_print_error_status(&main->program.error, macro_controller_f(f_time_spec_millisecond), F_status_set_fine(status));
         }
         else {
-          status = controller_time_sleep_nanoseconds(instance->global, delay);
+          status = controller_time_sleep_nanoseconds(instance->main, delay);
         }
       }
 
@@ -555,7 +554,7 @@ extern "C" {
       status_lock = controller_lock_write_instance(instance, &instance->active);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false, thread);
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
 
         if (F_status_set_fine(status_lock) != F_interrupt) {
           status = controller_lock_read_instance(instance, &instance->active);
@@ -576,7 +575,7 @@ extern "C" {
       status_lock = controller_lock_read_instance(instance, &instance->active);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true, thread);
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
       }
 
       if (F_status_set_fine(status_lock) != F_interrupt) {
@@ -596,14 +595,11 @@ extern "C" {
       status_lock = controller_lock_write_instance(instance, &instance->active);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false, thread);
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
 
         if (F_status_set_fine(status_lock) != F_interrupt) {
           status = controller_lock_read_instance(instance, &instance->active);
-
-          if (status == F_okay) {
-            return status_lock;
-          }
+          if (status == F_okay) return status_lock;
         }
 
         return F_status_set_error(F_lock);
@@ -619,7 +615,7 @@ extern "C" {
       status_lock = controller_lock_read_instance(instance, &instance->active);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true, thread);
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
 
         return F_status_set_error(F_lock);
       }
@@ -634,9 +630,7 @@ extern "C" {
     else {
       main->program.child = result.status;
 
-      if (!controller_thread_is_enabled_instance(instance)) {
-        return F_status_set_error(F_interrupt);
-      }
+      if (!controller_thread_is_enabled_instance(instance)) return F_status_set_error(F_interrupt);
     }
 
     if (F_status_is_error(status)) {
@@ -650,18 +644,16 @@ extern "C" {
       }
     }
 
-    if (status == F_child || F_status_set_fine(status) == F_interrupt) {
-      return status;
-    }
+    if (status == F_child || F_status_set_fine(status) == F_interrupt) return status;
 
     if (F_status_is_error(status)) {
       status = F_status_set_fine(status);
 
       if ((WIFEXITED(instance->result) && WEXITSTATUS(instance->result)) || status == F_control_group || status == F_failure || status == F_limit || status == F_processor || status == F_schedule) {
-        controller_print_rule_item_error_execute(instance->global->error, instance, type == controller_rule_item_type_script_e, program.used ? program : arguments.array[0], status);
+        controller_print_rule_item_error_execute(&instance->main->program.error, instance, type == controller_rule_item_type_script_e, program.used ? program : arguments.array[0], status);
       }
       else {
-        controller_print_error_status(instance->global->error, macro_controller_f(fll_execute_program), F_status_set_fine(status));
+        controller_print_error_status(&instance->main->program.error, macro_controller_f(fll_execute_program), F_status_set_fine(status));
       }
 
       status = F_status_set_error(status);
@@ -674,12 +666,12 @@ extern "C" {
 #ifndef _di_controller_rule_execute_pid_with_
   f_status_t controller_rule_execute_pid_with(const f_string_dynamic_t pid_file, const uint8_t type, const f_string_static_t program, const f_string_statics_t arguments, const uint8_t options, const uint8_t with, controller_execute_set_t * const execute_set, controller_instance_t * const instance) {
 
-    if (!execute_set || !instance || !instance->global || !instance->global->main || !instance->global->thread) return F_status_set_error(F_parameter);
+    if (!execute_set || !instance || !instance->main) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
     f_status_t status_lock = F_okay;
 
-    controller_t * const main = instance->global->main;
+    controller_t * const main = instance->main;
 
     f_execute_result_t result = f_execute_result_t_initialize;
 
@@ -746,7 +738,7 @@ extern "C" {
 
     if (options & controller_instance_option_simulate_e) {
       if (main->program.error.verbosity > f_console_verbosity_error_e) {
-        controller_lock_print(main->program.error.to, instance->global->thread);
+        controller_lock_print(main->program.error.to, &instance->main->thread);
 
         fl_print_format("%rSimulating execution of '%[", main->program.error.to, f_string_eol_s, main->program.context.set.title);
 
@@ -771,7 +763,7 @@ extern "C" {
         fl_print_format("%]' from '", main->program.error.to, main->program.context.set.important);
         fl_print_format("%[%Q%]'.%r", main->program.error.to, main->program.context.set.notable, instance->rule.name, main->program.context.set.notable, f_string_eol_s);
 
-        controller_unlock_print_flush(main->program.error.to, instance->global->thread);
+        controller_unlock_print_flush(main->program.error.to, &instance->main->thread);
       }
 
       // Sleep for less than a second to better show simulation of synchronous vs asynchronous.
@@ -784,7 +776,7 @@ extern "C" {
           controller_print_error_status(&main->program.error, macro_controller_f(f_time_spec_millisecond), F_status_set_fine(status));
         }
         else {
-          status = controller_time_sleep_nanoseconds(instance->global, delay);
+          status = controller_time_sleep_nanoseconds(instance->main, delay);
         }
       }
 
@@ -808,7 +800,7 @@ extern "C" {
       status_lock = controller_lock_write_instance(instance, &instance->active);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false, instance->global->thread);
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
 
         if (F_status_set_fine(status_lock) != F_interrupt) {
           status = controller_lock_read_instance(instance, &instance->active);
@@ -829,7 +821,7 @@ extern "C" {
       status_lock = controller_lock_read_instance(instance, &instance->active);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true, instance->global->thread);
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
       }
 
       if (F_status_set_fine(status_lock) != F_interrupt) {
@@ -853,7 +845,7 @@ extern "C" {
       status_lock = controller_lock_write_instance(instance, &instance->active);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false, instance->global->thread);
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
 
         if (F_status_set_fine(status_lock) != F_interrupt) {
           status = controller_lock_read_instance(instance, &instance->active);
@@ -876,7 +868,7 @@ extern "C" {
       status_lock = controller_lock_read_instance(instance, &instance->active);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true, instance->global->thread);
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
 
         return F_status_set_error(F_lock);
       }
@@ -915,10 +907,10 @@ extern "C" {
       status = F_status_set_fine(status);
 
       if ((WIFEXITED(instance->result) && WEXITSTATUS(instance->result)) || status == F_control_group || status == F_failure || status == F_limit || status == F_processor || status == F_schedule) {
-        controller_print_rule_item_error_execute(instance->global->error, instance, type == controller_rule_item_type_utility_e, program.used ? program : arguments.array[0], status);
+        controller_print_rule_item_error_execute(&instance->main->program.error, instance, type == controller_rule_item_type_utility_e, program.used ? program : arguments.array[0], status);
       }
       else {
-        controller_print_error_status(instance->global->error, macro_controller_f(fll_execute_program), F_status_set_fine(status));
+        controller_print_error_status(&instance->main->program.error, macro_controller_f(fll_execute_program), F_status_set_fine(status));
       }
 
       return F_status_set_error(status);
@@ -931,19 +923,19 @@ extern "C" {
 #ifndef _di_controller_rule_execute_rerun_
   int8_t controller_rule_execute_rerun(const uint8_t action, controller_instance_t * const instance, controller_rule_item_t * const item) {
 
-    if (!instance || !instance->global || !instance->global->main || !instance->global->thread || !item) return F_false;
+    if (!instance || !instance->main || !item) return F_false;
 
     const int result = WIFEXITED(instance->result) ? WEXITSTATUS(instance->result) : 0;
 
     if (item->reruns[action].is & (result ? controller_rule_rerun_is_failure_d : controller_rule_rerun_is_success_d)) {
-      controller_t * const main = instance->global->main;
+      controller_t * const main = instance->main;
       controller_rule_rerun_item_t * const rerun_item = result ? &item->reruns[action].failure : &item->reruns[action].success;
 
       if (!controller_thread_is_enabled_instance(instance)) return -2;
 
       if (!rerun_item->max || rerun_item->count < rerun_item->max) {
         if (main->program.error.verbosity == f_console_verbosity_debug_e) {
-          controller_lock_print(main->program.output.to, instance->global->thread);
+          controller_lock_print(main->program.output.to, &instance->main->thread);
 
           fl_print_format("%rRe-running '", main->program.output.to, f_string_eol_s);
           fl_print_format("%[%r%]' '", main->program.output.to, main->program.context.set.title, instance->rule.alias, main->program.context.set.title);
@@ -961,7 +953,7 @@ extern "C" {
             fl_print_format(" with no %[%r%].%r", main->program.output.to, main->program.context.set.notable, controller_max_s, main->program.context.set.notable, f_string_eol_s);
           }
 
-          controller_unlock_print_flush(main->program.output.to, instance->global->thread);
+          controller_unlock_print_flush(main->program.output.to, &instance->main->thread);
         }
 
         if (rerun_item->delay) {
@@ -978,7 +970,7 @@ extern "C" {
           }
 
           {
-            const f_status_t status = controller_time_sleep_nanoseconds(instance->global, delay);
+            const f_status_t status = controller_time_sleep_nanoseconds(instance->main, delay);
             if (F_status_is_error(status) || status == F_interrupt) return -1;
           }
 
index e4f7d74aef7219d5ff672f52b00dffdb01b1e300..8f409ecd06d5c7a8d9f0c9d459412917f8a5ebd4 100644 (file)
@@ -21,12 +21,12 @@ extern "C" {
  *
  * This requires that a read lock be set on process->lock before being called.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   This does not alter main.setting.state.status.
  * @param action
  *   The action to perform based on the action type codes.
  *
@@ -58,7 +58,7 @@ extern "C" {
  *   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_global_t * const global, const uint8_t action, const uint8_t options, controller_instance_t * const instance);
+  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_
 
 /**
index 71d7c706f63284e442ebf50b662f0e33af383720..d6529bd831ffe9d29e9fdb73f667b501c802f98d 100644 (file)
@@ -5,9 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_rule_expand_
-  f_status_t controller_rule_expand(controller_global_t * const global, const controller_rule_action_t action, controller_instance_t * const instance) {
+  f_status_t controller_rule_expand(controller_t * const main, const controller_rule_action_t action, controller_instance_t * const instance) {
 
-    if (!global || !instance) return F_status_set_error(F_parameter);
+    if (!main || !instance) return F_status_set_error(F_parameter);
 
     instance->cache.expanded.used = 0;
 
@@ -90,7 +90,7 @@ extern "C" {
 #ifndef _di_controller_rule_expand_iki_
   f_status_t controller_rule_expand_iki(controller_instance_t * const instance, const f_string_static_t source, const f_range_t vocabulary, const f_range_t content, f_string_dynamic_t * const destination) {
 
-    if (!instance || !instance->global || !instance->global->program || !destination) return F_status_set_error(F_parameter);
+    if (!instance || !instance->main || !destination) return F_status_set_error(F_parameter);
     if (vocabulary.start > vocabulary.stop) return F_okay;
     if (content.start > content.stop) return F_okay;
 
@@ -111,7 +111,7 @@ extern "C" {
       } // for
 
       if (i == instance->rule.define.used) {
-        controller_entry_t * const entry = instance->type == controller_instance_type_entry_e ? &instance->global->program->entry : &instance->global->program->exit;
+        controller_entry_t * const entry = instance->type == controller_instance_type_entry_e ? &instance->main->process.entry : &instance->main->process.exit;
 
         for (i = 0; i < entry->define.used; ++i) {
 
@@ -160,7 +160,7 @@ extern "C" {
       } // for
 
       if (i == instance->rule.parameter.used) {
-        controller_entry_t * const entry = instance->type == controller_instance_type_entry_e ? &instance->global->program->entry : &instance->global->program->exit;
+        controller_entry_t * const entry = instance->type == controller_instance_type_entry_e ? &instance->main->process.entry : &instance->main->process.exit;
 
         for (i = 0; i < entry->parameter.used; ++i) {
 
@@ -174,8 +174,8 @@ extern "C" {
       }
     }
     else if (f_compare_dynamic_partial_string(controller_program_s.string, source, controller_program_s.used, vocabulary) == F_equal_to) {
-      f_string_static_t * const argv = instance->global->main.program.parameters.arguments.array;
-      f_console_parameters_t * const parameters = &instance->global->main.program.parameters;
+      f_string_static_t * const argv = instance->main->program.parameters.arguments.array;
+      f_console_parameters_t * const parameters = &instance->main->program.parameters;
 
       const f_string_static_t options[] = {
         f_console_standard_long_light_s,
index a1db2cd71ddbc28b67ebe8b5882c57eddc57ebc6..97a819d79e852b5a0884cf2fc93164768d1cf938 100644 (file)
@@ -19,12 +19,12 @@ extern "C" {
 /**
  * Expand a single IKI variable into the buffer.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   This does not alter main.setting.state.status.
  * @param action
  *   The rule action data.
  * @param process
@@ -38,7 +38,7 @@ extern "C" {
  *   @see controller_rule_expand_iki()
  */
 #ifndef _di_controller_rule_expand_
-  extern f_status_t controller_rule_expand(controller_global_t * const global, const controller_rule_action_t action, controller_instance_t * const instance);
+  extern f_status_t controller_rule_expand(controller_t * const main, const controller_rule_action_t action, controller_instance_t * const instance);
 #endif // _di_controller_rule_expand_
 
 /**
index 8129c7388ff48fb72cd2af0dd683c84e81d2f5d9..87209f1ba76345db167c45ec5ed206ce52da1a06 100644 (file)
@@ -7,9 +7,9 @@ extern "C" {
 #ifndef _di_controller_rule_instance_
   f_status_t controller_rule_instance(controller_instance_t * const instance) {
 
-    if (!instance || !instance->global) return F_status_set_error(F_parameter);
+    if (!instance || !instance->main) return F_status_set_error(F_parameter);
 
-    controller_global_t * const global = instance->global;
+    controller_t * const main = instance->main;
 
     switch (instance->action) {
       case controller_rule_action_type_freeze_e:
@@ -24,16 +24,16 @@ extern "C" {
         break;
 
       default:
-        if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-          controller_lock_print(global->main->program.error.to, global->thread);
+        if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+          controller_lock_print(main->program.error.to, &main->thread);
 
-          fl_print_format("%r%[%QUnsupported action type '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-          fl_print_format(f_string_format_r_single_s.string, global->main->program.error.to, global->main->program.error.notable, controller_convert_rule_action_type_string(instance->action), global->main->program.error.notable);
-          fl_print_format("%[' while attempting to execute rule.%]%r", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+          fl_print_format("%r%[%QUnsupported action type '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+          fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_convert_rule_action_type_string(instance->action), main->program.error.notable);
+          fl_print_format("%[' while attempting to execute rule.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-          controller_print_rule_error_cache(global->error, instance->cache.action, F_true);
+          controller_print_rule_error_cache(&main->program.error, instance->cache.action, F_true);
 
-          controller_unlock_print_flush(global->main->program.error.to, global->thread);
+          controller_unlock_print_flush(main->program.error.to, &main->thread);
         }
 
         return F_status_set_error(F_parameter);
@@ -53,7 +53,7 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      controller_print_rule_error(global->error, instance->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true);
+      controller_print_rule_error(&main->program.error, instance->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true);
 
       return status;
     }
@@ -61,7 +61,7 @@ extern "C" {
     status = f_string_dynamic_append(instance->rule.alias, &instance->cache.action.name_file);
 
     if (F_status_is_error(status)) {
-      controller_print_rule_error(global->error, instance->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true);
+      controller_print_rule_error(&main->program.error, instance->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true);
 
       return status;
     }
@@ -73,13 +73,13 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      controller_print_rule_error(global->error, instance->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true);
+      controller_print_rule_error(&main->program.error, instance->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true);
 
       return status;
     }
 
-    if ((instance->options & controller_instance_option_simulate_e) && (instance->options & controller_instance_option_validate_e)) {
-      controller_rule_validate(global, instance->rule, instance->action, instance->options, &instance->cache);
+    if ((instance->options & controller_instance_option_simulate_validate_e) == controller_instance_option_simulate_validate_e) {
+      controller_rule_validate(main, instance->rule, instance->action, instance->options, &instance->cache);
     }
 
     f_number_unsigned_t i = 0;
@@ -128,28 +128,28 @@ extern "C" {
           dependency = 0;
           found = F_false;
 
-          status_lock = controller_lock_read_instance(instance, &global->thread->lock.instance);
+          status_lock = controller_lock_read_instance(instance, &main->thread.lock.instance);
 
           if (F_status_is_error(status_lock)) {
-            controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+            controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
           }
           else {
-            status = controller_instance_prepare_instance_type(global, instance->type, instance->action, dynamics[i]->array[j], &id_dependency);
+            status = controller_instance_prepare_instance_type(main, instance->type, instance->action, dynamics[i]->array[j], &id_dependency);
 
             if (F_status_is_error(status)) {
               if (F_status_set_fine(status) == F_lock) {
-                if (!controller_thread_is_enabled_instance_type(instance->type, global->thread)) {
+                if (!controller_thread_is_enabled_instance_type(instance->type, &main->thread)) {
                   return F_status_set_error(F_interrupt);
                 }
               }
 
-              if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                controller_lock_print(global->main->program.error.to, global->thread);
+              if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                controller_lock_print(main->program.error.to, &main->thread);
 
-                controller_print_rule_item_error_rule_not_loaded(&global->main->program.error, dynamics[i]->array[j]);
-                controller_print_rule_error_cache(global->error, instance->cache.action, F_false);
+                controller_print_rule_item_error_rule_not_loaded(&main->program.error, dynamics[i]->array[j]);
+                controller_print_rule_error_cache(&main->program.error, instance->cache.action, F_false);
 
-                controller_unlock_print_flush(global->main->program.error.to, global->thread);
+                controller_unlock_print_flush(main->program.error.to, &main->thread);
               }
 
               return status;
@@ -161,37 +161,37 @@ extern "C" {
           if (status == F_true) {
             found = F_true;
 
-            dependency = global->thread->instances.array[id_dependency];
+            dependency = main->thread.instances.array[id_dependency];
 
             status_lock = controller_lock_read_instance(instance, &dependency->active);
 
             if (F_status_is_error(status_lock)) {
-              controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+              controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
 
               status = F_false;
               dependency = 0;
 
-              f_thread_unlock(&global->thread->lock.instance);
+              f_thread_unlock(&main->thread.lock.instance);
             }
             else {
-              f_thread_unlock(&global->thread->lock.instance);
+              f_thread_unlock(&main->thread.lock.instance);
 
-              status_lock = controller_lock_read_instance(instance, &global->thread->lock.rule);
+              status_lock = controller_lock_read_instance(instance, &main->thread.lock.rule);
 
               if (F_status_is_error(status_lock)) {
-                controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+                controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
 
                 status = F_false;
               }
               else {
-                status = controller_rule_find(dynamics[i]->array[j], global->program->rules, &id_rule);
+                status = controller_rule_find(dynamics[i]->array[j], main->process.rules, &id_rule);
 
-                f_thread_unlock(&global->thread->lock.rule);
+                f_thread_unlock(&main->thread.lock.rule);
               }
             }
           }
           else {
-            f_thread_unlock(&global->thread->lock.instance);
+            f_thread_unlock(&main->thread.lock.instance);
           }
 
           if (status != F_true) {
@@ -199,12 +199,12 @@ extern "C" {
             id_rule = 0;
 
             if (i == 0) {
-              controller_lock_print(global->main->program.error.to, global->thread);
+              controller_lock_print(main->program.error.to, &main->thread);
 
-              controller_print_rule_item_error_need_want_wish(&global->main->program.error, strings[i], dynamics[i]->array[j], "is not found");
-              controller_print_rule_error_cache(global->error, instance->cache.action, F_true);
+              controller_print_rule_item_error_need_want_wish(&main->program.error, strings[i], dynamics[i]->array[j], "is not found");
+              controller_print_rule_error_cache(&main->program.error, instance->cache.action, F_true);
 
-              controller_unlock_print_flush(global->main->program.error.to, global->thread);
+              controller_unlock_print_flush(main->program.error.to, &main->thread);
 
               status = F_status_set_error(F_found_not);
 
@@ -217,22 +217,22 @@ extern "C" {
               }
             }
             else {
-              if (global->main->program.warning.verbosity == f_console_verbosity_debug_e) {
-                controller_lock_print(global->main->program.warning.to, global->thread);
+              if (main->program.warning.verbosity == f_console_verbosity_debug_e) {
+                controller_lock_print(main->program.warning.to, &main->thread);
 
-                controller_print_rule_item_error_need_want_wish(&global->main->program.warning, strings[i], dynamics[i]->array[j], "is not found");
+                controller_print_rule_item_error_need_want_wish(&main->program.warning, strings[i], dynamics[i]->array[j], "is not found");
 
-                controller_print_rule_error_cache(&global->main->program.warning, instance->cache.action, F_true);
+                controller_print_rule_error_cache(&main->program.warning, instance->cache.action, F_true);
 
-                controller_unlock_print_flush(global->main->program.warning.to, global->thread);
+                controller_unlock_print_flush(main->program.warning.to, &main->thread);
               }
             }
           }
           else if (found) {
-            status_lock = controller_lock_read_instance(instance, &global->thread->lock.rule);
+            status_lock = controller_lock_read_instance(instance, &main->thread.lock.rule);
 
             if (F_status_is_error(status_lock)) {
-              controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+              controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
 
               found = F_false;
               status = status_lock;
@@ -243,20 +243,20 @@ extern "C" {
 
             // 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 = global->program->rules.array[id_rule].alias.used;
+            alias_other_buffer.used = main->process.rules.array[id_rule].alias.used;
 
             f_char_t alias_other_buffer_string[alias_other_buffer.used + 1];
             alias_other_buffer.string = alias_other_buffer_string;
 
-            memcpy(alias_other_buffer_string, global->program->rules.array[id_rule].alias.string, sizeof(f_char_t) * alias_other_buffer.used);
+            memcpy(alias_other_buffer_string, main->process.rules.array[id_rule].alias.string, sizeof(f_char_t) * alias_other_buffer.used);
             alias_other_buffer_string[alias_other_buffer.used] = 0;
 
-            f_thread_unlock(&global->thread->lock.rule);
+            f_thread_unlock(&main->thread.lock.rule);
 
             status_lock = controller_lock_read_instance(instance, &dependency->lock);
 
             if (F_status_is_error(status_lock)) {
-              controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+              controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
 
               status = status_lock;
             }
@@ -270,22 +270,22 @@ extern "C" {
               status = dependency->rule.status[instance->action];
             }
             else {
-              status_lock = controller_lock_read_instance(instance, &global->thread->lock.rule);
+              status_lock = controller_lock_read_instance(instance, &main->thread.lock.rule);
 
               if (F_status_is_error(status_lock)) {
-                controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+                controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
 
                 f_thread_unlock(&dependency->lock);
 
                 status = status_lock;
               }
-              else if (controller_rule_status_is_available(instance->action, global->program->rules.array[id_rule])) {
-                f_thread_unlock(&global->thread->lock.rule);
+              else if (controller_rule_status_is_available(instance->action, main->process.rules.array[id_rule])) {
+                f_thread_unlock(&main->thread.lock.rule);
                 f_thread_unlock(&dependency->lock);
 
                 options_instance = 0;
 
-                if (global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e) {
+                if (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e) {
                   options_instance |= controller_instance_option_simulate_e;
                 }
 
@@ -294,7 +294,7 @@ extern "C" {
                 }
 
                 // Synchronously execute dependency.
-                status = controller_rule_instance_begin(global, 0, alias_other_buffer, instance->action, options_instance, instance->type, instance->stack, dependency->cache);
+                status = controller_rule_instance_begin(main, 0, alias_other_buffer, instance->action, options_instance, instance->type, instance->stack, dependency->cache);
 
                 if (status == F_child || F_status_set_fine(status) == F_interrupt) {
                   f_thread_unlock(&dependency->active);
@@ -304,12 +304,12 @@ extern "C" {
 
                 if (F_status_is_error(status)) {
                   if (i == 0 || i == 1 || F_status_set_fine(status) == F_memory_not) {
-                    controller_lock_print(global->main->program.error.to, global->thread);
+                    controller_lock_print(main->program.error.to, &main->thread);
 
-                    controller_print_rule_item_error_need_want_wish(&global->main->program.error, strings[i], alias_other_buffer, "failed during execution");
-                    controller_print_rule_error_cache(global->error, instance->cache.action, F_true);
+                    controller_print_rule_item_error_need_want_wish(&main->program.error, strings[i], alias_other_buffer, "failed during execution");
+                    controller_print_rule_error_cache(&main->program.error, instance->cache.action, F_true);
 
-                    controller_unlock_print_flush(global->main->program.error.to, global->thread);
+                    controller_unlock_print_flush(main->program.error.to, &main->thread);
 
                     if (!(dependency->options & controller_instance_option_simulate_e) || F_status_set_fine(status) == F_memory_not) {
                       f_thread_unlock(&dependency->active);
@@ -318,22 +318,22 @@ extern "C" {
                     }
                   }
                   else {
-                    if (global->main->program.warning.verbosity == f_console_verbosity_debug_e) {
-                      controller_lock_print(global->main->program.warning.to, global->thread);
+                    if (main->program.warning.verbosity == f_console_verbosity_debug_e) {
+                      controller_lock_print(main->program.warning.to, &main->thread);
 
-                      controller_print_rule_item_error_need_want_wish(&global->main->program.warning, strings[i], alias_other_buffer, "failed during execution");
+                      controller_print_rule_item_error_need_want_wish(&main->program.warning, strings[i], alias_other_buffer, "failed during execution");
 
-                      controller_print_rule_error_cache(&global->main->program.warning, instance->cache.action, F_true);
+                      controller_print_rule_error_cache(&main->program.warning, instance->cache.action, F_true);
 
-                      controller_unlock_print_flush(global->main->program.warning.to, global->thread);
+                      controller_unlock_print_flush(main->program.warning.to, &main->thread);
                     }
                   }
                 }
               }
               else {
-                status = global->program->rules.array[id_rule].status[instance->action];
+                status = main->process.rules.array[id_rule].status[instance->action];
 
-                f_thread_unlock(&global->thread->lock.rule);
+                f_thread_unlock(&main->thread.lock.rule);
                 f_thread_unlock(&dependency->lock);
               }
             }
@@ -345,31 +345,31 @@ extern "C" {
             }
 
             if (F_status_is_error_not(status_lock)) {
-              status_lock = controller_lock_read_instance(instance, &global->thread->lock.rule);
+              status_lock = controller_lock_read_instance(instance, &main->thread.lock.rule);
 
               if (F_status_is_error(status_lock)) {
-                controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+                controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
               }
             }
 
             if (F_status_is_error(status_lock)) {
               if (F_status_is_error(status_lock)) {
-                controller_print_rule_item_error_need_want_wish(&global->main->program.error, strings[i], alias_other_buffer, "due to lock failure");
+                controller_print_rule_item_error_need_want_wish(&main->program.error, strings[i], alias_other_buffer, "due to lock failure");
               }
 
               status = status_lock;
             }
-            else if (controller_rule_status_is_error(instance->action, global->program->rules.array[id_rule])) {
-              f_thread_unlock(&global->thread->lock.rule);
+            else if (controller_rule_status_is_error(instance->action, main->process.rules.array[id_rule])) {
+              f_thread_unlock(&main->thread.lock.rule);
 
               if (i == 0 || i == 1) {
-                controller_lock_print(global->main->program.error.to, global->thread);
+                controller_lock_print(main->program.error.to, &main->thread);
 
-                controller_print_rule_item_error_need_want_wish(&global->main->program.error, strings[i], alias_other_buffer, "is in a failed state");
+                controller_print_rule_item_error_need_want_wish(&main->program.error, strings[i], alias_other_buffer, "is in a failed state");
 
-                controller_print_rule_error_cache(global->error, instance->cache.action, F_true);
+                controller_print_rule_error_cache(&main->program.error, instance->cache.action, F_true);
 
-                controller_unlock_print_flush(global->main->program.error.to, global->thread);
+                controller_unlock_print_flush(main->program.error.to, &main->thread);
 
                 status = F_status_set_error(F_found_not);
 
@@ -380,19 +380,19 @@ extern "C" {
                 }
               }
               else {
-                if (global->main->program.warning.verbosity == f_console_verbosity_debug_e) {
-                  controller_lock_print(global->main->program.warning.to, global->thread);
+                if (main->program.warning.verbosity == f_console_verbosity_debug_e) {
+                  controller_lock_print(main->program.warning.to, &main->thread);
 
-                  controller_print_rule_item_error_need_want_wish(&global->main->program.warning, strings[i], alias_other_buffer, "is in a failed state");
+                  controller_print_rule_item_error_need_want_wish(&main->program.warning, strings[i], alias_other_buffer, "is in a failed state");
 
-                  controller_print_rule_error_cache(&global->main->program.warning, instance->cache.action, F_true);
+                  controller_print_rule_error_cache(&main->program.warning, instance->cache.action, F_true);
 
-                  controller_unlock_print_flush(global->main->program.warning.to, global->thread);
+                  controller_unlock_print_flush(main->program.warning.to, &main->thread);
                 }
               }
             }
             else {
-              f_thread_unlock(&global->thread->lock.rule);
+              f_thread_unlock(&main->thread.lock.rule);
             }
           }
 
@@ -416,7 +416,7 @@ extern "C" {
     }
 
     if ((instance->options & controller_instance_option_wait_e) && F_status_is_error_not(status) && (instance->options & controller_instance_option_validate_e)) {
-      status_lock = controller_rule_wait_all_instance_type(global, instance->type, F_false);
+      status_lock = controller_rule_wait_all_instance_type(main, instance->type, F_false);
 
       if (F_status_set_fine(status_lock) == F_interrupt) {
         return status_lock;
@@ -444,35 +444,35 @@ extern "C" {
         } // for
 
         if (missing) {
-          if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-            controller_lock_print(global->main->program.error.to, global->thread);
+          if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+            controller_lock_print(main->program.error.to, &main->thread);
 
             if (instance->rule.items.used) {
-              fl_print_format("%r%[%QThe rule '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-              fl_print_format(f_string_format_Q_single_s.string, global->main->program.error.to, global->main->program.error.notable, instance->rule.name, global->main->program.error.notable);
-              fl_print_format("%[' has no '%]", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-              fl_print_format(f_string_format_r_single_s.string, global->main->program.error.to, global->main->program.error.notable, controller_convert_rule_action_type_string(instance->action), global->main->program.error.notable);
-              fl_print_format("%[' action to execute.%]%r", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+              fl_print_format("%r%[%QThe rule '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+              fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, instance->rule.name, main->program.error.notable);
+              fl_print_format("%[' has no '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+              fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_convert_rule_action_type_string(instance->action), main->program.error.notable);
+              fl_print_format("%[' action to execute.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
             }
             else {
-              fl_print_format("%r%[%QThe rule '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-              fl_print_format(f_string_format_Q_single_s.string, global->main->program.error.to, global->main->program.error.notable, instance->rule.name, global->main->program.error.notable);
-              fl_print_format("%[ has no known '%]", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-              fl_print_format("%[%r %r%]", global->main->program.error.to, global->main->program.error.notable, controller_rule_s, controller_type_s, global->main->program.error.notable);
-              fl_print_format("%[' (such as '%]", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-              fl_print_format(f_string_format_r_single_s.string, global->main->program.error.to, global->main->program.error.notable, controller_command_s, global->main->program.error.notable);
-              fl_print_format("%[', '%]", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-              fl_print_format(f_string_format_r_single_s.string, global->main->program.error.to, global->main->program.error.notable, controller_service_s, global->main->program.error.notable);
-              fl_print_format("%[', '%]", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-              fl_print_format(f_string_format_r_single_s.string, global->main->program.error.to, global->main->program.error.notable, controller_script_s, global->main->program.error.notable);
-              fl_print_format("%[', or '%]", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-              fl_print_format(f_string_format_r_single_s.string, global->main->program.error.to, global->main->program.error.notable, controller_utility_s, global->main->program.error.notable);
-              fl_print_format("%[') to execute.%]%r", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+              fl_print_format("%r%[%QThe rule '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+              fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, instance->rule.name, main->program.error.notable);
+              fl_print_format("%[ has no known '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+              fl_print_format("%[%r %r%]", main->program.error.to, main->program.error.notable, controller_rule_s, controller_type_s, main->program.error.notable);
+              fl_print_format("%[' (such as '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+              fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_command_s, main->program.error.notable);
+              fl_print_format("%[', '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+              fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_service_s, main->program.error.notable);
+              fl_print_format("%[', '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+              fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_script_s, main->program.error.notable);
+              fl_print_format("%[', or '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+              fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_utility_s, main->program.error.notable);
+              fl_print_format("%[') to execute.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
             }
 
-            controller_print_rule_error_cache(global->error, instance->cache.action, F_true);
+            controller_print_rule_error_cache(&main->program.error, instance->cache.action, F_true);
 
-            controller_unlock_print_flush(global->main->program.error.to, global->thread);
+            controller_unlock_print_flush(main->program.error.to, &main->thread);
           }
 
           status = F_status_set_error(F_parameter);
@@ -480,14 +480,14 @@ extern "C" {
       }
 
       if (F_status_is_error_not(status)) {
-        status = controller_rule_execute(global, instance->action, instance->options, instance);
+        status = controller_rule_execute(main, instance->action, instance->options, instance);
 
         if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) {
           return status;
         }
 
         if (F_status_is_error(status)) {
-          controller_print_rule_item_error(global->error, instance->cache.action, F_true, F_status_set_fine(status));
+          controller_print_rule_item_error(&main->program.error, instance->cache.action, F_true, F_status_set_fine(status));
         }
       }
     }
@@ -499,7 +499,7 @@ extern "C" {
     status_lock = controller_lock_write_instance(instance, &instance->lock);
 
     if (F_status_is_error(status_lock)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+      controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
 
       if (F_status_set_fine(status) != F_interrupt) {
         status = controller_lock_read_instance(instance, &instance->lock);
@@ -516,10 +516,10 @@ extern "C" {
       instance->rule.status[instance->action] = status;
     }
 
-    status_lock = controller_lock_write_instance(instance, &global->thread->lock.rule);
+    status_lock = controller_lock_write_instance(instance, &main->thread.lock.rule);
 
     if (F_status_is_error(status_lock)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+      controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
 
       f_thread_unlock(&instance->lock);
 
@@ -529,9 +529,9 @@ extern "C" {
       return F_status_set_error(F_lock);
     }
 
-    // Update the global rule status, which is stored separately from the rule status for this instance.
-    if (controller_rule_find(instance->rule.alias, global->program->rules, &id_rule) == F_true) {
-      controller_rule_t *rule = &global->program->rules.array[id_rule];
+    // 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 *rule = &main->process.rules.array[id_rule];
 
       rule->status[instance->action] = instance->rule.status[instance->action];
 
@@ -550,13 +550,13 @@ extern "C" {
       } // for
     }
 
-    f_thread_unlock(&global->thread->lock.rule);
+    f_thread_unlock(&main->thread.lock.rule);
     f_thread_unlock(&instance->lock);
 
     status_lock = controller_lock_read_instance(instance, &instance->lock);
 
     if (F_status_is_error(status_lock)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+      controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
 
       return F_status_set_error(F_lock);
     }
@@ -566,11 +566,11 @@ extern "C" {
 #endif // _di_controller_rule_instance_
 
 #ifndef _di_controller_rule_instance_begin_
-  f_status_t controller_rule_instance_begin(controller_global_t * const global, const uint8_t options_force, const f_string_static_t alias_rule, const uint8_t action, const uint8_t options, const uint8_t type, const f_number_unsigneds_t stack, const controller_cache_t cache) {
+  f_status_t controller_rule_instance_begin(controller_t * const main, const uint8_t options_force, const f_string_static_t alias_rule, const uint8_t action, const uint8_t options, const uint8_t type, const f_number_unsigneds_t stack, const controller_cache_t cache) {
 
-    if (!global) return F_status_set_error(F_parameter);
+    if (!main) return F_status_set_error(F_parameter);
 
-    if (!controller_thread_is_enabled_instance_type(type, global->thread)) {
+    if (!controller_thread_is_enabled_instance_type(type, &main->thread)) {
       return F_status_set_error(F_interrupt);
     }
 
@@ -579,10 +579,10 @@ extern "C" {
 
     controller_instance_t *instance = 0;
 
-    status = controller_lock_read_instance_type(type, global->thread, &global->thread->lock.instance);
+    status = controller_lock_read_instance_type(type, &main->thread, &main->thread.lock.instance);
 
     if (F_status_is_error(status)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status), F_true, global->thread);
+      controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status), F_true);
 
       return status;
     }
@@ -590,32 +590,32 @@ extern "C" {
     {
       f_number_unsigned_t at = 0;
 
-      status = controller_instance_prepare(global, type != controller_instance_type_exit_e, action, alias_rule, &at);
+      status = controller_instance_prepare(main, type != controller_instance_type_exit_e, action, alias_rule, &at);
 
       if (F_status_is_error(status)) {
-        f_thread_unlock(&global->thread->lock.instance);
+        f_thread_unlock(&main->thread.lock.instance);
 
-        if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-          controller_lock_print(global->main->program.error.to, global->thread);
+        if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+          controller_lock_print(main->program.error.to, &main->thread);
 
-          controller_print_rule_item_error_rule_not_loaded(&global->main->program.error, alias_rule);
-          controller_print_rule_error_cache(global->error, cache.action, F_false);
+          controller_print_rule_item_error_rule_not_loaded(&main->program.error, alias_rule);
+          controller_print_rule_error_cache(&main->program.error, cache.action, F_false);
 
-          controller_unlock_print_flush(global->main->program.error.to, global->thread);
+          controller_unlock_print_flush(main->program.error.to, &main->thread);
         }
 
         return status;
       }
 
-      instance = global->thread->instances.array[at];
+      instance = main->thread.instances.array[at];
 
-      status = controller_lock_read_instance_type(type, global->thread, &instance->active);
+      status = controller_lock_read_instance_type(type, &main->thread, &instance->active);
 
       if (F_status_is_error(status)) {
-        controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status), F_true, global->thread);
-        controller_print_rule_item_error(global->error, cache.action, F_false, F_status_set_fine(status));
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status), F_true);
+        controller_print_rule_item_error(&main->program.error, cache.action, F_false, F_status_set_fine(status));
 
-        f_thread_unlock(&global->thread->lock.instance);
+        f_thread_unlock(&main->thread.lock.instance);
 
         return status;
       }
@@ -623,16 +623,16 @@ extern "C" {
       status_lock = controller_lock_write_instance(instance, &instance->lock);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+        controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
 
         f_thread_unlock(&instance->active);
-        f_thread_unlock(&global->thread->lock.instance);
+        f_thread_unlock(&main->thread.lock.instance);
 
         return status_lock;
       }
 
-      // Once a write lock on the instance is achieved, it is safe to unlock the global instance read lock.
-      f_thread_unlock(&global->thread->lock.instance);
+      // Once a write lock on the instance is achieved, it is safe to unlock the instance read lock.
+      f_thread_unlock(&main->thread.lock.instance);
 
       // If the instance is already running, then there is nothing to do.
       if (instance->state == controller_instance_state_active_e || instance->state == controller_instance_state_busy_e) {
@@ -659,7 +659,7 @@ extern "C" {
     status_lock = controller_lock_write_instance(instance, &instance->lock);
 
     if (F_status_is_error(status_lock)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+      controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
 
       f_thread_unlock(&instance->active);
 
@@ -697,7 +697,7 @@ extern "C" {
 
     instance->stack.used = 0;
 
-    instance->global = (void *) global;
+    instance->main = (void *) main;
 
     if (F_status_is_error_not(status) && stack.used) {
       if (instance->stack.size < stack.used) {
@@ -705,7 +705,7 @@ extern "C" {
       }
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(f_memory_array_resize), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_resize), F_status_set_fine(status));
       }
       else {
         for (f_number_unsigned_t i = 0; i < stack.used; ++i) {
@@ -727,7 +727,7 @@ extern "C" {
         status = f_string_dynamic_append(cache.action.name_item, &instance->cache.action.name_item);
       }
       else {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
       }
     }
 
@@ -743,7 +743,7 @@ extern "C" {
         }
 
         if (F_status_is_error(status)) {
-          controller_print_error_status(&global->main->program.error, macro_controller_f(f_thread_create), F_status_set_fine(status));
+          controller_print_error_status(&main->program.error, macro_controller_f(f_thread_create), F_status_set_fine(status));
         }
       }
       else {
@@ -762,7 +762,7 @@ extern "C" {
         status_lock = controller_lock_write_instance(instance, &instance->lock);
 
         if (F_status_is_error(status_lock)) {
-          controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+          controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
 
           f_thread_unlock(&instance->active);
 
@@ -797,7 +797,7 @@ extern "C" {
 #ifndef _di_controller_rule_instance_do_
   f_status_t controller_rule_instance_do(const uint8_t options_force, controller_instance_t * const instance) {
 
-    if (!instance) return F_status_set_error(F_parameter);
+    if (!instance || !instance->main) return F_status_set_error(F_parameter);
 
     f_status_t status_lock = F_okay;
 
@@ -806,7 +806,7 @@ extern "C" {
       status_lock = controller_lock_read_instance(instance, &instance->active);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+        controller_lock_print_error_critical(&instance->main->program.error, F_status_set_fine(status_lock), F_true);
 
         return status_lock;
       }
@@ -815,7 +815,7 @@ extern "C" {
     status_lock = controller_lock_read_instance(instance, &instance->lock);
 
     if (F_status_is_error(status_lock)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+      controller_lock_print_error_critical(&instance->main->program.error, F_status_set_fine(status_lock), F_true);
 
       if (options_force & controller_instance_option_asynchronous_e) {
         f_thread_unlock(&instance->active);
@@ -830,10 +830,10 @@ extern "C" {
 
     const f_number_unsigned_t used_original_stack = instance->stack.used;
 
-    status_lock = controller_lock_read_instance(instance, &global->thread->lock.rule);
+    status_lock = controller_lock_read_instance(instance, &instance->main->thread.lock.rule);
 
     if (F_status_is_error(status_lock)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+      controller_lock_print_error_critical(&instance->main->program.error, F_status_set_fine(status_lock), F_true);
 
       f_thread_unlock(&instance->lock);
 
@@ -844,15 +844,15 @@ extern "C" {
       return status_lock;
     }
 
-    if (controller_rule_find(instance->rule.alias, global->program->rules, &id_rule) == F_true) {
+    if (controller_rule_find(instance->rule.alias, instance->main->process.rules, &id_rule) == F_true) {
       f_thread_unlock(&instance->lock);
 
       status_lock = controller_lock_write_instance(instance, &instance->lock);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+        controller_lock_print_error_critical(&instance->main->program.error, F_status_set_fine(status_lock), F_false);
 
-        f_thread_unlock(&global->thread->lock.rule);
+        f_thread_unlock(&instance->main->thread.lock.rule);
 
         if (options_force & controller_instance_option_asynchronous_e) {
           f_thread_unlock(&instance->active);
@@ -863,16 +863,16 @@ extern "C" {
 
       controller_rule_delete(&instance->rule);
 
-      status = controller_rule_copy(global->program->rules.array[id_rule], &instance->rule);
+      status = controller_rule_copy(instance->main->process.rules.array[id_rule], &instance->rule);
 
       f_thread_unlock(&instance->lock);
 
       status_lock = controller_lock_read_instance(instance, &instance->lock);
 
       if (F_status_is_error(status_lock)) {
-        controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+        controller_lock_print_error_critical(&instance->main->program.error, F_status_set_fine(status_lock), F_true);
 
-        f_thread_unlock(&global->thread->lock.rule);
+        f_thread_unlock(&instance->main->thread.lock.rule);
 
         if (options_force & controller_instance_option_asynchronous_e) {
           f_thread_unlock(&instance->active);
@@ -881,10 +881,10 @@ extern "C" {
         return status_lock;
       }
 
-      f_thread_unlock(&global->thread->lock.rule);
+      f_thread_unlock(&instance->main->thread.lock.rule);
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(controller_rule_copy), F_status_set_fine(status));
+        controller_print_error_status(&instance->main->program.error, macro_controller_f(controller_rule_copy), F_status_set_fine(status));
       }
       else if (!instance->action) {
 
@@ -901,16 +901,16 @@ extern "C" {
         for (f_number_unsigned_t i = 0; i < instance->stack.used && controller_thread_is_enabled_instance(instance); ++i) {
 
           if (instance->stack.array[i] == id_rule) {
-            if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-              controller_lock_print(global->main->program.error.to, global->thread);
+            if (instance->main->program.error.verbosity > f_console_verbosity_quiet_e) {
+              controller_lock_print(instance->main->program.error.to, &instance->main->thread);
 
-              fl_print_format("%r%[%QThe rule '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-              fl_print_format(f_string_format_Q_single_s.string, global->main->program.error.to, global->main->program.error.notable, instance->rule.alias, global->main->program.error.notable);
-              fl_print_format("%[' is already on the execution dependency stack, this recursion is prohibited.%]%r", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+              fl_print_format("%r%[%QThe rule '%]", instance->main->program.error.to, f_string_eol_s, instance->main->program.error.context, instance->main->program.error.prefix, instance->main->program.error.context);
+              fl_print_format(f_string_format_Q_single_s.string, instance->main->program.error.to, instance->main->program.error.notable, instance->rule.alias, instance->main->program.error.notable);
+              fl_print_format("%[' is already on the execution dependency stack, this recursion is prohibited.%]%r", instance->main->program.error.to, instance->main->program.error.context, instance->main->program.error.context, f_string_eol_s);
 
-              controller_print_rule_error_cache(global->error, instance->cache.action, F_true);
+              controller_print_rule_error_cache(&instance->main->program.error, instance->cache.action, F_true);
 
-              controller_unlock_print_flush(global->main->program.error.to, global->thread);
+              controller_unlock_print_flush(instance->main->program.error.to, &instance->main->thread);
             }
 
             // Never continue on circular recursion errors even in simulate mode.
@@ -934,7 +934,7 @@ extern "C" {
           status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &instance->stack.array, &instance->stack.used, &instance->stack.size);
 
           if (F_status_is_error(status)) {
-            controller_print_error_status(&global->main->program.error, macro_controller_f(f_memory_array_increase), F_status_set_fine(status));
+            controller_print_error_status(&instance->main->program.error, macro_controller_f(f_memory_array_increase), F_status_set_fine(status));
           }
           else {
             f_thread_unlock(&instance->lock);
@@ -942,7 +942,7 @@ extern "C" {
             status_lock = controller_lock_write_instance(instance, &instance->lock);
 
             if (F_status_is_error(status_lock)) {
-              controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+              controller_lock_print_error_critical(&instance->main->program.error, F_status_set_fine(status_lock), F_false);
 
               if (options_force & controller_instance_option_asynchronous_e) {
                 f_thread_unlock(&instance->active);
@@ -958,7 +958,7 @@ extern "C" {
             status_lock = controller_lock_read_instance(instance, &instance->lock);
 
             if (F_status_is_error(status_lock)) {
-              controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+              controller_lock_print_error_critical(&instance->main->program.error, F_status_set_fine(status_lock), F_true);
 
               if (options_force & controller_instance_option_asynchronous_e) {
                 f_thread_unlock(&instance->active);
@@ -975,17 +975,17 @@ extern "C" {
       }
     }
     else {
-      f_thread_unlock(&global->thread->lock.rule);
+      f_thread_unlock(&instance->main->thread.lock.rule);
 
       status = F_status_set_error(F_found_not);
 
-      if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-        controller_lock_print(global->main->program.error.to, global->thread);
+      if (instance->main->program.error.verbosity > f_console_verbosity_quiet_e) {
+        controller_lock_print(instance->main->program.error.to, &instance->main->thread);
 
-        controller_print_rule_item_error_rule_not_loaded(&global->main->program.error, instance->rule.alias);
-        controller_print_rule_error_cache(global->error, instance->cache.action, F_false);
+        controller_print_rule_item_error_rule_not_loaded(&instance->main->program.error, instance->rule.alias);
+        controller_print_rule_error_cache(&instance->main->program.error, instance->cache.action, F_false);
 
-        controller_unlock_print_flush(global->main->program.error.to, global->thread);
+        controller_unlock_print_flush(instance->main->program.error.to, &instance->main->thread);
       }
     }
 
@@ -999,10 +999,10 @@ extern "C" {
       return status;
     }
 
-    status_lock = controller_lock_write_instance(instance, &global->thread->lock.rule);
+    status_lock = controller_lock_write_instance(instance, &instance->main->thread.lock.rule);
 
     if (F_status_is_error(status_lock)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+      controller_lock_print_error_critical(&instance->main->program.error, F_status_set_fine(status_lock), F_false);
 
       if (F_status_set_fine(status) != F_lock) {
         f_thread_unlock(&instance->lock);
@@ -1016,12 +1016,12 @@ extern "C" {
     }
 
     if (F_status_set_fine(status) == F_lock) {
-      if (controller_rule_find(instance->rule.alias, global->program->rules, &id_rule) == F_true) {
-        global->program->rules.array[id_rule].status[instance->action] = status;
+      if (controller_rule_find(instance->rule.alias, instance->main->process.rules, &id_rule) == F_true) {
+        instance->main->process.rules.array[id_rule].status[instance->action] = status;
       }
     }
 
-    f_thread_unlock(&global->thread->lock.rule);
+    f_thread_unlock(&instance->main->thread.lock.rule);
 
     if (F_status_set_fine(status) != F_lock) {
       f_thread_unlock(&instance->lock);
@@ -1038,7 +1038,7 @@ extern "C" {
     status_lock = controller_lock_write_instance(instance, &instance->lock);
 
     if (F_status_is_error(status_lock)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+      controller_lock_print_error_critical(&instance->main->program.error, F_status_set_fine(status_lock), F_false);
 
       if (options_force & controller_instance_option_asynchronous_e) {
         f_thread_unlock(&instance->active);
@@ -1047,13 +1047,7 @@ extern "C" {
       return status_lock;
     }
 
-    if (options_force & controller_instance_option_asynchronous_e) {
-      instance->state = controller_instance_state_done_e;
-    }
-    else {
-      instance->state = controller_instance_state_idle_e;
-    }
-
+    instance->state = (options_force & controller_instance_option_asynchronous_e) ? controller_instance_state_done_e : controller_instance_state_idle_e;
     instance->stack.used = used_original_stack;
 
     // inform all things waiting that the instance has finished running.
@@ -1067,11 +1061,7 @@ extern "C" {
       f_thread_unlock(&instance->active);
     }
 
-    if (controller_thread_is_enabled_instance(instance)) {
-      return status;
-    }
-
-    return F_status_set_error(F_interrupt);
+    return controller_thread_is_enabled_instance(instance) ? status : F_status_set_error(F_interrupt);
   }
 #endif // _di_controller_rule_instance_do_
 
index e6697bbfdd61fc615b6ef7c007eafdee785734de..f2b24732315e20208167b818aea17d76fc78ac44 100644 (file)
@@ -51,12 +51,12 @@ extern "C" {
 /**
  * Synchronously or asynchronously begin processing some rule.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   This does not alter main.setting.state.status.
  * @param options_force
  *   Force the given instance options, only supporting a subset of instance options.
  *
@@ -95,7 +95,7 @@ extern "C" {
  * @see f_thread_create()
  */
 #ifndef _di_controller_rule_instance_begin_
-  extern f_status_t controller_rule_instance_begin(controller_global_t * const global, const uint8_t options_force, const f_string_static_t alias_rule, const uint8_t action, const uint8_t options, const uint8_t type, const f_number_unsigneds_t stack, const controller_cache_t cache);
+  extern f_status_t controller_rule_instance_begin(controller_t * const main, const uint8_t options_force, const f_string_static_t alias_rule, const uint8_t action, const uint8_t options, const uint8_t type, const f_number_unsigneds_t stack, const controller_cache_t cache);
 #endif // _di_controller_rule_instance_begin_
 
 /**
index 67292dade738d35b20e7cd0094a8377b71fa1b21..cbd67059ca817a18ac149dabd1c1c0a6c31eda85 100644 (file)
@@ -19,7 +19,7 @@ extern "C" {
 /**
  * Check to see if the given Rule has status F_known_not for the given Rule Action.
  *
- * The global Rule status is checked for error and any errors on the global Rule status will result in F_false.
+ * The Rule status is checked for error and any errors on the Rule status will result in F_false.
  *
  * @param action
  *   The Rule Action type.
@@ -37,7 +37,7 @@ extern "C" {
 /**
  * Check to see if the given Rule has status is designated as an error for the given Rule Action.
  *
- * The global Rule status is checked for error and any errors on the global Rule status will result in F_true.
+ * The Rule status is checked for error and any errors on the Rule status will result in F_true.
  *
  * @param action
  *   The Rule Action type.
index d3dda8d0a5df2e3c882e5a40d9661bee4322a170..d866bb8ea79b8bbd8872f112c305dfc099becf67 100644 (file)
@@ -5,12 +5,12 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_rule_item_read_
-  f_status_t controller_rule_item_read(controller_global_t * const global, const bool is_normal, controller_cache_t * const cache, controller_rule_item_t * const item) {
+  f_status_t controller_rule_item_read(controller_t * const main, const bool is_normal, controller_cache_t * const cache, controller_rule_item_t * const item) {
 
-    if (!global || !cache || !item) return F_status_set_error(F_parameter);
+    if (!main || !cache || !item) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
-    controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, global);
+    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;
@@ -26,7 +26,7 @@ extern "C" {
       fl_fss_extended_list_object_read(cache->buffer_item, &range, &cache->range_action, &cache->delimits, &state);
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(fl_fss_extended_list_object_read), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(fl_fss_extended_list_object_read), F_status_set_fine(status));
 
         break;
       }
@@ -43,7 +43,7 @@ extern "C" {
         fl_fss_extended_object_read(cache->buffer_item, &range, &cache->range_action, 0, &cache->delimits, &state);
 
         if (F_status_is_error(status)) {
-          controller_print_error_status(&global->main->program.error, macro_controller_f(fl_fss_extended_object_read), F_status_set_fine(status));
+          controller_print_error_status(&main->program.error, macro_controller_f(fl_fss_extended_object_read), F_status_set_fine(status));
 
           break;
         }
@@ -55,7 +55,7 @@ extern "C" {
       f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state);
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(f_fss_apply_delimit), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(f_fss_apply_delimit), F_status_set_fine(status));
 
         break;
       }
@@ -63,7 +63,7 @@ extern "C" {
       f_fss_count_lines(cache->buffer_item, cache->range_action.start, &cache->action.line_action, &state);
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(f_fss_count_lines), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(f_fss_count_lines), F_status_set_fine(status));
 
         break;
       }
@@ -74,7 +74,7 @@ extern "C" {
       status = f_rip_dynamic_partial_nulless(cache->buffer_item, cache->range_action, &cache->action.name_action);
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status));
 
         break;
       }
@@ -122,16 +122,16 @@ extern "C" {
         type = controller_rule_action_type_with_e;
       }
       else {
-        if (global->main->program.warning.verbosity == f_console_verbosity_debug_e) {
-          controller_lock_print(global->main->program.warning.to, global->thread);
+        if (main->program.warning.verbosity == f_console_verbosity_debug_e) {
+          controller_lock_print(main->program.warning.to, &main->thread);
 
-          fl_print_format("%r%[%QUnknown rule item action '%]", global->main->program.warning.to, f_string_eol_s, global->main->program.warning.context, global->main->program.warning.prefix, global->main->program.warning.context);
-          fl_print_format(f_string_format_Q_single_s.string, global->main->program.warning.to, global->main->program.warning.notable, cache->action.name_action, global->main->program.warning.notable);
-          fl_print_format(f_string_format_sentence_end_quote_s.string, global->main->program.warning.to, global->main->program.warning.context, global->main->program.warning.context, f_string_eol_s);
+          fl_print_format("%r%[%QUnknown rule item action '%]", main->program.warning.to, f_string_eol_s, main->program.warning.context, main->program.warning.prefix, main->program.warning.context);
+          fl_print_format(f_string_format_Q_single_s.string, main->program.warning.to, main->program.warning.notable, cache->action.name_action, main->program.warning.notable);
+          fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.warning.to, main->program.warning.context, main->program.warning.context, f_string_eol_s);
 
-          controller_print_rule_error_cache(&global->main->program.warning, cache->action, F_true);
+          controller_print_rule_error_cache(&main->program.warning, cache->action, F_true);
 
-          controller_unlock_print_flush(global->main->program.warning.to, global->thread);
+          controller_unlock_print_flush(main->program.warning.to, &main->thread);
         }
 
         continue;
@@ -140,14 +140,14 @@ 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) {
 
-          if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-            controller_lock_print(global->main->program.error.to, global->thread);
+          if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+            controller_lock_print(main->program.error.to, &main->thread);
 
-            fl_print_format("%r%[%QFSS Extended List is not allowed for the rule item action '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-            fl_print_format(f_string_format_Q_single_s.string, global->main->program.error.to, global->main->program.error.notable, cache->action.name_action, global->main->program.error.notable);
-            fl_print_format(f_string_format_sentence_end_quote_s.string, global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+            fl_print_format("%r%[%QFSS Extended List is not allowed for the rule item action '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+            fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, cache->action.name_action, main->program.error.notable);
+            fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-            controller_unlock_print_flush(global->main->program.error.to, global->thread);
+            controller_unlock_print_flush(main->program.error.to, &main->thread);
           }
 
           status = F_status_set_error(F_support_not);
@@ -164,12 +164,12 @@ extern "C" {
       status = f_memory_array_increase_by(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &item->actions.array, &item->actions.used, &item->actions.size);
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(status));
 
         break;
       }
 
-      status = controller_rule_action_read(global, is_normal, type, method, cache, item, &item->actions, &range);
+      status = controller_rule_action_read(main, is_normal, type, method, cache, item, &item->actions, &range);
       if (F_status_is_error(status)) break;
     } // for
 
index f491edc2ecb7be204a66994a73fc20473ed9b650..329ba5c63a7ef8bb6d55826a89d7aff99a50df47 100644 (file)
@@ -21,12 +21,12 @@ extern "C" {
  *
  * This will perform additional FSS read functions as appropriate.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   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.
@@ -47,7 +47,7 @@ extern "C" {
  * @see f_string_dynamic_partial_append_nulless()
  */
 #ifndef _di_controller_rule_item_read_
-  extern f_status_t controller_rule_item_read(controller_global_t * const global, const bool is_normal, controller_cache_t * const cache, controller_rule_item_t * const item);
+  extern f_status_t controller_rule_item_read(controller_t * const main, const bool is_normal, controller_cache_t * const cache, controller_rule_item_t * const item);
 #endif // _di_controller_rule_item_read_
 
 #ifdef __cplusplus
index 570e54ebcecfdddb557349192ec215f4eb5a73b6..1401e41dcbf5a2c8d4fd77982ce70669a51731a9 100644 (file)
@@ -5,9 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_rule_parameters_read_
-  f_status_t controller_rule_parameters_read(controller_global_t * const global, 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) {
+  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) {
 
-    if (!global || !object || !content || !action || !state) return F_status_set_error(F_parameter);
+    if (!main || !object || !content || !action || !state) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
 
@@ -32,7 +32,7 @@ extern "C" {
       }
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, content ? macro_controller_f(f_memory_array_increase_by) : macro_controller_f(f_memory_array_increase), F_status_set_fine(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));
 
         return status;
       }
@@ -46,7 +46,7 @@ extern "C" {
       status = f_string_dynamic_partial_append_nulless(buffer, *object, &action->parameters.array[0]);
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
 
         return status;
       }
@@ -63,7 +63,7 @@ extern "C" {
       }
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(status));
 
         return status;
       }
@@ -83,7 +83,7 @@ extern "C" {
         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(&global->main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
+          controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
 
           return status;
         }
@@ -95,7 +95,7 @@ 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(&global->main->program.error, macro_controller_f(fl_iki_read), F_status_set_fine(status));
+            controller_print_error_status(&main->program.error, macro_controller_f(fl_iki_read), F_status_set_fine(status));
 
             action->parameters.array[action->parameters.used].used = 0;
 
index ed3a7db061d4a413480e0449bdecb0c6209a41fc..158fb232e4b86a79580c2f0c71dfe9698881b47e 100644 (file)
@@ -21,12 +21,12 @@ extern "C" {
  *
  * The object and content ranges are merged together (in that order) as the action parameters.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   This does not alter main.setting.state.status.
  * @param buffer
  *   The buffer containing the content.
  * @param object
@@ -59,7 +59,7 @@ extern "C" {
  * @see fl_iki_read()
  */
 #ifndef _di_controller_rule_parameters_read_
-  extern f_status_t controller_rule_parameters_read(controller_global_t * const global, 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 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);
 #endif // _di_controller_rule_parameters_read_
 
 #ifdef __cplusplus
index 18d63f109c23aa2a66c5c9d5d01ed3d91494f95e..c406aa2709bfba7ba16c0a81e7f3b84c3f863d7b 100644 (file)
@@ -5,9 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_rule_read_
-  f_status_t controller_rule_read(controller_global_t * const global, const bool is_normal, const f_string_static_t alias, controller_cache_t * const cache, controller_entry_t * const entry, controller_rule_t * const rule) {
+  f_status_t controller_rule_read(controller_t * const main, const bool is_normal, const f_string_static_t alias, controller_cache_t * const cache, controller_entry_t * const entry, controller_rule_t * const rule) {
 
-    if (!global || !cache || !entry || !rule) return F_status_set_error(F_parameter);
+    if (!main || !cache || !entry || !rule) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
 
@@ -169,30 +169,30 @@ extern "C" {
     status = f_string_dynamic_append_nulless(alias, &rule->alias);
 
     if (F_status_is_error(status)) {
-      controller_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append_nulless), F_status_set_fine(status));
+      controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append_nulless), F_status_set_fine(status));
     }
     else {
-      status = controller_file_load(global, cache, F_true, controller_rules_s, rule->alias, controller_rule_s);
+      status = controller_file_load(main, cache, F_true, controller_rules_s, rule->alias, controller_rule_s);
     }
 
     if (F_status_is_error_not(status)) {
       rule->timestamp = cache->timestamp;
 
       if (cache->buffer_file.used) {
-        controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, global);
+        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_file.used);
 
         fll_fss_basic_list_read(cache->buffer_file, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments, &state);
 
         if (F_status_is_error(status)) {
-          controller_print_error_status(&global->main->program.error, macro_controller_f(fll_fss_basic_list_read), F_status_set_fine(status));
+          controller_print_error_status(&main->program.error, macro_controller_f(fll_fss_basic_list_read), F_status_set_fine(status));
         }
         else {
           f_fss_apply_delimit(cache->delimits, &cache->buffer_file, &state);
 
           if (F_status_is_error(status)) {
-            controller_print_error_status(&global->main->program.error, macro_controller_f(f_fss_apply_delimit), F_status_set_fine(status));
+            controller_print_error_status(&main->program.error, macro_controller_f(f_fss_apply_delimit), F_status_set_fine(status));
           }
         }
       }
@@ -200,11 +200,11 @@ extern "C" {
 
     if (F_status_is_error_not(status) && cache->object_items.used) {
       if (rule->items.size < cache->object_items.size) {
-        status = f_memory_arrays_resize(cache->object_items.size, sizeof(controller_rule_item_t), (void **) &&rule->items.array, &rule->items.used, &rule->items.size, &controller_rule_items_delete_callback);
+        status = f_memory_arrays_resize(cache->object_items.size, sizeof(controller_rule_item_t), (void **) &rule->items.array, &rule->items.used, &rule->items.size, &controller_rule_items_delete_callback);
       }
 
       if (F_status_is_error(status)) {
-        controller_print_error_status(&global->main->program.error, macro_controller_f(f_memory_arrays_resize), F_status_set_fine(status));
+        controller_print_error_status(&main->program.error, macro_controller_f(f_memory_arrays_resize), F_status_set_fine(status));
       }
       else {
         f_number_unsigned_t i = 0;
@@ -239,10 +239,10 @@ extern "C" {
 
           for_item = F_true;
 
-          f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item, &global->main->setting.state);
+          f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item, &main->setting.state);
 
           if (F_status_is_error(status)) {
-            controller_print_error_status(&global->main->program.error, macro_controller_f(f_fss_count_lines), F_status_set_fine(status));
+            controller_print_error_status(&main->program.error, macro_controller_f(f_fss_count_lines), F_status_set_fine(status));
 
             break;
           }
@@ -252,7 +252,7 @@ extern "C" {
           status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->object_items.array[i], &cache->action.name_item);
 
           if (F_status_is_error(status)) {
-            controller_print_error_status(&global->main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status));
+            controller_print_error_status(&main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status));
 
             break;
           }
@@ -273,16 +273,16 @@ extern "C" {
             rule->items.array[rule->items.used].type = controller_rule_item_type_utility_e;
           }
           else {
-            if (global->main->program.warning.verbosity == f_console_verbosity_debug_e) {
-              controller_lock_print(global->main->program.warning.to, global->thread);
+            if (main->program.warning.verbosity == f_console_verbosity_debug_e) {
+              controller_lock_print(main->program.warning.to, &main->thread);
 
-              fl_print_format("%r%[%QUnknown rule item '%]", global->main->program.warning.to, f_string_eol_s, global->main->program.warning.context, global->main->program.warning.prefix, global->main->program.warning.context);
-              fl_print_format(f_string_format_Q_single_s.string, global->main->program.warning.to, global->main->program.warning.notable, cache->action.name_item, global->main->program.warning.notable);
-              fl_print_format(f_string_format_sentence_end_quote_s.string, global->main->program.warning.to, global->main->program.warning.context, global->main->program.warning.context, f_string_eol_s);
+              fl_print_format("%r%[%QUnknown rule item '%]", main->program.warning.to, f_string_eol_s, main->program.warning.context, main->program.warning.prefix, main->program.warning.context);
+              fl_print_format(f_string_format_Q_single_s.string, main->program.warning.to, main->program.warning.notable, cache->action.name_item, main->program.warning.notable);
+              fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.warning.to, main->program.warning.context, main->program.warning.context, f_string_eol_s);
 
-              controller_print_rule_error_cache(&global->main->program.warning, cache->action, F_true);
+              controller_print_rule_error_cache(&main->program.warning, cache->action, F_true);
 
-              controller_unlock_print_flush(global->main->program.warning.to, global->thread);
+              controller_unlock_print_flush(main->program.warning.to, &main->thread);
             }
 
             continue;
@@ -291,7 +291,7 @@ extern "C" {
           status = f_string_dynamic_partial_append(cache->buffer_file, cache->content_items.array[i].array[0], &cache->buffer_item);
 
           if (F_status_is_error(status)) {
-            controller_print_error_status(&global->main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status));
+            controller_print_error_status(&main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status));
 
             break;
           }
@@ -308,7 +308,7 @@ extern "C" {
               rule->items.array[rule->items.used].with |= controller_with_session_same_d;
             }
 
-            status = controller_rule_item_read(global, is_normal, cache, &rule->items.array[rule->items.used]);
+            status = controller_rule_item_read(main, is_normal, cache, &rule->items.array[rule->items.used]);
             if (F_status_is_error(status)) break;
 
             ++rule->items.used;
@@ -316,7 +316,7 @@ extern "C" {
           else {
             for_item = F_false;
 
-            status = controller_rule_setting_read(global, is_normal, *global->setting, cache, rule);
+            status = controller_rule_setting_read(main, is_normal, cache, rule);
 
             if (F_status_is_error(status)) {
               if (F_status_set_fine(status) == F_memory_not) break;
@@ -327,7 +327,7 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      controller_print_rule_item_error(global->error, cache->action, for_item, F_status_set_fine(status));
+      controller_print_rule_item_error(&main->program.error, cache->action, for_item, F_status_set_fine(status));
 
       rule->status[0] = controller_error_simplify(F_status_set_fine(status));
 
index 4cdcb3459885474101724a445bea0a32d379e98d..2b9978f688dc73e80b4c0f3075b6b2f488527920 100644 (file)
@@ -19,12 +19,12 @@ extern "C" {
 /**
  * Read the rule file, extracting all valid items.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   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.
@@ -55,7 +55,7 @@ extern "C" {
  * @see fll_fss_basic_list_read().
  */
 #ifndef _di_controller_rule_read_
-  extern f_status_t controller_rule_read(controller_global_t * const global, const bool is_normal, const f_string_static_t alias, controller_cache_t * const cache, controller_entry_t * const entry, controller_rule_t * const rule);
+  extern f_status_t controller_rule_read(controller_t * const main, const bool is_normal, const f_string_static_t alias, controller_cache_t * const cache, controller_entry_t * const entry, controller_rule_t * const rule);
 #endif // _di_controller_rule_read_
 
 
index d93a30603e40833c4b426fff4095b645d8454c1a..6dc0f5fa95e643a4f4828d889babb7e766cdcc95 100644 (file)
@@ -86,9 +86,9 @@ extern "C" {
 #endif // _di_controller_rule_setting_limit_type_name_
 
 #ifndef _di_controller_rule_setting_read_
-  f_status_t controller_rule_setting_read(controller_global_t * const global, const bool is_normal, controller_cache_t * const cache, controller_rule_t * const rule) {
+  f_status_t controller_rule_setting_read(controller_t * const main, const bool is_normal, controller_cache_t * const cache, controller_rule_t * const rule) {
 
-    if (!global || !cache || !rule) return F_status_set_error(F_parameter);
+    if (!main || !cache || !rule) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
     f_status_t status_return = F_okay;
@@ -96,13 +96,13 @@ extern "C" {
     f_range_t range = macro_f_range_t_initialize_2(cache->buffer_item.used);
     f_range_t range2 = f_range_t_initialize;
 
-    controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, global);
+    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);
 
     fll_fss_extended_read(cache->buffer_item, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0, &state);
 
     if (F_status_is_error(status)) {
-      controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, F_false);
+      controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, F_false);
 
       return status;
     }
@@ -137,7 +137,7 @@ extern "C" {
       status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->object_actions.array[i], &cache->action.name_item);
 
       if (F_status_is_error(status)) {
-        controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
+        controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
         if (F_status_set_fine(status) == F_memory_not) {
           status_return = status;
@@ -151,11 +151,11 @@ extern "C" {
 
         // Get the current line number within the settings item.
         cache->action.line_item = line_item;
-        f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+        f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
         cache->action.line_action = ++cache->action.line_item;
 
-        controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+        controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
         continue;
       }
@@ -212,23 +212,23 @@ extern "C" {
         type = controller_rule_setting_type_user_e;
       }
       else {
-        if (global->main->program.warning.verbosity == f_console_verbosity_debug_e) {
+        if (main->program.warning.verbosity == f_console_verbosity_debug_e) {
 
           // Get the current line number within the settings item.
           cache->action.line_item = line_item;
-          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_lock_print(global->main->program.warning.to, global->thread);
+          controller_lock_print(main->program.warning.to, &main->thread);
 
-          fl_print_format("%r%[%QUnknown rule setting '%]", global->main->program.warning.to, f_string_eol_s, global->main->program.warning.context, global->main->program.warning.prefix, global->main->program.warning.context);
-          fl_print_format(f_string_format_Q_single_s.string, global->main->program.warning.to, global->main->program.warning.notable, cache->action.name_item, global->main->program.warning.notable);
-          fl_print_format(f_string_format_sentence_end_quote_s.string, global->main->program.warning.to, global->main->program.warning.context, global->main->program.warning.context, f_string_eol_s);
+          fl_print_format("%r%[%QUnknown rule setting '%]", main->program.warning.to, f_string_eol_s, main->program.warning.context, main->program.warning.prefix, main->program.warning.context);
+          fl_print_format(f_string_format_Q_single_s.string, main->program.warning.to, main->program.warning.notable, cache->action.name_item, main->program.warning.notable);
+          fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.warning.to, main->program.warning.context, main->program.warning.context, f_string_eol_s);
 
-          controller_print_rule_error_cache(&global->main->program.warning, cache->action, F_false);
+          controller_print_rule_error_cache(&main->program.warning, cache->action, F_false);
 
-          controller_unlock_print_flush(global->main->program.warning.to, global->thread);
+          controller_unlock_print_flush(main->program.warning.to, &main->thread);
         }
 
         continue;
@@ -241,15 +241,15 @@ extern "C" {
         status = f_string_dynamic_partial_append_nulless(cache->buffer_item, range2, &cache->action.name_action);
 
         if (F_status_is_error(status)) {
-          controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
+          controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
           // Get the current line number within the settings item.
           cache->action.line_item = line_item;
-          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+          controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
           if (F_status_set_fine(status) == F_memory_not) {
             status_return = status;
@@ -266,21 +266,21 @@ extern "C" {
       }
       else {
         if (empty_disallow) {
-          if (global->main->program.warning.verbosity == f_console_verbosity_debug_e) {
+          if (main->program.warning.verbosity == f_console_verbosity_debug_e) {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_lock_print(global->main->program.warning.to, global->thread);
+            controller_lock_print(main->program.warning.to, &main->thread);
 
-            fl_print_format("%r%[%QEmpty rule setting.%]%r", global->main->program.warning.to, f_string_eol_s, global->main->program.warning.context, global->main->program.warning.prefix, global->main->program.warning.context, f_string_eol_s);
+            fl_print_format("%r%[%QEmpty rule setting.%]%r", main->program.warning.to, f_string_eol_s, main->program.warning.context, main->program.warning.prefix, main->program.warning.context, f_string_eol_s);
 
-            controller_print_rule_error_cache(&global->main->program.warning, cache->action, F_false);
+            controller_print_rule_error_cache(&main->program.warning, cache->action, F_false);
 
-            controller_unlock_print_flush(global->main->program.warning.to, global->thread);
+            controller_unlock_print_flush(main->program.warning.to, &main->thread);
           }
 
           continue;
@@ -289,7 +289,7 @@ extern "C" {
 
       if (type == controller_rule_setting_type_affinity_e) {
         if (!cache->content_actions.array[i].used) {
-          controller_print_rule_setting_read_error(&global->main->program.error, "requires one or more Content", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error(&main->program.error, "requires one or more Content", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -307,7 +307,7 @@ extern "C" {
           status = f_memory_array_increase(controller_allocation_small_d, sizeof(int32_t), (void **) &rule->affinity.array, &rule->affinity.used, &rule->affinity.size);
 
           if (F_status_is_error(status)) {
-            controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
+            controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
 
             break;
           }
@@ -328,13 +328,13 @@ extern "C" {
 
             if (status == F_data_not || status == F_number || status == F_number_overflow || status == F_number_underflow || status == F_number_negative || status == F_number_decimal) {
               if (status == F_number_underflow) {
-                controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an unsupported number", cache->content_actions.array[i].array[j], ", the number is too small for this system", i, line_item, global->thread, cache);
+                controller_print_rule_setting_read_error_with_range(&main->program.error, " has an unsupported number", cache->content_actions.array[i].array[j], ", the number is too small for this system", i, line_item, &main->thread, cache);
               }
               else if (status == F_number_overflow || status == F_number_positive) {
-                controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an unsupported number", cache->content_actions.array[i].array[j], ", the number is too large for this system", i, line_item, global->thread, cache);
+                controller_print_rule_setting_read_error_with_range(&main->program.error, " has an unsupported number", cache->content_actions.array[i].array[j], ", the number is too large for this system", i, line_item, &main->thread, cache);
               }
               else {
-                controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an invalid number", cache->content_actions.array[i].array[j], ", only whole numbers are allowed for an affinity value", i, line_item, global->thread, cache);
+                controller_print_rule_setting_read_error_with_range(&main->program.error, " has an invalid number", cache->content_actions.array[i].array[j], ", only whole numbers are allowed for an affinity value", i, line_item, &main->thread, cache);
               }
 
               status = F_status_set_error(F_valid_not);
@@ -344,7 +344,7 @@ extern "C" {
               }
             }
             else {
-              controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false);
 
               status = F_status_set_error(status);
 
@@ -359,14 +359,14 @@ extern "C" {
           rule->affinity.array[rule->affinity.used++] = number;
         } // for
 
-        controller_print_rule_setting_read_values(global, controller_affinity_s, i, cache);
+        controller_print_rule_setting_read_values(main, controller_affinity_s, i, cache);
 
         continue;
       }
 
       if (type == controller_rule_setting_type_define_e || type == controller_rule_setting_type_parameter_e) {
         if (cache->content_actions.array[i].used != 2) {
-          controller_print_rule_setting_read_error(&global->main->program.error, "requires exactly two Content", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error(&main->program.error, "requires exactly two Content", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -385,7 +385,7 @@ extern "C" {
         status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_map_t), (void **) &setting_maps->array, &setting_maps->used, &setting_maps->size);
 
         if (F_status_is_error(status)) {
-          controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
+          controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
 
           if (F_status_set_fine(status) == F_memory_not) {
             status_return = status;
@@ -399,11 +399,11 @@ extern "C" {
 
           // Get the current line number within the settings item.
           cache->action.line_item = line_item;
-          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+          controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
           continue;
         }
@@ -414,7 +414,7 @@ extern "C" {
         status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &setting_maps->array[setting_maps->used].key);
 
         if (F_status_is_error(status)) {
-          controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
+          controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
           if (F_status_set_fine(status) == F_memory_not) {
             status_return = status;
@@ -427,11 +427,11 @@ extern "C" {
 
           // Get the current line number within the settings item.
           cache->action.line_item = line_item;
-          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+          controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
           continue;
         }
@@ -439,7 +439,7 @@ extern "C" {
         status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[1], &setting_maps->array[setting_maps->used].value);
 
         if (F_status_is_error(status)) {
-          controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
+          controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
           if (F_status_set_fine(status) == F_memory_not) {
             status_return = status;
@@ -453,16 +453,16 @@ extern "C" {
 
           // Get the current line number within the settings item.
           cache->action.line_item = line_item;
-          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+          controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
           continue;
         }
 
-        controller_print_rule_setting_read_mapping(global, type == controller_rule_setting_type_define_e ? controller_define_s : controller_parameter_s, setting_maps->array[setting_maps->used]);
+        controller_print_rule_setting_read_mapping(main, type == controller_rule_setting_type_define_e ? controller_define_s : controller_parameter_s, setting_maps->array[setting_maps->used]);
 
         ++setting_maps->used;
 
@@ -471,7 +471,7 @@ extern "C" {
 
       if (type == controller_rule_setting_type_cgroup_e) {
         if (cache->content_actions.array[i].used < 2 || rule->has & controller_rule_has_cgroup_d) {
-          controller_print_rule_setting_read_error(&global->main->program.error, "requires two or more Content", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error(&main->program.error, "requires two or more Content", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -487,7 +487,7 @@ extern "C" {
           rule->cgroup.as_new = F_true;
         }
         else {
-          controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an unknown option", cache->content_actions.array[i].array[0], "", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error_with_range(&main->program.error, " has an unknown option", cache->content_actions.array[i].array[0], "", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -498,10 +498,10 @@ extern "C" {
 
         rule->cgroup.path.used = 0;
 
-        status = f_string_dynamic_append(global->program->path_cgroup, &rule->cgroup.path);
+        status = f_string_dynamic_append(main->process.path_cgroup, &rule->cgroup.path);
 
         if (F_status_is_error(status)) {
-          controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_false);
+          controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_false);
         }
         else {
           rule->cgroup.groups.used = 0;
@@ -511,7 +511,7 @@ extern "C" {
             status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &rule->cgroup.groups.array, &rule->cgroup.groups.used, &rule->cgroup.groups.size);
 
             if (F_status_is_error(status)) {
-              controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
 
               break;
             }
@@ -521,7 +521,7 @@ extern "C" {
             status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[j], &rule->cgroup.groups.array[rule->cgroup.groups.used]);
 
             if (F_status_is_error(status)) {
-              controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
               break;
             }
@@ -545,25 +545,25 @@ extern "C" {
 
           // Get the current line number within the settings item.
           cache->action.line_item = line_item;
-          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+          controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
           continue;
         }
 
         rule->has |= controller_rule_has_cgroup_d;
 
-        controller_print_rule_setting_read_values(global, controller_cgroup_s, i, cache);
+        controller_print_rule_setting_read_values(main, controller_cgroup_s, i, cache);
 
         continue;
       }
 
       if (type == controller_rule_setting_type_limit_e) {
         if (cache->content_actions.array[i].used != 3) {
-          controller_print_rule_setting_read_error(&global->main->program.error, "requires three Content", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error(&main->program.error, "requires three Content", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -621,23 +621,23 @@ extern "C" {
           type = controller_resource_limit_type_stack_e;
         }
         else {
-          if (global->main->program.error.verbosity == f_console_verbosity_debug_e) {
+          if (main->program.error.verbosity == f_console_verbosity_debug_e) {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_lock_print(global->main->program.error.to, global->thread);
+            controller_lock_print(main->program.error.to, &main->thread);
 
-            fl_print_format("%r%[%QUnknown resource limit type '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-            fl_print_format(f_string_format_Q_single_s.string, global->main->program.error.to, global->main->program.error.notable, cache->action.name_action, global->main->program.error.notable);
-            fl_print_format(f_string_format_sentence_end_quote_s.string, global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+            fl_print_format("%r%[%QUnknown resource limit type '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+            fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, cache->action.name_action, main->program.error.notable);
+            fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-            controller_print_rule_error_cache(global->error, cache->action, F_true);
+            controller_print_rule_error_cache(&main->program.error, cache->action, F_true);
 
-            controller_unlock_print_flush(global->main->program.error.to, global->thread);
+            controller_unlock_print_flush(main->program.error.to, &main->thread);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -650,21 +650,21 @@ extern "C" {
         for (j = 0; j < rule->limits.used; ++j) {
 
           if (type == rule->limits.array[j].type) {
-            if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
+            if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
 
               // Get the current line number within the settings item.
               cache->action.line_item = line_item;
-              f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+              f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
               cache->action.line_action = ++cache->action.line_item;
 
-              controller_lock_print(global->main->program.error.to, global->thread);
+              controller_lock_print(main->program.error.to, &main->thread);
 
-              fl_print_format("%r%[%QThe resource limit type is already specified%]%r", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context, f_string_eol_s);
+              fl_print_format("%r%[%QThe resource limit type is already specified%]%r", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context, f_string_eol_s);
 
-              controller_print_rule_error_cache(global->error, cache->action, F_false);
+              controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-              controller_unlock_print_flush(global->main->program.error.to, global->thread);
+              controller_unlock_print_flush(main->program.error.to, &main->thread);
             }
 
             status = F_status_set_error(F_valid_not);
@@ -680,7 +680,7 @@ extern "C" {
         status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_limit_set_t), (void **) &rule->limits.array, &rule->limits.used, &rule->limits.size);
 
         if (F_status_is_error(status)) {
-          controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
+          controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
 
           if (F_status_set_fine(status) == F_memory_not) {
             status_return = status;
@@ -694,11 +694,11 @@ extern "C" {
 
           // Get the current line number within the settings item.
           cache->action.line_item = line_item;
-          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+          controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
           continue;
         }
@@ -723,13 +723,13 @@ extern "C" {
 
             if (status == F_data_not || status == F_number || status == F_number_overflow || status == F_number_underflow || status == F_number_negative || status == F_number_positive || status == F_number_decimal) {
               if (status == F_number_underflow) {
-                controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an unsupported number", cache->content_actions.array[i].array[j], ", the number is too small for this system", i, line_item, global->thread, cache);
+                controller_print_rule_setting_read_error_with_range(&main->program.error, " has an unsupported number", cache->content_actions.array[i].array[j], ", the number is too small for this system", i, line_item, &main->thread, cache);
               }
               else if (status == F_number_overflow) {
-                controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an unsupported number", cache->content_actions.array[i].array[j], ", the number is too large for this system", i, line_item, global->thread, cache);
+                controller_print_rule_setting_read_error_with_range(&main->program.error, " has an unsupported number", cache->content_actions.array[i].array[j], ", the number is too large for this system", i, line_item, &main->thread, cache);
               }
               else {
-                controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an unsupported number", cache->content_actions.array[i].array[j], ", only whole numbers are allowed for a resource limit value", i, line_item, global->thread, cache);
+                controller_print_rule_setting_read_error_with_range(&main->program.error, " has an unsupported number", cache->content_actions.array[i].array[j], ", only whole numbers are allowed for a resource limit value", i, line_item, &main->thread, cache);
               }
 
               status = F_status_set_error(F_valid_not);
@@ -739,7 +739,7 @@ extern "C" {
               }
             }
             else {
-              controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false);
 
               status = F_status_set_error(status);
 
@@ -763,7 +763,7 @@ extern "C" {
 
         rule->limits.array[rule->limits.used++].type = type;
 
-        controller_print_rule_setting_read_values(global, controller_limit_s, i, cache);
+        controller_print_rule_setting_read_values(main, controller_limit_s, i, cache);
 
         continue;
       }
@@ -781,7 +781,7 @@ extern "C" {
         }
 
         if (setting_value->used || !cache->content_actions.array[i].used) {
-          controller_print_rule_setting_read_error(&global->main->program.error, "requires one or more Content", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error(&main->program.error, "requires one or more Content", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -827,11 +827,11 @@ extern "C" {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+            controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -839,26 +839,26 @@ extern "C" {
           status = controller_validate_has_graph(*setting_value);
 
           if (status == F_false || F_status_set_fine(status) == F_complete_not_utf) {
-            if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
+            if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
 
               // Get the current line number within the settings item.
               cache->action.line_item = line_item;
-              f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+              f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
               cache->action.line_action = ++cache->action.line_item;
             }
 
             if (status == F_false) {
-              if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                controller_lock_print(global->main->program.error.to, global->thread);
+              if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                controller_lock_print(main->program.error.to, &main->thread);
 
-                fl_print_format("%r%[%QRule setting has an invalid name '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-                fl_print_format(f_string_format_Q_single_s.string, global->main->program.error.to, global->main->program.error.notable, *setting_value, global->main->program.error.notable);
-                fl_print_format("%[', there must be at least 1 graph character.%]%r", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+                fl_print_format("%r%[%QRule setting has an invalid name '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+                fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, *setting_value, main->program.error.notable);
+                fl_print_format("%[', there must be at least 1 graph character.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-                controller_print_rule_error_cache(global->error, cache->action, F_false);
+                controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-                controller_unlock_print_flush(global->main->program.error.to, global->thread);
+                controller_unlock_print_flush(main->program.error.to, &main->thread);
               }
 
               if (F_status_is_error_not(status_return)) {
@@ -868,13 +868,13 @@ extern "C" {
             else {
 
               // This function should only return F_complete_not_utf on error.
-              controller_print_rule_error(global->error, cache->action, F_complete_not_utf, "controller_validate_has_graph", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, F_complete_not_utf, "controller_validate_has_graph", F_true, F_false);
 
               if (F_status_is_error_not(status_return)) {
                 status_return = status;
               }
 
-              controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+              controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
             }
 
             setting_value->used = 0;
@@ -882,13 +882,13 @@ extern "C" {
             continue;
           }
 
-          controller_print_rule_setting_read_value(global, type == controller_rule_setting_type_name_e ? controller_name_s : controller_engine_s, f_string_empty_s, *setting_value, 0);
+          controller_print_rule_setting_read_value(main, type == controller_rule_setting_type_name_e ? controller_name_s : controller_engine_s, f_string_empty_s, *setting_value, 0);
         }
         else if (type == controller_rule_setting_type_path_e) {
           status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], setting_value);
 
           if (F_status_is_error(status)) {
-            controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
+            controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
             if (F_status_set_fine(status) == F_memory_not) {
               status_return = status;
@@ -904,16 +904,16 @@ extern "C" {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+            controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
 
-          controller_print_rule_setting_read_value(global, controller_path_s, f_string_empty_s, *setting_value, 0);
+          controller_print_rule_setting_read_value(main, controller_path_s, f_string_empty_s, *setting_value, 0);
         }
 
         continue;
@@ -921,7 +921,7 @@ extern "C" {
 
       if (type == controller_rule_setting_type_scheduler_e) {
         if (cache->content_actions.array[i].used < 1 || cache->content_actions.array[i].used > 2 || rule->has & controller_rule_has_scheduler_d) {
-          controller_print_rule_setting_read_error(&global->main->program.error, "requires either one or two Content", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error(&main->program.error, "requires either one or two Content", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -955,7 +955,7 @@ extern "C" {
           rule->scheduler.priority = 49;
         }
         else {
-          controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an unknown scheduler", cache->content_actions.array[i].array[0], "", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error_with_range(&main->program.error, " has an unknown scheduler", cache->content_actions.array[i].array[0], "", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -984,34 +984,34 @@ extern "C" {
             status = F_status_set_fine(status);
 
             if ((zero_only && number) || (!zero_only && (number < 1 || number > 99)) || status == F_data_not || status == F_number || status == F_number_overflow || status == F_number_negative || status == F_number_positive) {
-              if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
+              if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
 
                 // Get the current line number within the settings item.
                 cache->action.line_item = line_item;
-                f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+                f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
                 cache->action.line_action = ++cache->action.line_item;
 
-                controller_lock_print(global->main->program.error.to, global->thread);
+                controller_lock_print(main->program.error.to, &main->thread);
 
-                fl_print_format("%r%[%QRule setting has an invalid number '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-                fl_print_format(f_string_format_Q_range_single_s.string, global->main->program.error.to, global->main->program.error.notable, cache->buffer_item, cache->content_actions.array[i].array[1], global->main->program.error.notable);
+                fl_print_format("%r%[%QRule setting has an invalid number '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+                fl_print_format(f_string_format_Q_range_single_s.string, main->program.error.to, main->program.error.notable, cache->buffer_item, cache->content_actions.array[i].array[1], main->program.error.notable);
 
                 if (zero_only) {
-                  fl_print_format("%[', only%] ", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-                  fl_print_format("%[0%]%[ is", global->main->program.error.to, global->main->program.error.notable, global->main->program.error.notable, global->main->program.error.context);
+                  fl_print_format("%[', only%] ", main->program.error.to, main->program.error.context, main->program.error.context);
+                  fl_print_format("%[0%]%[ is", main->program.error.to, main->program.error.notable, main->program.error.notable, main->program.error.context);
                 }
                 else {
-                  fl_print_format("%[', only the whole numbers inclusively between%] ", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-                  fl_print_format("%[1%] %[and%] ", global->main->program.error.to, global->main->program.error.notable, global->main->program.error.notable, global->main->program.error.context, global->main->program.error.context);
-                  fl_print_format("%[99%] %[are", global->main->program.error.to, global->main->program.error.notable, global->main->program.error.notable, global->main->program.error.context);
+                  fl_print_format("%[', only the whole numbers inclusively between%] ", main->program.error.to, main->program.error.context, main->program.error.context);
+                  fl_print_format("%[1%] %[and%] ", main->program.error.to, main->program.error.notable, main->program.error.notable, main->program.error.context, main->program.error.context);
+                  fl_print_format("%[99%] %[are", main->program.error.to, main->program.error.notable, main->program.error.notable, main->program.error.context);
                 }
 
-                fl_print_format(" allowed for the designated scheduler.%]%r", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+                fl_print_format(" allowed for the designated scheduler.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-                controller_print_rule_error_cache(global->error, cache->action, F_false);
+                controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-                controller_unlock_print_flush(global->main->program.error.to, global->thread);
+                controller_unlock_print_flush(main->program.error.to, &main->thread);
               }
 
               if (F_status_is_error_not(status_return)) {
@@ -1019,7 +1019,7 @@ extern "C" {
               }
             }
             else {
-              controller_print_rule_error(global->error, cache->action, status, "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, status, "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false);
               status = F_status_set_error(status);
 
               if (F_status_is_error_not(status_return)) {
@@ -1035,14 +1035,14 @@ extern "C" {
 
         rule->has |= controller_rule_has_scheduler_d;
 
-        controller_print_rule_setting_read_values(global, controller_scheduler_s, i, cache);
+        controller_print_rule_setting_read_values(main, controller_scheduler_s, i, cache);
 
         continue;
       }
 
       if (type == controller_rule_setting_type_timeout_e) {
         if (cache->content_actions.array[i].used != 2) {
-          controller_print_rule_setting_read_error(&global->main->program.error, "requires exactly two Content", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error(&main->program.error, "requires exactly two Content", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -1063,23 +1063,23 @@ extern "C" {
           timeout_code = controller_rule_timeout_code_stop_d;
         }
         else {
-          if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
+          if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_lock_print(global->main->program.error.to, global->thread);
+            controller_lock_print(main->program.error.to, &main->thread);
 
-            fl_print_format("%r%[%QRule setting's first value has '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-            fl_print_format(f_string_format_Q_range_single_s.string, global->main->program.error.to, global->main->program.error.notable, cache->buffer_item, cache->content_actions.array[i].array[0], global->main->program.error.notable);
-            fl_print_format("%[' but only supports %r, %r, and %r.%]%r", global->main->program.error.to, global->main->program.error.context, controller_kill_s, controller_start_s, controller_stop_s, global->main->program.error.context, f_string_eol_s);
+            fl_print_format("%r%[%QRule setting's first value has '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+            fl_print_format(f_string_format_Q_range_single_s.string, main->program.error.to, main->program.error.notable, cache->buffer_item, cache->content_actions.array[i].array[0], main->program.error.notable);
+            fl_print_format("%[' but only supports %r, %r, and %r.%]%r", main->program.error.to, main->program.error.context, controller_kill_s, controller_start_s, controller_stop_s, main->program.error.context, f_string_eol_s);
 
-            controller_print_rule_error_cache(global->error, cache->action, F_false);
+            controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-            controller_unlock_print_flush(global->main->program.error.to, global->thread);
+            controller_unlock_print_flush(main->program.error.to, &main->thread);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -1106,20 +1106,20 @@ extern "C" {
           status = F_status_set_fine(status);
 
           if (status == F_number_overflow) {
-            controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an unsupported number", cache->content_actions.array[i].array[1], ", the number is too large for this system", i, line_item, global->thread, cache);
+            controller_print_rule_setting_read_error_with_range(&main->program.error, " has an unsupported number", cache->content_actions.array[i].array[1], ", the number is too large for this system", i, line_item, &main->thread, cache);
           }
           else if (status == F_data_not || status == F_number || status == F_number_underflow || status == F_number_negative || status == F_number_positive || status == F_number_decimal) {
-            controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an invalid number", cache->content_actions.array[i].array[1], ", only positive whole numbers are allowed", i, line_item, global->thread, cache);
+            controller_print_rule_setting_read_error_with_range(&main->program.error, " has an invalid number", cache->content_actions.array[i].array[1], ", only positive whole numbers are allowed", i, line_item, &main->thread, cache);
           }
           else {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_print_rule_error(global->error, cache->action, status, "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false);
+            controller_print_rule_error(&main->program.error, cache->action, status, "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -1137,7 +1137,7 @@ extern "C" {
             rule->timeout_stop = number;
           }
 
-          if (global->main->program.error.verbosity == f_console_verbosity_debug_e || (global->main->program.error.verbosity == f_console_verbosity_verbose_e && (global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
+          if (main->program.error.verbosity == f_console_verbosity_debug_e || (main->program.error.verbosity == f_console_verbosity_verbose_e && (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
             f_string_static_t name_sub = controller_stop_s;
 
             if (timeout_code == controller_rule_timeout_code_kill_d) {
@@ -1152,12 +1152,12 @@ extern "C" {
             status = f_rip_dynamic_partial_nulless(cache->buffer_item, cache->content_actions.array[i].array[1], &cache->action.generic);
 
             if (F_status_is_error(status)) {
-              controller_print_error_status(&global->main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status));
+              controller_print_error_status(&main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status));
 
               break;
             }
 
-            controller_print_rule_setting_read_value(global, controller_timeout_s, name_sub, cache->action.generic, 0);
+            controller_print_rule_setting_read_value(main, controller_timeout_s, name_sub, cache->action.generic, 0);
           }
         }
 
@@ -1166,7 +1166,7 @@ extern "C" {
 
       if (type == controller_rule_setting_type_capability_e || type == controller_rule_setting_type_nice_e || type == controller_rule_setting_type_user_e) {
         if (cache->content_actions.array[i].used != 1 || type == controller_rule_setting_type_capability_e && rule->capability || type == controller_rule_setting_type_group_e && (rule->has & controller_rule_has_group_d) || type == controller_rule_setting_type_nice_e && (rule->has & controller_rule_has_nice_d) || type == controller_rule_setting_type_user_e && (rule->has & controller_rule_has_user_d)) {
-          controller_print_rule_setting_read_error(&global->main->program.error, "requires exactly one Content", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error(&main->program.error, "requires exactly one Content", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -1184,17 +1184,17 @@ extern "C" {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_lock_print(global->main->program.error.to, global->thread);
+            controller_lock_print(main->program.error.to, &main->thread);
 
-            controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
+            controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
-            controller_print_rule_error_cache(global->error, cache->action, F_false);
+            controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-            controller_unlock_print_flush(global->main->program.error.to, global->thread);
+            controller_unlock_print_flush(main->program.error.to, &main->thread);
 
             if (F_status_set_fine(status) == F_memory_not) {
               status_return = status;
@@ -1214,24 +1214,24 @@ extern "C" {
 
               // Get the current line number within the settings item.
               cache->action.line_item = line_item;
-              f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+              f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
               cache->action.line_action = ++cache->action.line_item;
 
-              controller_lock_print(global->main->program.error.to, global->thread);
+              controller_lock_print(main->program.error.to, &main->thread);
 
-              controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_capability_from_text", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_capability_from_text", F_true, F_false);
 
-              controller_print_rule_error_cache(global->error, cache->action, F_false);
+              controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-              controller_unlock_print_flush(global->main->program.error.to, global->thread);
+              controller_unlock_print_flush(main->program.error.to, &main->thread);
 
               status_return = status;
 
               break;
             }
 
-            controller_print_rule_setting_read_error(&global->main->program.error, "failed to process the capabilities", i, line_item, global->thread, cache);
+            controller_print_rule_setting_read_error(&main->program.error, "failed to process the capabilities", i, line_item, &main->thread, cache);
 
             if (F_status_is_error_not(status_return)) {
               status_return = F_status_set_error(F_valid_not);
@@ -1240,7 +1240,7 @@ extern "C" {
             continue;
           }
 
-          controller_print_rule_setting_read_value(global, controller_capability_s, f_string_empty_s, cache->action.generic, 0);
+          controller_print_rule_setting_read_value(main, controller_capability_s, f_string_empty_s, cache->action.generic, 0);
         }
         else if (type == controller_rule_setting_type_nice_e) {
           f_number_signed_t number = 0;
@@ -1260,27 +1260,27 @@ extern "C" {
             status = F_status_set_fine(status);
 
             if (number < -20 || number > 19 || status == F_data_not || status == F_number || status == F_number_overflow || status == F_number_underflow || status == F_number_decimal) {
-              if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
+              if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
 
                 // Get the current line number within the settings item.
                 cache->action.line_item = line_item;
-                f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+                f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
                 cache->action.line_action = ++cache->action.line_item;
 
-                controller_lock_print(global->main->program.error.to, global->thread);
+                controller_lock_print(main->program.error.to, &main->thread);
 
-                fl_print_format("%r%[%QRule setting has an invalid number '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-                fl_print_format(f_string_format_Q_range_single_s.string, global->main->program.error.to, global->main->program.error.notable, cache->buffer_item, cache->content_actions.array[i].array[0], global->main->program.error.notable);
-                fl_print_format("%[', only the whole numbers inclusively between%] ", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-                fl_print_format("%[-20%]", global->main->program.error.to, global->main->program.error.notable, global->main->program.error.notable);
-                fl_print_format(" %[and%] ", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context);
-                fl_print_format("%[19%]", global->main->program.error.to, global->main->program.error.notable, global->main->program.error.notable);
-                fl_print_format(" %[are allowed.%]%r", global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+                fl_print_format("%r%[%QRule setting has an invalid number '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+                fl_print_format(f_string_format_Q_range_single_s.string, main->program.error.to, main->program.error.notable, cache->buffer_item, cache->content_actions.array[i].array[0], main->program.error.notable);
+                fl_print_format("%[', only the whole numbers inclusively between%] ", main->program.error.to, main->program.error.context, main->program.error.context);
+                fl_print_format("%[-20%]", main->program.error.to, main->program.error.notable, main->program.error.notable);
+                fl_print_format(" %[and%] ", main->program.error.to, main->program.error.context, main->program.error.context);
+                fl_print_format("%[19%]", main->program.error.to, main->program.error.notable, main->program.error.notable);
+                fl_print_format(" %[are allowed.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-                controller_print_rule_error_cache(global->error, cache->action, F_false);
+                controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-                controller_unlock_print_flush(global->main->program.error.to, global->thread);
+                controller_unlock_print_flush(main->program.error.to, &main->thread);
               }
 
               if (F_status_is_error_not(status_return)) {
@@ -1288,7 +1288,7 @@ extern "C" {
               }
             }
             else {
-              controller_print_rule_error(global->error, cache->action, status, "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, status, "fl_conversion_dynamic_partial_to_signed_detect", F_true, F_false);
               status = F_status_set_error(status);
 
               if (F_status_is_error_not(status_return)) {
@@ -1300,7 +1300,7 @@ extern "C" {
             rule->nice = number;
             rule->has |= controller_rule_has_nice_d;
 
-            if ((global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e) || global->main->program.error.verbosity == f_console_verbosity_verbose_e) {
+            if ((main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e) || main->program.error.verbosity == f_console_verbosity_verbose_e) {
               cache->action.generic.used = 0;
 
               status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &cache->action.generic);
@@ -1309,17 +1309,17 @@ extern "C" {
 
                 // Get the current line number within the settings item.
                 cache->action.line_item = line_item;
-                f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+                f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
                 cache->action.line_action = ++cache->action.line_item;
 
-                controller_lock_print(global->main->program.error.to, global->thread);
+                controller_lock_print(main->program.error.to, &main->thread);
 
-                controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
+                controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
-                controller_print_rule_error_cache(global->error, cache->action, F_false);
+                controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-                controller_unlock_print_flush(global->main->program.error.to, global->thread);
+                controller_unlock_print_flush(main->program.error.to, &main->thread);
 
                 if (F_status_set_fine(status) == F_memory_not) {
                   status_return = status;
@@ -1333,7 +1333,7 @@ extern "C" {
               }
 
               if (F_status_is_error_not(status)) {
-                controller_print_rule_setting_read_value(global, controller_nice_s, f_string_empty_s, cache->action.generic, 0);
+                controller_print_rule_setting_read_value(main, controller_nice_s, f_string_empty_s, cache->action.generic, 0);
               }
             }
           }
@@ -1347,25 +1347,25 @@ extern "C" {
             status = F_status_set_fine(status);
 
             if (status == F_exist_not) {
-              controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an invalid user", cache->content_actions.array[i].array[0], ", because no user was found by that name", i, line_item, global->thread, cache);
+              controller_print_rule_setting_read_error_with_range(&main->program.error, " has an invalid user", cache->content_actions.array[i].array[0], ", because no user was found by that name", i, line_item, &main->thread, cache);
             }
             else if (status == F_number_too_large) {
-              controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an invalid user", cache->content_actions.array[i].array[0], ", because the given ID is too large", i, line_item, global->thread, cache);
+              controller_print_rule_setting_read_error_with_range(&main->program.error, " has an invalid user", cache->content_actions.array[i].array[0], ", because the given ID is too large", i, line_item, &main->thread, cache);
             }
             else if (status == F_number) {
-              controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an invalid user", cache->content_actions.array[i].array[0], ", because the given ID is not a valid supported number", i, line_item, global->thread, cache);
+              controller_print_rule_setting_read_error_with_range(&main->program.error, " has an invalid user", cache->content_actions.array[i].array[0], ", because the given ID is not a valid supported number", i, line_item, &main->thread, cache);
             }
             else {
 
               // Get the current line number within the settings item.
               cache->action.line_item = line_item;
-              f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+              f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
               cache->action.line_action = ++cache->action.line_item;
 
-              controller_print_rule_error(global->error, cache->action, status, "controller_convert_user_id", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, status, "controller_convert_user_id", F_true, F_false);
 
-              controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+              controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
             }
 
             if (F_status_is_error_not(status_return)) {
@@ -1376,12 +1376,12 @@ extern "C" {
             rule->user = number;
             rule->has |= controller_rule_has_user_d;
 
-            if (global->main->program.error.verbosity == f_console_verbosity_debug_e || (global->main->program.error.verbosity == f_console_verbosity_verbose_e && (global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
+            if (main->program.error.verbosity == f_console_verbosity_debug_e || (main->program.error.verbosity == f_console_verbosity_verbose_e && (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
               cache->action.generic.used = 0;
 
               status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &cache->action.generic);
 
-              controller_print_rule_setting_read_value(global, controller_user_s, f_string_empty_s, cache->action.generic, 0);
+              controller_print_rule_setting_read_value(main, controller_user_s, f_string_empty_s, cache->action.generic, 0);
             }
           }
         }
@@ -1391,7 +1391,7 @@ extern "C" {
 
       if (type == controller_rule_setting_type_group_e) {
         if (!cache->content_actions.array[i].used) {
-          controller_print_rule_setting_read_error(&global->main->program.error, "requires one or more Content", i, line_item, global->thread, cache);
+          controller_print_rule_setting_read_error(&main->program.error, "requires one or more Content", i, line_item, &main->thread, cache);
 
           if (F_status_is_error_not(status_return)) {
             status_return = F_status_set_error(F_valid_not);
@@ -1409,7 +1409,7 @@ extern "C" {
           status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_int32s_t), (void **) &rule->groups.array, &rule->groups.used, &rule->groups.size);
 
           if (F_status_is_error(status)) {
-            controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
+            controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
 
             if (F_status_set_fine(status) == F_memory_not) {
               status_return = status;
@@ -1423,11 +1423,11 @@ extern "C" {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+            controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -1438,25 +1438,25 @@ extern "C" {
             status = F_status_set_fine(status);
 
             if (status == F_exist_not) {
-              controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an invalid group", cache->content_actions.array[i].array[j], ", because no group was found by that name", i, line_item, global->thread, cache);
+              controller_print_rule_setting_read_error_with_range(&main->program.error, " has an invalid group", cache->content_actions.array[i].array[j], ", because no group was found by that name", i, line_item, &main->thread, cache);
             }
             else if (status == F_number_too_large) {
-              controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an invalid group", cache->content_actions.array[i].array[j], ", because the given ID is too large", i, line_item, global->thread, cache);
+              controller_print_rule_setting_read_error_with_range(&main->program.error, " has an invalid group", cache->content_actions.array[i].array[j], ", because the given ID is too large", i, line_item, &main->thread, cache);
             }
             else if (status == F_number) {
-              controller_print_rule_setting_read_error_with_range(&global->main->program.error, " has an invalid group", cache->content_actions.array[i].array[j], ", because the given ID is not a valid supported number", i, line_item, global->thread, cache);
+              controller_print_rule_setting_read_error_with_range(&main->program.error, " has an invalid group", cache->content_actions.array[i].array[j], ", because the given ID is not a valid supported number", i, line_item, &main->thread, cache);
             }
             else {
 
               // Get the current line number within the settings item.
               cache->action.line_item = line_item;
-              f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+              f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
               cache->action.line_action = ++cache->action.line_item;
 
-              controller_print_rule_error(global->error, cache->action, status, "f_account_group_id_by_name", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, status, "f_account_group_id_by_name", F_true, F_false);
 
-              controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+              controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
             }
 
             if (F_status_is_error_not(status_return)) {
@@ -1474,7 +1474,7 @@ extern "C" {
           }
         } // for
 
-        controller_print_rule_setting_read_values(global, controller_group_s, i, cache);
+        controller_print_rule_setting_read_values(main, controller_group_s, i, cache);
 
         continue;
       }
@@ -1487,7 +1487,7 @@ extern "C" {
           status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &setting_values->array, &setting_values->used, &setting_values->size);
 
           if (F_status_is_error(status)) {
-            controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
+            controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false);
 
             if (F_status_set_fine(status) == F_memory_not) {
               status_return = status;
@@ -1501,11 +1501,11 @@ extern "C" {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+            controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -1515,7 +1515,7 @@ extern "C" {
           status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[j], &setting_values->array[setting_values->used]);
 
           if (F_status_is_error(status)) {
-            controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
+            controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
             setting_values->array[setting_values->used].used = 0;
 
@@ -1531,11 +1531,11 @@ extern "C" {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+            controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -1546,21 +1546,21 @@ extern "C" {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
             if (status == F_false) {
-              if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                controller_lock_print(global->main->program.error.to, global->thread);
+              if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                controller_lock_print(main->program.error.to, &main->thread);
 
-                fl_print_format("%r%[%QRule setting has an invalid environment variable name '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-                fl_print_format(f_string_format_Q_single_s.string, global->main->program.error.to, global->main->program.error.notable, setting_values->array[setting_values->used], global->main->program.error.notable);
-                fl_print_format(f_string_format_sentence_end_quote_s.string, global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
+                fl_print_format("%r%[%QRule setting has an invalid environment variable name '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+                fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, setting_values->array[setting_values->used], main->program.error.notable);
+                fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-                controller_print_rule_error_cache(global->error, cache->action, F_false);
+                controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-                controller_unlock_print_flush(global->main->program.error.to, global->thread);
+                controller_unlock_print_flush(main->program.error.to, &main->thread);
               }
 
               if (F_status_is_error_not(status_return)) {
@@ -1570,7 +1570,7 @@ extern "C" {
             else {
 
               // This function should only return F_complete_not_utf on error.
-              controller_print_rule_error(global->error, cache->action, F_complete_not_utf, "controller_validate_environment_name", F_true, F_false);
+              controller_print_rule_error(&main->program.error, cache->action, F_complete_not_utf, "controller_validate_environment_name", F_true, F_false);
 
               if (F_status_is_error_not(status_return)) {
                 status_return = status;
@@ -1579,7 +1579,7 @@ extern "C" {
 
             setting_values->array[setting_values->used].used = 0;
 
-            controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+            controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -1590,15 +1590,15 @@ extern "C" {
         rule->has |= controller_rule_has_environment_d;
 
         if (cache->content_actions.array[i].used) {
-          controller_print_rule_setting_read_values(global, controller_environment_s, i, cache);
+          controller_print_rule_setting_read_values(main, controller_environment_s, i, cache);
         }
         else {
-          if (global->main->program.error.verbosity == f_console_verbosity_debug_e || (global->main->program.error.verbosity == f_console_verbosity_verbose_e && (global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
-            controller_lock_print(global->main->program.output.to, global->thread);
+          if (main->program.error.verbosity == f_console_verbosity_debug_e || (main->program.error.verbosity == f_console_verbosity_verbose_e && (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
+            controller_lock_print(main->program.output.to, &main->thread);
 
-            fl_print_format("%rProcessing rule item action '%[%r%]' setting value to an empty set.%r", global->main->program.output.to, f_string_eol_s, global->main->program.context.set.title, controller_environment_s, global->main->program.context.set.title, f_string_eol_s);
+            fl_print_format("%rProcessing rule item action '%[%r%]' setting value to an empty set.%r", main->program.output.to, f_string_eol_s, main->program.context.set.title, controller_environment_s, main->program.context.set.title, f_string_eol_s);
 
-            controller_unlock_print_flush(global->main->program.output.to, global->thread);
+            controller_unlock_print_flush(main->program.output.to, &main->thread);
           }
         }
 
@@ -1607,7 +1607,7 @@ extern "C" {
 
       // The "on" Rule Setting.
       if (cache->content_actions.array[i].used != 4) {
-        controller_print_rule_setting_read_error(&global->main->program.error, "requires exactly four Content", i, line_item, global->thread, cache);
+        controller_print_rule_setting_read_error(&main->program.error, "requires exactly four Content", i, line_item, &main->thread, cache);
 
         if (F_status_is_error_not(status_return)) {
           status_return = F_status_set_error(F_valid_not);
@@ -1644,26 +1644,26 @@ extern "C" {
         action = controller_rule_action_type_thaw_e;
       }
       else {
-        if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
+        if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
 
           // Get the current line number within the settings item.
           cache->action.line_item = line_item;
-          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+          f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
           cache->action.line_action = ++cache->action.line_item;
 
-          f_thread_mutex_lock(&global->thread->lock.print);
+          f_thread_mutex_lock(&main->thread.lock.print);
 
-          controller_lock_print(global->main->program.error.to, global->thread);
+          controller_lock_print(main->program.error.to, &main->thread);
 
-          fl_print_format("%r%[%QRule setting's second value has '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-          fl_print_format(f_string_format_Q_range_single_s.string, global->main->program.error.to, global->main->program.error.notable, cache->buffer_item, cache->content_actions.array[i].array[1], global->main->program.error.notable);
-          fl_print_format("%[' but only supports %r, %r, %r, %r, %r", global->main->program.error.to, global->main->program.error.context, controller_freeze_s, controller_kill_s, controller_pause_s, controller_reload_s, controller_restart_s);
-          fl_print_format("%r, %r, %r, and %r.%]%r", global->main->program.error.to, controller_resume_s, controller_start_s, controller_stop_s, controller_thaw_s, global->main->program.error.context, f_string_eol_s);
+          fl_print_format("%r%[%QRule setting's second value has '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+          fl_print_format(f_string_format_Q_range_single_s.string, main->program.error.to, main->program.error.notable, cache->buffer_item, cache->content_actions.array[i].array[1], main->program.error.notable);
+          fl_print_format("%[' but only supports %r, %r, %r, %r, %r", main->program.error.to, main->program.error.context, controller_freeze_s, controller_kill_s, controller_pause_s, controller_reload_s, controller_restart_s);
+          fl_print_format("%r, %r, %r, and %r.%]%r", main->program.error.to, controller_resume_s, controller_start_s, controller_stop_s, controller_thaw_s, main->program.error.context, f_string_eol_s);
 
-          controller_print_rule_error_cache(global->error, cache->action, F_false);
+          controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-          controller_unlock_print_flush(global->main->program.error.to, global->thread);
+          controller_unlock_print_flush(main->program.error.to, &main->thread);
         }
 
         if (F_status_is_error_not(status_return)) {
@@ -1682,7 +1682,7 @@ extern "C" {
       }
 
       if (F_status_is_error(status)) {
-        controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true, F_false);
+        controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true, F_false);
       }
       else {
         if (f_compare_dynamic_partial_string(controller_need_s.string, cache->buffer_item, controller_need_s.used, cache->content_actions.array[i].array[1]) == F_equal_to) {
@@ -1695,23 +1695,23 @@ extern "C" {
           setting_values = &rule->ons.array[j].wish;
         }
         else {
-          if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
+          if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
 
             // Get the current line number within the settings item.
             cache->action.line_item = line_item;
-            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+            f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_lock_print(global->main->program.error.to, global->thread);
+            controller_lock_print(main->program.error.to, &main->thread);
 
-            fl_print_format("%r%[%QRule setting's second value has '%]", global->main->program.error.to, f_string_eol_s, global->main->program.error.context, global->main->program.error.prefix, global->main->program.error.context);
-            fl_print_format(f_string_format_Q_range_single_s.string, global->main->program.error.to, global->main->program.error.notable, cache->buffer_item, cache->content_actions.array[i].array[1], global->main->program.error.notable);
-            fl_print_format("%[' but only supports %r, %r, and %r.%]%r", global->main->program.error.to, global->main->program.error.context, controller_need_s, controller_want_s, controller_wish_s, global->main->program.error.context, f_string_eol_s);
+            fl_print_format("%r%[%QRule setting's second value has '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
+            fl_print_format(f_string_format_Q_range_single_s.string, main->program.error.to, main->program.error.notable, cache->buffer_item, cache->content_actions.array[i].array[1], main->program.error.notable);
+            fl_print_format("%[' but only supports %r, %r, and %r.%]%r", main->program.error.to, main->program.error.context, controller_need_s, controller_want_s, controller_wish_s, main->program.error.context, f_string_eol_s);
 
-            controller_print_rule_error_cache(global->error, cache->action, F_false);
+            controller_print_rule_error_cache(&main->program.error, cache->action, F_false);
 
-            controller_unlock_print_flush(global->main->program.error.to, global->thread);
+            controller_unlock_print_flush(main->program.error.to, &main->thread);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -1724,7 +1724,7 @@ extern "C" {
         status = f_memory_array_increase_by(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &setting_values->array, &setting_values->used, &setting_values->size);
 
         if (F_status_is_error(status)) {
-          controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_memory_array_increase_by", F_true, F_false);
+          controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase_by", F_true, F_false);
         }
       }
 
@@ -1741,16 +1741,16 @@ extern "C" {
 
         // Get the current line number within the settings item.
         cache->action.line_item = line_item;
-        f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+        f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
         cache->action.line_action = ++cache->action.line_item;
 
-        controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+        controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
         continue;
       }
 
-      status = controller_rule_id_construct(global, cache->buffer_item, cache->content_actions.array[i].array[2], cache->content_actions.array[i].array[3], &setting_values->array[setting_values->used]);
+      status = controller_rule_id_construct(main, cache->buffer_item, cache->content_actions.array[i].array[2], cache->content_actions.array[i].array[3], &setting_values->array[setting_values->used]);
 
       if (F_status_is_error(status)) {
         setting_values->array[setting_values->used].used = 0;
@@ -1767,11 +1767,11 @@ extern "C" {
 
         // Get the current line number within the settings item.
         cache->action.line_item = line_item;
-        f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &global->main->setting.state);
+        f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &main->setting.state);
 
         cache->action.line_action = ++cache->action.line_item;
 
-        controller_print_rule_item_error(global->error, cache->action, F_false, F_status_set_fine(status));
+        controller_print_rule_item_error(&main->program.error, cache->action, F_false, F_status_set_fine(status));
 
         continue;
       }
@@ -1783,7 +1783,7 @@ extern "C" {
       if (F_status_is_error(status)) {
         setting_values->array[setting_values->used].used = 0;
 
-        controller_print_rule_error(global->error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, F_false);
+        controller_print_rule_error(&main->program.error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, F_false);
 
         if (F_status_set_fine(status) == F_memory_not) {
           status_return = status;
@@ -1806,15 +1806,15 @@ extern "C" {
         ++rule->ons.used;
       }
 
-      if (global->main->program.error.verbosity == f_console_verbosity_debug_e || (global->main->program.error.verbosity == f_console_verbosity_verbose_e && (global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
-        controller_lock_print(global->main->program.output.to, global->thread);
+      if (main->program.error.verbosity == f_console_verbosity_debug_e || (main->program.error.verbosity == f_console_verbosity_verbose_e && (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e))) {
+        controller_lock_print(main->program.output.to, &main->thread);
 
-        fl_print_format("%rProcessing rule item action '%[%r%]', adding ", global->main->program.output.to, f_string_eol_s, global->main->program.context.set.title, controller_on_s, global->main->program.context.set.title);
-        fl_print_format("'%[%/Q%]' of ", global->main->program.output.to, global->main->program.context.set.notable, cache->buffer_item, cache->content_actions.array[i].array[1], global->main->program.context.set.notable);
-        fl_print_format("'%[%/Q%]/", global->main->program.output.to, global->main->program.context.set.important, cache->buffer_item, cache->content_actions.array[i].array[2], global->main->program.context.set.important);
-        fl_print_format("%[%/Q%]'.%r", global->main->program.output.to, global->main->program.context.set.important, cache->buffer_item, cache->content_actions.array[i].array[3], global->main->program.context.set.important, f_string_eol_s);
+        fl_print_format("%rProcessing rule item action '%[%r%]', adding ", main->program.output.to, f_string_eol_s, main->program.context.set.title, controller_on_s, main->program.context.set.title);
+        fl_print_format("'%[%/Q%]' of ", main->program.output.to, main->program.context.set.notable, cache->buffer_item, cache->content_actions.array[i].array[1], main->program.context.set.notable);
+        fl_print_format("'%[%/Q%]/", main->program.output.to, main->program.context.set.important, cache->buffer_item, cache->content_actions.array[i].array[2], main->program.context.set.important);
+        fl_print_format("%[%/Q%]'.%r", main->program.output.to, main->program.context.set.important, cache->buffer_item, cache->content_actions.array[i].array[3], main->program.context.set.important, f_string_eol_s);
 
-        controller_unlock_print_flush(global->main->program.output.to, global->thread);
+        controller_unlock_print_flush(main->program.output.to, &main->thread);
       }
     } // for
 
index a81c7318c66310b6c4a9daf204f73c4fda20f72b..a5e1e0d6e34c9079448035e0a834976a53ee7137 100644 (file)
@@ -52,12 +52,12 @@ extern "C" {
  * Errors from this are not considered fatal, but the first error code encountered is returned.
  * Memory failure errors are always immediately returned.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   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.
@@ -86,7 +86,7 @@ extern "C" {
  * @see controller_path_canonical_relative()
  */
 #ifndef _di_controller_rule_setting_read_
-  extern f_status_t controller_rule_setting_read(controller_global_t * const global, const bool is_normal, controller_cache_t * const cache, controller_rule_t * const rule);
+  extern f_status_t controller_rule_setting_read(controller_t * const main, const bool is_normal, controller_cache_t * const cache, controller_rule_t * const rule);
 #endif // _di_controller_rule_setting_read_
 
 #ifdef __cplusplus
index 0d91c33dd8cc63cc4183ffa668d8a8eaae38dc78..9f0ca7a29cec2f30f0fdf5284c3ac80a8a8d3ed3 100644 (file)
@@ -5,11 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_rule_validate_
-  void controller_rule_validate(controller_global_t * const global, const controller_rule_t rule, const uint8_t action, const uint8_t options, controller_cache_t * const cache) {
+  void controller_rule_validate(controller_t * const main, const controller_rule_t rule, const uint8_t action, const uint8_t options, controller_cache_t * const cache) {
 
-    if (!global || !cache) return F_status_set_error(F_parameter);
-
-    controller_t * const main = global->main;
+    if (!main || !cache) return;
 
     switch (action) {
       case controller_rule_action_type_freeze_e:
@@ -25,15 +23,15 @@ extern "C" {
 
       default:
         if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
-          controller_lock_print(main->program.error.to, global->thread);
+          controller_lock_print(main->program.error.to, &main->thread);
 
           fl_print_format("%r%[%QUnsupported action type '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
           fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_convert_rule_action_type_string(action), main->program.error.notable);
           fl_print_format("%[' while attempting to validate rule execution.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-          controller_print_rule_error_cache(global->error, cache->action, F_true);
+          controller_print_rule_error_cache(&main->program.error, cache->action, F_true);
 
-          controller_unlock_print_flush(main->program.error.to, global->thread);
+          controller_unlock_print_flush(main->program.error.to, &main->thread);
         }
 
         return;
@@ -59,7 +57,7 @@ extern "C" {
       } // for
 
       if (missing) {
-        controller_lock_print(main->program.output.to, global->thread);
+        controller_lock_print(main->program.output.to, &main->thread);
 
         if (rule.items.used) {
           fl_print_format("%rRule '", main->program.output.to, f_string_eol_s);
@@ -80,11 +78,11 @@ extern "C" {
           fl_print_format("%[%r%]'.%r", main->program.output.to, main->program.context.set.important, options & controller_instance_option_require_e ? controller_required_s : controller_optional_s, main->program.context.set.important, f_string_eol_s);
         }
 
-        controller_unlock_print_flush(main->program.output.to, global->thread);
+        controller_unlock_print_flush(main->program.output.to, &main->thread);
       }
     }
 
-    controller_lock_print(main->program.output.to, global->thread);
+    controller_lock_print(main->program.output.to, &main->thread);
 
     fl_print_format("%rRule %[%Q%] {%r", main->program.output.to, f_string_eol_s, main->program.context.set.title, rule.alias, main->program.context.set.title, f_string_eol_s);
 
@@ -496,7 +494,7 @@ extern "C" {
 
     fl_print_format("}%r", main->program.output.to, f_string_eol_s);
 
-    controller_unlock_print_flush(main->program.output.to, global->thread);
+    controller_unlock_print_flush(main->program.output.to, &main->thread);
   }
 #endif // _di_controller_rule_validate_
 
index 1e15ddc362a67b894703f16d24a699248171ca9c..052afb3c1ad0dc88a7423c959da368b1288c69cd 100644 (file)
@@ -23,12 +23,12 @@ extern "C" {
  *
  * This automatically sets the rule's status to F_complete.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   This does not alter main.setting.state.status.
  * @param rule
  *   The rule to process.
  * @param action
@@ -42,7 +42,7 @@ extern "C" {
  *   A structure for containing and caching relevant data.
  */
 #ifndef _di_controller_rule_validate_
-  extern void controller_rule_validate(controller_global_t * const global, const controller_rule_t rule, const uint8_t action, const uint8_t options, controller_cache_t * const cache);
+  extern void controller_rule_validate(controller_t * const main, const controller_rule_t rule, const uint8_t action, const uint8_t options, controller_cache_t * const cache);
 #endif // _di_controller_rule_validate_
 
 #ifdef __cplusplus
index bb08add1d9448358a333ed3028d47a894eec197b..74bf74f38f60031ed1f256655a0f816da81cfd64 100644 (file)
@@ -5,20 +5,20 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_rule_wait_all_
-  f_status_t controller_rule_wait_all(controller_global_t * const global, const bool is_normal, const bool required) {
+  f_status_t controller_rule_wait_all(controller_t * const main, const bool is_normal, const bool required) {
 
-    if (!global) return F_status_set_error(F_parameter);
+    if (!main) return F_status_set_error(F_parameter);
 
-    f_status_t status_lock = controller_lock_read(is_normal, global->thread, &global->thread->lock.instance);
+    f_status_t status_lock = controller_lock_read(is_normal, &main->thread, &main->thread.lock.instance);
 
     if (F_status_is_error(status_lock)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+      controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
 
       return status_lock;
     }
 
-    if (!global->thread->instances.used) {
-      f_thread_unlock(&global->thread->lock.instance);
+    if (!main->thread.instances.used) {
+      f_thread_unlock(&main->thread.lock.instance);
 
       return F_data_not;
     }
@@ -32,41 +32,41 @@ extern "C" {
     f_number_unsigned_t j = 0;
 
     // Build a list of what to wait for so that anything new after this point will not be waited for.
-    const f_number_unsigned_t instance_total = global->thread->instances.used;
+    const f_number_unsigned_t instance_total = main->thread.instances.used;
     controller_instance_t *instance_list[instance_total];
 
     for (; i < instance_total; ++i) {
-      instance_list[i] = global->thread->instances.array[i];
+      instance_list[i] = main->thread.instances.array[i];
     } // for
 
-    f_thread_unlock(&global->thread->lock.instance);
+    f_thread_unlock(&main->thread.lock.instance);
 
     for (i = 0; i < instance_total; ++i) {
 
-      if (!controller_thread_is_enabled(is_normal, global->thread)) break;
+      if (!controller_thread_is_enabled(is_normal, &main->thread)) break;
 
-      // Re-establish global instance read lock to wait for or protect from the cleanup thread while checking the read instance.
-      status_lock = controller_lock_read(is_normal, global->thread, &global->thread->lock.instance);
+      // Re-establish instance read lock to wait for or protect from the cleanup thread while checking the read instance.
+      status_lock = controller_lock_read(is_normal, &main->thread, &main->thread.lock.instance);
       if (F_status_is_error(status_lock)) break;
 
       if (!instance_list[i]) {
-        f_thread_unlock(&global->thread->lock.instance);
+        f_thread_unlock(&main->thread.lock.instance);
 
         continue;
       }
 
-      status_lock = controller_lock_read(is_normal, global->thread, &instance_list[i]->active);
+      status_lock = controller_lock_read(is_normal, &main->thread, &instance_list[i]->active);
 
       if (F_status_is_error(status_lock)) {
-        f_thread_unlock(&global->thread->lock.instance);
+        f_thread_unlock(&main->thread.lock.instance);
 
         break;
       }
 
       // Once the active lock is obtained, then the main instance read lock can be safely released.
-      f_thread_unlock(&global->thread->lock.instance);
+      f_thread_unlock(&main->thread.lock.instance);
 
-      status_lock = controller_lock_read(is_normal, global->thread, &instance_list[i]->lock);
+      status_lock = controller_lock_read(is_normal, &main->thread, &instance_list[i]->lock);
 
       if (F_status_is_error(status_lock)) {
         f_thread_unlock(&instance_list[i]->active);
@@ -88,10 +88,10 @@ extern "C" {
         if (instance_list[i]->state == controller_instance_state_done_e) {
           f_thread_unlock(&instance_list[i]->lock);
 
-          status_lock = controller_lock_write(is_normal, global->thread, &instance_list[i]->lock);
+          status_lock = controller_lock_write(is_normal, &main->thread, &instance_list[i]->lock);
 
           if (F_status_is_error(status_lock)) {
-            controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
+            controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
 
             f_thread_unlock(&instance_list[i]->active);
 
@@ -113,7 +113,7 @@ extern "C" {
               f_thread_mutex_unlock(&instance_list[i]->wait_lock);
             }
 
-            status_lock = controller_lock_read(is_normal, global->thread, &instance_list[i]->active);
+            status_lock = controller_lock_read(is_normal, &main->thread, &instance_list[i]->active);
 
             if (F_status_is_error(status_lock)) {
               f_thread_unlock(&instance_list[i]->lock);
@@ -124,7 +124,7 @@ extern "C" {
 
           f_thread_unlock(&instance_list[i]->lock);
 
-          status_lock = controller_lock_read(is_normal, global->thread, &instance_list[i]->lock);
+          status_lock = controller_lock_read(is_normal, &main->thread, &instance_list[i]->lock);
           if (F_status_is_error(status_lock)) break;
         }
 
@@ -161,7 +161,7 @@ extern "C" {
           break;
         }
 
-        status_lock = controller_lock_read(is_normal, global->thread, &instance_list[i]->lock);
+        status_lock = controller_lock_read(is_normal, &main->thread, &instance_list[i]->lock);
 
         if (F_status_is_error(status_lock)) {
           f_thread_unlock(&instance_list[i]->active);
@@ -194,12 +194,12 @@ extern "C" {
     } // for
 
     if (F_status_is_error(status_lock)) {
-      controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
+      controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
 
       return status_lock;
     }
 
-    if (!controller_thread_is_enabled(is_normal, global->thread)) return F_status_set_error(F_interrupt);
+    if (!controller_thread_is_enabled(is_normal, &main->thread)) return F_status_set_error(F_interrupt);
     if (F_status_set_fine(status) == F_require) return status;
     if (required_not_run) return F_require;
 
@@ -208,11 +208,11 @@ extern "C" {
 #endif // _di_controller_rule_wait_all_
 
 #ifndef _di_controller_rule_wait_all_instance_type_
-  f_status_t controller_rule_wait_all_instance_type(controller_global_t * const global, const uint8_t type, const bool required) {
+  f_status_t controller_rule_wait_all_instance_type(controller_t * const main, const uint8_t type, const bool required) {
 
-    if (!global) return F_status_set_error(F_parameter);
+    if (!main) return F_status_set_error(F_parameter);
 
-    return controller_rule_wait_all(global, type != controller_instance_type_exit_e, required);
+    return controller_rule_wait_all(main, type != controller_instance_type_exit_e, required);
   }
 #endif // _di_controller_rule_wait_all_instance_type_
 
index f5e4e7f0984aae3096f15c00be43dc7469bc49ac..fc46a4d080b94c9752d5771626dffeae82778fe0 100644 (file)
@@ -19,12 +19,12 @@ extern "C" {
 /**
  * Wait until all currently running Rule processes are complete.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   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.
@@ -42,18 +42,18 @@ extern "C" {
  *   F_require (with error bit set) if a required process is in failed status when required is TRUE.
  */
 #ifndef _di_controller_rule_wait_all_
-  extern f_status_t controller_rule_wait_all(controller_global_t * const global, const bool is_normal, const bool required);
+  extern f_status_t controller_rule_wait_all(controller_t * const main, const bool is_normal, const bool required);
 #endif // _di_controller_rule_wait_all_
 
 /**
  * Wait until all currently running Rule processes are complete for some process type.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   This does not alter main.setting.state.status.
  * @param type
  *   The process type to use when checking if thread is enabled.
  * @param required
@@ -68,7 +68,7 @@ extern "C" {
  * @see controller_rule_wait_all()
  */
 #ifndef _di_controller_rule_wait_all_instance_type_
-  extern f_status_t controller_rule_wait_all_instance_type(controller_global_t * const global, const uint8_t type, const bool required);
+  extern f_status_t controller_rule_wait_all_instance_type(controller_t * const main, const uint8_t type, const bool required);
 #endif // _di_controller_rule_wait_all_instance_type_
 
 #ifdef __cplusplus
index b00c783f6fd0996d4d697cd4ac5bc1b9a72269dc..4de82ae73fb373666b760100e8774c74c973155b 100644 (file)
@@ -5,38 +5,41 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_cleanup_
-  void * controller_thread_cleanup(void * const arguments) {
+  void * controller_thread_cleanup(void * const argument) {
 
-    if (!arguments) return 0;
+    if (!argument) return 0;
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_global_t * const global = (controller_global_t * const) arguments;
+    controller_t * const main = (controller_t *) argument;
 
-    if (global->thread->enabled != controller_thread_enabled_e) return 0;
+    if (main->thread.enabled != controller_thread_enabled_e) return 0;
 
-    const f_time_spec_t delay = controller_time_seconds(global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e)
-      ? controller_thread_cleanup_interval_short_d
-      : controller_thread_cleanup_interval_long_d);
+    const f_time_spec_t delay = {
+      .tv_sec = (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e)
+        ? controller_thread_cleanup_interval_short_d
+        : controller_thread_cleanup_interval_long_d,
+      .tv_nsec = 0,
+    };
 
     f_status_t status = F_okay;
 
-    while (global->thread->enabled == controller_thread_enabled_e) {
+    while (main->thread.enabled == controller_thread_enabled_e) {
 
       f_time_sleep_spec(delay, 0);
 
-      if (global->thread->enabled != controller_thread_enabled_e) break;
+      if (main->thread.enabled != controller_thread_enabled_e) break;
 
-      if (f_thread_lock_write_try(&global->thread->lock.instance) == F_okay) {
+      if (f_thread_lock_write_try(&main->thread.lock.instance) == F_okay) {
         controller_instance_t *instance = 0;
 
         f_number_unsigned_t i = 0;
 
-        for (; i < global->thread->instances.size && global->thread->enabled == controller_thread_enabled_e; ++i) {
+        for (; i < main->thread.instances.size && main->thread.enabled == controller_thread_enabled_e; ++i) {
 
-          if (!global->thread->instances.array[i]) continue;
+          if (!main->thread.instances.array[i]) continue;
 
-          instance = global->thread->instances.array[i];
+          instance = main->thread.instances.array[i];
 
           // If "active" has a read lock, then do not attempt to clean it.
           if (f_thread_lock_write_try(&instance->active) != F_okay) continue;
@@ -49,7 +52,7 @@ extern "C" {
           }
 
           // If instance is active or busy, then do not attempt to clean it.
-          if (instance->state == controller_process_state_active_e || instance->state == controller_process_state_busy_e) {
+          if (instance->state == controller_instance_state_active_e || instance->state == controller_instance_state_busy_e) {
             f_thread_unlock(&instance->active);
             f_thread_unlock(&instance->lock);
 
@@ -85,14 +88,14 @@ extern "C" {
               status = f_thread_lock_write(&instance->lock);
 
               if (F_status_is_error(status)) {
-                controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status), F_false, global->thread);
+                controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status), F_false);
 
                 f_thread_unlock(&instance->active);
 
                 continue;
               }
 
-              instance->state = controller_process_state_idle_e;
+              instance->state = controller_instance_state_idle_e;
               instance->id_thread = 0;
 
               f_thread_mutex_lock(&instance->wait_lock);
@@ -109,7 +112,7 @@ extern "C" {
           }
 
           // De-allocate dynamic portions of the structure that are only ever needed while the instance is running.
-          controller_cache_delete_simple(&instance->cache);
+          controller_cache_delete(&instance->cache);
           f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &instance->stack.array, &instance->stack.used, &instance->stack.size);
 
           // Shrink the childs array.
@@ -131,14 +134,14 @@ extern "C" {
           }
 
           // De-allocate any rules in the space that is declared to be unused.
-          if (i >= global->thread->instances.used) {
+          if (i >= main->thread.instances.used) {
             controller_rule_delete(&instance->rule);
           }
 
           f_thread_unlock(&instance->active);
         } // for
 
-        f_thread_unlock(&global->thread->lock.instance);
+        f_thread_unlock(&main->thread.lock.instance);
       }
     } // while
 
index 360bc9c77612f9e4f64b4bc16e18bd0f6cb9abc5..d9f758fd3186bd7f252cd63469920040c2f63dcc 100644 (file)
@@ -19,17 +19,17 @@ extern "C" {
 /**
  * Thread for periodically cleaning up data when not busy.
  *
- * @param arguments
- *   The thread arguments.
- *   Must be of type controller_global_t.
+ * @param argument
+ *   The main program data.
  *
+ *   Must be of type controller_t.
  *   Must not be NULL.
  *
  * @return
  *   0, always.
  */
 #ifndef _di_controller_thread_cleanup_
-  extern void * controller_thread_cleanup(void * const arguments);
+  extern void * controller_thread_cleanup(void * const argument);
 #endif // _di_controller_thread_cleanup_
 
 #ifdef __cplusplus
index 26ae38f78f029a1e57241d97580e77208b9d3f86..0093c79ef201f0614f4afff1dfc268b48c31f05a 100644 (file)
@@ -5,25 +5,22 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_control_
-  void * controller_thread_control(void * const arguments) {
+  void * controller_thread_control(void * const argument) {
 
-    if (!arguments) return 0;
+    if (!argument) return 0;
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_global_t * const global = (controller_global_t * const) arguments;
+    controller_t * const main = (controller_t *) argument;
 
-    if (global->thread->enabled != controller_thread_enabled_e) return 0;
+    if (main->thread.enabled != controller_thread_enabled_e) return 0;
 
     f_status_t status = F_okay;
 
+    // A forked child process should de-allocate memory on exit.
+    // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below.
     if (status == F_child) {
-
-      // A forked child process should de-allocate memory on exit.
-      // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below.
-      controller_thread_delete_simple(global->thread);
-      controller_process_delete(global->setting);
-      controller_delete(global->main);
+      controller_delete(main);
     }
 
     return 0;
index f11c9f205787c1a7932885449fe24799720db9fb..adb8afb20d5aba32657d38e2e0eb1216b6cf484a 100644 (file)
@@ -19,17 +19,17 @@ extern "C" {
 /**
  * Thread for handling control requests and responses.
  *
- * @param arguments
- *   The global data.
- *   Must be of type controller_global_t.
+ * @param argument
+ *   The main program data.
  *
+ *   Must be of type controller_t.
  *   Must not be NULL.
  *
  * @return
  *   0, always.
  */
 #ifndef _di_controller_thread_control_
-  extern void * controller_thread_control(void * const arguments);
+  extern void * controller_thread_control(void * const argument);
 #endif // _di_controller_thread_control_
 
 #ifdef __cplusplus
index 8479fd903d416c1c90613240ad00ac1cab63d29f..dc209b74ffb6ecbe17327ffe8125476c27bad9a1 100644 (file)
@@ -5,82 +5,82 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_entry_
-  void * controller_thread_entry(void * const arguments) {
+  void * controller_thread_entry(void * const argument) {
 
-    if (!arguments) return 0;
+    if (!argument) return 0;
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_global_t * const global = (controller_global_t * const) arguments;
+    controller_t * const main = (controller_t *) argument;
 
-    if (!controller_thread_is_enabled(F_true, global->thread)) return 0;
+    if (!controller_thread_is_enabled(F_true, &main->thread)) return 0;
 
-    f_status_t * const status = &global->thread->status;
+    f_status_t * const status = &main->thread.status;
 
-    *status = controller_entry_read(global, F_true);
+    *status = controller_entry_read(main, F_true);
 
     if (F_status_set_fine(*status) == F_interrupt) {
-      global->program->ready = controller_program_ready_abort_e;
+      main->process.ready = controller_process_ready_abort_e;
     }
     else if (F_status_is_error(*status)) {
-      global->program->ready = controller_program_ready_fail_e;
+      main->process.ready = controller_process_ready_fail_e;
     }
     else if (*status != F_child) {
-      *status = controller_entry_preprocess(global, F_true);
+      *status = controller_entry_preprocess(main, F_true);
 
-      if ((global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e) && (global->main->program.parameters.array[controller_parameter_validate_e].result & f_console_result_found_e)) {
-        controller_entry_setting_validate(global, F_true);
+      if ((main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e) && (main->program.parameters.array[controller_parameter_validate_e].result & f_console_result_found_e)) {
+        controller_entry_setting_validate(main, F_true);
       }
     }
 
     if (F_status_is_error_not(*status) && *status != F_child) {
-      if (!(global->main->program.parameters.array[controller_parameter_validate_e].result & f_console_result_found_e) || (global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e)) {
+      if (!(main->program.parameters.array[controller_parameter_validate_e].result & f_console_result_found_e) || (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e)) {
 
-        if (global->program->entry.pid == controller_entry_pid_require_e && f_file_exists(global->program->path_pid, F_true) == F_true) {
+        if (main->process.entry.pid == controller_entry_pid_require_e && f_file_exists(main->process.path_pid, F_true) == F_true) {
           *status = F_status_set_error(F_available_not);
-          global->program->ready = controller_program_ready_fail_e;
+          main->process.ready = controller_process_ready_fail_e;
 
-          controller_print_error_file_pid_exists(&global->main->program.error, global->thread, global->program->path_pid);
+          controller_print_error_file_pid_exists(&main->program.error, &main->thread, main->process.path_pid);
         }
         else {
-          *status = controller_entry_process(global, F_false, F_true);
+          *status = controller_entry_process(main, F_false, F_true);
 
           if (F_status_is_error(*status)) {
-            global->program->ready = controller_program_ready_fail_e;
+            main->process.ready = controller_process_ready_fail_e;
 
-            if ((F_status_set_fine(*status) == F_execute || F_status_set_fine(*status) == F_require) && (program->flag & controller_setting_flag_failsafe_e)) {
-              const uint8_t original_enabled = global->thread->enabled;
+            if ((F_status_set_fine(*status) == F_execute || F_status_set_fine(*status) == F_require) && (main->setting.flag & controller_process_flag_failsafe_e)) {
+              const uint8_t original_enabled = main->thread.enabled;
 
               // Restore operating mode so that the failsafe can execute.
-              *status = f_thread_mutex_lock(&global->thread->lock.alert);
+              *status = f_thread_mutex_lock(&main->thread.lock.alert);
 
               if (F_status_is_error_not(*status)) {
-                global->thread->enabled = controller_thread_enabled_e;
+                main->thread.enabled = controller_thread_enabled_e;
 
-                f_thread_mutex_unlock(&global->thread->lock.alert);
+                f_thread_mutex_unlock(&main->thread.lock.alert);
               }
 
-              // Restart the signal global->thread to allow for signals while operating the failsafe Items.
-              if (!global->thread->id_signal) {
-                f_thread_create(0, &global->thread->id_signal, &controller_thread_signal_normal, (void *) global);
+              // Restart the signal main->thread to allow for signals while operating the failsafe Items.
+              if (!main->thread.id_signal) {
+                f_thread_create(0, &main->thread.id_signal, &controller_thread_signal_normal, (void *) main);
               }
 
-              const f_status_t status_failsafe = controller_entry_process(global, F_true, F_true);
+              const f_status_t status_failsafe = controller_entry_process(main, F_true, F_true);
 
               if (F_status_is_error(status_failsafe)) {
                 *status = F_status_set_error(F_failure);
 
-                controller_print_error_failsafe_item(&global->main->program.error, global->thread, global->program->entry.items.array[program->failsafe_item_id].name);
+                controller_print_error_failsafe_item(&main->program.error, &main->thread, main->process.entry.items.array[main->process.failsafe_item_id].name);
               }
               else {
 
                 // Restore operating mode to value prior to failsafe mode.
-                *status = f_thread_mutex_lock(&global->thread->lock.alert);
+                *status = f_thread_mutex_lock(&main->thread.lock.alert);
 
                 if (F_status_is_error_not(*status)) {
-                  global->thread->enabled = original_enabled;
+                  main->thread.enabled = original_enabled;
 
-                  f_thread_mutex_unlock(&global->thread->lock.alert);
+                  f_thread_mutex_unlock(&main->thread.lock.alert);
                 }
 
                 *status = F_failure;
@@ -88,121 +88,114 @@ extern "C" {
             }
           }
           else if (F_status_set_fine(*status) == F_interrupt) {
-            global->program->ready = controller_program_ready_abort_e;
+            main->process.ready = controller_process_ready_abort_e;
           }
           else if (*status != F_child) {
-            global->program->ready = controller_program_ready_done_e;
+            main->process.ready = controller_process_ready_done_e;
           }
         }
 
-        if (F_status_is_error_not(*status) && *status != F_child && global->main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e && global->program->mode == controller_program_mode_helper_e) {
+        if (F_status_is_error_not(*status) && *status != F_child && main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e && main->process.mode == controller_process_mode_helper_e) {
           f_time_spec_t time;
           time.tv_sec = controller_thread_exit_helper_timeout_seconds_d;
           time.tv_nsec = controller_thread_exit_helper_timeout_nanoseconds_d;
 
           nanosleep(&time, 0);
 
-          controller_thread_instance_cancel(global, F_true, controller_thread_cancel_exit_e);
+          controller_thread_instance_cancel(main, F_true, controller_thread_cancel_exit_e);
         }
       }
     }
 
+    // A forked child process should de-allocate memory on exit.
+    // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below.
     if (*status == F_child) {
+      controller_delete(main);
 
-      // A forked child process should de-allocate memory on exit.
-      // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below.
-      controller_thread_delete(global->thread);
-      controller_program_delete(global->program);
-      controller_delete(global->main);
-
-      // According to the manpages, pthread_exit() calls exit(0), which the value of global->main->program.child should be returned instead.
-      if (global->main->program.child) exit(global->main->program.child);
-
-      return 0;
+      // According to the manpages, pthread_exit() calls exit(0), which the value of main->program.child should be returned instead.
+      if (main->program.child) exit(main->program.child);
+    } else {
+      f_thread_condition_signal_all(&main->thread.lock.alert_condition);
     }
 
-    f_thread_condition_signal_all(&global->thread->lock.alert_condition);
-
     return 0;
   }
 #endif // _di_controller_thread_entry_
 
 #ifndef _di_controller_thread_exit_
-  void * controller_thread_exit(void * const arguments) {
+  void * controller_thread_exit(void * const argument) {
 
-    if (!arguments) return 0;
+    if (!argument) return 0;
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_global_t * const global = (controller_global_t * const) arguments;
+    controller_t * const main = (controller_t *) argument;
+    controller_cache_t * const cache = &main->thread.cache;
+    f_status_t * const status = &main->thread.status;
 
-    controller_t * const main = global->main;
-    controller_cache_t * const cache = &global->thread->cache;
-    f_status_t * const status = &global->thread->status;
-
-    *status = controller_entry_read(global, F_false);
+    *status = controller_entry_read(main, F_false);
 
     if (F_status_set_fine(*status) == F_interrupt) {
-      global->program->ready = controller_program_ready_abort_e;
+      main->process.ready = controller_process_ready_abort_e;
     }
     else if (F_status_is_error(*status)) {
-      global->program->ready = controller_program_ready_fail_e;
+      main->process.ready = controller_process_ready_fail_e;
     }
     else if (*status == F_file_found_not) {
-      global->program->ready = controller_program_ready_done_e;
+      main->process.ready = controller_process_ready_done_e;
     }
     else if (*status != F_child) {
-      *status = controller_entry_preprocess(global, F_false, cache);
+      *status = controller_entry_preprocess(main, F_false, cache);
 
       if ((main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e) && (main->program.parameters.array[controller_parameter_validate_e].result & f_console_result_found_e)) {
-        controller_entry_setting_validate(global, F_false, cache);
+        controller_entry_setting_validate(main, F_false, cache);
       }
     }
 
     if (F_status_is_error_not(*status) && *status != F_child && *status != F_file_found_not) {
       if (!(main->program.parameters.array[controller_parameter_validate_e].result & f_console_result_found_e) || (main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e)) {
 
-        *status = controller_entry_process(global, F_false, F_false);
+        *status = controller_entry_process(main, F_false, F_false);
 
         if (F_status_is_error(*status)) {
-          global->program->ready = controller_program_ready_fail_e;
+          main->process.ready = controller_process_ready_fail_e;
 
-          if ((F_status_set_fine(*status) == F_execute || F_status_set_fine(*status) == F_require) && (global->program->flag & controller_setting_flag_failsafe_e)) {
+          if ((F_status_set_fine(*status) == F_execute || F_status_set_fine(*status) == F_require) && (main->setting.flag & controller_process_flag_failsafe_e)) {
 
-            const uint8_t original_enabled = global->thread->enabled;
+            const uint8_t original_enabled = main->thread.enabled;
 
             // Restore operating mode so that the failsafe can execute.
             if (F_status_set_fine(*status) == F_execute) {
-              *status = f_thread_mutex_lock(&global->thread->lock.alert);
+              *status = f_thread_mutex_lock(&main->thread.lock.alert);
 
               if (F_status_is_error_not(*status)) {
-                global->thread->enabled = controller_thread_enabled_exit_e;
+                main->thread.enabled = controller_thread_enabled_exit_e;
 
-                f_thread_mutex_unlock(&global->thread->lock.alert);
+                f_thread_mutex_unlock(&main->thread.lock.alert);
               }
 
               // Restart the signal thread to allow for signals while operating the failsafe Items.
-              if (!global->thread->id_signal) {
-                f_thread_create(0, &global->thread->id_signal, &controller_thread_signal_other, (void *) global);
+              if (!main->thread.id_signal) {
+                f_thread_create(0, &main->thread.id_signal, &controller_thread_signal_other, (void *) main);
               }
             }
 
-            const f_status_t status_failsafe = controller_entry_process(global, F_true, F_false);
+            const f_status_t status_failsafe = controller_entry_process(main, F_true, F_false);
 
             if (F_status_is_error(status_failsafe)) {
               *status = F_status_set_error(F_failure);
 
-              controller_print_error_failsafe_item(&global->main->program.error, global->thread, global->program->entry.items.array[program->failsafe_item_id].name);
+              controller_print_error_failsafe_item(&main->program.error, &main->thread, main->process.entry.items.array[main->process.failsafe_item_id].name);
             }
             else {
 
               // Restore operating mode to value prior to failsafe mode.
-              *status = f_thread_mutex_lock(&global->thread->lock.alert);
+              *status = f_thread_mutex_lock(&main->thread.lock.alert);
 
               if (F_status_is_error_not(*status)) {
-                global->thread->enabled = original_enabled;
+                main->thread.enabled = original_enabled;
 
-                f_thread_mutex_unlock(&global->thread->lock.alert);
+                f_thread_mutex_unlock(&main->thread.lock.alert);
               }
 
               *status = F_failure;
@@ -210,32 +203,29 @@ extern "C" {
           }
         }
         else if (F_status_set_fine(*status) == F_interrupt) {
-          global->program->ready = controller_program_ready_abort_e;
+          main->process.ready = controller_process_ready_abort_e;
         }
         else if (*status != F_child) {
-          global->program->ready = controller_program_ready_done_e;
+          main->process.ready = controller_process_ready_done_e;
         }
       }
     }
 
+    // A forked child process should de-allocate memory on exit.
+    // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below.
     if (*status == F_child) {
-
-      // A forked child process should de-allocate memory on exit.
-      // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below.
-      controller_thread_delete_simple(global->thread);
-      controller_process_delete(global->program);
       controller_delete(main);
 
       return 0;
     }
 
-    if (F_status_is_error_not(f_thread_mutex_lock(&global->thread->lock.alert))) {
-      global->thread->enabled = controller_thread_enabled_not_e;
+    if (F_status_is_error_not(f_thread_mutex_lock(&main->thread.lock.alert))) {
+      main->thread.enabled = controller_thread_enabled_not_e;
 
-      f_thread_mutex_unlock(&global->thread->lock.alert);
+      f_thread_mutex_unlock(&main->thread.lock.alert);
     }
 
-    f_thread_condition_signal_all(&global->thread->lock.alert_condition);
+    f_thread_condition_signal_all(&main->thread.lock.alert_condition);
 
     return 0;
   }
index a2a256017ce6001fd54eb28c5acf9a16305b1016..04a02b3f97572af1363a1d61f017cd3a3bebc486 100644 (file)
@@ -23,9 +23,9 @@ extern "C" {
  * This runs all synchronous rules or spawns asynchronous rules.
  *
  * @param arguments
- *   The global data.
- *   Must be of type controller_instance_t.
+ *   The main program data.
  *
+ *   Must be of type controller_t.
  *   Must not be NULL.
  *
  * @return
@@ -44,17 +44,17 @@ extern "C" {
  * 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 arguments
- *   The global data.
- *   Must be of type controller_instance_t.
+ * @param argument
+ *   The main program data.
  *
+ *   Must be of type controller_t.
  *   Must not be NULL.
  *
  * @return
  *   0, always.
  */
 #ifndef _di_controller_thread_exit_
-  extern void * controller_thread_exit(void * const arguments);
+  extern void * controller_thread_exit(void * const argument);
 #endif // _di_controller_thread_exit_
 
 #ifdef __cplusplus
index 3cedb151479f8c4b1cbd14b87c92c7396f8566a2..53af640c922a3f62a4c0ee23a8e98d0c67688580 100644 (file)
@@ -7,39 +7,37 @@ extern "C" {
 #ifndef _di_controller_thread_instance_
   void controller_thread_instance(const uint8_t is_normal, controller_instance_t * const instance) {
 
-    if (!instance) return;
-    if (!controller_thread_is_enabled(is_normal, (controller_thread_t * const) instance->thread)) return;
+    if (!instance || !instance->main) return;
+    if (!controller_thread_is_enabled(is_normal, &instance->main->thread)) return;
 
     const f_status_t status = controller_rule_instance_do(controller_instance_option_asynchronous_e, instance);
 
     // A forked child instance should de-allocate memory on exit.
     // It seems that this function doesn't return to the calling thread for a forked child instance, even with the "return 0;" below.
     if (status == F_child) {
-      controller_thread_delete_simple(instance->main_thread);
-      controller_process_delete(instance->program);
-      controller_delete(instance->main_data);
+      controller_delete(instance->main);
 
       // According to some man pages, pthread_exit() calls exit(0), so expliticly exit to ensure a non-zero code is returned when needed.
-      if (instance->main_data->program.child) exit(instance->main_data->program.child);
+      if (instance->main->program.child) exit(instance->main->program.child);
     }
   }
 #endif // _di_controller_thread_instance_
 
 #ifndef _di_controller_thread_instance_cancel_
-  void controller_thread_instance_cancel(controller_global_t * const global, const uint8_t is_normal, const uint8_t by) {
+  void controller_thread_instance_cancel(controller_t * const main, const uint8_t is_normal, const uint8_t by) {
 
-    if (!global) return;
+    if (!main) return;
 
-    f_thread_mutex_lock(&global->thread->lock.cancel);
+    f_thread_mutex_lock(&main->thread.lock.cancel);
 
     // Only cancel when enabled.
-    if (!controller_thread_is_enabled(is_normal, global->thread)) {
-      f_thread_mutex_unlock(&global->thread->lock.cancel);
+    if (!controller_thread_is_enabled(is_normal, &main->thread)) {
+      f_thread_mutex_unlock(&main->thread.lock.cancel);
 
       return;
     }
 
-    controller_entry_t * const entry = is_normal ? &global->program->entry : &global->program->exit;
+    controller_entry_t * const entry = is_normal ? &main->process.entry : &main->process.exit;
     controller_instance_t *instance = 0;
 
     f_time_spec_t time = f_time_spec_t_initialize;
@@ -55,15 +53,15 @@ extern "C" {
     time.tv_sec = 0;
     time.tv_nsec = interval_nanoseconds;
 
-    if (global->program->mode == controller_program_mode_helper_e && global->main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e) {
+    if (main->process.mode == controller_process_mode_helper_e && main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e) {
       int value = 0;
       f_number_unsigned_t lapsed = 0;
 
-      for (i = 0; i < global->thread->instances.used; ++i) {
+      for (i = 0; i < main->thread.instances.used; ++i) {
 
-        if (!global->thread->instances.array[i]) continue;
+        if (!main->thread.instances.array[i]) continue;
 
-        instance = global->thread->instances.array[i];
+        instance = main->thread.instances.array[i];
 
         if (!instance->id_thread) continue;
 
@@ -74,71 +72,71 @@ extern "C" {
     }
 
     // Use the alert lock to toggle enabled (using it as if it is a write like and a signal lock).
-    status = f_thread_mutex_lock(&global->thread->lock.alert);
+    status = f_thread_mutex_lock(&main->thread.lock.alert);
 
     if (F_status_is_error(status)) {
-      global->thread->enabled = controller_thread_enabled_not_e;
+      main->thread.enabled = controller_thread_enabled_not_e;
     }
     else {
       if (by == controller_thread_cancel_execute_e) {
-        global->thread->enabled = controller_thread_enabled_execute_e;
+        main->thread.enabled = controller_thread_enabled_execute_e;
       }
       else if (by == controller_thread_cancel_exit_e) {
-        global->thread->enabled = controller_thread_enabled_not_e;
+        main->thread.enabled = controller_thread_enabled_not_e;
       }
       else if (by == controller_thread_cancel_exit_execute_e) {
-        global->thread->enabled = controller_thread_enabled_exit_execute_e;
+        main->thread.enabled = controller_thread_enabled_exit_execute_e;
       }
       else {
-        global->thread->enabled = controller_thread_enabled_exit_e;
+        main->thread.enabled = controller_thread_enabled_exit_e;
       }
 
-      f_thread_mutex_unlock(&global->thread->lock.alert);
+      f_thread_mutex_unlock(&main->thread.lock.alert);
     }
 
-    if (global->thread->id_cleanup) {
-      f_thread_cancel(global->thread->id_cleanup);
-      f_thread_join(global->thread->id_cleanup, 0);
+    if (main->thread.id_cleanup) {
+      f_thread_cancel(main->thread.id_cleanup);
+      f_thread_join(main->thread.id_cleanup, 0);
 
-      global->thread->id_cleanup = 0;
+      main->thread.id_cleanup = 0;
     }
 
-    if (global->thread->id_control) {
-      f_thread_cancel(global->thread->id_control);
-      f_thread_join(global->thread->id_control, 0);
+    if (main->thread.id_control) {
+      f_thread_cancel(main->thread.id_control);
+      f_thread_join(main->thread.id_control, 0);
 
-      global->thread->id_control = 0;
+      main->thread.id_control = 0;
     }
 
     // The sigtimedwait() function that is run inside of signal must be interrupted via the f_thread_cancel().
-    if (by != controller_thread_cancel_signal_e && global->thread->id_signal) {
-      f_thread_cancel(global->thread->id_signal);
-      f_thread_join(global->thread->id_signal, 0);
+    if (by != controller_thread_cancel_signal_e && main->thread.id_signal) {
+      f_thread_cancel(main->thread.id_signal);
+      f_thread_join(main->thread.id_signal, 0);
 
-      global->thread->id_signal = 0;
+      main->thread.id_signal = 0;
     }
 
-    if (global->program->mode == controller_program_mode_helper_e && global->main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e) {
-      f_thread_mutex_unlock(&global->thread->lock.cancel);
+    if (main->process.mode == controller_process_mode_helper_e && main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e) {
+      f_thread_mutex_unlock(&main->thread.lock.cancel);
 
       return;
     }
 
-    for (; i < global->thread->instances.used; ++i) {
+    for (; i < main->thread.instances.used; ++i) {
 
-      if (!global->thread->instances.array[i]) continue;
+      if (!main->thread.instances.array[i]) continue;
 
-      instance = global->thread->instances.array[i];
+      instance = main->thread.instances.array[i];
 
       // Do not cancel exit instances, when not performing "execute" during exit.
-      if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) {
+      if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) {
         continue;
       }
 
       for (j = 0; j < instance->childs.used; ++j) {
 
         if (instance->childs.array[j] > 0) {
-          f_signal_send(global->thread->signal ? global->thread->signal : F_signal_termination, instance->childs.array[j]);
+          f_signal_send(main->thread.signal ? main->thread.signal : F_signal_termination, instance->childs.array[j]);
         }
       } // for
 
@@ -148,7 +146,7 @@ extern "C" {
           status = controller_file_pid_read(instance->path_pids.array[j], &pid);
 
           if (pid) {
-            f_signal_send(global->thread->signal ? global->thread->signal : F_signal_termination, pid);
+            f_signal_send(main->thread.signal ? main->thread.signal : F_signal_termination, pid);
           }
         }
       } // for
@@ -157,14 +155,14 @@ extern "C" {
     if (entry->timeout_exit && !(entry->flag & controller_entry_flag_timeout_exit_no_e)) {
       f_number_unsigned_t lapsed = 0;
 
-      for (i = 0; i < global->thread->instances.used && lapsed < entry->timeout_exit; ++i) {
+      for (i = 0; i < main->thread.instances.used && lapsed < entry->timeout_exit; ++i) {
 
-        if (!global->thread->instances.array[i]) continue;
+        if (!main->thread.instances.array[i]) continue;
 
-        instance = global->thread->instances.array[i];
+        instance = main->thread.instances.array[i];
 
         // Do not wait for instances, when not performing "execute" during exit.
-        if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) {
+        if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) {
           continue;
         }
 
@@ -218,14 +216,14 @@ extern "C" {
       } // for
     }
 
-    for (i = 0; i < global->thread->instances.size; ++i) {
+    for (i = 0; i < main->thread.instances.size; ++i) {
 
-      if (!global->thread->instances.array[i]) continue;
+      if (!main->thread.instances.array[i]) continue;
 
-      instance = global->thread->instances.array[i];
+      instance = main->thread.instances.array[i];
 
       // Do not kill exit instances, when not performing "execute" during exit.
-      if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) continue;
+      if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) continue;
 
       if (instance->id_thread) {
         if (instance->childs.used) {
@@ -253,7 +251,7 @@ extern "C" {
         for (j = 0; j < instance->childs.size; ++j) {
 
           // Do not kill exit processes, when not performing "execute" during exit.
-          if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) continue;
+          if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) continue;
 
           if (instance->childs.array[j]) {
 
@@ -271,7 +269,7 @@ extern "C" {
         for (j = 0; j < instance->path_pids.used; ++j) {
 
           // Do not kill exit processes, when not performing "execute" during exit.
-          if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) continue;
+          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) {
             status = controller_file_pid_read(instance->path_pids.array[j], &pid);
@@ -290,7 +288,7 @@ extern "C" {
       while (instance->childs.used) {
 
         // Do not shrink below an exit instances, when not performing "execute" during exit.
-        if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) break;
+        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;
 
         --instance->childs.used;
@@ -300,131 +298,131 @@ extern "C" {
       while (instance->path_pids.used) {
 
         // Do not shrink below an exit instances, when not performing "execute" during exit.
-        if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) break;
+        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;
 
         --instance->path_pids.used;
       } // while
     } // for
 
-    f_thread_mutex_unlock(&global->thread->lock.cancel);
+    f_thread_mutex_unlock(&main->thread.lock.cancel);
   }
 #endif // _di_controller_thread_instance_cancel_
 
 #ifndef _di_controller_thread_instance_exit_
-  void controller_thread_instance_exit(controller_global_t * const global) {
+  void controller_thread_instance_exit(controller_t * const main) {
 
-    if (!global) return;
+    if (!main) return;
 
-    if (global->thread->enabled != controller_thread_enabled_exit_e) return;
+    if (main->thread.enabled != controller_thread_enabled_exit_e) return;
 
-    if (global->program->ready == controller_program_ready_done_e) {
+    if (main->process.ready == controller_process_ready_done_e) {
 
       // The exit processing runs using the entry thread.
-      if (global->thread->id_entry) {
-        f_thread_cancel(global->thread->id_entry);
-        f_thread_join(global->thread->id_entry, 0);
+      if (main->thread.id_entry) {
+        f_thread_cancel(main->thread.id_entry);
+        f_thread_join(main->thread.id_entry, 0);
 
-        global->thread->id_entry = 0;
+        main->thread.id_entry = 0;
       }
 
       // Restart the signal thread to allow for signals while operating the Exit.
-      if (!global->thread->id_signal) {
-        f_thread_create(0, &global->thread->id_signal, &controller_thread_signal_other, (void *) global);
+      if (!main->thread.id_signal) {
+        f_thread_create(0, &main->thread.id_signal, &controller_thread_signal_other, (void *) main);
       }
 
-      f_status_t status = f_thread_create(0, &global->thread->id_entry, &controller_thread_exit, (void *) global);
+      f_status_t status = f_thread_create(0, &main->thread.id_entry, &controller_thread_exit, (void *) main);
 
       if (F_status_is_error(status)) {
-        if (global->main->program.error.verbosity > f_console_verbosity_quiet_e) {
-          controller_print_error_status(&global->main->program.error, macro_controller_f(f_thread_create), F_status_set_fine(status));
+        if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+          controller_print_error_status(&main->program.error, macro_controller_f(f_thread_create), F_status_set_fine(status));
         }
 
-        if (F_status_is_error_not(f_thread_mutex_lock(&global->thread->lock.alert))) {
-          global->thread->enabled = controller_thread_enabled_not_e;
+        if (F_status_is_error_not(f_thread_mutex_lock(&main->thread.lock.alert))) {
+          main->thread.enabled = controller_thread_enabled_not_e;
 
-          f_thread_mutex_unlock(&global->thread->lock.alert);
+          f_thread_mutex_unlock(&main->thread.lock.alert);
         }
         else {
-          global->thread->enabled = controller_thread_enabled_not_e;
+          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(&global->thread->lock.alert);
+          status = f_thread_mutex_lock(&main->thread.lock.alert);
 
           if (F_status_is_error(status)) {
-            global->thread->enabled = controller_thread_enabled_not_e;
+            main->thread.enabled = controller_thread_enabled_not_e;
 
             break;
           }
 
           controller_time_now(controller_thread_exit_ready_timeout_seconds_d, controller_thread_exit_ready_timeout_nanoseconds_d, &time);
 
-          status = f_thread_condition_wait_timed(&time, &global->thread->lock.alert_condition, &global->thread->lock.alert);
+          status = f_thread_condition_wait_timed(&time, &main->thread.lock.alert_condition, &main->thread.lock.alert);
 
-          f_thread_mutex_unlock(&global->thread->lock.alert);
+          f_thread_mutex_unlock(&main->thread.lock.alert);
 
-        } while (F_status_is_error_not(status) && global->thread->enabled == controller_thread_enabled_exit_e);
+        } while (F_status_is_error_not(status) && main->thread.enabled == controller_thread_enabled_exit_e);
 
         if (F_status_is_error(status)) {
-          if (F_status_is_error_not(f_thread_mutex_lock(&global->thread->lock.alert))) {
-            global->thread->enabled = controller_thread_enabled_not_e;
+          if (F_status_is_error_not(f_thread_mutex_lock(&main->thread.lock.alert))) {
+            main->thread.enabled = controller_thread_enabled_not_e;
 
-            f_thread_mutex_unlock(&global->thread->lock.alert);
+            f_thread_mutex_unlock(&main->thread.lock.alert);
           }
           else {
-            global->thread->enabled = controller_thread_enabled_not_e;
+            main->thread.enabled = controller_thread_enabled_not_e;
           }
         }
       }
 
       // The sigtimedwait() function that is run inside of signal must be interrupted via the f_thread_cancel().
-      if (global->thread->id_signal) {
-        f_thread_cancel(global->thread->id_signal);
-        f_thread_join(global->thread->id_signal, 0);
+      if (main->thread.id_signal) {
+        f_thread_cancel(main->thread.id_signal);
+        f_thread_join(main->thread.id_signal, 0);
 
-        global->thread->id_signal = 0;
+        main->thread.id_signal = 0;
       }
 
-      controller_thread_instance_cancel(global, F_false, controller_thread_cancel_exit_e);
+      controller_thread_instance_cancel(main, F_false, controller_thread_cancel_exit_e);
     }
     else {
-      if (F_status_is_error_not(f_thread_mutex_lock(&global->thread->lock.alert))) {
-        global->thread->enabled = controller_thread_enabled_not_e;
+      if (F_status_is_error_not(f_thread_mutex_lock(&main->thread.lock.alert))) {
+        main->thread.enabled = controller_thread_enabled_not_e;
 
-        f_thread_mutex_unlock(&global->thread->lock.alert);
+        f_thread_mutex_unlock(&main->thread.lock.alert);
       }
       else {
-        global->thread->enabled = controller_thread_enabled_not_e;
+        main->thread.enabled = controller_thread_enabled_not_e;
       }
     }
   }
 #endif // _di_controller_thread_instance_exit_
 
 #ifndef _di_controller_thread_instance_normal_
-  void * controller_thread_instance_normal(void * const arguments) {
+  void * controller_thread_instance_normal(void * const argument) {
 
-    if (!arguments) return 0;
+    if (!argument) return 0;
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_thread_instance(F_true, (controller_instance_t * const) arguments);
+    controller_thread_instance(F_true, (controller_instance_t * const) argument);
 
     return 0;
   }
 #endif // _di_controller_thread_instance_normal_
 
 #ifndef _di_controller_thread_instance_other_
-  void * controller_thread_instance_other(void * const arguments) {
+  void * controller_thread_instance_other(void * const argument) {
 
-    if (!arguments) return 0;
+    if (!argument) return 0;
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_thread_instance(F_false, (controller_instance_t * const) arguments);
+    controller_thread_instance(F_false, (controller_instance_t * const) argument);
 
     return 0;
   }
index 64a3426eeaaffeb2dda4cc057d0a4d83142364c5..31b0ccb16c36ceca96e79be08e651e16b6a79174 100644 (file)
@@ -36,12 +36,12 @@ extern "C" {
 /**
  * Cancel all process threads.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   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.
@@ -53,30 +53,30 @@ extern "C" {
  *   If controller_thread_cancel_execute_e, then this was called from within the Entry/Exit for executing a process, so cancel the signal thread but not the Entry thread.
  */
 #ifndef _di_controller_thread_instance_cancel_
-  extern void controller_thread_instance_cancel(controller_global_t * const global, const uint8_t is_normal, const uint8_t by);
+  extern void controller_thread_instance_cancel(controller_t * const main, const uint8_t is_normal, const uint8_t by);
 #endif // _di_controller_thread_instance_cancel_
 
 /**
  * Process the Exit file, if applicable.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   This does not alter main.setting.state.status.
  */
 #ifndef _di_controller_thread_instance_exit_
-  extern void controller_thread_instance_exit(controller_global_t * const global);
+  extern void controller_thread_instance_exit(controller_t * const main);
 #endif // _di_controller_thread_instance_exit_
 
 /**
  * Asynchronously execute a Rule process during normal operations.
  *
- * @param arguments
- *   The thread arguments.
- *   Must be of type controller_global_t.
+ * @param argument
+ *   The instance data.
  *
+ *   Must be of type controller_instance_t.
  *   Must not be NULL.
  *
  * @return
@@ -85,17 +85,17 @@ extern "C" {
  * @see controller_thread_instance()
  */
 #ifndef _di_controller_thread_instance_normal_
-  extern void * controller_thread_instance_normal(void * const global);
+  extern void * controller_thread_instance_normal(void * const argument);
 #endif // _di_controller_thread_instance_normal_
 
 /**
  * Asynchronously execute a Rule process during other operations.
  *
- * @param arguments
- *   The thread arguments.
+ * @param argument
+ *   The instance data.
  *
- *   Must not be NULL.
  *   Must be of type controller_instance_t.
+ *   Must not be NULL.
  *
  * @return
  *   0, always.
@@ -103,7 +103,7 @@ extern "C" {
  * @see controller_thread_instance()
  */
 #ifndef _di_controller_thread_instance_other_
-  extern void * controller_thread_instance_other(void * const arguments);
+  extern void * controller_thread_instance_other(void * const argument);
 #endif // _di_controller_thread_instance_other_
 
 #ifdef __cplusplus
index 7df726f4cd0ea4c0488b73433f760f9fdf6f982e..57440f72bd03c30ef650314fddeaf3c8d0f7883d 100644 (file)
@@ -18,7 +18,7 @@ extern "C" {
 
     if (!instance) return F_false;
 
-    return controller_thread_is_enabled_instance_type(instance->type, instance->global->thread);
+    return controller_thread_is_enabled_instance_type(instance->type, &instance->main->thread);
   }
 #endif // _di_controller_thread_is_enabled_instance_
 
index 9a315f16b8aea6d62397e9a2725e625a33d143aa..6d5ffcbd147ca366a98dcc31783505855303c46a 100644 (file)
@@ -5,15 +5,15 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_rule_
-  void * controller_thread_rule(void * const arguments) {
+  void * controller_thread_rule(void * const argument) {
 
-    if (!arguments) return 0;
+    if (!argument) return 0;
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_global_t * const global = (controller_global_t * const) arguments;
+    controller_t * const main = (controller_t *) argument;
 
-    if (!controller_thread_is_enabled(F_true, global->thread)) return 0;
+    if (!controller_thread_is_enabled(F_true, &main->thread)) return 0;
 
     return 0;
   }
index b72bc9b73bf3f1b9b6a06f280068428ebc7d3651..4e4eb8b9626037811a7a5bbfd04899aa4c6dfe25 100644 (file)
@@ -24,17 +24,17 @@ extern "C" {
  *
  * @todo the control thread should send commands to this thread, somehow.
  *
- * @param arguments
- *   The global data.
- *   Must be of type controller_global_t.
+ * @param argument
+ *   The main program data.
  *
+ *   Must be of type controller_t.
  *   Must not be NULL.
  *
  * @return
  *   0, always.
  */
 #ifndef _di_controller_thread_rule_
-  extern void * controller_thread_rule(void * const arguments);
+  extern void * controller_thread_rule(void * const argument);
 #endif // _di_controller_thread_rule_
 
 #ifdef __cplusplus
index 66bf1392bc396557669f0741994a83bacdbcd3dd..523a788d9a42aa0e29907e81c6c39494629fb746 100644 (file)
@@ -5,29 +5,29 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_signal_
-  void controller_thread_signal(controller_global_t * const global, const bool is_normal) {
+  void controller_thread_signal(controller_t * const main, const bool is_normal) {
 
-    if (!global || !global->main || !global->thread) return;
-    if (!controller_thread_is_enabled(is_normal, global->thread)) return;
-    if (!(global->main->setting.flag & controller_main_flag_interruptible_e)) return;
+    if (!main) return;
+    if (!controller_thread_is_enabled(is_normal, &main->thread)) return;
+    if (!(main->setting.flag & controller_main_flag_interruptible_e)) return;
 
     f_status_t status = F_okay;
     siginfo_t information;
     f_time_spec_t time = f_time_spec_t_initialize;
 
-    while (controller_thread_is_enabled(is_normal, global->thread)) {
+    while (controller_thread_is_enabled(is_normal, &main->thread)) {
 
       controller_time_now(controller_thread_exit_ready_timeout_seconds_d, controller_thread_exit_ready_timeout_nanoseconds_d, &time);
 
       memset((void *) &information, 0, sizeof(siginfo_t));
 
-      status = f_signal_wait_until(&global->main->program.signal.set, &time, &information);
+      status = f_signal_wait_until(&main->program.signal.set, &time, &information);
       if (status == F_time_out) continue;
 
       if (information.si_signo == F_signal_interrupt || information.si_signo == F_signal_abort || information.si_signo == F_signal_quit || information.si_signo == F_signal_termination) {
-        global->thread->signal = information.si_signo;
+        main->thread.signal = information.si_signo;
 
-        controller_thread_instance_cancel(global, is_normal, controller_thread_cancel_signal_e);
+        controller_thread_instance_cancel(main, is_normal, controller_thread_cancel_signal_e);
 
         break;
       }
@@ -42,15 +42,15 @@ extern "C" {
 
     controller_interrupt_t * const interrupt = (controller_interrupt_t *) state->custom;
 
-    if (!interrupt->global || !interrupt->global->main || !interrupt->global->thread) return;
+    if (!interrupt->main) return;
 
-    if (!controller_thread_is_enabled(interrupt->is_normal, interrupt->global->thread)) {
-      interrupt->global->main->program.signal_received = F_signal_abort;
-      interrupt->global->main->setting.state.status = F_status_set_error(F_interrupt);
+    if (!controller_thread_is_enabled(interrupt->is_normal, &interrupt->main->thread)) {
+      interrupt->main->program.signal_received = F_signal_abort;
+      interrupt->main->setting.state.status = F_status_set_error(F_interrupt);
     }
-    else if (interrupt->global->thread->signal == F_signal_interrupt || interrupt->global->thread->signal == F_signal_abort || interrupt->global->thread->signal == F_signal_quit || interrupt->global->thread->signal == F_signal_termination) {
-      interrupt->global->main->program.signal_received = F_signal_abort;
-      interrupt->global->main->setting.state.status = F_status_set_error(F_interrupt);
+    else if (interrupt->main->thread.signal == F_signal_interrupt || interrupt->main->thread.signal == F_signal_abort || interrupt->main->thread.signal == F_signal_quit || interrupt->main->thread.signal == F_signal_termination) {
+      interrupt->main->program.signal_received = F_signal_abort;
+      interrupt->main->setting.state.status = F_status_set_error(F_interrupt);
     }
   }
 #endif // _di_controller_thread_signal_state_fss_
@@ -62,36 +62,36 @@ extern "C" {
 
     controller_interrupt_t * const interrupt = (controller_interrupt_t *) state->custom;
 
-    if (!interrupt->global || !interrupt->global->main || !interrupt->global->thread) return;
+    if (!interrupt->main) return;
 
-    if (!controller_thread_is_enabled(interrupt->is_normal, interrupt->global->thread)) {
-      interrupt->global->main->program.signal_received = F_signal_abort;
-      interrupt->global->main->setting.state.status = F_status_set_error(F_interrupt);
+    if (!controller_thread_is_enabled(interrupt->is_normal, &interrupt->main->thread)) {
+      interrupt->main->program.signal_received = F_signal_abort;
+      interrupt->main->setting.state.status = F_status_set_error(F_interrupt);
     }
-    else if (interrupt->global->thread->signal == F_signal_interrupt || interrupt->global->thread->signal == F_signal_abort || interrupt->global->thread->signal == F_signal_quit || interrupt->global->thread->signal == F_signal_termination) {
-      interrupt->global->main->program.signal_received = F_signal_abort;
-      interrupt->global->main->setting.state.status = F_status_set_error(F_interrupt);
+    else if (interrupt->main->thread.signal == F_signal_interrupt || interrupt->main->thread.signal == F_signal_abort || interrupt->main->thread.signal == F_signal_quit || interrupt->main->thread.signal == F_signal_termination) {
+      interrupt->main->program.signal_received = F_signal_abort;
+      interrupt->main->setting.state.status = F_status_set_error(F_interrupt);
     }
   }
 #endif // _di_controller_thread_signal_state_iki_
 
 #ifndef _di_controller_thread_signal_normal_
-  void * controller_thread_signal_normal(void * const global) {
+  void * controller_thread_signal_normal(void * const argument) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_thread_signal((controller_global_t * const) global, F_true);
+    controller_thread_signal((controller_t *) argument, F_true);
 
     return 0;
   }
 #endif // _di_controller_thread_signal_normal_
 
 #ifndef _di_controller_thread_signal_other_
-  void * controller_thread_signal_other(void * const global) {
+  void * controller_thread_signal_other(void * const argument) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_thread_signal((controller_global_t * const) global, F_false);
+    controller_thread_signal((controller_t *) argument, F_false);
 
     return 0;
   }
index 89fb7523c05938d516012bc76492b62856337088..7af8fbe250b1bd168df0fa5520364475e3b4d066 100644 (file)
@@ -15,8 +15,8 @@
 /**
  * Thread for handling signals/interrupts.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  * @param is_normal
@@ -24,7 +24,7 @@
  *   If FALSE, then process as if this operates during a an exit operation.
  */
 #ifndef _di_controller_thread_signal_
-  extern void controller_thread_signal(controller_global_t * const global, const bool is_normal);
+  extern void controller_thread_signal(controller_t * const main, const bool is_normal);
 #endif // _di_controller_thread_signal_
 
 /**
 /**
  * Thread for handling signals/interrupts during normal operations.
  *
- * @param global
- *   The global structure.
- *   Must be of type controller_global_t.
+ * @param argument
+ *   The main program data.
  *
+ *   Must be of type controller_t.
  *   Must not be NULL.
  *
  * @return
  * @see controller_thread_signal()
  */
 #ifndef _di_controller_thread_signal_normal_
-  extern void * controller_thread_signal_normal(void * const global);
+  extern void * controller_thread_signal_normal(void * const argument);
 #endif // _di_controller_thread_signal_normal_
 
 /**
  * Thread for handling signals/interrupts during other operations.
  *
- * @param global
- *   The global structure.
- *   Must be of type controller_global_t.
+ * @param argument
+ *   The main program data.
  *
+ *   Must be of type controller_t.
  *   Must not be NULL.
  *
  * @return
@@ -88,7 +88,7 @@
  * @see controller_thread_signal()
  */
 #ifndef _di_controller_thread_signal_other_
-  extern void * controller_thread_signal_other(void * const global);
+  extern void * controller_thread_signal_other(void * const argument);
 #endif // _di_controller_thread_signal_other_
 
 #ifdef __cplusplus
index 359529084d505a117dbc01f138406758d70a2093..bd787551e6eba877da68b921e85e192bf1c2b33b 100644 (file)
@@ -26,12 +26,12 @@ extern "C" {
 #endif // _di_controller_time_now_
 
 #ifndef _di_controller_time_sleep_nanoseconds_
-  f_status_t controller_time_sleep_nanoseconds(controller_global_t * const global, const f_time_spec_t time) {
+  f_status_t controller_time_sleep_nanoseconds(controller_t * const main, const f_time_spec_t time) {
 
-    if (!global || !global->main) return F_status_set_error(F_parameter);
+    if (!main) return F_status_set_error(F_parameter);
 
     // When sleep is a second or more, instead wait for terminating signals if interruptible.
-    if ((global->main->program.flag & controller_main_flag_interruptible_e) && time.tv_sec) {
+    if ((main->setting.flag & controller_main_flag_interruptible_e) && time.tv_sec) {
       siginfo_t information;
       f_signal_t signal = f_signal_t_initialize;
 
index 21a0cbcc3a6bd67fae2713141bce272296c2da7a..67b962363c76f9906cabb3aeb418154377f31b93 100644 (file)
 /**
  * Sleep for the given time.
  *
- * @param global
- *   The global data.
+ * @param main
+ *   The main program data.
  *
  *   Must not be NULL.
  *
- *   This does not alter global.main.setting.state.status.
+ *   This does not alter main.setting.state.status.
  * @param time
  *   The time in nanoseconds to wait.
  *
@@ -52,7 +52,7 @@
  * @see f_time_of_day_get()
  */
 #ifndef _di_controller_time_sleep_nanoseconds_
-  extern f_status_t controller_time_sleep_nanoseconds(controller_global_t * const global, const f_time_spec_t time);
+  extern f_status_t controller_time_sleep_nanoseconds(controller_t * const main, const f_time_spec_t time);
 #endif // _di_controller_time_sleep_nanoseconds_
 
 #ifdef __cplusplus
diff --git a/sources/c/main/validate.c b/sources/c/main/validate.c
new file mode 100644 (file)
index 0000000..b24fa4c
--- /dev/null
@@ -0,0 +1,56 @@
+#include "controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_validate_define_name_
+  f_status_t controller_validate_environment_name(const f_string_static_t name) {
+
+    if (!name.used) return F_okay;
+
+    f_status_t status = F_okay;
+
+    if (name.string[0] != '_') {
+      status = f_utf_is_alphabetic(name.string, name.used);
+
+      if (F_status_is_error(status)) return status;
+      if (status == F_false) return F_false;
+    }
+
+    for (f_number_unsigned_t i = macro_f_utf_byte_width(name.string[0]); i < name.used; i += macro_f_utf_byte_width(name.string[i])) {
+
+      if (name.string[i] == '_') continue;
+
+      status = f_utf_is_alphabetic_digit(name.string, name.used, 0);
+
+      if (F_status_is_error(status)) return status;
+      if (status == F_false) return F_false;
+    } // for
+
+    return F_true;
+  }
+#endif // _di_controller_validate_define_name_
+
+#ifndef _di_controller_validate_has_graph_
+  f_status_t controller_validate_has_graph(const f_string_static_t name) {
+
+    if (!name.used) return F_okay;
+
+    f_status_t status = F_okay;
+
+    for (f_number_unsigned_t i = 0; i < name.used; i += macro_f_utf_byte_width(name.string[i])) {
+
+      status = f_utf_is_graph(name.string, name.used);
+
+      if (F_status_is_error(status)) return status;
+      if (status == F_true) return F_true;
+    } // for
+
+    return F_false;
+  }
+#endif // _di_controller_validate_has_graph_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/sources/c/main/validate.h b/sources/c/main/validate.h
new file mode 100644 (file)
index 0000000..bd751b0
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides validate functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_validate_h
+#define _controller_validate_h
+
+/**
+ * Validate that the given string is a valid environment variable name.
+ *
+ * A valid environment variable name must begin with an alpha-character or an underscore.
+ * Every character after that may be alphanumeric or underscore.
+ * All other characters, including Unicode characters, are invalid.
+ *
+ * @param name
+ *   The string to validate.
+ *
+ * @return
+ *   F_true on valid.
+ *   F_false on invalid.
+ *   F_okay if there is no string to validate (used = 0).
+ *
+ *   Errors (with error bit) from: f_utf_is_alphabetic().
+ *   Errors (with error bit) from: f_utf_is_alphabetic_digit().
+ *
+ * @see f_utf_is_alphabetic()
+ * @see f_utf_is_alphabetic_digit()
+ */
+#ifndef _di_controller_validate_define_name_
+  extern f_status_t controller_validate_environment_name(const f_string_static_t name);
+#endif // _di_controller_validate_define_name_
+
+/**
+ * Validate that the given string has at least one graph character.
+ *
+ * @param name
+ *   The string to validate.
+ *
+ * @return
+ *   F_true on valid.
+ *   F_false on invalid.
+ *   F_okay if there is no string to validate (used = 0).
+ *
+ *   Errors (with error bit) from: f_utf_is_graph().
+ *
+ * @see f_utf_is_graph()
+ */
+#ifndef _di_controller_validate_has_graph_
+  extern f_status_t controller_validate_has_graph(const f_string_static_t name);
+#endif // _di_controller_validate_has_graph_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_validate_h