build_sources_library main/file.c main/lock.c main/path.c main/process.c
build_sources_library main/rule.c main/rule/action.c main/rule/execute.c main/rule/expand.c main/rule/instance.c main/rule/is.c main/rule/item.c main/rule/parameter.c main/rule/read.c main/rule/setting.c main/rule/validate.c main/rule/wait.c
build_sources_library main/perform.c
-build_sources_library main/print/action.c main/print/data.c main/print/debug.c main/print/entry.c main/print/error.c main/print/lock.c main/print/message.c main/print/rule.c main/print/verbose.c main/print/warning.c
+build_sources_library main/print/action.c main/print/data.c main/print/debug.c main/print/error.c main/print/lock.c main/print/message.c main/print/rule.c main/print/verbose.c main/print/warning.c
+build_sources_library main/print/entry/error.c main/print/entry/error/item.c main/print/entry/error/setting.c
+build_sources_library main/print/entry/message.c main/print/entry/message/action.c main/print/entry/message/item.c
+build_sources_library main/print/entry/output/setting.c
+build_sources_library main/print/entry/warning/action.c main/print/entry/warning/setting.c
build_sources_library main/print/rule/action.c main/print/rule/item.c main/print/rule/setting.c
build_sources_library main/signal.c main/time.c
build_sources_library main/thread.c main/thread/cleanup.c main/thread/control.c main/thread/entry.c main/thread/instance.c main/thread/is.c main/thread/rule.c main/thread/signal.c
build_sources_headers main/file.h main/lock.h main/path.h main/process.h
build_sources_headers main/rule.h main/rule/action.h main/rule/execute.h main/rule/expand.h main/rule/instance.h main/rule/is.h main/rule/item.h main/rule/parameter.h main/rule/read.h main/rule/setting.h main/rule/validate.h main/rule/wait.h
build_sources_headers main/perform.h
-build_sources_headers main/print/action.h main/print/data.h main/print/debug.h main/print/entry.h main/print/error.h main/print/lock.h main/print/message.h main/print/rule.h main/print/verbose.h main/print/warning.h
+build_sources_headers main/print/action.h main/print/data.h main/print/debug.h main/print/error.h main/print/lock.h main/print/message.h main/print/rule.h main/print/verbose.h main/print/warning.h
+build_sources_headers main/print/entry/error.h main/print/entry/error/item.h main/print/entry/error/setting.h
+build_sources_headers main/print/entry/message.h main/print/entry/message/action.h main/print/entry/message/item.h
+build_sources_headers main/print/entry/output/setting.h
+build_sources_headers main/print/entry/warning/action.h main/print/entry/warning/setting.h
build_sources_headers main/print/rule/action.h main/print/rule/item.h main/print/rule/setting.h
build_sources_headers main/signal.h main/time.h
build_sources_headers main/thread.h main/thread/cleanup.h main/thread/control.h main/thread/entry.h main/thread/instance.h main/thread/is.h main/thread/rule.h main/thread/signal.h
extern "C" {
#endif
+#ifndef _di_controller_init_process_entry_setup_
+ f_status_t controller_init_process_entry_setup(controller_t * const main, controller_cache_t * const cache, controller_entry_t * const entry, const uint8_t is_entry) {
+
+ if (!main || !entry || !cache) return F_status_set_error(F_parameter);
+
+ entry->session = controller_entry_session_new_e;
+
+ return F_okay;
+ }
+#endif // _di_controller_init_process_entry_setup_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern "C" {
#endif
+/**
+ * The init program implementation of the process_entry_setup() callback.
+ *
+ * @param main
+ * The main program data.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param entry
+ * The entry data.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this operates as an entry.
+ * If FALSE, then this operates as an exit.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_controller_init_process_entry_setup_
+ extern f_status_t controller_init_process_entry_setup(controller_t * const main, controller_cache_t * const cache, controller_entry_t * const entry, const uint8_t is_entry);
+#endif // _di_controller_init_process_entry_setup_
+
#ifdef __cplusplus
} // extern "C"
#endif
data.program.pipe = fll_program_data_pipe_input_e;
}
+ data.callback.process_entry_setup = &controller_init_process_entry_setup;
data.process = &process;
data.setting.flag &= ~controller_main_flag_interruptible_e;
data.thread = &thread;
#endif // _di_controller_setting_t_
/**
+ * The Controller callbacks.
+ *
+ * Properties:
+ * - process_entry_setup: Perform any optional initialization on the entry.
+ */
+#ifndef _di_controller_t_
+ typedef struct {
+ f_status_t (*process_entry_setup)(controller_t * const main, controller_cache_t * const cache, controller_entry_t * const entry, const uint8_t is_entry);
+ } controller_callback_t;
+
+ #define controller_callback_t_initialize \
+ { \
+ 0, \
+ }
+#endif // _di_controller_t_
+
+/**
* The main program data.
*
* The typedef for this is located in the defs.h header.
* Properties:
* - program: The main program data.
*
- * - cache: The cache.
- * - process: The process data.
- * - setting: The settings data.
- * - thread: The thread data.
+ * - cache: The cache.
+ * - callback: The callbacks.
+ * - process: The process data.
+ * - setting: The settings data.
+ * - thread: The thread data.
*/
#ifndef _di_controller_t_
struct controller_t_ {
fll_program_data_t program;
controller_cache_t cache;
+ controller_callback_t callback;
controller_process_t process;
controller_setting_t setting;
controller_thread_t thread;
{ \
fll_program_data_t_initialize, \
controller_cache_t_initialize, \
+ controller_callback_t_initialize, \
controller_process_t_initialize, \
controller_setting_t_initialize, \
controller_thread_t_initialize, \
#include <program/controller/main/common/type.h>
#include <program/controller/main/common.h>
#include <program/controller/main/convert.h>
+#include <program/controller/main/entry.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/lock.h>
#include <program/controller/main/path.h>
#include <program/controller/main/perform.h>
#include <program/controller/main/print/action.h>
#include <program/controller/main/print/data.h>
#include <program/controller/main/print/debug.h>
+#include <program/controller/main/print/entry/error.h>
+#include <program/controller/main/print/entry/error/item.h>
+#include <program/controller/main/print/entry/error/setting.h>
+#include <program/controller/main/print/entry/message.h>
+#include <program/controller/main/print/entry/message/action.h>
+#include <program/controller/main/print/entry/message/item.h>
+#include <program/controller/main/print/entry/output/setting.h>
+#include <program/controller/main/print/entry/warning/action.h>
+#include <program/controller/main/print/entry/warning/setting.h>
#include <program/controller/main/print/error.h>
#include <program/controller/main/print/lock.h>
#include <program/controller/main/print/message.h>
#ifndef _di_controller_entry_read_
f_status_t controller_entry_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_entry) {
+ if (!main || !cache) return F_status_set_error(F_parameter);
+
f_status_t status = F_okay;
controller_entry_t * const entry = is_entry ? &main->process.entry : &main->process.exit;
entry->status = F_known_not;
entry->items.used = 0;
- entry->session = (main->setting.flag & controller_main_flag_init_e) ? controller_entry_session_new_e : controller_entry_session_same_e;
+ entry->session = controller_entry_session_same_e;
+
+ if (main->callback.process_entry_setup) {
+ status = main->callback.process_entry_setup(main, cache, entry, is_entry);
+ }
cache->action.line_action = 0;
cache->action.line_item = 0;
cache->action.name_action.used = 0;
cache->action.name_item.used = 0;
- if (is_entry) {
- status = controller_file_load(main, cache, F_true, controller_entries_s, main->setting.name_entry, controller_entry_s);
- }
- else {
- status = controller_file_load(main, cache, F_false, controller_exits_s, main->setting.name_entry, controller_exit_s);
- if (status == F_file_found_not) return F_file_found_not;
+ if (F_status_is_error_not(status)) {
+ if (is_entry) {
+ status = controller_file_load(main, cache, F_true, controller_entries_s, main->process.name_entry, controller_entry_s);
+ }
+ else {
+ status = controller_file_load(main, cache, F_false, controller_exits_s, main->process.name_entry, controller_exit_s);
+ if (status == F_file_found_not) return F_file_found_not;
+ }
}
if (F_status_is_error_not(status)) {
if (cache->buffer_file.used) {
controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_entry, main);
- 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_state_t state = macro_f_state_t_initialize_1(controller_allocation_large_d, controller_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_range_t range = macro_f_range_t_initialize_2(cache->buffer_file.used);
fll_fss_basic_list_read(cache->buffer_file, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments, &state);
f_fss_apply_delimit(cache->delimits, &cache->buffer_file, &state);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true);
}
}
}
status = f_memory_array_increase_by(cache->object_items.used, &entry->items.array, &entry->items.used, &entry->items.size);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
}
else {
cache->action.name_action.used = 0;
cache->action.name_item.used = 0;
- status = controller_entry_items_increase_by(controller_common_allocation_small_d, &entry->items);
+ status = controller_entry_items_increase_by(controller_allocation_small_d, &entry->items);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_items_increase_by), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_items_increase_by), F_true);
break;
}
status = f_string_dynamic_partial_append(cache->buffer_file, cache->object_items.array[i], &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_partial_append), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_partial_append), F_true);
break;
}
f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item, &main->setting.state);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
break;
}
* F_okay on success.
* F_file_found_not on file not found for a an exit file (is_entry is FALSE).
*
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
* Errors (with error bit) from: controller_entry_actions_read().
* Errors (with error bit) from: controller_entry_items_increase_by().
* Errors (with error bit) from: controller_file_load().
cache->action.name_action.used = 0;
cache->action.name_item.used = 0;
- status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
+ 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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
return status;
}
status = f_string_dynamic_append_nulless(entry->items.array[0].name, &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status;
}
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, 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) {
- controller_print_entry_warning_item_action_multiple(&main->program.warning, &cache->action, is_entry, controller_ready_s);
+ controller_print_entry_warning_action_multiple(&main->program.warning, cache, is_entry, controller_ready_s);
}
else {
main->setting.ready = controller_setting_ready_wait_e;
for (j = 2; j < cache->ats.used; j += 2) {
if (cache->ats.array[j] == i) {
- controller_print_entry_error_item_failure(&main->program.error, &cache->action, entry->items.array[i].name, "cannot be executed because recursion is not allowed");
+ controller_print_entry_error_item_failure(&main->program.error, cache, entry->items.array[i].name, "cannot be executed because recursion is not allowed");
if (F_status_is_error_not(status)) {
status = F_status_set_error(F_recurse);
if (error_has) break;
- status2 = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
+ 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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status2), macro_controller_f(f_memory_array_increase), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_memory_array_increase), F_true);
return status2;
}
status2 = f_string_dynamic_append_nulless(entry->items.array[i].name, &cache->action.name_item);
if (F_status_is_error(status2)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status2;
}
if (error_has || i >= entry->items.used) {
if (i >= entry->items.used) {
- controller_print_entry_error_item_failure(&main->program.error, &cache->action, actions->array[cache->ats.array[at_j]].parameters.array[0], "does not exist");
+ controller_print_entry_error_item_failure(&main->program.error, cache, actions->array[cache->ats.array[at_j]].parameters.array[0], "does not exist");
if (F_status_is_error_not(status)) {
status = F_status_set_error(F_valid_not);
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status2;
}
if (!controller_thread_is_enabled(is_entry, &main->thread)) return F_status_set_error(F_interrupt);
- // If ready was never found in the entry, then default to always ready.
+ // 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;
}
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this operate as an entry.
- * If FALSE, then this operate as an exit.
+ * If TRUE, then this operates as an entry.
+ * If FALSE, then this operates as an exit.
*
* @return
* F_okay on success.
f_number_unsigned_t at_j = 1;
uint8_t options_force = 0;
- uint8_t options_process = 0;
+ uint8_t options_instance = 0;
controller_entry_t * const entry = is_entry ? &main->process.entry : &main->process.exit;
controller_cache_t * const cache = &main->thread.cache;
cache->action.name_action.used = 0;
cache->action.name_item.used = 0;
- status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
+ 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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
return status;
}
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status;
}
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status;
}
if (F_status_is_error(entry_action->status)) {
if (main->setting.flag & controller_main_flag_simulate_e) {
- controller_print_entry_message_action_state_failed(&main->program.message, entry_action, is_entry, cache->action.name_action);
+ controller_print_entry_message_action_state_failed(&main->program.message, cache, entry_action, is_entry);
}
else {
if ((entry_action->code & controller_entry_rule_code_require_d) && main->program.error.verbosity > f_console_verbosity_quiet_e || !(entry_action->code & controller_entry_rule_code_require_d) && (main->program.warning.verbosity == f_console_verbosity_verbose_e || main->program.warning.verbosity == f_console_verbosity_debug_e)) {
}
if (print) {
- controller_print_entry_message_action_state(print, &cache->action, entry_action, is_entry, cache->action.name_action);
+ controller_print_entry_message_action_state(print, cache, entry_action, is_entry);
}
}
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 ((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_entry_message_item_action_wait(&main->program.output, is_entry, controller_ready_s);
+ controller_print_entry_message_action_wait(&main->program.message, is_entry, controller_ready_s);
}
if (!(main->setting.flag & controller_main_flag_validate_e)) {
if (main->setting.ready == controller_setting_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_entry_message_item_action_ready(&main->program.output, is_entry, controller_ready_s);
+ controller_print_entry_message_action_ready(&main->program.message, is_entry, controller_ready_s);
}
}
else {
if (!failsafe && (main->program.error.verbosity == f_console_verbosity_verbose_e || entry->show == controller_entry_show_init_e) && !(main->setting.flag & controller_main_flag_simulate_e)) {
- controller_print_entry_message_state(&main->program.output, is_entry, controller_ready_s);
+ controller_print_entry_message_state(&main->program.message, is_entry, controller_ready_s);
}
status = controller_perform_ready(main, is_entry);
if (entry_action->number == 0 || entry_action->number >= entry->items.used || failsafe && entry_action->number == main->setting.failsafe_item_id) {
// This should not happen if the pre-process is working as intended, but in case it doesn't, return a critical error to prevent infinite recursion and similar errors.
- controller_print_entry_error_item_invalid(&main->program.error, &cache->action, is_entry, entry_action->number);
+ controller_print_entry_error_item_invalid(&main->program.error, cache, is_entry, entry_action->number);
return F_status_is_error(F_critical);
}
- status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
+ 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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
return status;
}
- // continue into the requested item.
+ // Continue into the requested item.
cache->ats.array[cache->ats.used] = entry_action->number;
cache->ats.array[cache->ats.used + 1] = 0;
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status;
}
f_thread_unlock(&main->thread.lock.rule);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(controller_rules_increase), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_rules_increase), F_true);
return status;
}
f_thread_unlock(&main->thread.lock.rule);
if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e || (entry->show == controller_entry_show_init_e && entry_action->type != controller_entry_action_type_consider_e)) {
- if (main->program.output.verbosity != f_console_verbosity_quiet_e && main->program.error.verbosity != f_console_verbosity_error_e) {
- controller_lock_print(main->program.output.to, &main->thread);
-
- fl_print_format("%r%r %r item rule ", main->program.output.to, f_string_eol_s, entry_action->type == controller_entry_action_type_consider_e ? controller_print_entry_considering_s : controller_print_entry_processing_s, is_entry ? controller_entry_s : controller_exit_s);
- fl_print_format("'%[%Q%]'", main->program.output.to, main->program.context.set.title, alias_rule, main->program.context.set.title);
-
- if (entry->show == controller_entry_show_init_e && !(main->setting.flag & controller_main_flag_simulate_e)) {
- fl_print_format(" [%[%r%]]", main->program.output.to, main->program.context.set.notable, entry_action->code == controller_entry_rule_code_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, main->program.context.set.notable);
-
- if (entry_action->code == controller_entry_rule_code_wait_d) {
- fl_print_format(" [%[%r%]]", main->program.output.to, main->program.context.set.notable, controller_wait_s, main->program.context.set.notable);
- }
-
- if (entry_action->code == controller_entry_rule_code_require_d) {
- fl_print_format(" [%[%r%]]", main->program.output.to, main->program.context.set.notable, controller_required_s, main->program.context.set.notable);
- }
- }
-
- fl_print_format(".%r", main->program.output.to, f_string_eol_s);
-
- controller_unlock_print_flush(main->program.output.to, &main->thread);
- }
+ controller_print_entry_message_item_rule(&main->program.message, entry, entry_action, is_entry);
}
if (!controller_thread_is_enabled(is_entry, &main->thread)) break;
if (F_status_is_error_not(status)) {
options_force = 0;
- options_process = 0;
+ options_instance = 0;
if (main->setting.flag & controller_main_flag_simulate_e) {
- options_process |= controller_process_option_simulate_d;
+ options_instance |= controller_instance_option_simulate_e;
}
if (entry_action->code & controller_entry_rule_code_require_d) {
- options_process |= controller_process_option_require_d;
+ options_instance |= controller_instance_option_require_e;
}
if (entry_action->code & controller_entry_rule_code_wait_d) {
- options_process |= controller_process_option_wait_d;
+ options_instance |= controller_instance_option_wait_e;
}
if (main->setting.flag & controller_main_flag_validate_e) {
- options_process |= controller_process_option_validate_d;
+ options_instance |= controller_instance_option_validate_e;
}
if (entry_action->code & controller_entry_rule_code_asynchronous_d) {
if (!(main->setting.flag & controller_main_flag_validate_e)) {
- options_force |= controller_process_option_asynchronous_d;
+ options_force |= controller_instance_option_asynchronous_e;
}
- options_process |= controller_process_option_asynchronous_d;
+ options_instance |= controller_instance_option_asynchronous_e;
}
- status = controller_rule_process_begin(main, options_force, alias_rule, controller_entry_action_type_to_rule_action_type(entry_action->type), options_process, is_entry ? controller_data_type_entry_e : controller_data_type_exit_e, stack, *cache);
+ status = controller_rule_process_begin(main, options_force, alias_rule, controller_entry_action_type_to_rule_action_type(entry_action->type), options_instance, is_entry ? controller_instance_type_entry_e : controller_instance_type_exit_e, stack, *cache);
if (F_status_set_fine(status) == F_memory_not || status == F_child || F_status_set_fine(status) == F_interrupt) {
break;
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_file_found_not) {
- controller_print_entry_error_item_action_execution_missing(&main->program.error, &cache->action, is_entry, entry_action->parameters.array[0]);
+ controller_print_entry_error_item_action_execution_missing(&main->program.error, cache, is_entry, entry_action->parameters.array[0]);
}
else {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(fll_execute_into), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(fll_execute_into), F_true);
}
return F_status_set_error(F_execute);
}
else if (result != 0) {
- controller_print_entry_error_item_action_execution_failure(&main->program.error, &cache->action, is_entry, result);
+ controller_print_entry_error_item_action_execution_failure(&main->program.error, cache, is_entry, result);
return F_status_set_error(F_execute);
}
if (entry_action->code == controller_entry_timeout_code_exit_d) {
entry->timeout_exit = entry_action->number;
- controller_entry_preprocess_print_simulate_setting_value(main, is_entry, controller_timeout_s, controller_exit_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
+ controller_print_entry_output_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_exit_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
}
else if (entry_action->code == controller_entry_timeout_code_kill_d) {
entry->timeout_kill = entry_action->number;
- controller_entry_preprocess_print_simulate_setting_value(main, is_entry, controller_timeout_s, controller_kill_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
+ controller_print_entry_output_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_kill_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
}
else if (entry_action->code == controller_entry_timeout_code_start_d) {
entry->timeout_start = entry_action->number;
- controller_entry_preprocess_print_simulate_setting_value(main, is_entry, controller_timeout_s, controller_start_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
+ controller_print_entry_output_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_start_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
}
else if (entry_action->code == controller_entry_timeout_code_stop_d) {
entry->timeout_stop = entry_action->number;
- controller_entry_preprocess_print_simulate_setting_value(main, is_entry, controller_timeout_s, controller_stop_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
+ controller_print_entry_output_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_stop_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
}
}
else if (entry_action->type == controller_entry_action_type_failsafe_e) {
if (failsafe) {
- controller_print_entry_warning_item_action_failsafe_twice(&main->program.warning, &cache->action, is_entry);
+ controller_print_entry_warning_action_failsafe_twice(&main->program.warning, cache, is_entry);
}
else {
if (entry_action->number == 0 || entry_action->number >= entry->items.used) {
// This should not happen if the pre-process is working as designed, but in case it doesn't, return a critical error to prevent infinite recursion and similar errors.
- controller_print_entry_error_item_invalid(&main->program.error, &cache->action, is_entry, entry_action->number);
+ controller_print_entry_error_item_invalid(&main->program.error, cache, is_entry, entry_action->number);
return F_status_is_error(F_critical);
}
main->setting.flag |= controller_setting_flag_failsafe_e;
main->setting.failsafe_item_id = entry_action->number;
- controller_entry_preprocess_print_simulate_setting_value(main, is_entry, controller_failsafe_s, f_string_empty_s, entry->items.array[main->setting.failsafe_item_id].name, f_string_empty_s);
+ controller_print_entry_output_setting_simulate_value(&main->program.output, is_entry, controller_failsafe_s, f_string_empty_s, entry->items.array[main->setting.failsafe_item_id].name, f_string_empty_s);
}
}
}
cache->action.name_action.used = 0;
if (F_status_is_error(status)) {
- if (F_status_set_fine(status) == F_memory_not || F_status_set_fine(status) == F_require) {
- break;
- }
+ if (F_status_set_fine(status) == F_memory_not || F_status_set_fine(status) == F_require) break;
}
// End of actions found, so drop to previous loop in stack.
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
break;
}
}
} // while
- if (!controller_thread_is_enabled(is_entry, &main->thread)) {
- return F_status_set_error(F_interrupt);
- }
-
- if (status == F_child) {
- return status;
- }
-
- if (F_status_is_error(status_lock)) {
- return status_lock;
- }
+ if (!controller_thread_is_enabled(is_entry, &main->thread)) return F_status_set_error(F_interrupt);
+ if (status == F_child) return status;
+ 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 (status_wait == F_require) return F_status_set_error(F_require);
}
- if (((main->setting.flag & controller_main_flag_simulate_e) && main->program.error.verbosity > f_console_verbosity_quiet_e) && main->program.error.verbosity != f_console_verbosity_error_e || main->program.error.verbosity == f_console_verbosity_verbose_e) {
- controller_lock_print(main->program.output.to, &main->thread);
-
- fl_print_format("%rDone processing %r item '", main->program.output.to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
- fl_print_format(f_string_format_r_single_s.string, main->program.output.to, main->program.context.set.title, controller_main_s, main->program.context.set.title);
- fl_print_format("'.%r", main->program.output.to, f_string_eol_s);
-
- // failsafe should not print the extra newline because the failure exit from controller_main should handle this.
- if (!failsafe) {
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
- }
-
- controller_unlock_print_flush(main->program.output.to, &main->thread);
+ if ((main->setting.flag & controller_main_flag_simulate_e && main->program.error.verbosity > f_console_verbosity_error_e) || main->program.error.verbosity > f_console_verbosity_normal_e) {
+ controller_print_entry_message_item_done(&main->program.message, is_entry, failsafe, controller_main_s);
}
return status;
* If TRUE, operate in failsafe mode (starts at designated failsafe Item).
* If FALSE, operate in normal mode (starts at "main" Item).
* @param is_entry
- * If TRUE, then this operate as an entry.
- * If FALSE, then this operate as an exit.
+ * If TRUE, then this operates as an entry.
+ * If FALSE, then this operates as an exit.
*
* @return
* F_okay on success.
{
controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_entry, main);
- 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_state_t state = macro_f_state_t_initialize_1(controller_allocation_large_d, controller_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_range_t range = content_range;
fll_fss_extended_read(cache->buffer_file, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0, &state);
}
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(fll_fss_extended_read), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(fll_fss_extended_read), F_true);
return status;
}
}
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true);
return status;
}
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
break;
}
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
break;
}
if (cache->content_actions.array[i].used == 2) {
if (f_compare_dynamic_partial_string(controller_readonly_s.string, cache->buffer_file, controller_readonly_s.used, cache->content_actions.array[i].array[1]) == F_equal_to) {
- main->setting.control.flag |= controller_control_flag_readonly_e;
+ main->process.control.flag |= controller_control_flag_readonly_e;
}
else {
- if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
- controller_lock_print(main->program.error.to, &main->thread);
+ controller_print_entry_error_item_setting_support_not_option(&main->program.error, cache, is_entry, cache->content_actions.array[i].array[1]);
- fl_print_format("%r%[%QThe %r item setting '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, is_entry ? 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, controller_control_s, main->program.error.notable);
- fl_print_format("%[' does not support the option '%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
-
- fl_print_format(f_string_format_Q_range_single_s.string, main->program.error.to, main->program.error.notable, cache->buffer_file, cache->content_actions.array[i].array[1], main->program.error.notable);
-
- fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
-
- controller_print_entry_error_cache(is_entry, &main->program.error, &cache->action);
-
- controller_unlock_print_flush(main->program.error.to, &main->thread);
-
- continue;
- }
+ continue;
}
}
else {
- main->setting.control.flag &= ~controller_control_flag_readonly_e;
+ main->process.control.flag &= ~controller_control_flag_readonly_e;
}
cache->action.generic.used = 0;
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
break;
}
status = controller_path_canonical_relative(main->setting, cache->action.generic, &main->setting.path_control);
if (F_status_is_error(status)) {
- controller_print_entry_error_file(&main->program.error, &cache->action, 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);
+ controller_print_entry_error_file(&main->program.error, cache, 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);
continue;
}
status = F_status_set_fine(status);
if (status == F_exist_not) {
- controller_entry_setting_read_print_error_with_range(&main->program.error, cache, is_entry, " has an invalid group", cache->content_actions.array[i].array[0], ", because no group was found by that name");
+ controller_print_entry_error_setting_with_range(&main->program.error, cache, is_entry, " has an invalid group", cache->content_actions.array[i].array[0], ", because no group was found by that name");
}
else if (status == F_number_too_large) {
- controller_entry_setting_read_print_error_with_range(&main->program.error, cache, is_entry, " has an invalid group", cache->content_actions.array[i].array[0], ", because the given ID is too large");
+ controller_print_entry_error_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 too large");
}
else if (status == F_number) {
- controller_entry_setting_read_print_error_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");
+ controller_print_entry_error_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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_group_id), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_group_id), F_true);
}
continue;
}
- main->setting.control.group = number;
- main->setting.control.flag |= controller_control_flag_has_group_e;
+ main->process.control.group = number;
+ main->process.control.flag |= controller_control_flag_has_group_e;
}
else if (is_entry && f_compare_dynamic(controller_control_mode_s, cache->action.name_action) == F_equal_to) {
mode_t mode = 0;
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
break;
}
status = f_file_mode_from_string(cache->action.generic, main->program.umask, &mode_file, &replace);
if (F_status_is_error(status)) {
- controller_entry_setting_read_print_error_with_range(&main->program.error, cache, is_entry, " has an unsupported mode", cache->content_actions.array[i].array[0], ", because the format is unknown or contains invalid data");
+ controller_print_entry_error_setting_with_range(&main->program.error, cache, is_entry, " has an unsupported mode", cache->content_actions.array[i].array[0], ", because the format is unknown or contains invalid data");
continue;
}
status = f_file_mode_to_mode(mode_file, &mode);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_file_mode_to_mode), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_file_mode_to_mode), F_true);
continue;
}
- main->setting.control.mode = mode;
- main->setting.control.flag |= controller_control_flag_has_mode_e;
+ main->process.control.mode = mode;
+ main->process.control.flag |= controller_control_flag_has_mode_e;
}
else if (is_entry && f_compare_dynamic(controller_control_user_s, cache->action.name_action) == F_equal_to) {
uid_t number = 0;
status = F_status_set_fine(status);
if (status == F_exist_not) {
- controller_entry_setting_read_print_error_with_range(&main->program.error, cache, is_entry, " has an invalid user", cache->content_actions.array[i].array[0], ", because no user was found by that name");
+ controller_print_entry_error_setting_with_range(&main->program.error, cache, is_entry, " has an invalid user", cache->content_actions.array[i].array[0], ", because no user was found by that name");
}
else if (status == F_number_too_large) {
- controller_entry_setting_read_print_error_with_range(&main->program.error, cache, is_entry, " has an invalid user", cache->content_actions.array[i].array[0], ", because the given ID is too large");
+ controller_print_entry_error_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 too large");
}
else if (status == F_number) {
- controller_entry_setting_read_print_error_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");
+ controller_print_entry_error_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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_user_id), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_user_id), F_true);
}
continue;
}
- main->setting.control.user = number;
- main->setting.control.flag |= controller_control_flag_has_user_e;
+ main->process.control.user = number;
+ main->process.control.flag |= controller_control_flag_has_user_e;
}
else if (f_compare_dynamic(controller_define_s, cache->action.name_action) == F_equal_to) {
if (cache->content_actions.array[i].used != 2) {
- controller_entry_setting_read_print_setting_requires_exactly(main, is_entry, *cache, 2);
+ controller_print_entry_error_setting_requires_exactly(&main->program.error, cache, is_entry, 2);
continue;
}
status = controller_entry_setting_read_map(cache->buffer_file, cache->content_actions.array[i], &entry->define);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
continue;
}
}
else if (is_entry && f_compare_dynamic(controller_mode_s, cache->action.name_action) == F_equal_to) {
if (cache->content_actions.array[i].used != 1) {
- controller_entry_setting_read_print_setting_requires_exactly(main, is_entry, *cache, 1);
+ controller_print_entry_error_setting_requires_exactly(&main->program.error, cache, is_entry, 1);
continue;
}
}
else if (f_compare_dynamic(controller_parameter_s, cache->action.name_action) == F_equal_to) {
if (cache->content_actions.array[i].used != 2) {
- controller_entry_setting_read_print_setting_requires_exactly(main, is_entry, *cache, 2);
+ controller_print_entry_error_setting_requires_exactly(&main->program.error, cache, is_entry, 2);
continue;
}
status = controller_entry_setting_read_map(cache->buffer_file, cache->content_actions.array[i], &entry->parameter);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
continue;
}
}
else if (f_compare_dynamic(controller_pid_s, cache->action.name_action) == F_equal_to) {
if (cache->content_actions.array[i].used != 1) {
- controller_entry_setting_read_print_setting_requires_exactly(main, is_entry, *cache, 1);
+ controller_print_entry_error_setting_requires_exactly(&main->program.error, cache, is_entry, 1);
continue;
}
}
else if (is_entry && f_compare_dynamic(controller_pid_file_s, cache->action.name_action) == F_equal_to) {
if (cache->content_actions.array[i].used != 1) {
- controller_entry_setting_read_print_setting_requires_exactly(main, is_entry, *cache, 1);
+ controller_print_entry_error_setting_requires_exactly(&main->program.error, cache, is_entry, 1);
continue;
}
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_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
continue;
}
status = controller_path_canonical_relative(main->setting, cache->action.generic, &main->setting.path_pid);
if (F_status_is_error(status)) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true);
continue;
}
}
else if (f_compare_dynamic(controller_session_s, cache->action.name_action) == F_equal_to) {
if (cache->content_actions.array[i].used != 1) {
- controller_entry_setting_read_print_setting_requires_exactly(main, is_entry, *cache, 1);
+ controller_print_entry_error_setting_requires_exactly(&main->program.error, cache, is_entry, 1);
continue;
}
}
else if (f_compare_dynamic(controller_show_s, cache->action.name_action) == F_equal_to) {
if (cache->content_actions.array[i].used != 1) {
- controller_entry_setting_read_print_setting_requires_exactly(main, is_entry, *cache, 1);
+ controller_print_entry_error_setting_requires_exactly(&main->program.error, cache, is_entry, 1);
continue;
}
*time = time_previous;
if (F_status_set_fine(status) == F_memory_not) {
- controller_print_entry_error(&main->program.error, cache->action, is_entry, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_partial_to_unsigned_detect), F_true);
+ controller_print_entry_error(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_partial_to_unsigned_detect), F_true);
continue;
}
- if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(main->program.error.to);
-
- fl_print_format("%r%[%QThe %r setting '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, main->program.error.context);
- fl_print_format(f_string_format_Q_range_single_s.string, main->program.error.to, main->program.error.notable, cache->buffer_file, cache->content_actions.array[i].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(main->program.error.to);
- }
+ controller_print_entry_error_setting_support_not_number(&main->program.error, is_entry, cache->buffer_file, cache->content_actions.array[i].array[1]);
}
}
else {
}
} // for
- return f_status_is_error(status) ? status : F_okay;
+ return F_status_is_error(status) ? status : F_okay;
}
#endif // _di_controller_entry_setting_read_
f_status_t controller_entry_setting_read_map(const f_string_static_t buffer, const f_ranges_t ranges, f_string_maps_t * const setting_maps) {
{
- f_status_t status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_string_map_t), (void **) &setting_maps->array, &setting_maps->used, &setting_maps->size);
+ f_status_t status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_map_t), (void **) &setting_maps->array, &setting_maps->used, &setting_maps->size);
if (F_status_is_error(status)) return status;
setting_maps->array[setting_maps->used].key.used = 0;
f_status_t status = F_okay;
- if (main->setting.control.flag & controller_control_flag_readonly_e) {
+ if (main->process.control.flag & controller_control_flag_readonly_e) {
if (f_file_exists(main->setting.path_control, F_true) != F_true) {
controller_print_perform_debug_control_socket_missing_read_only(&main->program.debug);
}
}
- status = f_socket_create(&main->setting.control.server);
+ status = f_socket_create(&main->process.control.server);
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_memory_not) {
return status;
}
- if (!(main->setting.control.flag & controller_control_flag_readonly_e)) {
+ if (!(main->process.control.flag & controller_control_flag_readonly_e)) {
status = f_file_remove(main->setting.path_control);
if (F_status_set_fine(status) == F_memory_not) {
}
}
- main->setting.control.server.name = main->setting.path_control;
+ main->process.control.server.name = main->setting.path_control;
- status = f_socket_bind(&main->setting.control.server);
+ status = f_socket_bind(&main->process.control.server);
if (F_status_is_error(status)) {
- f_socket_disconnect(&main->setting.control.server, f_socket_close_fast_e);
+ f_socket_disconnect(&main->process.control.server, f_socket_close_fast_e);
- if (!(main->setting.control.flag & controller_control_flag_readonly_e)) {
+ if (!(main->process.control.flag & controller_control_flag_readonly_e)) {
f_file_remove(main->setting.path_control);
}
return status;
}
- if (main->setting.control.flag & (controller_control_flag_has_user_e | controller_control_flag_has_group_e)) {
- status = f_file_role_change(main->setting.path_control, main->setting.control.user, main->setting.control.group, F_true);
+ if (main->process.control.flag & (controller_control_flag_has_user_e | controller_control_flag_has_group_e)) {
+ status = f_file_role_change(main->setting.path_control, main->process.control.user, main->process.control.group, F_true);
if (F_status_is_error(status)) {
- f_socket_disconnect(&main->setting.control.server, f_socket_close_fast_e);
+ f_socket_disconnect(&main->process.control.server, f_socket_close_fast_e);
- if (!(main->setting.control.flag & controller_control_flag_readonly_e)) {
+ if (!(main->process.control.flag & controller_control_flag_readonly_e)) {
f_file_remove(main->setting.path_control);
}
}
}
- if (main->setting.control.flag & controller_control_flag_has_mode_e) {
- status = f_file_mode_set(main->setting.path_control, main->setting.control.mode);
+ if (main->process.control.flag & controller_control_flag_has_mode_e) {
+ status = f_file_mode_set(main->setting.path_control, main->process.control.mode);
if (F_status_is_error(status)) {
- f_socket_disconnect(&main->setting.control.server, f_socket_close_fast_e);
+ f_socket_disconnect(&main->process.control.server, f_socket_close_fast_e);
- if (!(main->setting.control.flag & controller_control_flag_readonly_e)) {
+ if (!(main->process.control.flag & controller_control_flag_readonly_e)) {
f_file_remove(main->setting.path_control);
}
if (status == F_child) return status;
if (F_status_is_error(status)) {
- f_socket_disconnect(&main->setting.control.server, f_socket_close_fast_e);
+ f_socket_disconnect(&main->process.control.server, f_socket_close_fast_e);
- if (!(main->setting.control.flag & controller_control_flag_readonly_e)) {
+ if (!(main->process.control.flag & controller_control_flag_readonly_e)) {
f_file_remove(main->setting.path_control);
}
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this operate as an entry.
- * If FALSE, then this operate as an exit.
+ * If TRUE, then this operates as an entry.
+ * If FALSE, then this operates as an exit.
*
* @return
* F_okay on success.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this operate as an entry.
- * If FALSE, then this operate as an exit.
+ * If TRUE, then this operates as an entry.
+ * If FALSE, then this operates as an exit.
*
* @return
* F_okay on success.
+++ /dev/null
-#include "../controller.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _di_controller_print_entry_error_
- f_status_t controller_print_entry_error(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- if (status == F_interrupt) return F_status_set_error(F_output_not);
-
- controller_t * const main = (controller_t *) print->custom;
-
- // fll_error_print() automatically locks, so manually handle only the mutex locking and flushing rather than calling controller_lock_print().
- f_thread_mutex_lock(&main->thread.lock.print);
-
- fll_error_print(print, status, function, fallback);
-
- f_file_stream_lock(print->to);
-
- controller_print_entry_error_cache(print, cache, is_entry);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_error_
-
-#ifndef _di_controller_print_entry_error_cache_
- f_status_t controller_print_entry_error_cache(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry) {
-
- if (!print) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
-
- fl_print_format("%r%[%QWhile processing ", print->to.stream, f_string_eol_s, print->context, print->prefix);
-
- if (cache->name_action.used) {
- fl_print_format("action '%]", print->to.stream, print->context);
- fl_print_format("%[%Q%]", print->to.stream, print->notable, cache->name_action, print->notable);
- fl_print_format("%[' on line%] ", print->to.stream, print->context, print->context);
- fl_print_format("%[%un%]", print->to.stream, print->notable, cache->line_action, print->notable);
- fl_print_format("%[ for ", print->to.stream, print->context);
- }
-
- if (cache->name_item.used) {
- fl_print_format("%r item '%]", print->to.stream, is_entry ? controller_entry_s : controller_exit_s, print->context);
- fl_print_format("%[%Q%]", print->to.stream, print->notable, cache->name_item, print->notable);
- fl_print_format("%[' on line%] ", print->to.stream, print->context, print->context);
- fl_print_format("%[%un%]", print->to.stream, print->notable, cache->line_item, print->notable);
- fl_print_format("%[ for ", print->to.stream, print->context);
- }
-
- if (cache->name_file.used) {
- fl_print_format("%r file '%]", print->to.stream, is_entry ? controller_entry_s : controller_exit_s, print->context);
- fl_print_format("%[%Q%]%['", print->to.stream, print->notable, cache->name_file, print->notable, print->context);
- }
-
- fl_print_format(".%]%r", print->to.stream, print->context, f_string_eol_s);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_error_cache_
-
-#ifndef _di_controller_print_entry_error_file_
- f_status_t controller_print_entry_error_file(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- if (status == F_interrupt) return F_status_set_error(F_output_not);
-
- controller_t * const main = (controller_t *) print->custom;
-
- // fll_error_file_print() automatically locks, so manually handle only the mutex locking and flushing rather than calling controller_lock_print().
- f_thread_mutex_lock(&main->thread.lock.print);
-
- fll_error_file_print(print, status, function, fallback, name, operation, type);
-
- f_file_stream_lock(print->to);
-
- controller_print_entry_error_cache(print, cache, is_entry);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_error_file_
-
-#ifndef _di_controller_print_entry_error_item_action_execution_failure_
- f_status_t controller_print_entry_error_item_action_execution_failure(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const int code) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- controller_lock_print(print->to, &main->thread);
-
- fl_print_format("%r%[%QExecution failed with return value of '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
- fl_print_format(f_string_format_i_single_s.string, print->to, print->notable, code, print->notable);
- fl_print_format("$['.%]%r", print->to, print->context, print->context, f_string_eol_s);
-
- controller_print_entry_error_cache(print, cache, is_entry);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_error_item_action_execution_failure_
-
-#ifndef _di_controller_print_entry_error_item_action_execution_missing_
- f_status_t controller_print_entry_error_item_action_execution_missing(fl_print_t * const print, controller_cache_action_t * const cache, 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_error_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- controller_lock_print(print->to, &main->thread);
-
- fl_print_format("%r%[%QExecution failed, unable to find program or script '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
- fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
-
- controller_print_entry_error_cache(print, cache, is_entry);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_error_item_action_execution_missing_
-
-#ifndef _di_controller_print_entry_error_item_failure_
- f_status_t controller_print_entry_error_item_failure(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t message) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- controller_lock_print(print->to, &main->thread);
-
- fl_print_format("%r%[%QThe %r item named '%]", print->to, f_string_eol_s, print->context, is_entry ? controller_entry_s : controller_exit_s, print->prefix, print->context);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, parameter, print->notable);
- fl_print_format("%[' %S.%]%r", print->to, print->context, message, print->context, f_string_eol_s);
-
- controller_print_entry_error_cache(print, cache, is_entry);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_error_item_failure_
-
-#ifndef _di_controller_print_entry_error_item_invalid_
- f_status_t controller_print_entry_error_item_invalid(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const f_number_unsigned_t number) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- controller_lock_print(print->to, &main->thread);
-
- fl_print_format("%r%[Invalid %r item index '%]", print->to, f_string_eol_s, print->context, is_entry ? controller_entry_s : controller_exit_s, print->context);
- fl_print_format(f_string_format_un_single_s.string, print->to, print->notable, number, print->notable);
- fl_print_format("%[' detected.%]%r", print->to, print->context, print->context, f_string_eol_s);
-
- controller_print_entry_error_cache(print, cache, is_entry);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_error_item_invalid_
-
-#ifndef _di_controller_print_entry_message_action_parameters_
- f_status_t controller_print_entry_message_action_parameters(fl_print_t * const print, controller_entry_action_t * const action) {
-
- if (!print) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
-
- for (f_array_length_t index = 0; ;) {
-
- f_print_dynamic_safely(action.parameters.array[index], stream);
-
- ++index;
-
- if (index == action.parameters.used) break;
-
- f_print_dynamic_raw(f_string_space_s, stream);
- } // for
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_message_action_parameters_
-
-#ifndef _di_controller_print_entry_message_action_state_
- f_status_t controller_print_entry_message_action_state(fl_print_t * const print, controller_cache_action_t * const cache, controller_entry_action_t * const action, 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_error_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- controller_lock_print(print->to, &main->thread);
-
- fl_print_format("%r%[%QThe %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);
-
-
- if (action->parameters.used) {
- fl_print_format(" %[", print->to, context->notable);
-
- controller_print_entry_message_action_parameters(print, action);
-
- fl_print_format("%]", print->to, context->notable);
- }
-
- if (action->code & controller_entry_rule_code_require_d) {
- fl_print_format("%[' is%] %[required%]", print->to, print->context, print->context, print->notable, print->notable);
- }
- else {
- fl_print_format("%[' is%] %[optional%]", print->to, print->context, print->context, print->notable, print->notable);
- }
-
- fl_print_format(" %[and is in a%] %[failed%]", print->to, print->context, print->context, print->notable, print->notable);
-
- if (action->code & controller_entry_rule_code_require_d) {
- fl_print_format(" %[state, aborting.%]%r", print->to, print->context, print->context, f_string_eol_s);
- }
- else {
- fl_print_format(" %[state, skipping.%]%r", print->to, print->context, print->context, f_string_eol_s);
- }
-
- controller_print_entry_error_cache(is_entry, print, &cache->action);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_message_action_state_
-
-#ifndef _di_controller_print_entry_message_action_state_failed_
- f_status_t controller_print_entry_message_action_state_failed(fl_print_t * const print, controller_entry_action_t * const action, 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_error_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- controller_lock_print(print->to, &main->thread);
-
- fl_print_format("%rThe %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, context->set.title, name, context->set.title);
-
- if (action->parameters.used) {
- fl_print_format(" %[", print->to, context->notable);
-
- controller_print_entry_message_action_parameters(print->to, action);
-
- fl_print_format("%]", print->to, context->notable);
- }
-
- fl_print_format("' is %[%r%] and is in a ", print->to, context->notable, action->code & controller_entry_rule_code_require_d ? "required" : "optional", context->notable);
-
- fl_print_format("%[failed%] state, skipping.%r", print->to, context->notable, context->notable, context->notable, f_string_eol_s);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_message_action_state_failed_
-
-#ifndef _di_controller_print_entry_message_item_action_ready_
- f_status_t controller_print_entry_message_item_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_r_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_entry_message_item_action_ready_
-
-#ifndef _di_controller_print_entry_message_item_action_wait_
- f_status_t controller_print_entry_message_item_action_wait(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("%rWaiting before processing %r item action '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
- fl_print_format(f_string_format_r_single_s.string, print->to, print->set.title, name, print->set.title);
- fl_print_format("'.%r", print->to, f_string_eol_s);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_message_item_action_wait_
-
-#ifndef _di_controller_print_entry_message_item_executing_
- f_status_t controller_print_entry_message_item_executing(fl_print_t * const print, const uint8_t is_entry, f_string_dynamics_t * const parameters) {
-
- 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("%r%Q is executing '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
-
- for (f_number_unsigned_t k = 0; k < parameters.used; ++k) {
-
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->set.title, parameters.array[k], print->set.title);
-
- if (k + 1 < parameters.used) {
- f_print_dynamic_raw(f_string_space_s, print->to);
- }
- } // for
-
- fl_print_format("'.%r", print->to, f_string_eol_s);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_message_item_executing_
-
-#ifndef _di_controller_print_entry_message_item_process_
- f_status_t controller_print_entry_message_item_process(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t prepend, 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("%rProcessing %r", print->to, f_string_eol_s, prepend);
-
- if (prepend.used) {
- fl_print_format("%r ", print->to, prepend);
- }
-
- fl_print_format("%r item '%[%Q%]'.%r", print->to, is_entry ? controller_entry_s : controller_exit_s, print->title, name, print->title, f_string_eol_s);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_message_item_process_
-
- if (((main->setting.flag & controller_main_flag_simulate_e) && main->program.error.verbosity > f_console_verbosity_quiet_e) && main->program.error.verbosity != f_console_verbosity_error_e || main->program.error.verbosity == f_console_verbosity_verbose_e) {
- controller_lock_print(print->to, &main->thread);
-
- fl_print_format("%rDone processing %r item '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
- fl_print_format(f_string_format_r_single_s.string, print->to, print->set.title, controller_main_s, print->set.title);
- fl_print_format("'.%r", print->to, f_string_eol_s);
-
- // failsafe should not print the extra newline because the failure exit from controller_main should handle this.
- if (!failsafe) {
- f_print_dynamic_raw(f_string_eol_s, print->to);
- }
-
- controller_unlock_print_flush(print->to, &main->thread);
- }
-
-#ifndef _di_controller_print_entry_message_item_rule_
- f_status_t controller_print_entry_message_item_rule(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("%r%r %r item rule ", print->to, f_string_eol_s, entry_action->type == controller_entry_action_type_consider_e ? controller_print_entry_considering_s : controller_print_entry_processing_s, is_entry ? controller_entry_s : controller_exit_s);
- fl_print_format("'%[%Q%]'", print->to, print->set.title, alias_rule, print->set.title);
-
- if (entry->show == controller_entry_show_init_e && !(main->setting.flag & controller_main_flag_simulate_e)) {
- fl_print_format(" [%[%r%]]", print->to, main->program.context.set.notable, entry_action->code == controller_entry_rule_code_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, main->program.context.set.notable);
-
- if (entry_action->code == controller_entry_rule_code_wait_d) {
- fl_print_format(" [%[%r%]]", print->to, main->program.context.set.notable, controller_wait_s, main->program.context.set.notable);
- }
-
- if (entry_action->code == controller_entry_rule_code_require_d) {
- fl_print_format(" [%[%r%]]", print->to, main->program.context.set.notable, controller_required_s, main->program.context.set.notable);
- }
- }
-
- fl_print_format(".%r", print->to, f_string_eol_s);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_message_item_rule_
-
-#ifndef _di_controller_print_entry_message_state_
- f_status_t controller_print_entry_message_state(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("%rState is now '%[%r%]'.%r", print->to, f_string_eol_s, print->notable, name, print->notable, f_string_eol_s);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_message_state_
-
-#ifndef _di_controller_print_entry_warning_item_action_failsafe_twice_
- f_status_t controller_print_entry_warning_item_action_failsafe_twice(fl_print_t * const print, controller_cache_action_t * const cache, 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;
-
- controller_t * const main = (controller_t *) print->custom;
-
- controller_lock_print(print->to, &main->thread);
-
- fl_print_format("%r%[%QFailsafe may not be specified when running in failsafe, ignoring.%]%r", print->to, f_string_eol_s, print->context, print->prefix, print->context, f_string_eol_s);
-
- controller_print_entry_error_cache(print, cache, is_entry);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_warning_item_action_failsafe_twice_
-
-#ifndef _di_controller_print_entry_warning_item_action_multiple_
- f_status_t controller_print_entry_warning_item_action_multiple(fl_print_t * const print, controller_cache_action_t * const cache, 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_error_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- controller_lock_print(print->to, &main->thread);
-
- fl_print_format("%r%[%QMultiple '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
- fl_print_format("%[' %r item actions detected; only the first will be used.%]%r", print->to, print->context, is_entry ? controller_entry_s : controller_exit_s, print->context, f_string_eol_s);
-
- controller_print_entry_error_cache(print, cache, is_entry);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_warning_item_action_multiple_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 3
- *
- * Project: Controller
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Provides the print entry functionality.
- *
- * This is auto-included and should not need to be explicitly included.
- */
-#ifndef _controller_main_print_entry_h
-#define _controller_main_print_entry_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Print the entry related error.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param cache
- * The action cache.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @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
- * (optional) The name of the function where the error happened.
- * Set to 0 to disable.
- * @param fallback
- * Set to F_true to print the fallback error message for unknown errors.
- * @param thread
- * The thread data.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_error_
- extern f_status_t controller_print_entry_error(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback);
-#endif // _di_controller_print_entry_error_
-
-/**
- * Print additional error/warning information in addition to existing error that is found within the cache.
- *
- * This is explicitly intended to be used in addition to the error message.
- *
- * This neither locks the thread nor does it check to see if output is enabled or disabled.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param cache
- * The action cache.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see controller_entry_actions_read()
- * @see controller_entry_read()
- */
-#ifndef _di_controller_print_entry_error_cache_
- extern f_status_t controller_print_entry_error_cache(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry);
-#endif // _di_controller_print_entry_error_cache_
-
-/**
- * Print the entry related file error.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param cache
- * The action cache.
- * @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
- * (optional) The name of the function where the error happened.
- * Set to 0 to disable.
- * @param fallback
- * Set to F_true to print the fallback error message for unknown errors.
- * @param name
- * The name of the file or directory.
- * @param operation
- * The operation that fails, such as 'create' or 'access'.
- * @param type
- * A valid file type code from the fll_error_file_type enum.
- * @param thread
- * The thread data.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_error_file_
- extern f_status_t controller_print_entry_error_file(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback, const f_string_static_t name, const f_string_static_t operation, const uint8_t type);
-#endif // _di_controller_print_entry_error_file_
-
-/**
- * Print an error about a entry item action program or script execution failure.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param cache
- * The action cache.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param code
- * The return code.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_error_item_action_execution_failure_
- extern f_status_t controller_print_entry_error_item_action_execution_failure(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const int code);
-#endif // _di_controller_print_entry_error_item_action_execution_failure_
-
-/**
- * Print an error about a entry item action program or script not being found.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param cache
- * The action cache.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param name
- * The program or script name.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_error_item_action_execution_missing_
- extern f_status_t controller_print_entry_error_item_action_execution_missing(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const f_string_static_t name);
-#endif // _di_controller_print_entry_error_item_action_execution_missing_
-
-/**
- * Print the entry item related error.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param cache
- * The action cache.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param name
- * The item name.
- * @param message
- * A short message describing the reason for the failure.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_error_item_failure_
- extern f_status_t controller_print_entry_error_item_failure(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t message);
-#endif // _di_controller_print_entry_error_item_failure_
-
-/**
- * Print an error message for an invalid entry item.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param cache
- * The action cache.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param number
- * The index position of the invalid item.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_error_item_invalid_
- extern f_status_t controller_print_entry_error_item_invalid(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const f_number_unsigned_t number);
-#endif // _di_controller_print_entry_error_item_invalid_
-
-/**
- * Print all parameters for some action, separated by a space.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param action
- * The entry action whose parameters will be printed.
- *
- * Must not be NULL.
- *
- * @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_entry_message_action_parameters_
- extern f_status_t controller_print_entry_message_action_parameters(fl_print_t * const print, controller_entry_action_t * const action);
-#endif // _di_controller_print_entry_message_action_parameters_
-
-/**
- * Print message about entry action state.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param action
- * The entry action whose parameters will be printed.
- *
- * Must not be NULL.
- *
- * @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_entry_message_action_state_
- extern f_status_t controller_print_entry_message_action_state(fl_print_t * const print, controller_entry_action_t * const action, const uint8_t is_entry, const f_string_static_t name);
-#endif // _di_controller_print_entry_message_action_state_
-
-/**
- * Print message about entry action state having failed.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param action
- * The entry action whose parameters will be printed.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param name
- * The item name.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- */
-#ifndef _di_controller_print_entry_message_action_state_failed_
- extern f_status_t controller_print_entry_message_action_state_failed(fl_print_t * const print, controller_entry_action_t * const action, const uint8_t is_entry, const f_string_static_t name) {
-#ifndef _di_controller_print_entry_message_action_state_failed_
-
-/**
- * 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.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param name
- * The item name.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_message_item_action_ready_
- extern f_status_t controller_print_entry_message_item_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
-#endif // _di_controller_print_entry_message_item_action_ready_
-
-/**
- * Print message about waiting for the specified entry item action.
- *
- * This generally only applies to the "ready" entry item action.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param name
- * The item name.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_message_item_action_wait_
- extern f_status_t controller_print_entry_message_item_action_wait(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
-#endif // _di_controller_print_entry_message_item_action_wait_
-
-/**
- * Print message about the entry item executing.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param parameters
- * The array of parameters.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_message_item_executing_
- extern f_status_t controller_print_entry_message_item_executing(fl_print_t * const print, const uint8_t is_entry, f_string_dynamics_t * const parameters);
-#endif // _di_controller_print_entry_message_item_executing_
-
-/**
- * Print message about processing an item.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- * @param cache
- * The action cache.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param prepend
- * A string to prepend before entry string in the message.
- * When prepend.used is not 0, then a space is also printed between entry string and the prepend string.
- * Set prepend.used to 0 to disable.
- * @param name
- * The item name.
- * This name is printed after the "item" and after any optonal append string.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_message_item_process_
- extern f_status_t controller_print_entry_message_item_process(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t prepend, const f_string_static_t name);
-#endif // _di_controller_print_entry_message_item_process_
-
-/**
- * Print warning message about multiple actions for a specified item.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param cache
- * The action cache.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param name
- * The item name.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_message_item_rule_
- extern f_status_t controller_print_entry_message_item_rule(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
-#endif // _di_controller_print_entry_message_item_rule_
-
-/**
- * Print warning the "failsafe" entry item action being specified while already in failsafe mode.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param cache
- * The action cache.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_warning_item_action_failsafe_twice_
- extern f_status_t controller_print_entry_warning_item_action_failsafe_twice(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry);
-#endif // _di_controller_print_entry_warning_item_action_failsafe_twice_
-
-/**
- * Print message about the specified entry being in the given state.
- *
- * This generally only applies to the "ready" entry item action.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param name
- * The name of the state.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_message_state_
- extern f_status_t controller_print_entry_message_state(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
-#endif // _di_controller_print_entry_message_state_
-
-/**
- * Print warning message about multiple actions for a specified item.
- *
- * @param print
- * The output structure to print to.
- *
- * This requires print.custom to be controller_t.
- *
- * This does not alter print.custom.setting.state.status.
- *
- * Must not be NULL.
- * @param cache
- * The action cache.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param name
- * The item name.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see fll_error_file_print()
- * @see controller_print_entry_error_cache()
- */
-#ifndef _di_controller_print_entry_warning_item_action_multiple_
- extern f_status_t controller_print_entry_warning_item_action_multiple(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry, const f_string_static_t name);
-#endif // _di_controller_print_entry_warning_item_action_multiple_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _controller_main_print_entry_h
--- /dev/null
+#include "../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_print_entry_error_
+ f_status_t controller_print_entry_error(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (status == F_interrupt) return F_status_set_error(F_output_not);
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ // fll_error_print() automatically locks, so manually handle only the mutex locking and flushing rather than calling controller_lock_print().
+ f_thread_mutex_lock(&main->thread.lock.print);
+
+ fll_error_print(print, status, function, fallback);
+
+ f_file_stream_lock(print->to);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_
+
+#ifndef _di_controller_print_entry_error_cache_
+ f_status_t controller_print_entry_error_cache(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry) {
+
+ if (!print || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ fl_print_format("%r%[%QWhile processing ", print->to.stream, f_string_eol_s, print->context, print->prefix);
+
+ if (cache->name_action.used) {
+ fl_print_format("action '%]", print->to.stream, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to.stream, print->notable, cache->name_action, print->notable);
+ fl_print_format("%[' on line%] ", print->to.stream, print->context, print->context);
+ fl_print_format(f_string_format_un_single_s.string, print->to.stream, print->notable, cache->line_action, print->notable);
+ fl_print_format("%[ for ", print->to.stream, print->context);
+ }
+
+ if (cache->name_item.used) {
+ fl_print_format("%r item '%]", print->to.stream, is_entry ? controller_entry_s : controller_exit_s, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to.stream, print->notable, cache->name_item, print->notable);
+ fl_print_format("%[' on line%] ", print->to.stream, print->context, print->context);
+ fl_print_format(f_string_format_un_single_s.string, print->to.stream, print->notable, cache->line_item, print->notable);
+ fl_print_format("%[ for ", print->to.stream, print->context);
+ }
+
+ if (cache->name_file.used) {
+ fl_print_format("%r file '%]", print->to.stream, is_entry ? controller_entry_s : controller_exit_s, print->context);
+ fl_print_format("%[%Q%]%['", print->to.stream, print->notable, cache->name_file, print->notable, print->context);
+ }
+
+ fl_print_format(".%]%r", print->to.stream, print->context, f_string_eol_s);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_cache_
+
+#ifndef _di_controller_print_entry_error_file_
+ f_status_t controller_print_entry_error_file(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+ if (status == F_interrupt) return F_status_set_error(F_output_not);
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ // fll_error_file_print() automatically locks, so manually handle only the mutex locking and flushing rather than calling controller_lock_print().
+ f_thread_mutex_lock(&main->thread.lock.print);
+
+ fll_error_file_print(print, status, function, fallback, name, operation, type);
+
+ f_file_stream_lock(print->to);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_file_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print entry error functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_entry_error_h
+#define _controller_main_print_entry_error_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print the entry related error.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param 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
+ * (optional) The name of the function where the error happened.
+ * Set to 0 to disable.
+ * @param fallback
+ * Set to F_true to print the fallback error message for unknown errors.
+ * @param thread
+ * The thread data.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_error_
+ extern f_status_t controller_print_entry_error(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback);
+#endif // _di_controller_print_entry_error_
+
+/**
+ * Print additional error/warning information in addition to existing error that is found within the cache.
+ *
+ * This is explicitly intended to be used in addition to the error message.
+ *
+ * This neither locks the thread nor does it check to see if output is enabled or disabled.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The action cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see controller_entry_actions_read()
+ * @see controller_entry_read()
+ */
+#ifndef _di_controller_print_entry_error_cache_
+ extern f_status_t controller_print_entry_error_cache(fl_print_t * const print, controller_cache_action_t * const cache, const uint8_t is_entry);
+#endif // _di_controller_print_entry_error_cache_
+
+/**
+ * Print the entry related file error.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param 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
+ * (optional) The name of the function where the error happened.
+ * Set to 0 to disable.
+ * @param fallback
+ * If TRUE, then print the fallback error message for unknown errors.
+ * If FALSE, then do not print the fallback error message.
+ * @param name
+ * The name of the file or directory.
+ * @param operation
+ * The operation that fails, such as 'create' or 'access'.
+ * @param type
+ * A valid file type code from the fll_error_file_type enum.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_error_file_
+ extern f_status_t controller_print_entry_error_file(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const uint8_t fallback, const f_string_static_t name, const f_string_static_t operation, const uint8_t type);
+#endif // _di_controller_print_entry_error_file_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_entry_error_h
--- /dev/null
+#include "../../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_print_entry_error_item_action_execution_failure_
+ f_status_t controller_print_entry_error_item_action_execution_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const int code) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QExecution failed with return value of '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format(f_string_format_i_single_s.string, print->to, print->notable, code, 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_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_item_action_execution_failure_
+
+#ifndef _di_controller_print_entry_error_item_action_execution_missing_
+ f_status_t controller_print_entry_error_item_action_execution_missing(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_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QExecution failed, unable to find program or script '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
+ fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_item_action_execution_missing_
+
+#ifndef _di_controller_print_entry_error_item_failure_
+ f_status_t controller_print_entry_error_item_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t message) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QThe %r item named '%]", print->to, f_string_eol_s, print->context, is_entry ? controller_entry_s : controller_exit_s, print->prefix, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, parameter, print->notable);
+ fl_print_format("%[' %S.%]%r", print->to, print->context, message, print->context, f_string_eol_s);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_item_failure_
+
+#ifndef _di_controller_print_entry_error_item_invalid_
+ f_status_t controller_print_entry_error_item_invalid(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_number_unsigned_t number) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[Invalid %r item index '%]", print->to, f_string_eol_s, print->context, is_entry ? controller_entry_s : controller_exit_s, print->context);
+ fl_print_format(f_string_format_un_single_s.string, print->to, print->notable, number, print->notable);
+ fl_print_format("%[' detected.%]%r", print->to, print->context, print->context, f_string_eol_s);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_item_invalid_
+
+#ifndef _di_controller_print_entry_error_item_setting_support_not_option_
+ f_status_t controller_print_entry_error_item_setting_support_not_option(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t setting) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QThe %r item setting '%]", 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, controller_control_s, print->notable);
+ fl_print_format("%[' does not support the option '%]", print->to, print->context, print->context, f_string_eol_s);
+
+ fl_print_format(f_string_format_Q_range_single_s.string, print->to, print->notable, cache->buffer_file, setting, 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_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_item_setting_support_not_option_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print entry error item functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_entry_error_item_h
+#define _controller_main_print_entry_error_item_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print an error about a entry item action program or script execution failure.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param code
+ * The return code.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_error_item_action_execution_failure_
+ extern f_status_t controller_print_entry_error_item_action_execution_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const int code);
+#endif // _di_controller_print_entry_error_item_action_execution_failure_
+
+/**
+ * Print an error about a entry item action program or script not being found.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param name
+ * The program or script name.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_error_item_action_execution_missing_
+ extern f_status_t controller_print_entry_error_item_action_execution_missing(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_entry_error_item_action_execution_missing_
+
+/**
+ * Print the entry item related error.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param name
+ * The item name.
+ * @param message
+ * A short message describing the reason for the failure.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_error_item_failure_
+ extern f_status_t controller_print_entry_error_item_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t message);
+#endif // _di_controller_print_entry_error_item_failure_
+
+/**
+ * Print an error message for an invalid entry item.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param number
+ * The index position of the invalid item.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_error_item_invalid_
+ extern f_status_t controller_print_entry_error_item_invalid(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_number_unsigned_t number);
+#endif // _di_controller_print_entry_error_item_invalid_
+
+/**
+ * Print an error message about an entry it setting option not being supported.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param setting
+ * The setting name.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_error_item_setting_support_not_option_
+ extern f_status_t controller_print_entry_error_item_setting_support_not_option(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t setting);
+#endif // _di_controller_print_entry_error_item_setting_support_not_option_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_entry_error_item_h
--- /dev/null
+#include "../../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_print_entry_error_setting_with_range_
+ f_status_t controller_print_entry_error_setting_with_range(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_t before, const f_range_t range, const f_string_t after) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%Q%r setting%S '%]", print->to.stream, f_string_eol_s, print->context, print->prefix, is_entry ? controller_Entry_s : controller_Exit_s, before, print->context);
+ fl_print_format("%[%/Q%]", print->to.stream, print->notable, cache->buffer_file, range, print->notable);
+ fl_print_format("%['%S.%]%r", print->to.stream, print->context, after, print->context, f_string_eol_s);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_setting_with_range_
+
+#ifndef _di_controller_print_entry_error_setting_ignored_
+ f_status_t controller_print_entry_error_setting_ignored(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry) {
+
+ 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%[%QThe %Q item setting '%]", print->to.stream, 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.stream, print->notable, cache->action.name_action, print->notable);
+ fl_print_format("%[' is being ignored.%]%r", print->to.stream, print->context, print->context, f_string_eol_s);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_setting_ignored_
+
+#ifndef _di_controller_print_entry_error_setting_requires_between_
+ f_status_t controller_print_entry_error_setting_requires_between(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_number_unsigned_t minimum, const f_number_unsigned_t maximum) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QThe %Q item setting '%]", print->to.stream, 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.stream, print->notable, cache->action.name_action, print->notable);
+ fl_print_format("%[' requires at least %]", print->to.stream, print->context, print->context);
+ fl_print_format(f_string_format_un_single_s.string, print->to.stream, print->notable, minimum, print->notable);
+ fl_print_format("%[ and at most %]", print->to.stream, print->context, print->context);
+ fl_print_format(f_string_format_un_single_s.string, print->to.stream, print->notable, maximum, print->notable);
+ fl_print_format("%[ Content.%]%r", print->to.stream, print->context, print->context, f_string_eol_s);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_setting_requires_between_
+
+#ifndef _di_controller_print_entry_error_setting_requires_exactly_
+ f_status_t controller_print_entry_error_setting_requires_exactly(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_number_unsigned_t total) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QThe %Q item setting '%]", print->to.stream, 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.stream, print->notable, cache->action.name_action, print->notable);
+ fl_print_format("%[' requires exactly %]", print->to.stream, print->context, print->context);
+ fl_print_format(f_string_format_un_single_s.string, print->to.stream, print->notable, total, print->notable);
+ fl_print_format("%[ Content.%]%r", print->to.stream, print->context, print->context, f_string_eol_s);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_setting_requires_exactly_
+
+#ifndef _di_controller_print_entry_error_setting_support_not_number_
+ f_status_t controller_print_entry_error_setting_support_not_number(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t buffer, const f_range_t range) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QThe %r setting '%]", 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_range_single_s.string, print->to, print->notable, buffer, range, print->notable);
+ fl_print_format("%[' is not a valid supported number.%]", print->to, print->context, print->context, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_error_setting_support_not_number_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print entry error setting functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_entry_error_setting_h
+#define _controller_main_print_entry_error_setting_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print a message about an entry setting problem, with additional messages about the value.
+ *
+ * This is intended to be explicitly called by controller_entry_settings_read().
+ * This is intended only to be used for simple messages.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param before
+ * The string to add to the message being printed (before the value).
+ * @param range
+ * The range within the cache item buffer representing the value.
+ * @param after
+ * The string to add to the message being printed (after the 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.
+ *
+ * @see controller_entry_settings_read()
+ */
+#ifndef _di_controller_print_entry_error_setting_with_range_
+ extern f_status_t controller_print_entry_error_setting_with_range(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_t before, const f_range_t range, const f_string_t after);
+#endif // _di_controller_print_entry_error_setting_with_range_
+
+/**
+ * Print a message for when an entry setting is being ignored.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ *
+ * @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_entry_error_setting_ignored_
+ extern f_status_t controller_print_entry_error_setting_ignored(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry);
+#endif // _di_controller_print_entry_error_setting_ignored_
+
+/**
+ * Print a message for when an entry setting action has the incorrect number of parameters when the required amount is between a range.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param minimum
+ * The expected minimum number of arguments.
+ * @param maximum
+ * The expected maximum number of arguments.
+ *
+ * @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_entry_error_setting_requires_between_
+ extern f_status_t controller_print_entry_error_setting_requires_between(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_number_unsigned_t minimum, const f_number_unsigned_t maximum);
+#endif // _di_controller_print_entry_error_setting_requires_between_
+
+/**
+ * Print a message for when an entry setting action has the incorrect number of parameters when the required amount is fixed.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param total
+ * The expected number of arguments.
+ *
+ * @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_entry_error_setting_requires_exactly_
+ extern f_status_t controller_print_entry_error_setting_requires_exactly(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_number_unsigned_t total);
+#endif // _di_controller_print_entry_error_setting_requires_exactly_
+
+/**
+ * Print an error message about an entry setting value not being a supported number.
+ *
+ * This utilizes the buffer and range because the number is not supported and therefore the string cannot be converted to a number.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param buffer
+ * The buffer containing the settings.
+ * @param range
+ * The range within the buffer representing the unsupported number.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_error_setting_support_not_number_
+ extern f_status_t controller_print_entry_error_setting_support_not_number(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t buffer, const f_range_t range);
+#endif // _di_controller_print_entry_error_setting_support_not_number_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_entry_error_setting_h
--- /dev/null
+#include "../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_print_entry_message_state_
+ f_status_t controller_print_entry_message_state(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("%rState is now '%[%r%]'.%r", print->to, f_string_eol_s, print->notable, name, print->notable, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_message_state_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print entry message functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_entry_message_h
+#define _controller_main_print_entry_message_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print message about the specified entry being in the given state.
+ *
+ * This generally only applies to the "ready" entry item action.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param name
+ * The name of the state.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_message_state_
+ extern f_status_t controller_print_entry_message_state(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
+#endif // _di_controller_print_entry_message_state_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_entry_message_h
--- /dev/null
+#include "../../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_print_entry_message_action_parameters_
+ f_status_t controller_print_entry_message_action_parameters(fl_print_t * const print, controller_entry_action_t * const action) {
+
+ if (!print || !action) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ for (f_array_length_t index = 0; ;) {
+
+ f_print_dynamic_safely(action.parameters.array[index], stream);
+
+ ++index;
+
+ if (index == action.parameters.used) break;
+
+ f_print_dynamic_raw(f_string_space_s, stream);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_message_action_parameters_
+
+#ifndef _di_controller_print_entry_message_action_state_
+ f_status_t controller_print_entry_message_action_state(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry) {
+
+ if (!print || !print->custom || !cache || !action) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QThe %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, cache->action.name_action, print->notable);
+
+ if (action->parameters.used) {
+ fl_print_format(" %[", print->to, context->notable);
+
+ controller_print_entry_message_action_parameters(print, action);
+
+ fl_print_format("%]", print->to, context->notable);
+ }
+
+ if (action->code & controller_entry_rule_code_require_d) {
+ fl_print_format("%[' is%] %[required%]", print->to, print->context, print->context, print->notable, print->notable);
+ }
+ else {
+ fl_print_format("%[' is%] %[optional%]", print->to, print->context, print->context, print->notable, print->notable);
+ }
+
+ fl_print_format(" %[and is in a%] %[failed%]", print->to, print->context, print->context, print->notable, print->notable);
+
+ if (action->code & controller_entry_rule_code_require_d) {
+ fl_print_format(" %[state, aborting.%]%r", print->to, print->context, print->context, f_string_eol_s);
+ }
+ else {
+ fl_print_format(" %[state, skipping.%]%r", print->to, print->context, print->context, f_string_eol_s);
+ }
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_message_action_state_
+
+#ifndef _di_controller_print_entry_message_action_state_failed_
+ f_status_t controller_print_entry_message_action_state_failed(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry) {
+
+ if (!print || !print->custom || !cache || !action) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%rThe %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, context->set.title, cache->action.name_action, context->set.title);
+
+ if (action->parameters.used) {
+ fl_print_format(" %[", print->to, context->notable);
+
+ controller_print_entry_message_action_parameters(print, action);
+
+ fl_print_format("%]", print->to, context->notable);
+ }
+
+ fl_print_format("' is %[%r%] and is in a ", print->to, context->notable, action->code & controller_entry_rule_code_require_d ? "required" : "optional", context->notable);
+
+ fl_print_format("%[failed%] state, skipping.%r", print->to, context->notable, context->notable, context->notable, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_message_action_state_failed_
+
+#ifndef _di_controller_print_entry_message_action_ready_
+ f_status_t controller_print_entry_message_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_r_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_entry_message_action_ready_
+
+#ifndef _di_controller_print_entry_message_action_wait_
+ f_status_t controller_print_entry_message_action_wait(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("%rWaiting before processing %r item action '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
+ fl_print_format(f_string_format_r_single_s.string, print->to, print->set.title, name, print->set.title);
+ fl_print_format("'.%r", print->to, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_message_action_wait_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print entry message action functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_entry_message_action_h
+#define _controller_main_print_entry_message_action_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print all parameters for some action, separated by a space.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param action
+ * The entry action.
+ *
+ * Must not be NULL.
+ *
+ * @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_entry_message_action_parameters_
+ extern f_status_t controller_print_entry_message_action_parameters(fl_print_t * const print, controller_entry_action_t * const action);
+#endif // _di_controller_print_entry_message_action_parameters_
+
+/**
+ * Print message about entry action state.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param action
+ * The entry action.
+ *
+ * Must not be NULL.
+ *
+ * @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_entry_message_action_state_
+ extern f_status_t controller_print_entry_message_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_entry_message_action_state_
+
+/**
+ * Print message about entry action state having failed.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param 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.
+ *
+ * @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_entry_message_action_state_failed_
+ extern f_status_t controller_print_entry_message_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_entry_message_action_state_failed_
+
+/**
+ * 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.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param name
+ * The item name.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_message_action_ready_
+ extern f_status_t controller_print_entry_message_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
+#endif // _di_controller_print_entry_message_action_ready_
+
+/**
+ * Print message about waiting for the specified entry item action.
+ *
+ * This generally only applies to the "ready" entry item action.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param name
+ * The item name.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_message_action_wait_
+ extern f_status_t controller_print_entry_message_action_wait(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
+#endif // _di_controller_print_entry_message_action_wait_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_entry_message_action_h
--- /dev/null
+#include "../../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_print_entry_message_item_executing_
+ f_status_t controller_print_entry_message_item_executing(fl_print_t * const print, const uint8_t is_entry, f_string_dynamics_t * const parameters) {
+
+ if (!print || !print->custom || !parameters) 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("%r%Q is executing '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
+
+ for (f_number_unsigned_t k = 0; k < parameters.used; ++k) {
+
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->set.title, parameters.array[k], print->set.title);
+
+ if (k + 1 < parameters.used) {
+ f_print_dynamic_raw(f_string_space_s, print->to);
+ }
+ } // for
+
+ fl_print_format("'.%r", print->to, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_message_item_executing_
+
+#ifndef _di_controller_print_entry_message_item_process_
+ f_status_t controller_print_entry_message_item_process(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t prepend, 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("%rProcessing %r", print->to, f_string_eol_s, prepend);
+
+ if (prepend.used) {
+ fl_print_format("%r ", print->to, prepend);
+ }
+
+ fl_print_format("%r item '%[%Q%]'.%r", print->to, is_entry ? controller_entry_s : controller_exit_s, print->title, name, print->title, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_message_item_process_
+
+#ifndef _di_controller_print_entry_message_item_done_
+ f_status_t controller_print_entry_message_item_done(fl_print_t * const print, const uint8_t is_entry, const uint8_t failsafe, const f_string_static_t name) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%rDone processing %r item '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
+ fl_print_format(f_string_format_r_single_s.string, print->to, print->set.title, name, print->set.title);
+ fl_print_format("'.%r%r", print->to, f_string_eol_s, failsafe ? f_string_eol_s : f_string_empty_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_message_item_done_
+
+#ifndef _di_controller_print_entry_message_item_rule_
+ f_status_t controller_print_entry_message_item_rule(fl_print_t * const print, controller_entry_t * const entry, controller_entry_action_t * const action, const uint8_t is_entry, const f_string_static_t alias_rule) {
+
+ if (!print || !print->custom || !entry || !action) 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("%r%r %r item rule ", print->to, f_string_eol_s, entry_action->type == controller_entry_action_type_consider_e ? controller_print_entry_considering_s : controller_print_entry_processing_s, is_entry ? controller_entry_s : controller_exit_s);
+ fl_print_format("'%[%Q%]'", print->to, print->set.title, alias_rule, print->set.title);
+
+ if (entry->show == controller_entry_show_init_e && !(main->setting.flag & controller_main_flag_simulate_e)) {
+ fl_print_format(" [%[%r%]]", print->to, print->notable, entry_action->code == controller_entry_rule_code_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, print->notable);
+
+ if (entry_action->code == controller_entry_rule_code_wait_d) {
+ fl_print_format(" [%[%r%]]", print->to, print->notable, controller_wait_s, print->notable);
+ }
+
+ if (entry_action->code == controller_entry_rule_code_require_d) {
+ fl_print_format(" [%[%r%]]", print->to, print->notable, controller_required_s, print->notable);
+ }
+ }
+
+ fl_print_format(".%r", print->to, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_message_item_rule_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print entry message item functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_entry_message_item_h
+#define _controller_main_print_entry_message_item_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print message about the entry item executing.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param parameters
+ * The array of parameters.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_message_item_executing_
+ extern f_status_t controller_print_entry_message_item_executing(fl_print_t * const print, const uint8_t is_entry, f_string_dynamics_t * const parameters);
+#endif // _di_controller_print_entry_message_item_executing_
+
+/**
+ * Print message about processing an item.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param prepend
+ * A string to prepend before entry string in the message.
+ * When prepend.used is not 0, then a space is also printed between entry string and the prepend string.
+ * Set prepend.used to 0 to disable.
+ * @param name
+ * The item name.
+ * This name is printed after the "item" and after any optonal append string.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_message_item_process_
+ extern f_status_t controller_print_entry_message_item_process(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t prepend, const f_string_static_t name);
+#endif // _di_controller_print_entry_message_item_process_
+
+/**
+ * Print message about processing an item.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param failsafe
+ * If TRUE, then running in failsafe.
+ * If FALSE, then running normally.
+ * @param name
+ * The item name.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_message_item_done_
+ extern f_status_t controller_print_entry_message_item_done(fl_print_t * const print, const uint8_t is_entry, const uint8_t failsafe, const f_string_static_t name);
+#endif // _di_controller_print_entry_message_item_done_
+
+/**
+ * Print warning message about multiple actions for a specified item.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param entry
+ * The entry.
+ *
+ * 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 alias_rule
+ * The rule alias name.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_message_item_rule_
+ extern f_status_t controller_print_entry_message_item_rule(fl_print_t * const print, controller_entry_t * const entry, controller_entry_action_t * const action, const uint8_t is_entry, const f_string_static_t alias_rule);
+#endif // _di_controller_print_entry_message_item_rule_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_entry_message_item_h
--- /dev/null
+#include "../../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_print_entry_output_setting_simulate_value_
+ f_status_t controller_print_entry_output_setting_simulate_value(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_static_t suffix) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ if (print->verbosity < f_console_verbosity_debug_e && !((main->setting.flag & controller_main_flag_simulate_e) && print->verbosity > f_console_verbosity_normal_e)) {
+ return F_output_not;
+ }
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%rProcessing %r item action '", print->to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
+
+ fl_print_format("%[%Q%]' setting ", print->to.stream, print->set.title, name, print->set.title);
+
+ if (name_sub.used) {
+ fl_print_format("'%[%Q%]'", print->to.stream, print->set.notable, name_sub, print->set.notable);
+ }
+ else {
+ fl_print_format("value", print->to.stream);
+ }
+
+ fl_print_format(" to '%[%Q%]", print->to.stream, print->set.important, value, print->set.important);
+
+ fl_print_format("'%Q.%r", print->to.stream, suffix, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_output_setting_simulate_value_
+
+#ifndef _di_controller_print_entry_output_setting_validate_
+ f_status_t controller_print_entry_output_setting_validate(fl_print_t * const print, 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;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_entry_t * const entry = is_entry ? &main->process.entry : &main->process.exit;
+
+ controller_lock_print(print->to, &main->thread);
+
+ const f_string_static_t *string = 0;
+
+ f_status_t status = F_okay;
+ f_number_unsigned_t i = 0;
+ f_number_unsigned_t j = 0;
+
+ fl_print_format("%r%Q %[%Q%] {%r", print->to, f_string_eol_s, is_entry ? controller_Entry_s : controller_Exit_s, print->set.title, controller_settings_s, print->set.title, f_string_eol_s);
+
+
+ // Mode.
+ if (main->setting.mode == controller_setting_mode_service_e) {
+ string = &controller_mode_s;
+ }
+ else if (main->setting.mode == controller_setting_mode_helper_e) {
+ string = &controller_helper_s;
+ }
+ else if (main->setting.mode == controller_setting_mode_program_e) {
+ string = &controller_program_s;
+ }
+ else {
+ string = &f_string_empty_s;
+ }
+
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_mode_s, print->set.important, f_string_eol_s);
+
+ if (string->used) {
+ fl_print_format(" %r", print->to, *string);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Session.
+ if (entry->pid == controller_entry_session_new_e) {
+ string = &controller_new_s;
+ }
+ else if (entry->pid == controller_entry_session_same_e) {
+ string = &controller_same_s;
+ }
+ else {
+ string = &f_string_empty_s;
+ }
+
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_session_s, print->set.important, f_string_eol_s);
+
+ if (string->used) {
+ fl_print_format(" %r", print->to, *string, f_string_eol_s);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Show.
+ if (entry->pid == controller_entry_show_normal_e) {
+ string = &controller_normal_s;
+ }
+ else if (entry->pid == controller_entry_show_init_e) {
+ string = &controller_init_s;
+ }
+ else {
+ string = &f_string_empty_s;
+ }
+
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_show_s, print->set.important, f_string_eol_s);
+
+ if (string->used) {
+ fl_print_format(" %r", print->to, *string, f_string_eol_s);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Pid.
+ if (entry->pid == controller_entry_pid_disable_e) {
+ string = &controller_disable_s;
+ }
+ else if (entry->pid == controller_entry_pid_require_e) {
+ string = &controller_require_s;
+ }
+ else if (entry->pid == controller_entry_pid_ready_e) {
+ string = &controller_ready_s;
+ }
+ else {
+ string = &f_string_empty_s;
+ }
+
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_pid_s, print->set.important);
+
+ if (string->used) {
+ fl_print_format(" %r", print->to, *string);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Pid File.
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_pid_file_s, print->set.important);
+
+ if (main->setting.path_pid.used) {
+ fl_print_format(" %r", print->to, main->setting.path_pid);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Control.
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_control_s, print->set.important);
+
+ if (main->setting.path_control.used) {
+ fl_print_format(" %Q", print->to, main->setting.path_control);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Control Has.
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_control_has_s, print->set.important);
+
+ if (main->process.control.flag & controller_control_flag_readonly_e) {
+ fl_print_format(" %r", print->to, controller_readonly_s);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Control User.
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_control_user_s, print->set.important);
+
+ if (main->process.control.flag & controller_control_flag_has_user_e) {
+ fl_print_format(" %u", print->to, (unsigned int) main->process.control.user);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Control Group.
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_control_group_s, print->set.important);
+
+ if (main->process.control.flag & controller_control_flag_has_group_e) {
+ fl_print_format(" %u", print->to, (unsigned int) main->process.control.group);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Control Mode.
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_control_mode_s, print->set.important);
+
+ if (F_status_is_error_not(status)) {
+ if (main->process.control.flag & controller_control_flag_has_group_e) {
+ fl_print_format(" %@05u", print->to, (unsigned int) main->process.control.mode);
+ }
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Timeout: Exit.
+ fl_print_format(" %[%r%] %r", print->to, print->set.important, controller_timeout_s, print->set.important, controller_exit_s);
+
+ if (!(entry->flag & controller_entry_flag_timeout_exit_no_e)) {
+ fl_print_format(" %ul", print->to, entry->timeout_exit, f_string_eol_s);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Timeout: Kill.
+ fl_print_format(" %[%r%] %r", print->to, print->set.important, controller_timeout_s, print->set.important, controller_kill_s);
+
+ if (!(entry->flag & controller_entry_flag_timeout_kill_no_e)) {
+ fl_print_format(" %ul", print->to, entry->timeout_kill, f_string_eol_s);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Timeout: Start.
+ fl_print_format(" %[%r%] %r", print->to, print->set.important, controller_timeout_s, print->set.important, controller_start_s);
+
+ if (!(entry->flag & controller_entry_flag_timeout_start_no_e)) {
+ fl_print_format(" %ul", print->to, entry->timeout_start, f_string_eol_s);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Timeout: Stop.
+ fl_print_format(" %[%r%] %r", print->to, print->set.important, controller_timeout_s, print->set.important, controller_stop_s);
+
+ if (!(entry->flag & controller_entry_flag_timeout_stop_no_e)) {
+ fl_print_format(" %ul", print->to, entry->timeout_stop, f_string_eol_s);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Define.
+ fl_print_format(" %[%r%] {%r", print->to, print->set.important, controller_define_s, print->set.important, f_string_eol_s);
+
+ for (i = 0; i < entry->define.used; ++i) {
+ fl_print_format(" %Q %Q%r", print->to, entry->define.array[i].key, entry->define.array[i].value, f_string_eol_s);
+ } // for
+
+ fl_print_format(" }%r", print->to, f_string_eol_s, f_string_eol_s);
+
+
+ // Parameter.
+ fl_print_format(" %[%r%] {%r", print->to, print->set.important, controller_parameter_s, print->set.important, f_string_eol_s);
+
+ for (i = 0; i < entry->parameter.used; ++i) {
+ fl_print_format(" %Q %Q%r", print->to, entry->parameter.array[i].key, entry->parameter.array[i].value, f_string_eol_s);
+ } // for
+
+ fl_print_format(" }%r", print->to, f_string_eol_s);
+
+ fl_print_format("}%r", print->to, f_string_eol_s);
+
+
+ // Entry Items.
+ if (entry->items.used) {
+ controller_entry_action_t *action = 0;
+ bool raw = F_false;
+ f_number_unsigned_t k = 0;
+
+ for (i = 0; i < entry->items.used; ++i) {
+
+ fl_print_format("%r%Q %Q %[%Q%] {%r", print->to, f_string_eol_s, is_entry ? controller_Entry_s : controller_Exit_s, controller_Item_s, print->set.title, entry->items.array[i].name, print->set.title, f_string_eol_s);
+
+ for (j = 0; j < entry->items.array[i].actions.used; ++j) {
+
+ action = &entry->items.array[i].actions.array[j];
+
+ fl_print_format(" %[%r%] {%r", print->to, print->set.important, controller_action_s, print->set.important, f_string_eol_s);
+
+
+ // Item Type.
+ if (action->type == controller_entry_action_type_consider_e) {
+ string = &controller_consider_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_execute_e) {
+ string = &controller_execute_s;
+ raw = F_true;
+ }
+ else if (action->type == controller_entry_action_type_failsafe_e) {
+ string = &controller_failsafe_s;
+ raw = F_true;
+ }
+ else if (action->type == controller_entry_action_type_freeze_e) {
+ string = &controller_freeze_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_item_e) {
+ string = &controller_item_s;
+ raw = F_true;
+ }
+ else if (action->type == controller_entry_action_type_kexec_e) {
+ string = &controller_kexec_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_kill_e) {
+ string = &controller_kill_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_pause_e) {
+ string = &controller_pause_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_ready_e) {
+ string = &controller_ready_s;
+ raw = F_true;
+ }
+ else if (action->type == controller_entry_action_type_reboot_e) {
+ string = &controller_reboot_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_reload_e) {
+ string = &controller_reload_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_restart_e) {
+ string = &controller_restart_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_resume_e) {
+ string = &controller_resume_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_shutdown_e) {
+ string = &controller_shutdown_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_start_e) {
+ string = &controller_start_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_stop_e) {
+ string = &controller_stop_s;
+ raw = F_false;
+ }
+ else if (action->type == controller_entry_action_type_timeout_e) {
+ string = &controller_timeout_s;
+ raw = F_true;
+ }
+ else if (action->type == controller_entry_action_type_thaw_e) {
+ string = &controller_thaw_s;
+ raw = F_false;
+ }
+ else {
+ string = &f_string_empty_s;
+ }
+
+ fl_print_format(" %[%r%] %r%r", print->to, print->set.important, controller_type_s, print->set.important, *string, f_string_eol_s);
+
+
+ // Item Code (How).
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_how_s, print->set.important);
+
+ if (action->code) {
+ if (action->code == controller_entry_rule_code_asynchronous_d) {
+ fl_print_format(" %r", print->to, controller_asynchronous_s);
+ }
+
+ if (action->type == controller_entry_rule_code_require_d) {
+ fl_print_format(" %r", print->to, controller_require_s);
+ }
+
+ if (action->type == controller_entry_rule_code_wait_d) {
+ fl_print_format(" %r", print->to, controller_wait_s);
+ }
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Parameters.
+ if (action->type == controller_entry_action_type_item_e) {
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_item_s, print->set.important);
+
+ if (action->parameters.used && action->parameters.array[0].used) {
+ fl_print_format(" %Q", print->to, action->parameters.array[0], f_string_eol_s);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+ }
+ else if (raw) {
+ for (k = 0; k < action->parameters.used; ++k) {
+ fl_print_format(" %[%r%] %Q%r", print->to, print->set.important, controller_parameter_s, print->set.important, action->parameters.array[k], f_string_eol_s);
+ } // for
+ }
+ else {
+
+ // Parameter, Directory.
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_directory_s, print->set.important);
+
+ if (action->parameters.used && action->parameters.array[0].used) {
+ fl_print_format(" %Q", print->to, action->parameters.array[0], f_string_eol_s);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+
+
+ // Parameter, File.
+ fl_print_format(" %[%r%]", print->to, print->set.important, controller_file_s, print->set.important);
+
+ if (action->parameters.used && action->parameters.array[0].used > 1) {
+ fl_print_format(" %Q", print->to, action->parameters.array[1], f_string_eol_s);
+ }
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+ }
+
+ fl_print_format(" }%r", print->to, f_string_eol_s);
+ } // for
+
+ fl_print_format("}%r", print->to, f_string_eol_s);
+ } // for
+ }
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_output_setting_validate_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print entry output setting functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_entry_output_setting_h
+#define _controller_main_print_entry_output_setting_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print message regarding the population of a setting when in simulation or verbose mode.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this operates as an entry.
+ * If FALSE, then this operates as an exit.
+ * @param name
+ * The Object name of the setting being populated.
+ * @param name_sub
+ * A sub-name associated with the setting being populated.
+ * Set to a string with used set to 0 to not use.
+ * @param value
+ * The value being set.
+ * @param suffix
+ * An additional message to append at the end (before the final period).
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ */
+#ifndef _di_controller_print_entry_output_setting_simulate_value_
+ extern f_status_t controller_print_entry_output_setting_simulate_value(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_static_t suffix);
+#endif // _di_controller_print_entry_output_setting_simulate_value_
+
+/**
+ * Print a simulated execution of the given entry.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this is an entry.
+ * If FALSE, then this is an exit.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ */
+#ifndef _di_controller_print_entry_output_setting_validate_
+ extern f_status_t controller_print_entry_output_setting_validate(fl_print_t * const print, const uint8_t is_entry);
+#endif // _di_controller_print_entry_output_setting_validate_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_entry_output_setting_h
+++ /dev/null
-#include "../../controller.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _di_controller_entry_setting_read_print_error_with_range_
- f_status_t controller_entry_setting_read_print_error_with_range(fl_print_t * const print, const uint8_t is_entry, const f_string_t before, const f_string_range_t range, const f_string_t after) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- if (main->warning.verbosity < f_console_verbosity_debug_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- controller_lock_print(print.to, thread);
-
- fl_print_format("%r%[%Q%r setting%S '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, is_entry ? controller_Entry_s : controller_Exit_s, before, print.context);
- fl_print_format("%[%/Q%]", print.to.stream, print.notable, cache->buffer_file, range, print.notable);
- fl_print_format("%['%S.%]%r", print.to.stream, print.context, after, print.context, f_string_eol_s);
-
- controller_print_entry_error_cache(is_entry, print, &cache->action);
-
- controller_unlock_print_flush(print.to, thread);
-
- return F_okay;
- }
-#endif // _di_controller_entry_setting_read_print_error_with_range_
-
-#ifndef _di_controller_print_entry_setting_read_ignored_
- f_status_t controller_print_entry_setting_read_ignored(fl_print_t * const print, const uint8_t is_entry, const f_array_length_t index) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
- if (main->warning.verbosity < f_console_verbosity_debug_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- if (main->warning.verbosity < f_console_verbosity_debug_e) return F_output_not;
-
- controller_lock_print(main->warning.to, &main->thread);
-
- fl_print_format("%r%[%QThe %Q item setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, main->warning.context);
- fl_print_format("%[%Q%]", main->warning.to.stream, main->warning.notable, cache->action.name_action, main->warning.notable);
- fl_print_format("%[' is being ignored.%]%r", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s);
-
- controller_print_entry_error_cache(is_entry, main->warning, &cache->action);
-
- controller_unlock_print_flush(main->warning.to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_setting_read_ignored_
-
-#ifndef _di_controller_print_entry_setting_read_requires_between_
- f_status_t controller_print_entry_setting_read_requires_between(fl_print_t * const print, const uint8_t is_entry, const f_number_unsigned_t minimum, const f_number_unsigned_t maximum) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- if (main->warning.verbosity < f_console_verbosity_debug_e) return F_output_not;
-
- controller_lock_print(main->error.to, &main->thread);
-
- fl_print_format("%r%[%QThe %Q item setting '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, main->error.context);
- fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, cache->action.name_action, main->error.notable);
- fl_print_format("%[' requires at least %]", main->error.to.stream, main->error.context, main->error.context);
- fl_print_format("%[%un%]", main->error.to.stream, main->error.notable, minimum, main->error.notable);
- fl_print_format("%[ and at most %]", main->error.to.stream, main->error.context, main->error.context);
- fl_print_format("%[%un%]", main->error.to.stream, main->error.notable, maximum, main->error.notable);
- fl_print_format("%[ Content.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
-
- controller_print_entry_error_cache(is_entry, main->error, &cache->action);
-
- controller_unlock_print_flush(main->error.to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_setting_read_requires_between_
-
-#ifndef _di_controller_print_entry_setting_read_requires_exactly_
- f_status_t controller_print_entry_setting_read_requires_exactly(fl_print_t * const print, const uint8_t is_entry, const f_number_unsigned_t total) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- if (main->warning.verbosity < f_console_verbosity_debug_e) return F_output_not;
-
- controller_lock_print(main->error.to, &main->thread);
-
- fl_print_format("%r%[%QThe %Q item setting '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, main->error.context);
- fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, cache->action.name_action, main->error.notable);
- fl_print_format("%[' requires exactly %]", main->error.to.stream, main->error.context, main->error.context);
- fl_print_format("%[%un%]", main->error.to.stream, main->error.notable, total, main->error.notable);
- fl_print_format("%[ Content.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
-
- controller_print_entry_error_cache(is_entry, main->error, &cache->action);
-
- controller_unlock_print_flush(main->error.to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_setting_read_requires_exactly_
-
-#ifndef _di_controller_print_entry_setting_read_unknown_action_
- f_status_t controller_print_entry_setting_read_unknown_action(fl_print_t * const print, 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;
-
- controller_t * const main = (controller_t *) print->custom;
-
- if (main->warning.verbosity < f_console_verbosity_debug_e) return F_output_not;
-
- controller_lock_print(main->warning.to, &main->thread);
-
- fl_print_format("%r%[%QUnknown %r item setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, main->warning.context);
- fl_print_format("%[%Q%]", main->warning.to.stream, main->warning.notable, cache->action.name_action, main->warning.notable);
- fl_print_format("%['.%]%r", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s);
-
- controller_print_entry_error_cache(is_entry, main->warning, &cache->action);
-
- controller_unlock_print_flush(main->warning.to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_setting_read_unknown_action_
-
-#ifndef _di_controller_print_entry_setting_read_unknown_action_value_
- f_status_t controller_print_entry_setting_read_unknown_action_value(fl_print_t * const print, const uint8_t is_entry, const f_array_length_t index) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- if (!main || !cache) return F_status_set_error(F_output_not);
- if (main->warning.verbosity < f_console_verbosity_debug_e) return F_output_not;
-
- controller_lock_print(main->warning.to, &main->thread);
-
- fl_print_format("%r%[%QThe %Q item setting '%]", main->warning.to.stream, f_string_eol_s, main->warning.context, main->warning.prefix, is_entry ? controller_entry_s : controller_exit_s, main->warning.context);
- fl_print_format("%[%Q%]", main->warning.to.stream, main->warning.notable, cache->action.name_action, main->warning.notable);
- fl_print_format("%[' has an unknown value '%]", main->warning.to.stream, main->warning.context, main->warning.context);
- fl_print_format("%[%/Q%]", main->warning.to.stream, main->warning.notable, cache->buffer_file, cache->content_actions.array[index].array[0], main->warning.notable);
- fl_print_format("%['.%]%r", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s);
-
- controller_print_entry_error_cache(is_entry, main->warning, &cache->action);
-
- controller_unlock_print_flush(main->warning.to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_setting_read_unknown_action_value_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 3
- *
- * Project: Controller
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Provides the print entry setting functionality.
- *
- * This is auto-included and should not need to be explicitly included.
- */
-#ifndef _controller_main_print_entry_setting_h
-#define _controller_main_print_entry_setting_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Print a message about an entry setting problem, with additional messages about the value.
- *
- * This is intended to be explicitly called by controller_entry_settings_read().
- * This is intended only to be used for simple messages.
- *
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param print
- * The error or warning output structure.
- * @param before
- * The string to add to the message being printed (before the value).
- * @param range
- * The range within the cache item buffer representing the value.
- * @param after
- * The string to add to the message being printed (after the value).
- * @param thread
- * The thread data.
- * @param cache
- * A structure for containing and caching relevant data.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- *
- * @see controller_entry_settings_read()
- */
-#ifndef _di_controller_entry_setting_read_print_error_with_range_
- extern f_status_t controller_entry_setting_read_print_error_with_range(fl_print_t * const print, const uint8_t is_entry, const fl_print_t print, const f_string_t before, const f_string_range_t range, const f_string_t after);
-#endif // _di_controller_entry_setting_read_print_error_with_range_
-
-/**
- * Print a message for when an entry setting is being ignored.
- *
- * @param main
- * The main program data.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param cache
- * A structure for containing and caching relevant data.
- * @param total
- * The expected number of arguments.
- *
- * @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_entry_setting_read_ignored_
- extern f_status_t controller_print_entry_setting_read_ignored(fl_print_t * const print, const uint8_t is_entry, const f_array_length_t index);
-#endif // _di_controller_print_entry_setting_read_ignored_
-
-/**
- * Print a message for when an entry setting action has the incorrect number of parameters when the required amount is between a range.
- *
- * @param main
- * The main program data.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param cache
- * A structure for containing and caching relevant data.
- * @param minimum
- * The expected minimum number of arguments.
- * @param maximum
- * The expected maximum number of arguments.
- *
- * @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_entry_setting_read_requires_between_
- extern f_status_t controller_print_entry_setting_read_requires_between(fl_print_t * const print, const uint8_t is_entry, const f_number_unsigned_t minimum, const f_number_unsigned_t maximum);
-#endif // _di_controller_print_entry_setting_read_requires_between_
-
-/**
- * Print a message for when an entry setting action has the incorrect number of parameters when the required amount is fixed.
- *
- * @param main
- * The main program data.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param cache
- * A structure for containing and caching relevant data.
- * @param total
- * The expected number of arguments.
- *
- * @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_entry_setting_read_requires_exactly_
- extern f_status_t controller_print_entry_setting_read_requires_exactly(fl_print_t * const print, const uint8_t is_entry, const f_number_unsigned_t total);
-#endif // _di_controller_print_entry_setting_read_requires_exactly_
-
-/**
- * Print a message for when an entry setting action is unknown.
- *
- * @param main
- * The main program data.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param cache
- * A structure for containing and caching relevant data.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- */
-#ifndef _di_controller_print_entry_setting_read_unknown_action_
- extern f_status_t controller_print_entry_setting_read_unknown_action(fl_print_t * const print, const uint8_t is_entry);
-#endif // _di_controller_print_entry_setting_read_unknown_action_
-
-/**
- * Print a message for when an entry setting action has an unknown value.
- *
- * @param main
- * The main program data.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
- * @param cache
- * A structure for containing and caching relevant data.
- * @param total
- * The expected number of arguments.
- * @param index
- * The location in the content actions array representing the action 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_entry_setting_read_unknown_action_value_
- extern f_status_t controller_print_entry_setting_read_unknown_action_value(fl_print_t * const print, const uint8_t is_entry, const f_array_length_t index);
-#endif // _di_controller_print_entry_setting_read_unknown_action_value_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _controller_main_print_entry_setting_h
+++ /dev/null
-#include "../../controller.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _di_controller_entry_preprocess_print_simulate_setting_value_
- f_status_t controller_entry_preprocess_print_simulate_setting_value(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_static_t suffix) {
-
- if (main->error.verbosity != f_console_verbosity_debug_e && !(main->error.verbosity == f_console_verbosity_verbose_e && main->parameters.array[controller_parameter_simulate_e].result == f_console_result_found_e)) {
- return;
- }
-
- controller_lock_print(main->output.to, &main->thread);
-
- fl_print_format("%rProcessing %r item action '", main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
-
- fl_print_format("%[%Q%]' setting ", main->output.to.stream, main->context.set.title, name, main->context.set.title);
-
- if (name_sub.used) {
- fl_print_format("'%[%Q%]'", main->output.to.stream, main->context.set.notable, name_sub, main->context.set.notable);
- }
- else {
- fl_print_format("value", main->output.to.stream);
- }
-
- fl_print_format(" to '%[%Q%]", main->output.to.stream, main->context.set.important, value, main->context.set.important);
-
- fl_print_format("'%Q.%r", main->output.to.stream, suffix, f_string_eol_s);
-
- controller_unlock_print_flush(main->output.to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_entry_preprocess_print_simulate_setting_value_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 3
- *
- * Project: Controller
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Provides the print entry simulate functionality.
- *
- * This is auto-included and should not need to be explicitly included.
- */
-#ifndef _controller_main_print_entry_simulate_h
-#define _controller_main_print_entry_simulate_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Print message regarding the population of a setting when in simulation or verbose mode.
- *
- * @param main
- * The main program data.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this operate as an entry.
- * If FALSE, then this operate as an exit.
- * @param name
- * The Object name of the setting being populated.
- * @param name_sub
- * A sub-name associated with the setting being populated.
- * Set to a string with used set to 0 to not use.
- * @param value
- * The value being set.
- * @param suffix
- * An additional message to append at the end (before the final period).
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- */
-#ifndef _di_controller_entry_preprocess_print_simulate_setting_value_
- extern f_status_t controller_entry_preprocess_print_simulate_setting_value(controller_t * const main, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t name_sub, const f_string_static_t value, const f_string_static_t suffix);
-#endif // _di_controller_entry_preprocess_print_simulate_setting_value_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _controller_main_print_entry_simulate_h
+++ /dev/null
-#include "../../controller.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _di_controller_print_entry_validate_setting_
- f_status_t controller_print_entry_validate_setting(fl_print_t * const print, const uint8_t is_entry) {
-
- if (!main) return F_status_set_error(F_output_not);
-
- controller_entry_t * const entry = is_entry ? &main->process.entry : &main->process.exit;
-
- controller_lock_print(main->program.output.to, &main->thread);
-
- const f_string_static_t *string = 0;
-
- f_status_t status = F_okay;
- f_number_unsigned_t i = 0;
- f_number_unsigned_t j = 0;
-
- fl_print_format("%r%Q %[%Q%] {%r", main->program.output.to, f_string_eol_s, is_entry ? controller_Entry_s : controller_Exit_s, main->program.context.set.title, controller_settings_s, main->program.context.set.title, f_string_eol_s);
-
-
- // Mode.
- if (main->setting.mode == controller_setting_mode_service_e) {
- string = &controller_mode_s;
- }
- else if (main->setting.mode == controller_setting_mode_helper_e) {
- string = &controller_helper_s;
- }
- else if (main->setting.mode == controller_setting_mode_program_e) {
- string = &controller_program_s;
- }
- else {
- string = &f_string_empty_s;
- }
-
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_mode_s, main->program.context.set.important, f_string_eol_s);
-
- if (string->used) {
- fl_print_format(" %r", main->program.output.to, *string);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Session.
- if (entry->pid == controller_entry_session_new_e) {
- string = &controller_new_s;
- }
- else if (entry->pid == controller_entry_session_same_e) {
- string = &controller_same_s;
- }
- else {
- string = &f_string_empty_s;
- }
-
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_session_s, main->program.context.set.important, f_string_eol_s);
-
- if (string->used) {
- fl_print_format(" %r", main->program.output.to, *string, f_string_eol_s);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Show.
- if (entry->pid == controller_entry_show_normal_e) {
- string = &controller_normal_s;
- }
- else if (entry->pid == controller_entry_show_init_e) {
- string = &controller_init_s;
- }
- else {
- string = &f_string_empty_s;
- }
-
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_show_s, main->program.context.set.important, f_string_eol_s);
-
- if (string->used) {
- fl_print_format(" %r", main->program.output.to, *string, f_string_eol_s);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Pid.
- if (entry->pid == controller_entry_pid_disable_e) {
- string = &controller_disable_s;
- }
- else if (entry->pid == controller_entry_pid_require_e) {
- string = &controller_require_s;
- }
- else if (entry->pid == controller_entry_pid_ready_e) {
- string = &controller_ready_s;
- }
- else {
- string = &f_string_empty_s;
- }
-
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_pid_s, main->program.context.set.important);
-
- if (string->used) {
- fl_print_format(" %r", main->program.output.to, *string);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Pid File.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_pid_file_s, main->program.context.set.important);
-
- if (main->setting.path_pid.used) {
- fl_print_format(" %r", main->program.output.to, main->setting.path_pid);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Control.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_control_s, main->program.context.set.important);
-
- if (main->setting.path_control.used) {
- fl_print_format(" %Q", main->program.output.to, main->setting.path_control);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Control Has.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_control_has_s, main->program.context.set.important);
-
- if (main->setting.control.flag & controller_control_flag_readonly_e) {
- fl_print_format(" %r", main->program.output.to, controller_readonly_s);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Control User.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_control_user_s, main->program.context.set.important);
-
- if (main->setting.control.flag & controller_control_flag_has_user_e) {
- fl_print_format(" %u", main->program.output.to, (unsigned int) main->setting.control.user);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Control Group.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_control_group_s, main->program.context.set.important);
-
- if (main->setting.control.flag & controller_control_flag_has_group_e) {
- fl_print_format(" %u", main->program.output.to, (unsigned int) main->setting.control.group);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Control Mode.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_control_mode_s, main->program.context.set.important);
-
- if (F_status_is_error_not(status)) {
- if (main->setting.control.flag & controller_control_flag_has_group_e) {
- fl_print_format(" %@05u", main->program.output.to, (unsigned int) main->setting.control.mode);
- }
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Timeout: Exit.
- fl_print_format(" %[%r%] %r", main->program.output.to, main->program.context.set.important, controller_timeout_s, main->program.context.set.important, controller_exit_s);
-
- if (!(entry->flag & controller_entry_flag_timeout_exit_no_e)) {
- fl_print_format(" %ul", main->program.output.to, entry->timeout_exit, f_string_eol_s);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Timeout: Kill.
- fl_print_format(" %[%r%] %r", main->program.output.to, main->program.context.set.important, controller_timeout_s, main->program.context.set.important, controller_kill_s);
-
- if (!(entry->flag & controller_entry_flag_timeout_kill_no_e)) {
- fl_print_format(" %ul", main->program.output.to, entry->timeout_kill, f_string_eol_s);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Timeout: Start.
- fl_print_format(" %[%r%] %r", main->program.output.to, main->program.context.set.important, controller_timeout_s, main->program.context.set.important, controller_start_s);
-
- if (!(entry->flag & controller_entry_flag_timeout_start_no_e)) {
- fl_print_format(" %ul", main->program.output.to, entry->timeout_start, f_string_eol_s);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Timeout: Stop.
- fl_print_format(" %[%r%] %r", main->program.output.to, main->program.context.set.important, controller_timeout_s, main->program.context.set.important, controller_stop_s);
-
- if (!(entry->flag & controller_entry_flag_timeout_stop_no_e)) {
- fl_print_format(" %ul", main->program.output.to, entry->timeout_stop, f_string_eol_s);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Define.
- fl_print_format(" %[%r%] {%r", main->program.output.to, main->program.context.set.important, controller_define_s, main->program.context.set.important, f_string_eol_s);
-
- for (i = 0; i < entry->define.used; ++i) {
- fl_print_format(" %Q %Q%r", main->program.output.to, entry->define.array[i].key, entry->define.array[i].value, f_string_eol_s);
- } // for
-
- fl_print_format(" }%r", main->program.output.to, f_string_eol_s, f_string_eol_s);
-
-
- // Parameter.
- fl_print_format(" %[%r%] {%r", main->program.output.to, main->program.context.set.important, controller_parameter_s, main->program.context.set.important, f_string_eol_s);
-
- for (i = 0; i < entry->parameter.used; ++i) {
- fl_print_format(" %Q %Q%r", main->program.output.to, entry->parameter.array[i].key, entry->parameter.array[i].value, f_string_eol_s);
- } // for
-
- fl_print_format(" }%r", main->program.output.to, f_string_eol_s);
-
- fl_print_format("}%r", main->program.output.to, f_string_eol_s);
-
-
- // Entry Items.
- if (entry->items.used) {
- controller_entry_action_t *action = 0;
- bool raw = F_false;
- f_number_unsigned_t k = 0;
-
- for (i = 0; i < entry->items.used; ++i) {
-
- fl_print_format("%r%Q %Q %[%Q%] {%r", main->program.output.to, f_string_eol_s, is_entry ? controller_Entry_s : controller_Exit_s, controller_Item_s, main->program.context.set.title, entry->items.array[i].name, main->program.context.set.title, f_string_eol_s);
-
- for (j = 0; j < entry->items.array[i].actions.used; ++j) {
-
- action = &entry->items.array[i].actions.array[j];
-
- fl_print_format(" %[%r%] {%r", main->program.output.to, main->program.context.set.important, controller_action_s, main->program.context.set.important, f_string_eol_s);
-
-
- // Item Type.
- if (action->type == controller_entry_action_type_consider_e) {
- string = &controller_consider_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_execute_e) {
- string = &controller_execute_s;
- raw = F_true;
- }
- else if (action->type == controller_entry_action_type_failsafe_e) {
- string = &controller_failsafe_s;
- raw = F_true;
- }
- else if (action->type == controller_entry_action_type_freeze_e) {
- string = &controller_freeze_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_item_e) {
- string = &controller_item_s;
- raw = F_true;
- }
- else if (action->type == controller_entry_action_type_kexec_e) {
- string = &controller_kexec_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_kill_e) {
- string = &controller_kill_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_pause_e) {
- string = &controller_pause_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_ready_e) {
- string = &controller_ready_s;
- raw = F_true;
- }
- else if (action->type == controller_entry_action_type_reboot_e) {
- string = &controller_reboot_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_reload_e) {
- string = &controller_reload_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_restart_e) {
- string = &controller_restart_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_resume_e) {
- string = &controller_resume_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_shutdown_e) {
- string = &controller_shutdown_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_start_e) {
- string = &controller_start_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_stop_e) {
- string = &controller_stop_s;
- raw = F_false;
- }
- else if (action->type == controller_entry_action_type_timeout_e) {
- string = &controller_timeout_s;
- raw = F_true;
- }
- else if (action->type == controller_entry_action_type_thaw_e) {
- string = &controller_thaw_s;
- raw = F_false;
- }
- else {
- string = &f_string_empty_s;
- }
-
- fl_print_format(" %[%r%] %r%r", main->program.output.to, main->program.context.set.important, controller_type_s, main->program.context.set.important, *string, f_string_eol_s);
-
-
- // Item Code (How).
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_how_s, main->program.context.set.important);
-
- if (action->code) {
- if (action->code == controller_entry_rule_code_asynchronous_d) {
- fl_print_format(" %r", main->program.output.to, controller_asynchronous_s);
- }
-
- if (action->type == controller_entry_rule_code_require_d) {
- fl_print_format(" %r", main->program.output.to, controller_require_s);
- }
-
- if (action->type == controller_entry_rule_code_wait_d) {
- fl_print_format(" %r", main->program.output.to, controller_wait_s);
- }
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Parameters.
- if (action->type == controller_entry_action_type_item_e) {
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_item_s, main->program.context.set.important);
-
- if (action->parameters.used && action->parameters.array[0].used) {
- fl_print_format(" %Q", main->program.output.to, action->parameters.array[0], f_string_eol_s);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
- }
- else if (raw) {
- for (k = 0; k < action->parameters.used; ++k) {
- fl_print_format(" %[%r%] %Q%r", main->program.output.to, main->program.context.set.important, controller_parameter_s, main->program.context.set.important, action->parameters.array[k], f_string_eol_s);
- } // for
- }
- else {
-
- // Parameter, Directory.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_directory_s, main->program.context.set.important);
-
- if (action->parameters.used && action->parameters.array[0].used) {
- fl_print_format(" %Q", main->program.output.to, action->parameters.array[0], f_string_eol_s);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
-
-
- // Parameter, File.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_file_s, main->program.context.set.important);
-
- if (action->parameters.used && action->parameters.array[0].used > 1) {
- fl_print_format(" %Q", main->program.output.to, action->parameters.array[1], f_string_eol_s);
- }
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
- }
-
- fl_print_format(" }%r", main->program.output.to, f_string_eol_s);
- } // for
-
- fl_print_format("}%r", main->program.output.to, f_string_eol_s);
- } // for
- }
-
- controller_unlock_print_flush(main->program.output.to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_entry_validate_setting_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 3
- *
- * Project: Controller
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Provides the print entry validate functionality.
- *
- * This is auto-included and should not need to be explicitly included.
- */
-#ifndef _controller_main_print_entry_validate_h
-#define _controller_main_print_entry_validate_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Print a simulated execution of the given entry.
- *
- * @param main
- * The main program data.
- *
- * Must not be NULL.
- * @param cache
- * A structure for containing and caching relevant data.
- *
- * Must not be NULL.
- * @param is_entry
- * If TRUE, then this is an entry.
- * If FALSE, then this is an exit.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
- *
- * F_output_not (with error bit) if setting is NULL.
- */
-#ifndef _di_controller_print_entry_validate_setting_
- extern f_status_t controller_print_entry_validate_setting(fl_print_t * const print, const uint8_t is_entry);
-#endif // _di_controller_print_entry_validate_setting_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _controller_main_print_entry_validate_h
--- /dev/null
+#include "../../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_print_entry_warning_action_failsafe_twice_
+ f_status_t controller_print_entry_warning_action_failsafe_twice(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry) {
+
+ 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%[%QFailsafe may not be specified when running in failsafe, ignoring.%]%r", print->to, f_string_eol_s, print->context, print->prefix, print->context, f_string_eol_s);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_warning_action_failsafe_twice_
+
+#ifndef _di_controller_print_entry_warning_action_multiple_
+ f_status_t controller_print_entry_warning_action_multiple(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%[%QMultiple '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
+ fl_print_format("%[' %r item actions detected; only the first will be used.%]%r", print->to, print->context, is_entry ? controller_entry_s : controller_exit_s, print->context, f_string_eol_s);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_warning_action_multiple_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print entry warning action functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_entry_warning_action_h
+#define _controller_main_print_entry_warning_action_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print warning the "failsafe" entry item action being specified while already in failsafe mode.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_warning_action_failsafe_twice_
+ extern f_status_t controller_print_entry_warning_action_failsafe_twice(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry);
+#endif // _di_controller_print_entry_warning_action_failsafe_twice_
+
+/**
+ * Print warning message about multiple actions for a specified item.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param name
+ * The item name.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_entry_error_cache()
+ */
+#ifndef _di_controller_print_entry_warning_action_multiple_
+ extern f_status_t controller_print_entry_warning_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_entry_warning_action_multiple_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_entry_warning_action_h
--- /dev/null
+#include "../../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_print_entry_warning_setting_unknown_action_
+ f_status_t controller_print_entry_warning_setting_unknown_action(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry) {
+
+ 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 setting '%]", print->to.stream, 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.stream, print->notable, cache->action.name_action, print->notable);
+ fl_print_format(f_string_format_sentence_end_quote_s.string, print->to.stream, print->context, print->context, f_string_eol_s);
+
+ controller_print_entry_error_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_entry_warning_setting_unknown_action_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print entry warning setting functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_entry_warning_setting_h
+#define _controller_main_print_entry_warning_setting_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print a message for when an entry setting action is unknown.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ *
+ * @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_entry_warning_setting_unknown_action_
+ extern f_status_t controller_print_entry_warning_setting_unknown_action(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry);
+#endif // _di_controller_print_entry_warning_setting_unknown_action_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_entry_warning_setting_h
* The status code to process.
* Make sure this has F_status_set_fine() called if the status code has any error or warning bits.
* @param is_entry
- * If TRUE, then this operate as an entry.
- * If FALSE, then this operate as an exit.
+ * If TRUE, then this operates as an entry.
+ * If FALSE, then this operates as an exit.
*
* @return
* F_okay on success.
*
* This does not alter print.custom.setting.state.status.
* @param is_entry
- * If TRUE, then this operate as an entry.
- * If FALSE, then this operate as an exit.
+ * If TRUE, then this operates as an entry.
+ * If FALSE, then this operates as an exit.
*
* @return
* F_okay on success.
* The status code to process.
* Make sure this has F_status_set_fine() called if the status code has any error or warning bits.
* @param is_entry
- * If TRUE, then this operate as an entry.
- * If FALSE, then this operate as an exit.
+ * If TRUE, then this operates as an entry.
+ * If FALSE, then this operates as an exit.
*
* @return
* F_okay on success.
#endif // _di_controller_print_rule_item_error_action_second_
#ifndef _di_controller_print_rule_item_error_action_unknown_
- f_status_t controller_print_rule_item_error_action_unknown(fl_print_t * const print, controller_cache_t * const cache, const f_string_static_t name, const f_number_unsigned_t index) {
+ f_status_t controller_print_rule_item_error_action_unknown(fl_print_t * const print, controller_cache_t * const cache, const f_string_static_t name, const f_string_static_t unknown) {
if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
fl_print_format("%r%[%QRule item action '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_r_single_s.string, print->to, print->notable, name, print->notable);
fl_print_format("%[' has an unknown value '%]", print->to, print->context, print->context);
- fl_print_format(f_string_format_Q_range_single_s.string, print->to, print->notable, cache->buffer_item, cache->content_action.array[index], print->notable);
+ fl_print_format(f_string_format_Q_range_single_s.string, print->to, print->notable, cache->buffer_item, unknown, 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_rule_error_cache(print, cache->action, F_true);
* Must not be NULL.
* @param name
* The parameter name whose value is unknown.
- * @param index
- * The index in the content action cache representing the unknown value.
+ * @param unknown
+ * The unknown value.
*
* @return
* F_okay on success.
* @see controller_unlock_print_flush()
*/
#ifndef _di_controller_print_rule_item_error_action_unknown_
- extern f_status_t controller_print_rule_item_error_action_unknown(fl_print_t * const print, controller_cache_t * const cache, const f_string_static_t name, const f_number_unsigned_t index);
+ extern f_status_t controller_print_rule_item_error_action_unknown(fl_print_t * const print, controller_cache_t * const cache, const f_string_static_t name, const f_string_static_t unknown);
#endif // _di_controller_print_rule_item_error_action_unknown_
/**
item->reruns[type_rerun].is |= rerun_item == &item->reruns[type_rerun].failure ? controller_rule_rerun_is_failure_reset_d : controller_rule_rerun_is_success_reset_d;
}
else {
- controller_print_rule_item_error_action_unknown(&main->program.error, cache, controller_rerun_s, i);
+ controller_print_rule_item_error_action_unknown(&main->program.error, cache, controller_rerun_s, cache->content_action.array[i]);
return F_status_set_error(F_valid_not);
}
item->with &= ~controller_with_session_new_d;
}
else {
- controller_print_rule_item_error_action_unknown(&main->program.error, cache, controller_with_s, i);
+ controller_print_rule_item_error_action_unknown(&main->program.error, cache, controller_with_s, cache->content_action.array[i]);
status = F_status_set_error(F_valid_not);
*status = controller_entry_preprocess(main, F_true);
if ((main->setting.flag & controller_main_flag_simulate_e) && (main->setting.flag & controller_main_flag_validate_e)) {
- controller_print_entry_validate_setting(main, F_true);
+ controller_print_entry_output_setting_validate(main, F_true);
}
}
*status = controller_entry_preprocess(main, F_false);
if ((main->setting.flag & controller_main_flag_simulate_e) && (main->setting.flag & controller_main_flag_validate_e)) {
- controller_print_entry_validate_setting(main, F_false);
+ controller_print_entry_output_setting_validate(main, F_false);
}
}