]> Kevux Git Server - controller/commitdiff
Progress: Continue migrating the project.
authorKevin Day <Kevin@kevux.org>
Sun, 23 Jun 2024 03:03:39 +0000 (22:03 -0500)
committerKevin Day <Kevin@kevux.org>
Sun, 23 Jun 2024 03:03:39 +0000 (22:03 -0500)
28 files changed:
data/build/settings
sources/c/controller/main.c
sources/c/init/main.c
sources/c/main/common.c
sources/c/main/common/print.c
sources/c/main/common/print.h
sources/c/main/controller.h
sources/c/main/entry.c
sources/c/main/entry/action.c
sources/c/main/entry/action.h
sources/c/main/entry/preprocess.c
sources/c/main/entry/process.c
sources/c/main/entry/setting.c
sources/c/main/path.c
sources/c/main/path.h
sources/c/main/perform.c
sources/c/main/print/debug/perform/pid.c
sources/c/main/print/debug/perform/pid.h
sources/c/main/print/error/perform/pid.c
sources/c/main/print/error/perform/pid.h
sources/c/main/print/message/entry/action.c
sources/c/main/print/message/entry/action.h
sources/c/main/print/output/entry/setting.c
sources/c/main/print/warning/entry/action.c
sources/c/main/print/warning/entry/action.h
sources/c/main/rule/setting.c
sources/c/main/status.c [new file with mode: 0644]
sources/c/main/status.h [new file with mode: 0644]

index 7832d42c36599a96ca51400cc1899c7cea229932..3b65d0269df40b34f4a38b4a2a8dd5944b70c25c 100644 (file)
@@ -59,7 +59,7 @@ build_sources_library main/print/output/entry/setting.c main/print/output/rule/e
 build_sources_library main/print/message.c main/print/message/entry.c main/print/message/entry/action.c main/print/message/entry/item.c
 build_sources_library main/print/verbose.c
 build_sources_library main/print/warning.c main/print/warning/entry/action.c main/print/warning/entry/item.c main/print/warning/entry/setting.c
-build_sources_library main/signal.c main/time.c
+build_sources_library main/signal.c main/status.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
 
@@ -84,7 +84,7 @@ build_sources_headers main/print/output/entry/setting.h main/print/output/rule/e
 build_sources_headers main/print/message.h main/print/message/entry.h main/print/message/entry/action.h main/print/message/entry/item.h
 build_sources_headers main/print/verbose.h
 build_sources_headers main/print/warning.h main/print/warning/entry/action.h main/print/warning/entry/item.h main/print/warning/entry/setting.h
-build_sources_headers main/signal.h main/time.h
+build_sources_headers main/signal.h main/status.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
 
index dfcdf1433bc6f1d2875b27327378ea8a40121647..45ad6f88e30f54f9cddfe208764423a45642eddd 100644 (file)
@@ -3,8 +3,6 @@
 int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   controller_t data = controller_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;
@@ -27,9 +25,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
     data.program.pipe = fll_program_data_pipe_input_e;
   }
 
-  data.process = &process;
   data.setting.flag |= controller_main_flag_interruptible_e;
-  data.thread = &thread;
 
   fll_program_standard_set_up(&data.program);
 
index dc2f73b1b78c5c22123bfc168d4081d281b200eb..a891707a12b4372152ec4f64716e50ecfa8cb1b9 100644 (file)
@@ -3,8 +3,6 @@
 int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   controller_t data = controller_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;
@@ -28,9 +26,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   }
 
   data.callback.process_entry_setup = &controller_init_process_entry_setup;
-  data.process = &process;
   data.setting.flag &= ~controller_main_flag_interruptible_e;
-  data.thread = &thread;
 
   process.entry.pid = controller_entry_pid_disable_e;
   process.entry.show = controller_entry_show_init_e;
index a0e44c8daf32b1936c52ff033379ce066bf3fb43..abbcaa04327fb1d5bba8ef55b43c84689abf8cac 100644 (file)
@@ -175,7 +175,7 @@ extern "C" {
     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, main->process.path_current, args[index], &main->process.path_setting);
+      main->setting.state.status = 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);
@@ -227,7 +227,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, main->process.path_current, args[index], &main->process.path_cgroup);
+        main->setting.state.status = 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);
index ceae44c8b15d61fc48851dcea347a395b67a1f73..e4e2e5573dcf6329cd7e142acd3b571b4b04b86f 100644 (file)
@@ -39,6 +39,7 @@ extern "C" {
     "f_thread_create",
     "f_time_spec_millisecond",
     "fl_conversion_dynamic_partial_to_signed_detect",
+    "fl_conversion_dynamic_partial_to_unsigned_detect",
     "fl_conversion_dynamic_to_unsigned_detect ",
     "fl_environment_load_names",
     "fl_fss_extended_list_content_read",
index 2f879ade92abbf076bd586b1d3acf67977a0b036..57bb838427d02d397637bdd1135f218ee2b85bb6 100644 (file)
@@ -72,6 +72,7 @@ extern "C" {
     controller_f_f_thread_create_e,
     controller_f_f_time_spec_millisecond_e,
     controller_f_fl_conversion_dynamic_partial_to_signed_detect_e,
+    controller_f_fl_conversion_dynamic_partial_to_unsigned_detect_e,
     controller_f_fl_conversion_dynamic_to_unsigned_detect_e,
     controller_f_fl_environment_load_names_e,
     controller_f_fl_fss_extended_list_content_read_e,
index 3cb4b54881806a9f2ef0851f2167ceb0d020bd32..4b07ce40cf06a4df9c4537a12552574b46b5aa65 100644 (file)
 #include <program/controller/main/common.h>
 #include <program/controller/main/convert.h>
 #include <program/controller/main/entry.h>
+#include <program/controller/main/entry/action.h>
 #include <program/controller/main/entry/preprocess.h>
 #include <program/controller/main/entry/process.h>
 #include <program/controller/main/entry/setting.h>
 #include <program/controller/main/print/warning/entry/item.h>
 #include <program/controller/main/print/warning/entry/setting.h>
 #include <program/controller/main/signal.h>
+#include <program/controller/main/status.h>
 #include <program/controller/main/time.h>
 #include <program/controller/main/thread/cleanup.h>
 #include <program/controller/main/thread/control.h>
index 593a319974b7c29707fabfc242fbfb68b59cfdec..447061d858f13c070fdea5f2e5cb1c1abdc9a800 100644 (file)
@@ -83,6 +83,7 @@ extern "C" {
       }
       else {
         controller_print_error_file_status(&main->program.error, macro_controller_f(controller_file_load), (entry->flag & controller_entry_flag_is_e) ? controller_entry_s : controller_exit_s, f_file_operation_read_s, fll_error_file_type_file_e, F_status_set_fine(status));
+      }
     }
 
     if (F_status_is_error_not(status) && main->thread.cache.object_items.used) {
@@ -101,7 +102,7 @@ extern "C" {
         f_number_unsigned_t j = 0;
         f_state_t state = f_state_t_initialize;
 
-        for (; i < main->thread.cache.object_items.used && controller_thread_is_enabled(entry->flag & controller_entry_flag_is_e, &main->thread); ++i) {
+        for (i = 0; i < main->thread.cache.object_items.used && controller_thread_is_enabled(entry->flag & controller_entry_flag_is_e, &main->thread); ++i) {
 
           code &= ~0x2;
           at = 0;
@@ -199,7 +200,7 @@ extern "C" {
             break;
           }
 
-          status = controller_entry_action_read(main, entry->flag & controller_entry_flag_is_e, *range, &entry->items.array[at].actions);
+          status = controller_entry_action_read(main, entry, *range, &entry->items.array[at].actions);
 
           if (F_status_is_error(status)) {
             if (F_status_set_fine(status) != F_interrupt) {
@@ -217,15 +218,15 @@ extern "C" {
         if (entry->flag & controller_entry_flag_is_e && F_status_set_fine(status) == F_interrupt) return status;
 
         if (F_status_is_error_not(status)) {
-          main->thread.cache.action.name_action.used = 0;
-          main->thread.cache.action.name_item.used = 0;
-
           if (!(code & 0x1)) {
             status = F_status_set_error(F_found_not);
 
-            controller_print_message_entry_item_required(&main->program.error, entry->flag & controller_entry_flag_is_e, "is not found");
+            controller_print_message_entry_item_required(&main->program.error, entry->flag & controller_entry_flag_is_e, main->thread.cache.action.name_item, "is not found");
           }
 
+          main->thread.cache.action.name_action.used = 0;
+          main->thread.cache.action.name_item.used = 0;
+
           if (F_status_is_error_not(status)) {
             controller_entry_action_t *action = 0;
 
@@ -264,6 +265,7 @@ extern "C" {
 
                     main->thread.cache.action.line_action = action->line;
                     main->thread.cache.action.line_item = entry->items.array[i].line;
+                    main->thread.cache.action.name_item.used = 0;
 
                     status = f_string_dynamic_append_nulless(entry->items.array[i].name, &main->thread.cache.action.name_item);
 
@@ -273,7 +275,7 @@ extern "C" {
                       break;
                     }
 
-                    controller_print_message_entry_item_required(&main->program.error, entry->flag & controller_entry_flag_is_e, "does not exist");
+                    controller_print_message_entry_item_required(&main->program.error, entry->flag & controller_entry_flag_is_e, main->thread.cache.action.name_item, "does not exist");
 
                     action->number = 0;
                     action->status = controller_status_simplify_error(F_found_not);
@@ -293,11 +295,11 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
+      entry->status = controller_status_simplify_error(F_status_set_fine(status));
+
       if (F_status_set_fine(status) != F_interrupt) {
         controller_print_error_entry_cache(&main->program.error, &main->thread.cache.action, entry->flag & controller_entry_flag_is_e);
       }
-
-      entry->status = controller_status_simplify_error(F_status_set_fine(status));
     }
     else {
       entry->status = F_okay;
index b269bd19b36f1f66f6aeba099ab079587b828ef6..3968e7418c56e4c661fe7c97f702540d2015cd34 100644 (file)
@@ -5,9 +5,9 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_entry_action_read_
-  f_status_t controller_entry_action_read(controller_t * const main, const uint8_t is_entry, f_range_t range, controller_entry_actions_t * const actions) {
+  f_status_t controller_entry_action_read(controller_t * const main, controller_entry_t * const entry, const f_range_t range, controller_entry_actions_t * const actions) {
 
-    if (!main || !actions) return F_status_set_error(F_parameter);
+    if (!main || !entry || !actions) return F_status_set_error(F_parameter);
 
     f_status_t status = F_okay;
     f_status_t status_action = F_okay;
@@ -27,36 +27,35 @@ extern "C" {
       main->thread.cache.content_actions.array[--main->thread.cache.content_actions.used].used = 0;
     } // while
 
+    controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(entry->flag & controller_entry_flag_is_e, 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);
+
     {
-      controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize_1(is_entry, global.thread);
-      f_state_t state = macro_f_state_t_initialize_1(controller_common_allocation_large_d, controller_common_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
       f_range_t content_range = range;
 
       fll_fss_extended_read(main->thread.cache.buffer_file, &content_range, &main->thread.cache.object_actions, &main->thread.cache.content_actions, 0, 0, &main->thread.cache.delimits, 0, &state);
     }
 
-    if (F_status_is_error(status)) {
-      controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fll_fss_extended_read), F_true);
+    if (F_status_is_error(state.status)) {
+      controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(state.status), macro_controller_f(fll_fss_extended_read), F_true);
 
-      return status;
+      return state.status;
     }
 
-    f_state_t state = f_state_t_initialize;
-
     f_fss_apply_delimit(main->thread.cache.delimits, &main->thread.cache.buffer_file, &state);
 
-    if (F_status_is_error(status)) {
-      controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true);
+    if (F_status_is_error(state.status)) {
+      controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(state.status), macro_controller_f(f_fss_apply_delimit), F_true);
 
-      return status;
+      return state.status;
     }
 
     main->thread.cache.delimits.used = 0;
 
-    status  f_memory_array_increase_by(main->thread.cache.object_actions.used, sizeof(controller_entry_action_t), (void **) &actions->array, &actions->used, &actions->size);
+    status = f_memory_array_increase_by(main->thread.cache.object_actions.used, sizeof(controller_entry_action_t), (void **) &actions->array, &actions->used, &actions->size);
 
     if (F_status_is_error(status)) {
-      controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
+      controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
 
       return status;
     }
@@ -83,10 +82,12 @@ extern "C" {
       action->status = F_known_not;
       action->parameters.used = 0;
 
-      f_fss_count_lines(main->thread.cache.buffer_file, main->thread.cache.object_actions.array[i].start, &main->thread.cache.action.line_action, &global.main->setting.state);
+      f_fss_count_lines(main->thread.cache.buffer_file, main->thread.cache.object_actions.array[i].start, &main->thread.cache.action.line_action, &state);
 
-      if (F_status_is_error(status)) {
-        controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
+      if (F_status_is_error(state.status)) {
+        status = state.status;
+
+        controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
 
         break;
       }
@@ -96,7 +97,7 @@ extern "C" {
       status = f_rip_dynamic_partial_nulless(main->thread.cache.buffer_file, main->thread.cache.object_actions.array[i], &main->thread.cache.action.name_action);
 
       if (F_status_is_error(status)) {
-        controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+        controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
 
         break;
       }
@@ -147,17 +148,7 @@ extern "C" {
         actions->array[actions->used].type = controller_entry_action_type_timeout_e;
       }
       else {
-        if (global.main->program.warning.verbosity == f_console_verbosity_debug_e) {
-          controller_lock_print(global.main->program.warning.to, global.thread);
-
-          fl_print_format("%r%[%QUnknown %r item action '%]", global.main->program.warning.to, f_string_eol_s, global.main->program.warning.context, global.main->program.warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.warning.context);
-          fl_print_format(f_string_format_Q_single_s.string, global.main->program.warning.to, global.main->program.warning.notable, main->thread.cache.action.name_action, global.main->program.warning.notable);
-          fl_print_format(f_string_format_sentence_end_quote_s.string, global.main->program.warning.to, global.main->program.warning.context, global.main->program.warning.context, f_string_eol_s);
-
-          controller_entry_print_error_cache(is_entry, &global.main->program.warning, main->thread.cache.action);
-
-          controller_unlock_print_flush(global.main->program.warning.to, global.thread);
-        }
+        controller_print_warning_entry_action_unknown(&main->program.warning, &main->thread.cache, entry->flag & controller_entry_flag_is_e, main->thread.cache.action.name_action);
 
         continue;
       }
@@ -189,40 +180,40 @@ extern "C" {
       }
 
       if (main->thread.cache.content_actions.array[i].used < at_least || main->thread.cache.content_actions.array[i].used > at_most) {
-        action->status = F_status_set_error(F_parameter);
+        action->status = controller_status_simplify_error(F_parameter);
 
-        if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
-          f_thread_mutex_lock(&global.thread->lock.print);
+        if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+          f_thread_mutex_lock(&main->thread.lock.print);
 
-          f_file_stream_lock(global.main->program.error.to);
+          f_file_stream_lock(main->program.error.to);
 
-          fl_print_format("%r%[%QThe %r item action '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
-          fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, main->thread.cache.action.name_action, global.main->program.error.notable);
-          fl_print_format("%[' requires ", global.main->program.error.to, global.main->program.error.context);
+          fl_print_format("%r%[%QThe %r item action '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+          fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, main->thread.cache.action.name_action, main->program.error.notable);
+          fl_print_format("%[' requires ", main->program.error.to, main->program.error.context);
 
           if (at_least == at_most) {
-            f_print_terminated("exactly ", global.main->program.error.to);
+            f_print_terminated("exactly ", main->program.error.to);
           }
 
-          fl_print_format("%]%[%un%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.notable, at_least, global.main->program.error.notable);
+          fl_print_format("%]%[%un%]", main->program.error.to, main->program.error.context, main->program.error.notable, at_least, main->program.error.notable);
 
           if (action->type == controller_entry_action_type_consider_e || controller_entry_action_type_is_rule(action->type)) {
-            fl_print_format("%[ or more parameters.%]%r", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+            fl_print_format("%[ or more parameters.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
           }
           else {
             if (at_least == at_most) {
-              fl_print_format("%[ parameters.%]%r", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+              fl_print_format("%[ parameters.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
             }
             else {
-              fl_print_format("%[ to %]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
-              fl_print_format("%[%un%]", global.main->program.error.to, global.main->program.error.notable, at_most, global.main->program.error.notable);
-              fl_print_format("%[ parameters.%]%r", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+              fl_print_format("%[ to %]", main->program.error.to, main->program.error.context, main->program.error.context);
+              fl_print_format("%[%un%]", main->program.error.to, main->program.error.notable, at_most, main->program.error.notable);
+              fl_print_format("%[ parameters.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
             }
           }
 
-          f_file_stream_unlock(global.main->program.error.to);
+          f_file_stream_unlock(main->program.error.to);
 
-          f_thread_mutex_unlock(&global.thread->lock.print);
+          f_thread_mutex_unlock(&main->thread.lock.print);
         }
       }
       else {
@@ -241,7 +232,7 @@ extern "C" {
         status = f_memory_array_increase_by(allocate, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size);
 
         if (F_status_is_error(status)) {
-          controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
+          controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
 
           action->status = status;
 
@@ -261,7 +252,7 @@ extern "C" {
           status = f_memory_array_increase_by((main->thread.cache.content_actions.array[i].array[j].stop - main->thread.cache.content_actions.array[i].array[j].start) + 1, sizeof(f_char_t), (void **) &action->parameters.array[j].string, &action->parameters.array[j].used, &action->parameters.array[j].size);
 
           if (F_status_is_error(status)) {
-            controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
+            controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
 
             break;
           }
@@ -269,7 +260,7 @@ extern "C" {
           status = f_string_dynamic_partial_append_nulless(main->thread.cache.buffer_file, main->thread.cache.content_actions.array[i].array[j], &action->parameters.array[j]);
 
           if (F_status_is_error(status)) {
-            controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_partial_append_nulless), F_true);
+            controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_string_dynamic_partial_append_nulless), F_true);
 
             break;
           }
@@ -282,10 +273,10 @@ extern "C" {
             if (action->parameters.array[0].used) {
 
               // Force the path to be canonical (removing all '../' parts).
-              status = controller_path_canonical_relative(global.setting, action->parameters.array[0], &main->thread.cache.buffer_path);
+              status = controller_path_canonical_relative(main, main->process.path_current, action->parameters.array[0], &main->thread.cache.buffer_path);
 
               if (F_status_is_error(status)) {
-                controller_entry_print_error_file(is_entry, &global.main->program.error, main->thread.cache.action, F_status_set_fine(status), "controller_path_canonical_relative", F_true, main->thread.cache.action.generic, f_file_operation_analyze_s, fll_error_file_type_path_e, global.thread);
+                controller_print_error_entry_file(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true, main->thread.cache.action.generic, f_file_operation_analyze_s, fll_error_file_type_path_e);
 
                 action->status = status;
 
@@ -301,14 +292,14 @@ extern "C" {
               }
             }
             else {
-              action->status = F_status_set_error(F_parameter);
+              action->status = controller_status_simplify_error(F_parameter);
 
               if (F_status_is_error_not(status_action)) {
                 status_action = action->status;
               }
 
-              if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                fll_print_format("%r%[%QThe %r item action must not have an empty string for a path (the first parameter).%]%r", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context, f_string_eol_s);
+              if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                fll_print_format("%r%[%QThe %r item action must not have an empty string for a path (the first parameter).%]%r", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context, f_string_eol_s);
               }
             }
 
@@ -318,15 +309,15 @@ extern "C" {
               status = f_file_name_base(action->parameters.array[1], &main->thread.cache.buffer_path);
 
               if (F_status_is_error(status)) {
-                controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_file_name_base), F_true);
+                controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_file_name_base), F_true);
 
                 if (F_status_set_fine(status) == F_memory_not) {
-                  status_action = status;
+                  status_action = controller_status_simplify_error(status);
 
                   break;
                 }
 
-                action->status = status;
+                action->status = controller_status_simplify_error(status);
 
                 if (F_status_is_error_not(status_action)) {
                   status_action = status;
@@ -334,19 +325,19 @@ extern "C" {
               }
               else {
                 if (f_compare_dynamic(action->parameters.array[1], main->thread.cache.buffer_path) == F_equal_to_not) {
-                  if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                    f_file_stream_lock(global.main->program.error.to);
+                  if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                    f_file_stream_lock(main->program.error.to);
 
-                    fl_print_format("%r%[%QThe %r item action second parameter '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
-                    fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[1], global.main->program.error.notable);
-                    fl_print_format("%[' must be a base path name, such as '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
-                    fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, main->thread.cache.buffer_path, global.main->program.error.notable);
-                    fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+                    fl_print_format("%r%[%QThe %r item action second parameter '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+                    fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[1], main->program.error.notable);
+                    fl_print_format("%[' must be a base path name, such as '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+                    fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, main->thread.cache.buffer_path, main->program.error.notable);
+                    fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-                    f_file_stream_unlock(global.main->program.error.to);
+                    f_file_stream_unlock(main->program.error.to);
                   }
 
-                  action->status = F_status_set_error(F_parameter);
+                  action->status = controller_status_simplify_error(F_parameter);
 
                   if (F_status_is_error_not(status_action)) {
                     status_action = action->status;
@@ -355,14 +346,14 @@ extern "C" {
               }
             }
             else {
-              action->status = F_status_set_error(F_parameter);
+              action->status = controller_status_simplify_error(F_parameter);
 
               if (F_status_is_error_not(status_action)) {
                 status_action = action->status;
               }
 
-              if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                fll_print_format("%r%[%QThe %r item action must not have an empty string for a rule name (the second parameter).%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context, f_string_eol_s);
+              if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                fll_print_format("%r%[%QThe %r item action must not have an empty string for a rule name (the second parameter).%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context, f_string_eol_s);
               }
             }
 
@@ -379,47 +370,47 @@ extern "C" {
               }
               else {
                 if (action->status == F_okay) {
-                  action->status = F_status_set_error(F_support_not);
+                  action->status = controller_status_simplify_error(F_support_not);
 
                   if (F_status_is_error_not(status_action)) {
                     status_action = action->status;
                   }
                 }
 
-                if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                  f_file_stream_lock(global.main->program.error.to);
+                if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                  f_file_stream_lock(main->program.error.to);
 
-                  fl_print_format("%r%[%QThe %r item action third parameter (and beyond) must be one of '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
-                  fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_asynchronous_s, global.main->program.error.notable);
-                  fl_print_format("%[', '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
-                  fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_require_s, global.main->program.error.notable);
-                  fl_print_format("%[', or '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
-                  fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_wait_s, global.main->program.error.notable);
-                  fl_print_format("%[' but instead has '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
-                  fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[j], global.main->program.error.notable);
-                  fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+                  fl_print_format("%r%[%QThe %r item action third parameter (and beyond) must be one of '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+                  fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_asynchronous_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_require_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_wait_s, main->program.error.notable);
+                  fl_print_format("%[' but instead has '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+                  fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[j], main->program.error.notable);
+                  fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-                  f_file_stream_unlock(global.main->program.error.to);
+                  f_file_stream_unlock(main->program.error.to);
                 }
               }
             } // for
           }
           else if (action->type == controller_entry_action_type_failsafe_e || action->type == controller_entry_action_type_item_e) {
             if (f_compare_dynamic(controller_main_s, action->parameters.array[0]) == F_equal_to) {
-              action->status = F_status_set_error(F_support_not);
+              action->status = controller_status_simplify_error(F_support_not);
 
               if (F_status_is_error_not(status_action)) {
                 status_action = action->status;
               }
 
-              if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                f_file_stream_lock(global.main->program.error.to);
+              if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                f_file_stream_lock(main->program.error.to);
 
-                fl_print_format("%r%[%QThe %r item action may not specify the reserved item '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
-                fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_main_s, global.main->program.error.notable);
-                fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+                fl_print_format("%r%[%QThe %r item action may not specify the reserved item '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+                fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_main_s, main->program.error.notable);
+                fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-                f_file_stream_unlock(global.main->program.error.to);
+                f_file_stream_unlock(main->program.error.to);
               }
             }
           }
@@ -435,26 +426,26 @@ extern "C" {
               action->code = controller_entry_timeout_code_stop_d;
             }
             else {
-              action->status = F_status_set_error(F_support_not);
+              action->status = controller_status_simplify_error(F_support_not);
 
               if (F_status_is_error_not(status_action)) {
                 status_action = action->status;
               }
 
-              if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                f_file_stream_lock(global.main->program.error.to);
+              if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                f_file_stream_lock(main->program.error.to);
 
-                fl_print_format("%r%[%QThe %r item action must have one of '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
-                fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_kill_s, global.main->program.error.notable);
-                fl_print_format("%[', '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
-                fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_start_s, global.main->program.error.notable);
-                fl_print_format("%[', or '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
-                fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_stop_s, global.main->program.error.notable);
-                fl_print_format("%[' but instead has '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
-                fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[0], global.main->program.error.notable);
-                fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+                fl_print_format("%r%[%QThe %r item action must have one of '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+                fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_kill_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_start_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_stop_s, main->program.error.notable);
+                fl_print_format("%[' but instead has '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+                fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[0], main->program.error.notable);
+                fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-                f_file_stream_unlock(global.main->program.error.to);
+                f_file_stream_unlock(main->program.error.to);
               }
             }
 
@@ -468,28 +459,28 @@ extern "C" {
                   action->number = 0;
 
                   if (status == F_data_not) {
-                    action->status = F_status_set_error(F_number);
+                    action->status = controller_status_simplify_error(F_number);
                   }
                   else {
                     action->status = controller_status_simplify_error(F_status_set_fine(status));
                   }
 
                   if (F_status_set_fine(status) == F_memory_not) {
-                    controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_to_unsigned_detect), F_true);
+                    controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_to_unsigned_detect), F_true);
 
                     status_action = status;
 
                     break;
                   }
 
-                  if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                    f_file_stream_lock(global.main->program.error.to);
+                  if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                    f_file_stream_lock(main->program.error.to);
 
-                    fl_print_format("%r%[%QThe %r item action parameter '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
-                    fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[1], global.main->program.error.notable);
-                    fl_print_format("%[' is not a valid supported number.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+                    fl_print_format("%r%[%QThe %r item action parameter '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+                    fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[1], main->program.error.notable);
+                    fl_print_format("%[' is not a valid supported number.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-                    f_file_stream_unlock(global.main->program.error.to);
+                    f_file_stream_unlock(main->program.error.to);
                   }
                 }
               }
@@ -504,18 +495,18 @@ extern "C" {
                 action->code |= controller_entry_rule_code_wait_d;
               }
               else {
-                action->status = F_status_set_error(F_support_not);
+                action->status = controller_status_simplify_error(F_support_not);
 
-                if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
-                  f_file_stream_lock(global.main->program.error.to);
+                if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+                  f_file_stream_lock(main->program.error.to);
 
-                  fl_print_format("%r%[%QThe %r item action may only have '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
-                  fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_wait_s, global.main->program.error.notable);
-                  fl_print_format("%[' but instead has '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
-                  fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[0], global.main->program.error.notable);
-                  fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+                  fl_print_format("%r%[%QThe %r item action may only have '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+                  fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_wait_s, main->program.error.notable);
+                  fl_print_format("%[' but instead has '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+                  fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[0], main->program.error.notable);
+                  fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
 
-                  f_file_stream_unlock(global.main->program.error.to);
+                  f_file_stream_unlock(main->program.error.to);
                 }
               }
             }
@@ -526,13 +517,128 @@ extern "C" {
       ++actions->used;
     } // for
 
-    if (F_status_is_error(status_action)) {
-      return status_action;
+    return F_status_is_error(status_action) ? status_action : status;
+  }
+#endif // _di_controller_entry_action_read_
+
+#ifndef _di_controller_entry_action_type_name_
+  f_string_static_t controller_entry_action_type_name(const uint8_t type) {
+
+    switch (type) {
+      case controller_entry_action_type_consider_e:
+        return controller_consider_s;
+
+      case controller_entry_action_type_execute_e:
+        return controller_execute_s;
+
+      case controller_entry_action_type_failsafe_e:
+        return controller_failsafe_s;
+
+      case controller_entry_action_type_freeze_e:
+        return controller_freeze_s;
+
+      case controller_entry_action_type_item_e:
+        return controller_item_s;
+
+      case controller_entry_action_type_kexec_e:
+        return controller_kexec_s;
+
+      case controller_entry_action_type_kill_e:
+        return controller_kill_s;
+
+      case controller_entry_action_type_pause_e:
+        return controller_pause_s;
+
+      case controller_entry_action_type_ready_e:
+        return controller_ready_s;
+
+      case controller_entry_action_type_reboot_e:
+        return controller_reboot_s;
+
+      case controller_entry_action_type_reload_e:
+        return controller_reload_s;
+
+      case controller_entry_action_type_restart_e:
+        return controller_restart_s;
+
+      case controller_entry_action_type_resume_e:
+        return controller_resume_s;
+
+      case controller_entry_action_type_shutdown_e:
+        return controller_shutdown_s;
+
+      case controller_entry_action_type_start_e:
+        return controller_start_s;
+
+      case controller_entry_action_type_stop_e:
+        return controller_stop_s;
+
+      case controller_entry_action_type_thaw_e:
+        return controller_thaw_s;
+
+      case controller_entry_action_type_timeout_e:
+        return controller_timeout_s;
     }
 
-    return status;
+    return f_string_empty_s;
   }
-#endif // _di_controller_entry_action_read_
+#endif // _di_controller_entry_action_type_name_
+
+#ifndef _di_controller_entry_action_type_is_rule_
+  f_status_t controller_entry_action_type_is_rule(uint8_t type) {
+
+    switch (type) {
+      case controller_entry_action_type_freeze_e:
+      case controller_entry_action_type_kill_e:
+      case controller_entry_action_type_pause_e:
+      case controller_entry_action_type_reload_e:
+      case controller_entry_action_type_restart_e:
+      case controller_entry_action_type_resume_e:
+      case controller_entry_action_type_start_e:
+      case controller_entry_action_type_stop_e:
+      case controller_entry_action_type_thaw_e:
+        return F_true;
+    }
+
+    return F_false;
+  }
+#endif // _di_controller_entry_action_type_is_rule_
+
+#ifndef _di_controller_entry_action_type_to_rule_action_type_
+  uint8_t controller_entry_action_type_to_rule_action_type(uint8_t type) {
+
+    switch (type) {
+      case controller_entry_action_type_freeze_e:
+        return controller_rule_action_type_freeze_e;
+
+      case controller_entry_action_type_kill_e:
+        return controller_rule_action_type_kill_e;
+
+      case controller_entry_action_type_pause_e:
+        return controller_rule_action_type_pause_e;
+
+      case controller_entry_action_type_reload_e:
+        return controller_rule_action_type_reload_e;
+
+      case controller_entry_action_type_restart_e:
+        return controller_rule_action_type_restart_e;
+
+      case controller_entry_action_type_resume_e:
+        return controller_rule_action_type_resume_e;
+
+      case controller_entry_action_type_start_e:
+        return controller_rule_action_type_start_e;
+
+      case controller_entry_action_type_stop_e:
+        return controller_rule_action_type_stop_e;
+
+      case controller_entry_action_type_thaw_e:
+        return controller_rule_action_type_thaw_e;
+    }
+
+    return 0;
+  }
+#endif // _di_controller_entry_action_type_to_rule_action_type_
 
 #ifdef __cplusplus
 } // extern "C"
index 2b05f666c7288e87486f83a01bb12a674534a790..9ed95d5a99bee00b04ad49ad0617205fe5f902a9 100644 (file)
@@ -23,9 +23,10 @@ extern "C" {
  *   The main program data.
  *
  *   Must not be NULL.
- * @param is_entry
- *   If TRUE, then this operates as an entry.
- *   If FALSE, then this operates as an exit.
+ * @param entry
+ *   The entry.
+ *
+ *   Must not be NULL.
  * @param range
  *   The range in the list buffer representing the content.
  * @param actions
@@ -36,6 +37,8 @@ extern "C" {
  * @return
  *   F_okay on success.
  *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
  *   Errors (with error bit) from: controller_entry_actions_increase_by().
  *   Errors (with error bit) from: f_fss_apply_delimit().
  *   Errors (with error bit) from: f_fss_count_lines().
@@ -53,9 +56,51 @@ extern "C" {
  * @see fll_fss_extended_read()
  */
 #ifndef _di_controller_entry_action_read_
-  extern f_status_t controller_entry_action_read(controller_t * const main, const uint8_t is_entry, const f_range_t range, controller_entry_actions_t * const actions);
+  extern f_status_t controller_entry_action_read(controller_t * const main, controller_entry_t * const entry, const f_range_t range, controller_entry_actions_t * const actions);
 #endif // _di_controller_entry_action_read_
 
+/**
+ * Determine if the Entry Action type code represents a Rule type.
+ *
+ * @param type
+ *   The type code to compare against.
+ *
+ * @return
+ *    TRUE if Rule type.
+ *    FALSE otherwise.
+ */
+#ifndef _di_controller_entry_action_type_is_rule_
+  extern f_status_t controller_entry_action_type_is_rule(uint8_t type);
+#endif // _di_controller_entry_action_type_is_rule_
+
+/**
+ * Get a string representing the Entry Action type.
+ *
+ * @param type
+ *   The Entry Action type code.
+ *
+ * @return
+ *   The string with used > 0 on success.
+ *   The string with used == 0 if no match was found.
+ */
+#ifndef _di_controller_entry_action_type_name_
+  extern f_string_static_t controller_entry_action_type_name(const uint8_t type);
+#endif // _di_controller_entry_action_type_name_
+
+/**
+ * Convert the Entry Action type to Rule Action type.
+ *
+ * @param type
+ *   The Entry Action type.
+ *
+ * @return
+ *    TRUE if Rule type.
+ *    FALSE otherwise.
+ */
+#ifndef _di_controller_entry_action_type_to_rule_action_type_
+  extern uint8_t controller_entry_action_type_to_rule_action_type(uint8_t type);
+#endif // _di_controller_entry_action_type_to_rule_action_type_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 45f63a432d99e32297aa262c26b991591a7a7420..e8664a159552bce097121eb89ac9e86bfb0de9a1 100644 (file)
@@ -23,7 +23,7 @@ extern "C" {
     uint8_t error_has = F_false;
 
     // This effectively sets the read for an entry and resets the ready for an exit.
-    main->setting.ready = controller_setting_ready_no_e;
+    main->process.ready = controller_process_ready_no_e;
 
     cache->ats.used = 0;
 
@@ -35,7 +35,7 @@ extern "C" {
     status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
 
     if (F_status_is_error(status)) {
-      controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
+      controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
 
       return status;
     }
@@ -51,7 +51,7 @@ extern "C" {
     status = f_string_dynamic_append_nulless(entry->items.array[0].name, &cache->action.name_item);
 
     if (F_status_is_error(status)) {
-      controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+      controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
 
       return status;
     }
@@ -68,17 +68,17 @@ extern "C" {
         status2 = f_string_dynamic_append_nulless(controller_entry_action_type_name(actions->array[cache->ats.array[at_j]].type), &cache->action.name_action);
 
         if (F_status_is_error(status2)) {
-          controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+          controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
 
           return status2;
         }
 
         if (actions->array[cache->ats.array[at_j]].type == controller_entry_action_type_ready_e) {
-          if (main->setting.ready == controller_setting_ready_wait_e) {
+          if (main->process.ready == controller_process_ready_wait_e) {
             controller_print_warning_entry_action_multiple(&main->program.warning, cache, is_entry, controller_ready_s);
           }
           else {
-            main->setting.ready = controller_setting_ready_wait_e;
+            main->process.ready = controller_process_ready_wait_e;
           }
         }
         else if (actions->array[cache->ats.array[at_j]].type == controller_entry_action_type_item_e) {
@@ -118,7 +118,7 @@ extern "C" {
               status2 = f_memory_array_increase(controller_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
 
               if (F_status_is_error(status2)) {
-                controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_memory_array_increase), F_true);
+                controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status2), macro_controller_f(f_memory_array_increase), F_true);
 
                 return status2;
               }
@@ -143,7 +143,7 @@ extern "C" {
               status2 = f_string_dynamic_append_nulless(entry->items.array[i].name, &cache->action.name_item);
 
               if (F_status_is_error(status2)) {
-                controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+                controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
 
                 return status2;
               }
@@ -188,7 +188,7 @@ extern "C" {
         status2 = f_string_dynamic_append_nulless(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
 
         if (F_status_is_error(status2)) {
-          controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+          controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
 
           return status2;
         }
@@ -198,8 +198,8 @@ extern "C" {
     if (!controller_thread_is_enabled(is_entry, &main->thread)) return F_status_set_error(F_interrupt);
 
     // If ready is not found in the entry, then default to always ready.
-    if (main->setting.ready == controller_setting_ready_no_e) {
-      main->setting.ready = controller_setting_ready_yes_e;
+    if (main->process.ready == controller_process_ready_no_e) {
+      main->process.ready = controller_process_ready_yes_e;
     }
 
     return status;
index a158aadf0d66b94f9f0cd4cbb1d67cef4c7c17a5..ef1153bfe18a1885496bcd7feb65c5b660ab7dda 100644 (file)
@@ -35,7 +35,7 @@ extern "C" {
     status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
 
     if (F_status_is_error(status)) {
-      controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
+      controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
 
       return status;
     }
@@ -51,7 +51,7 @@ extern "C" {
     status = f_string_dynamic_append_nulless(entry->items.array[cache->ats.array[0]].name, &cache->action.name_item);
 
     if (F_status_is_error(status)) {
-      controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+      controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
 
       return status;
     }
@@ -61,7 +61,7 @@ extern "C" {
     }
 
     // The pre-process determines if ready is explicitly specified within the entry file and if it is not start as ready.
-    if (main->setting.ready == controller_setting_ready_yes_e) {
+    if (main->process.ready == controller_process_ready_yes_e) {
       status = controller_perform_ready(main, is_entry);
       if (F_status_is_error(status)) return status;
     }
@@ -80,7 +80,7 @@ extern "C" {
         status = f_string_dynamic_append_nulless(controller_entry_action_type_name(entry_action->type), &cache->action.name_action);
 
         if (F_status_is_error(status)) {
-          controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+          controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
 
           return status;
         }
@@ -114,7 +114,7 @@ extern "C" {
         }
 
         if (entry_action->type == controller_entry_action_type_ready_e) {
-          if ((entry_action->code & controller_entry_rule_code_wait_d) || main->setting.ready == controller_setting_ready_wait_e) {
+          if ((entry_action->code & controller_entry_rule_code_wait_d) || main->process.ready == controller_process_ready_wait_e) {
             if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e || entry->show == controller_entry_show_init_e) {
               controller_print_message_entry_action_wait(&main->program.message, is_entry, controller_ready_s);
             }
@@ -125,7 +125,7 @@ extern "C" {
             }
           }
 
-          if (main->setting.ready == controller_setting_ready_yes_e) {
+          if (main->process.ready == controller_process_ready_yes_e) {
             if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e) {
               controller_print_message_entry_action_ready(&main->program.message, is_entry, controller_ready_s);
             }
@@ -151,7 +151,7 @@ extern "C" {
           status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
 
           if (F_status_is_error(status)) {
-            controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
+            controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
 
             return status;
           }
@@ -174,7 +174,7 @@ extern "C" {
           status = f_string_dynamic_append_nulless(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
 
           if (F_status_is_error(status)) {
-            controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+            controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
 
             return status;
           }
@@ -200,7 +200,7 @@ extern "C" {
           f_thread_unlock(&main->thread.lock.rule);
 
           if (F_status_is_error(status)) {
-            controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_rules_increase), F_true);
+            controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_rules_increase), F_true);
 
             return status;
           }
@@ -296,7 +296,7 @@ extern "C" {
               }
 
               // Designate the action as failed.
-              entry_action->status = F_status_set_error(F_failure);
+              entry_action->status = controller_status_simplify_error(F_failure);
 
               if (!(main->setting.flag & controller_main_flag_simulate_e)) {
                 f_thread_unlock(&main->thread.lock.rule);
@@ -379,7 +379,7 @@ extern "C" {
               controller_print_error_entry_action_execution_missing(&main->program.error, cache, is_entry, entry_action->parameters.array[0]);
             }
             else {
-              controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(fll_execute_into), F_true);
+              controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fll_execute_into), F_true);
             }
 
             return F_status_set_error(F_execute);
@@ -464,7 +464,7 @@ extern "C" {
         status = f_string_dynamic_append_nulless(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
 
         if (F_status_is_error(status)) {
-          controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+          controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
 
           break;
         }
@@ -476,7 +476,7 @@ extern "C" {
     if (F_status_is_error(status_lock)) return status_lock;
 
     // Check to see if any required processes failed, but do not do this if already operating in failsafe.
-    if (F_status_is_error_not(status) && !failsafe && !(main->setting.flag & controller_main_flag_validate_e) && main->setting.mode != controller_setting_mode_helper_e) {
+    if (F_status_is_error_not(status) && !failsafe && !(main->setting.flag & controller_main_flag_validate_e) && main->setting.mode != controller_process_mode_helper_e) {
       const f_status_t status_wait = controller_rule_wait_all(main, is_entry, F_true);
       if (F_status_is_error(status_wait)) return status_wait;
       if (status_wait == F_require) return F_status_set_error(F_require);
index e6ed71d838c0b6d8ef29ed78d3ed46b1a81a54d9..405fb7da6af2112d5385b623c630e9307e677e52 100644 (file)
@@ -20,7 +20,7 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(fll_fss_extended_read), F_true);
+      controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fll_fss_extended_read), F_true);
 
       return status;
     }
@@ -32,7 +32,7 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true);
+      controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true);
 
       return status;
     }
@@ -51,7 +51,7 @@ extern "C" {
       f_fss_count_lines(cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action, &main->setting.state);
 
       if (F_status_is_error(status)) {
-        controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
+        controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
 
         break;
       }
@@ -62,7 +62,7 @@ extern "C" {
       status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->object_actions.array[i], &cache->action.name_action);
 
       if (F_status_is_error(status)) {
-        controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+        controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
 
         break;
       }
@@ -94,14 +94,14 @@ extern "C" {
         status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->content_actions.array[i].array[0], &cache->action.generic);
 
         if (F_status_is_error(status)) {
-          controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+          controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
 
           break;
         }
 
         main->setting.path_control.used = 0;
 
-        status = controller_path_canonical_relative(main->setting, cache->action.generic, &main->setting.path_control);
+        status = controller_path_canonical_relative(main, main->process.path_current, cache->action.generic, &main->process.path_control);
 
         if (F_status_is_error(status)) {
           controller_print_error_entry_file(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true, cache->action.generic, f_file_operation_analyze_s, fll_error_file_type_path_e);
@@ -112,7 +112,7 @@ extern "C" {
       else if (is_entry && f_compare_dynamic(controller_control_group_s, cache->action.name_action) == F_equal_to) {
         gid_t number = 0;
 
-        status = controller_convert_group_id(cache->buffer_file, cache->content_actions.array[i].array[0], cache, &number);
+        status = controller_convert_group_id(cache, cache->buffer_file, cache->content_actions.array[i].array[0], &number);
 
         if (F_status_is_error(status)) {
           status = F_status_set_fine(status);
@@ -127,7 +127,7 @@ extern "C" {
             controller_print_error_entry_setting_with_range(&main->program.error, cache, is_entry, " has an invalid group", cache->content_actions.array[i].array[0], ", because the given ID is not a valid supported number");
           }
           else {
-            controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_group_id), F_true);
+            controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_group_id), F_true);
           }
 
           continue;
@@ -146,7 +146,7 @@ extern "C" {
         status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->content_actions.array[i].array[0], &cache->action.generic);
 
         if (F_status_is_error(status)) {
-          controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+          controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
 
           break;
         }
@@ -162,7 +162,7 @@ extern "C" {
         status = f_file_mode_to_mode(mode_file, &mode);
 
         if (F_status_is_error(status)) {
-          controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_file_mode_to_mode), F_true);
+          controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_file_mode_to_mode), F_true);
 
           continue;
         }
@@ -173,7 +173,7 @@ extern "C" {
       else if (is_entry && f_compare_dynamic(controller_control_user_s, cache->action.name_action) == F_equal_to) {
         uid_t number = 0;
 
-        status = controller_convert_user_id(cache->buffer_file, cache->content_actions.array[i].array[0], cache, &number);
+        status = controller_convert_user_id(cache, cache->buffer_file, cache->content_actions.array[i].array[0], &number);
 
         if (F_status_is_error(status)) {
           status = F_status_set_fine(status);
@@ -188,7 +188,7 @@ extern "C" {
             controller_print_error_entry_setting_with_range(&main->program.error, cache, is_entry, " has an invalid user", cache->content_actions.array[i].array[0], ", because the given ID is not a valid supported number");
           }
           else {
-            controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_user_id), F_true);
+            controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_user_id), F_true);
           }
 
           continue;
@@ -207,7 +207,7 @@ extern "C" {
         status = controller_entry_setting_read_map(cache->buffer_file, cache->content_actions.array[i], &entry->define);
 
         if (F_status_is_error(status)) {
-          controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
+          controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
 
           continue;
         }
@@ -220,13 +220,13 @@ extern "C" {
         }
 
         if (f_compare_dynamic_partial_string(controller_service_s.string, cache->buffer_file, controller_service_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) {
-          main->setting.mode = controller_setting_mode_service_e;
+          main->setting.mode = controller_process_mode_service_e;
         }
         else if (f_compare_dynamic_partial_string(controller_helper_s.string, cache->buffer_file, controller_helper_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) {
-          main->setting.mode = controller_setting_mode_helper_e;
+          main->setting.mode = controller_process_mode_helper_e;
         }
         else if (f_compare_dynamic_partial_string(controller_program_s.string, cache->buffer_file, controller_program_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) {
-          main->setting.mode = controller_setting_mode_program_e;
+          main->setting.mode = controller_process_mode_program_e;
         }
         else {
           controller_entry_setting_read_print_setting_unknown_action_value(main, is_entry, *cache, i);
@@ -244,7 +244,7 @@ extern "C" {
         status = controller_entry_setting_read_map(cache->buffer_file, cache->content_actions.array[i], &entry->parameter);
 
         if (F_status_is_error(status)) {
-          controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
+          controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
 
           continue;
         }
@@ -287,17 +287,17 @@ extern "C" {
           status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->content_actions.array[i].array[0], &cache->action.generic);
 
           if (F_status_is_error(status)) {
-            controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+            controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
 
             continue;
           }
 
           main->setting.path_pid.used = 0;
 
-          status = controller_path_canonical_relative(main->setting, cache->action.generic, &main->setting.path_pid);
+          status = controller_path_canonical_relative(main, main->process.path_current, cache->action.generic, &main->setting.path_pid);
 
           if (F_status_is_error(status)) {
-            controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true);
+            controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true);
 
             continue;
           }
@@ -404,7 +404,7 @@ extern "C" {
           *time = time_previous;
 
           if (F_status_set_fine(status) == F_memory_not) {
-            controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_partial_to_unsigned_detect), F_true);
+            controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_partial_to_unsigned_detect), F_true);
 
             continue;
           }
index a9d17b9439ab7cf2116ee2fae5f16b61b4c8e736..50b1c52f7600b84e7dff73e992429a1204ff9fde 100644 (file)
@@ -5,12 +5,14 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_path_canonical_relative_
-  void controller_path_canonical_relative(controller_t * const main, const f_string_static_t current, const f_string_static_t source, f_string_dynamic_t * const destination) {
+  f_status_t controller_path_canonical_relative(controller_t * const main, const f_string_static_t current, const f_string_static_t source, f_string_dynamic_t * const destination) {
 
-    if (!main || !destination) return;
+    if (!main || !destination) return F_status_set_error(F_parameter);
 
-    main->setting.state.status = fl_path_canonical(source, destination);
-    if (F_status_is_error(main->setting.state.status)) return;
+    {
+      const f_status_t status = fl_path_canonical(source, destination);
+      if (F_status_is_error(status)) return status;
+    }
 
     if (destination->used >= current.used) {
       const f_range_t range = macro_f_range_t_initialize_2(current.used);
@@ -30,7 +32,7 @@ extern "C" {
       }
     }
 
-    main->setting.state.status = F_okay;
+    return F_okay;
   }
 #endif // _di_controller_path_canonical_relative_
 
index 119f2ff47d2f1d8c4294a799017321786fdaadae..6a83e9fa8b7a3cde038f5f93722dd4fd5369aed6 100644 (file)
@@ -43,12 +43,19 @@ extern "C" {
  *   The resulting relative canonical path.
  *   The destination will be completely replaced on success.
  *
+ *   Must not be NULL.
+ *
+ * @return
+ *   F_okay on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
  * @see fl_path_canonical()
  *
  * @see memmove()
  */
 #ifndef _di_controller_path_canonical_relative_
-  extern void controller_path_canonical_relative(controller_t * const main, const f_string_static_t current, const f_string_static_t source, f_string_dynamic_t * const destination);
+  extern f_status_t controller_path_canonical_relative(controller_t * const main, const f_string_static_t current, const f_string_static_t source, f_string_dynamic_t * const destination);
 #endif // _di_controller_path_canonical_relative_
 
 #ifdef __cplusplus
index f81ab7cdeffc741bab89614960de14f9420bd42e..856e500d3e74a3efcf1a6df5218c9556da522f19 100644 (file)
@@ -28,12 +28,12 @@ extern "C" {
 
         // Always return immediately on memory errors.
         if (F_status_set_fine(status) == F_memory_not) {
-          controller_print_error_perform_pid_file_create(&main->program.error, macro_controller_f(controller_file_pid_create), is_entry);
+          controller_print_error_perform_pid_file_create(&main->program.error, F_status_set_fine(status), macro_controller_f(controller_file_pid_create), is_entry);
 
           return status;
         }
 
-        controller_print_debug_perform_pid_file_create_problem(&main->program.debug, macro_controller_f(controller_file_pid_create), is_entry);
+        controller_print_debug_perform_pid_file_create_problem(&main->program.debug, F_status_set_fine(status), macro_controller_f(controller_file_pid_create), is_entry);
 
         status = F_okay;
       }
index 9995826f9adda71434496a11e5771bee3fa0989e..90dfdeb11d0cc9d60f477e13ac8e34c194354e6e 100644 (file)
@@ -30,7 +30,7 @@ extern "C" {
 #endif // _di_controller_print_debug_perform_pid_file_control_socket_
 
 #ifndef _di_controller_print_debug_perform_pid_file_create_problem_
-  f_status_t controller_print_debug_perform_pid_file_create_problem(fl_print_t * const print, const f_string_t function, const f_status_t status, const uint8_t is_entry) {
+  f_status_t controller_print_debug_perform_pid_file_create_problem(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t is_entry) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
     if (print->verbosity < f_console_verbosity_debug_e) return F_output_not;
index 8796cde294407b9ee667505b1e2614b983a6dc0d..a706838109ec16ecf9192ee657003c517ea29a85 100644 (file)
@@ -45,11 +45,11 @@ extern "C" {
  *   This requires print.custom to be controller_t.
  *
  *   This does not alter print.custom.setting.state.status.
- * @param function
- *   The name of the function associated with the error.
  * @param status
  *   The status code to process.
  *   Make sure this has F_status_set_fine() called if the status code has any error or warning bits.
+ * @param function
+ *   The name of the function associated with the error.
  * @param is_entry
  *   If TRUE, then this operates as an entry.
  *   If FALSE, then this operates as an exit.
@@ -61,7 +61,7 @@ extern "C" {
  *   F_output_not (with error bit) if setting is NULL.
  */
 #ifndef _di_controller_print_debug_perform_pid_file_create_problem_
-  extern f_status_t controller_print_debug_perform_pid_file_create_problem(fl_print_t * const print, const f_string_t function, const f_status_t status, const uint8_t is_entry);
+  extern f_status_t controller_print_debug_perform_pid_file_create_problem(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t is_entry);
 #endif // _di_controller_print_debug_perform_pid_file_create_problem_
 
 /**
index 5164beac333b64b1976e3ac31c5ed84a77b5c536..cc4d2c014c53374ee047ee91e0a1fc7257d96de4 100644 (file)
@@ -5,7 +5,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_print_error_perform_pid_file_create_
-  f_status_t controller_print_error_perform_pid_file_create(fl_print_t * const print, const f_string_t function, const f_status_t status, const uint8_t is_entry) {
+  f_status_t controller_print_error_perform_pid_file_create(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t is_entry) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
     if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
index d9d9d0b9171e0802a1c66b3a9622632764419c88..c13c2bf603b4b88662cb1070da33a94cfdcd5ec3 100644 (file)
@@ -25,11 +25,11 @@ extern "C" {
  *   This requires print.custom to be controller_t.
  *
  *   This does not alter print.custom.setting.state.status.
- * @param function
- *   The name of the function associated with the error.
  * @param status
  *   The status code to process.
  *   Make sure this has F_status_set_fine() called if the status code has any error or warning bits.
+ * @param function
+ *   The name of the function associated with the error.
  * @param is_entry
  *   If TRUE, then this operates as an entry.
  *   If FALSE, then this operates as an exit.
@@ -41,7 +41,7 @@ extern "C" {
  *   F_output_not (with error bit) if setting is NULL.
  */
 #ifndef _di_controller_print_error_perform_pid_file_create_
-  extern f_status_t controller_print_error_perform_pid_file_create(fl_print_t * const print, const f_string_t function, const f_status_t status, const uint8_t is_entry);
+  extern f_status_t controller_print_error_perform_pid_file_create(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t is_entry);
 #endif // _di_controller_print_error_perform_pid_file_create_
 
 #ifdef __cplusplus
index 8fcbe90314bcc0d6c101c6878e72e6a640228dc8..567e66f64e42c123faf05965d3592b5a4b13a787 100644 (file)
@@ -25,6 +25,26 @@ extern "C" {
   }
 #endif // _di_controller_print_message_entry_action_parameters_
 
+#ifndef _di_controller_print_message_entry_action_ready_
+  f_status_t controller_print_message_entry_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name) {
+
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
+    if (print->verbosity < f_console_verbosity_normal_e) return F_output_not;
+
+    controller_t * const main = (controller_t *) print->custom;
+
+    controller_lock_print(print->to, &main->thread);
+
+    fl_print_format("%rIgnoring %r item action '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
+    fl_print_format(f_string_format_Q_single_s.string, print->to, print->set.title, name, print->set.title);
+    fl_print_format("', state already is ready.%r", print->to, f_string_eol_s);
+
+    controller_unlock_print_flush(print->to, &main->thread);
+
+    return F_okay;
+  }
+#endif // _di_controller_print_message_entry_action_ready_
+
 #ifndef _di_controller_print_message_entry_action_state_
   f_status_t controller_print_message_entry_action_state(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry) {
 
@@ -101,26 +121,6 @@ extern "C" {
   }
 #endif // _di_controller_print_message_entry_action_state_failed_
 
-#ifndef _di_controller_print_message_entry_action_ready_
-  f_status_t controller_print_message_entry_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name) {
-
-    if (!print || !print->custom) return F_status_set_error(F_output_not);
-    if (print->verbosity < f_console_verbosity_normal_e) return F_output_not;
-
-    controller_t * const main = (controller_t *) print->custom;
-
-    controller_lock_print(print->to, &main->thread);
-
-    fl_print_format("%rIgnoring %r item action '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
-    fl_print_format(f_string_format_Q_single_s.string, print->to, print->set.title, name, print->set.title);
-    fl_print_format("', state already is ready.%r", print->to, f_string_eol_s);
-
-    controller_unlock_print_flush(print->to, &main->thread);
-
-    return F_okay;
-  }
-#endif // _di_controller_print_message_entry_action_ready_
-
 #ifndef _di_controller_print_message_entry_action_wait_
   f_status_t controller_print_message_entry_action_wait(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name) {
 
index a44a4786a954f82b3d22e9469a979ba1c8e33c8a..460d1c9dd82e0ef285aad455baebf79a53657f32 100644 (file)
@@ -43,7 +43,9 @@ extern "C" {
 #endif // _di_controller_print_message_entry_action_parameters_
 
 /**
- * Print message about entry action state.
+ * Print message about the specified entry item action being in the ready state.
+ *
+ * This generally only applies to the "ready" entry item action.
  *
  * @param print
  *   The output structure to print to.
@@ -53,14 +55,11 @@ extern "C" {
  *   This does not alter print.custom.setting.state.status.
  *
  *   Must not be NULL.
- * @param cache
- *   The cache.
- *
- *   Must not be NULL.
- * @param action
- *   The entry action.
- *
- *   Must not be NULL.
+ * @param is_entry
+ *   If TRUE, then this loads as an entry.
+ *   If FALSE, then this loads as an exit.
+ * @param name
+ *   The item name.
  *
  * @return
  *   F_okay on success.
@@ -68,12 +67,12 @@ extern "C" {
  *
  *   F_output_not (with error bit) if setting is NULL.
  */
-#ifndef _di_controller_print_message_entry_action_state_
-  extern f_status_t controller_print_message_entry_action_state(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry);
-#endif // _di_controller_print_message_entry_action_state_
+#ifndef _di_controller_print_message_entry_action_ready_
+  extern f_status_t controller_print_message_entry_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
+#endif // _di_controller_print_message_entry_action_ready_
 
 /**
- * Print message about entry action state having failed.
+ * Print message about entry action state.
  *
  * @param print
  *   The output structure to print to.
@@ -91,9 +90,6 @@ extern "C" {
  *   The entry action.
  *
  *   Must not be NULL.
- * @param is_entry
- *   If TRUE, then this loads as an entry.
- *   If FALSE, then this loads as an exit.
  *
  * @return
  *   F_okay on success.
@@ -101,14 +97,12 @@ extern "C" {
  *
  *   F_output_not (with error bit) if setting is NULL.
  */
-#ifndef _di_controller_print_message_entry_action_state_failed_
-  extern f_status_t controller_print_message_entry_action_state_failed(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry);
-#endif // _di_controller_print_message_entry_action_state_failed_
+#ifndef _di_controller_print_message_entry_action_state_
+  extern f_status_t controller_print_message_entry_action_state(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry);
+#endif // _di_controller_print_message_entry_action_state_
 
 /**
- * Print message about the specified entry item action being in the ready state.
- *
- * This generally only applies to the "ready" entry item action.
+ * Print message about entry action state having failed.
  *
  * @param print
  *   The output structure to print to.
@@ -118,11 +112,17 @@ extern "C" {
  *   This does not alter print.custom.setting.state.status.
  *
  *   Must not be NULL.
+ * @param cache
+ *   The cache.
+ *
+ *   Must not be NULL.
+ * @param action
+ *   The entry action.
+ *
+ *   Must not be NULL.
  * @param is_entry
  *   If TRUE, then this loads as an entry.
  *   If FALSE, then this loads as an exit.
- * @param name
- *   The item name.
  *
  * @return
  *   F_okay on success.
@@ -130,9 +130,9 @@ extern "C" {
  *
  *   F_output_not (with error bit) if setting is NULL.
  */
-#ifndef _di_controller_print_message_entry_action_ready_
-  extern f_status_t controller_print_message_entry_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
-#endif // _di_controller_print_message_entry_action_ready_
+#ifndef _di_controller_print_message_entry_action_state_failed_
+  extern f_status_t controller_print_message_entry_action_state_failed(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry);
+#endif // _di_controller_print_message_entry_action_state_failed_
 
 /**
  * Print message about waiting for the specified entry item action.
index 3d1ad8e0bf9c609ee4df9260d4a847b1d4e97021..b1b5c0263d91838a025427e90f01c5c6dcf8ea57 100644 (file)
@@ -60,13 +60,13 @@ extern "C" {
 
 
     // Mode.
-    if (main->setting.mode == controller_setting_mode_service_e) {
+    if (main->setting.mode == controller_process_mode_service_e) {
       string = &controller_mode_s;
     }
-    else if (main->setting.mode == controller_setting_mode_helper_e) {
+    else if (main->setting.mode == controller_process_mode_helper_e) {
       string = &controller_helper_s;
     }
-    else if (main->setting.mode == controller_setting_mode_program_e) {
+    else if (main->setting.mode == controller_process_mode_program_e) {
       string = &controller_program_s;
     }
     else {
index cf925b93ee7318457f6163192c83c45e67edd08a..7533c39d7db98f5c0f14e54d89e0be306ef3eb66 100644 (file)
@@ -46,6 +46,28 @@ extern "C" {
   }
 #endif // _di_controller_print_warning_entry_action_multiple_
 
+#ifndef _di_controller_print_warning_entry_action_unknown_
+  f_status_t controller_print_warning_entry_action_unknown(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name) {
+
+    if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+    if (print->verbosity < f_console_verbosity_debug_e) return F_output_not;
+
+    controller_t * const main = (controller_t *) print->custom;
+
+    controller_lock_print(print->to, &main->thread);
+
+    fl_print_format("%r%[%QUnknown %r item action '%]", print->to, f_string_eol_s, print->context, print->prefix, is_entry ? controller_entry_s : controller_exit_s, print->context);
+    fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
+    fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
+
+    controller_print_error_rule_cache(print, &cache->action, F_true);
+
+    controller_unlock_print_flush(print->to, &main->thread);
+
+    return F_okay;
+  }
+#endif // _di_controller_print_warning_entry_action_unknown_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index b6a8c7a39d21e427ab546bf7410697468e7d5aa2..1821396e868c1f5a29db144490fb61fb302f74c4 100644 (file)
@@ -76,6 +76,32 @@ extern "C" {
   extern f_status_t controller_print_warning_entry_action_multiple(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name);
 #endif // _di_controller_print_warning_entry_action_multiple_
 
+/**
+ * Print warnng message about a entry item action being unknown.
+ *
+ * @param print
+ *   The output structure to print to.
+ *
+ *   Must not be NULL.
+ * @param cache
+ *   A structure for containing and caching relevant data.
+ *
+ *   Must not be NULL.
+ * @param name
+ *   The parameter name whose value is unknown.
+ * @param unknown
+ *   The unknown value.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if setting is NULL.
+ */
+#ifndef _di_controller_print_warning_entry_action_unknown_
+  extern f_status_t controller_print_warning_entry_action_unknown(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name);
+#endif // _di_controller_print_warning_entry_action_unknown_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index f7a40171b2790aa61226b1d9c4cb469c7b8e72dc..3f7249d1d7c6e6aa3e60757fa718a420e690c2e3 100644 (file)
@@ -1341,7 +1341,7 @@ extern "C" {
         else if (type == controller_rule_setting_type_user_e) {
           uid_t number = 0;
 
-          status = controller_convert_user_id(cache->buffer_item, cache->content_actions.array[i].array[0], cache, &number);
+          status = controller_convert_user_id(cache, cache->buffer_item, cache->content_actions.array[i].array[0], &number);
 
           if (F_status_is_error(status)) {
             status = F_status_set_fine(status);
@@ -1432,7 +1432,7 @@ extern "C" {
             continue;
           }
 
-          status = controller_convert_group_id(cache->buffer_item, cache->content_actions.array[i].array[j], cache, &number);
+          status = controller_convert_group_id(cache, cache->buffer_item, cache->content_actions.array[i].array[j], &number);
 
           if (F_status_is_error(status)) {
             status = F_status_set_fine(status);
diff --git a/sources/c/main/status.c b/sources/c/main/status.c
new file mode 100644 (file)
index 0000000..14e3e5b
--- /dev/null
@@ -0,0 +1,57 @@
+#include "controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_status_simplify_error_
+  f_status_t controller_status_simplify_error(const f_status_t status) {
+
+    switch (status) {
+      case F_memory_not:
+        return F_status_set_error(F_memory);
+
+      case F_file_open_max:
+      case F_space_not:
+      case F_busy:
+        return F_status_set_error(F_resource);
+
+      case F_access_denied:
+      case F_filesystem_quota_block:
+      case F_prohibited:
+      case F_input_output:
+        return F_status_set_error(F_access);
+
+      case F_complete_not_utf:
+      case F_complete_not_utf_block:
+      case F_complete_not_utf_eof:
+      case F_complete_not_utf_eol:
+      case F_complete_not_utf_eos:
+      case F_complete_not_utf_stop:
+        return F_status_set_error(F_encoding);
+
+      case F_number:
+      case F_number_negative:
+      case F_number_positive:
+      case F_number_overflow:
+        return F_status_set_error(F_number);
+
+      case F_parameter:
+      case F_found_not:
+      case F_interrupt:
+      case F_support_not:
+      case F_critical:
+        return F_status_set_error(status);
+
+      case F_valid_not:
+        return F_status_set_error(F_valid_not);
+
+      default:
+        return F_status_set_error(F_failure);
+    };
+  }
+#endif // _di_controller_status_simplify_error_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/sources/c/main/status.h b/sources/c/main/status.h
new file mode 100644 (file)
index 0000000..7c84784
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides status functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_status_h
+#define _controller_status_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Given a wide range of status codes (that are errors), simplify them down to a smaller subset.
+ *
+ * @param status
+ *   The status code (without the error bit set) to simplify.
+ *
+ * @return
+ *   The status code (with error bit set) mapped to a status code from a subset of status codes.
+ */
+#ifndef _di_controller_status_simplify_error_
+  extern f_status_t controller_status_simplify_error(const f_status_t status);
+#endif // _di_controller_status_simplify_error_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_status_h