#ifndef _di_controller_print_error_lock_critical_
f_status_t controller_print_error_lock_critical(fl_print_t * const print, const f_status_t status, const uint8_t is_read) {
- // A signal is not an error.
if (!print || !print->custom) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e || status == F_interrupt) return F_output_not;
* This requires print.custom to be controller_t.
*
* This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
* @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.
}
#endif // _di_controller_print_error_rule_cache_
+#ifndef _di_controller_print_error_rule_stack_already_
+ f_status_t controller_print_error_rule_stack_already(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t name, const uint8_t item) {
+
+ if (!print || !print->custom || !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 rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
+ fl_print_format("%[' is already on the execution dependency stack, this recursion is prohibited.%]%r", print->to, print->context, print->context, f_string_eol_s);
+
+ controller_print_error_rule_cache(print, action, item);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_error_rule_stack_already_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern f_status_t controller_print_error_rule_cache(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t item);
#endif // _di_controller_print_error_rule_cache_
+/**
+ * Print error regarding the rule already being on the execution stack.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param action
+ * The action cache.
+ *
+ * Must not be NULL.
+ * @param name
+ * The rule name.
+ * @param item
+ * If TRUE, then this error is associated with an item.
+ * If FALSE, then this error is associated with a rule setting.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ */
+#ifndef _di_controller_print_error_rule_stack_already_
+ extern f_status_t controller_print_error_rule_stack_already(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t name, const uint8_t item);
+#endif // _di_controller_print_error_rule_stack_already_
+
#ifdef __cplusplus
} // extern "C"
#endif
#ifndef _di_controller_print_error_rule_action_missing_pid_
f_status_t controller_print_error_rule_action_missing_pid(fl_print_t * const print, const f_string_static_t alias) {
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, alias, print->notable);
fl_print_format("%[' is not designating a pid file.%]%r", 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_error_rule_action_missing_pid_
+#ifndef _di_controller_print_error_rule_action_type_supported_not_
+ f_status_t controller_print_error_rule_action_type_supported_not(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t type) {
+
+ if (!print || !print->custom || !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%[%QUnsupported action type '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, type, print->notable);
+ fl_print_format("%[' while attempting to execute rule.%]%r", print->to, print->context, print->context, f_string_eol_s);
+
+ controller_print_error_rule_cache(print, action, F_true);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_error_rule_action_type_supported_not_
+
+#ifndef _di_controller_print_error_rule_action_unknown_execute_
+ f_status_t controller_print_error_rule_action_unknown_execute(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t name, const f_string_static_t type, 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;
+
+ controller_lock_print(print->to, &main->thread);
+
+ if (total) {
+ fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
+ fl_print_format("%[' has no '%]", print->to, print->context, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, type, print->notable);
+ fl_print_format("%[' action to execute.%]%r", print->to, print->context, print->context, f_string_eol_s);
+ }
+ else {
+ fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
+ fl_print_format("%[ has no known '%]", print->to, print->context, print->context);
+ fl_print_format("%[%r %r%]", print->to, print->notable, controller_rule_s, controller_type_s, print->notable);
+ fl_print_format("%[' (such as '%]", print->to, print->context, print->context);
+ fl_print_format(f_string_format_r_single_s.string, print->to, print->notable, controller_command_s, print->notable);
+ fl_print_format("%[', '%]", print->to, print->context, print->context);
+ fl_print_format(f_string_format_r_single_s.string, print->to, print->notable, controller_service_s, print->notable);
+ fl_print_format("%[', '%]", print->to, print->context, print->context);
+ fl_print_format(f_string_format_r_single_s.string, print->to, print->notable, controller_script_s, print->notable);
+ fl_print_format("%[', or '%]", print->to, print->context, print->context);
+ fl_print_format(f_string_format_r_single_s.string, print->to, print->notable, controller_utility_s, print->notable);
+ fl_print_format("%[') to execute.%]%r", print->to, print->context, print->context, f_string_eol_s);
+ }
+
+ controller_print_error_rule_cache(print, action, F_true);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_error_rule_action_unknown_execute_
+
#ifdef __cplusplus
} // extern "C"
#endif
* Print an error or warning message about some rule not having the pid file information.
*
* @param print
- * The error or warning output structure.
+ * 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 alias
* The rule alias of the rule that is missing the pid file designation.
*
extern f_status_t controller_print_error_rule_action_missing_pid(fl_print_t * const print, const f_string_static_t alias);
#endif // _di_controller_print_error_rule_action_missing_pid_
+/**
+ * Print an error about Rule Action type 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 action
+ * The action cache.
+ *
+ * Must not be NULL.
+ * @param type
+ * The Action type 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_error_rule_action_type_supported_not_
+ extern f_status_t controller_print_error_rule_action_type_supported_not(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t type);
+#endif // _di_controller_print_error_rule_action_type_supported_not_
+
+/**
+ * Print an error about Rule Action type 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 action
+ * The action cache.
+ *
+ * Must not be NULL.
+ * @param name
+ * The Rule name.
+ * @param type
+ * The Action type 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_error_rule_action_unknown_execute_
+ extern f_status_t controller_print_error_rule_action_unknown_execute(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t name, const f_string_static_t type, const f_number_unsigned_t total);
+#endif // _di_controller_print_error_rule_action_unknown_execute_
+
#ifdef __cplusplus
} // extern "C"
#endif
#ifndef _di_controller_print_error_rule_item_
f_status_t controller_print_error_rule_item(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t item, const f_status_t status) {
- if (!print || !print->custom || !action) return F_status_set_error(F_output_not);
+ if (!print || !print->custom || !action || status == F_interrupt) 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;
controller_print_error_rule_cache(print, &cache->action, F_true);
controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
}
#endif // _di_controller_print_error_rule_item_action_positive_number_not_
#ifndef _di_controller_print_error_rule_item_need_want_wish_
f_status_t controller_print_error_rule_item_need_want_wish(fl_print_t * const print, const f_string_static_t need_want_wish, const f_string_static_t value, const f_string_t why) {
+ 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 (print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
fl_print_format("%r%[%QThe %r rule '%]", print->to, f_string_eol_s, print->context, print->prefix, need_want_wish, print->context);
#ifndef _di_controller_print_error_rule_item_rule_not_loaded_
f_status_t controller_print_error_rule_item_rule_not_loaded(fl_print_t * const print, const f_string_static_t alias) {
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
break;
default:
- if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
- controller_lock_print(main->program.error.to, &main->thread);
-
- fl_print_format("%r%[%QUnsupported action type '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, controller_convert_rule_action_type_string(instance->action), main->program.error.notable);
- fl_print_format("%[' while attempting to execute rule.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
-
- controller_print_error_rule_cache(&main->program.error, &instance->cache.action, F_true);
-
- controller_unlock_print_flush(main->program.error.to, &main->thread);
- }
+ controller_print_error_rule_action_type_supported_not(&main->program.error, &instance->cache.action, controller_convert_rule_action_type_string(instance->action));
return F_status_set_error(F_parameter);
}
} // for
if (missing) {
- if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
- controller_lock_print(main->program.error.to, &main->thread);
-
- if (instance->rule.items.used) {
- fl_print_format("%r%[%QThe rule '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, instance->rule.name, main->program.error.notable);
- fl_print_format("%[' has no '%]", main->program.error.to, main->program.error.context, main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, controller_convert_rule_action_type_string(instance->action), main->program.error.notable);
- fl_print_format("%[' action to execute.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
- }
- else {
- fl_print_format("%r%[%QThe rule '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, instance->rule.name, main->program.error.notable);
- fl_print_format("%[ has no known '%]", main->program.error.to, main->program.error.context, main->program.error.context);
- fl_print_format("%[%r %r%]", main->program.error.to, main->program.error.notable, controller_rule_s, controller_type_s, main->program.error.notable);
- fl_print_format("%[' (such as '%]", main->program.error.to, main->program.error.context, main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_command_s, main->program.error.notable);
- fl_print_format("%[', '%]", main->program.error.to, main->program.error.context, main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_service_s, main->program.error.notable);
- fl_print_format("%[', '%]", main->program.error.to, main->program.error.context, main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_script_s, main->program.error.notable);
- fl_print_format("%[', or '%]", main->program.error.to, main->program.error.context, main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_utility_s, main->program.error.notable);
- fl_print_format("%[') to execute.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
- }
-
- controller_print_error_rule_cache(&main->program.error, &instance->cache.action, F_true);
-
- controller_unlock_print_flush(main->program.error.to, &main->thread);
- }
-
status = F_status_set_error(F_parameter);
+
+ controller_print_error_rule_action_unknown_execute(&main->program.error, &instance->cache.action, instance->rule.name, controller_convert_rule_action_type_string(instance->action), instance->rule.items.used);
}
}
if (F_status_is_error_not(status)) {
status = controller_rule_execute(main, instance->action, instance->options, instance);
-
- if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) {
- return status;
- }
+ if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) return status;
if (F_status_is_error(status)) {
controller_print_error_rule_item(&main->program.error, &instance->cache.action, F_true, F_status_set_fine(status));
// Update the rule status, which is stored separately from the rule status for this instance.
if (controller_rule_find(instance->rule.alias, main->process.rules, &id_rule) == F_true) {
- controller_rule_t *rule = &main->process.rules.array[id_rule];
+ controller_rule_t * const rule = &main->process.rules.array[id_rule];
rule->status[instance->action] = instance->rule.status[instance->action];
for (f_number_unsigned_t i = 0; i < instance->stack.used && controller_thread_is_enabled_instance(instance); ++i) {
if (instance->stack.array[i] == id_rule) {
- if (instance->main->program.error.verbosity > f_console_verbosity_quiet_e) {
- controller_lock_print(instance->main->program.error.to, &instance->main->thread);
-
- fl_print_format("%r%[%QThe rule '%]", instance->main->program.error.to, f_string_eol_s, instance->main->program.error.context, instance->main->program.error.prefix, instance->main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, instance->main->program.error.to, instance->main->program.error.notable, instance->rule.alias, instance->main->program.error.notable);
- fl_print_format("%[' is already on the execution dependency stack, this recursion is prohibited.%]%r", instance->main->program.error.to, instance->main->program.error.context, instance->main->program.error.context, f_string_eol_s);
-
- controller_print_error_rule_cache(&instance->main->program.error, &instance->cache.action, F_true);
-
- controller_unlock_print_flush(instance->main->program.error.to, &instance->main->thread);
- }
// Never continue on circular recursion errors even in simulate mode.
status = F_status_set_error(F_recurse);
+ controller_print_error_rule_stack_already(&instance->main->program.error, &instance->cache.action, instance->rule.alias, F_true);
+
break;
}
} // for