build_sources_library convert.c instance.c instance/prepare.c instance/wait.c
build_sources_library entry.c entry/action.c entry/preprocess.c entry/process.c entry/setting.c
build_sources_library file.c lock.c path.c process.c
-build_sources_library rule.c rule/action.c rule/execute.c rule/expand.c rule/instance.c rule/is.c rule/item.c rule/parameter.c rule/read.c rule/setting.c rule/validate.c rule/wait.c
+build_sources_library rule.c rule/action.c rule/execute.c rule/expand.c rule/instance.c rule/is.c rule/item.c rule/parameter.c rule/read.c rule/setting.c rule/wait.c
build_sources_library perform.c
build_sources_library print/data.c
build_sources_library print/debug.c print/debug/rule/action.c print/debug/rule/execute.c print/debug/perform/control.c print/debug/perform/pid.c
build_sources_library print/error/perform/pid.c
build_sources_library print/error/rule.c print/error/rule/action.c print/error/rule/item.c print/error/rule/setting.c
build_sources_library print/lock.c print/error/lock.c
-build_sources_library print/output/entry/setting.c print/output/rule/execute.c print/output/rule/setting.c
+build_sources_library print/output/entry/setting.c print/output/rule/execute.c print/output/rule/setting.c print/output/rule/validate.c
build_sources_library print/message.c print/message/entry.c print/message/entry/action.c print/message/entry/item.c
build_sources_library print/verbose.c
build_sources_library print/warning.c print/warning/entry/action.c print/warning/entry/item.c print/warning/entry/setting.c print/warning/rule/action.c print/warning/rule/item.c print/warning/rule/setting.c
build_sources_headers convert.h instance.h instance/prepare.h instance/wait.h
build_sources_headers entry.h entry/action.h entry/preprocess.h entry/process.h entry/setting.h
build_sources_headers file.h lock.h path.h process.h
-build_sources_headers rule.h rule/action.h rule/execute.h rule/expand.h rule/instance.h rule/is.h rule/item.h rule/parameter.h rule/read.h rule/setting.h rule/validate.h rule/wait.h
+build_sources_headers rule.h rule/action.h rule/execute.h rule/expand.h rule/instance.h rule/is.h rule/item.h rule/parameter.h rule/read.h rule/setting.h rule/wait.h
build_sources_headers perform.h
build_sources_headers print/data.h
build_sources_headers print/debug.h print/debug/rule/action.h print/debug/rule/execute.h print/debug/perform/control.h print/debug/perform/pid.h
build_sources_headers print/error/perform/pid.h
build_sources_headers print/error/rule.h print/error/rule/action.h print/error/rule/item.h print/error/rule/setting.h
build_sources_headers print/lock.h print/error/lock.h
-build_sources_headers print/output/entry/setting.h print/output/rule/execute.h print/output/rule/setting.h
+build_sources_headers print/output/entry/setting.h print/output/rule/execute.h print/output/rule/setting.h print/output/rule/validate.h
build_sources_headers print/message.h print/message/entry.h print/message/entry/action.h print/message/entry/item.h
build_sources_headers print/verbose.h
build_sources_headers print/warning.h print/warning/entry/action.h print/warning/entry/item.h print/warning/entry/setting.h print/warning/rule/action.h print/warning/rule/item.h print/warning/rule/setting.h
#include <program/controller/main/print/output/entry/setting.h>
#include <program/controller/main/print/output/rule/execute.h>
#include <program/controller/main/print/output/rule/setting.h>
+#include <program/controller/main/print/output/rule/validate.h>
#include <program/controller/main/print/verbose.h>
#include <program/controller/main/print/warning.h>
#include <program/controller/main/print/warning/entry/action.h>
#include <program/controller/main/rule/parameter.h>
#include <program/controller/main/rule/read.h>
#include <program/controller/main/rule/setting.h>
-#include <program/controller/main/rule/validate.h>
#include <program/controller/main/rule/wait.h>
#include <program/controller/main/process.h>
#include <program/controller/main/validate.h>
fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[1], main->program.error.notable);
fl_print_format("%[' must be a base path name, such as '%]", main->program.error.to, main->program.error.context, main->program.error.context);
fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, main->thread.cache.buffer_path, main->program.error.notable);
- fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
+ 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);
f_file_stream_unlock(main->program.error.to);
}
fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_wait_s, main->program.error.notable);
fl_print_format("%[' but instead has '%]", main->program.error.to, main->program.error.context, main->program.error.context);
fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[j], main->program.error.notable);
- fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
+ 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);
f_file_stream_unlock(main->program.error.to);
}
fl_print_format("%r%[%QThe %r Item Action may not specify the reserved item '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_main_s, main->program.error.notable);
- fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
+ 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);
f_file_stream_unlock(main->program.error.to);
}
fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_stop_s, main->program.error.notable);
fl_print_format("%[' but instead has '%]", main->program.error.to, main->program.error.context, main->program.error.context);
fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[0], main->program.error.notable);
- fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
+ 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);
f_file_stream_unlock(main->program.error.to);
}
break;
}
- if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(main->program.error.to);
-
- fl_print_format("%r%[%QThe %r Item Action parameter '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[1], main->program.error.notable);
- fl_print_format("%[' is not a valid supported number.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
-
- f_file_stream_unlock(main->program.error.to);
- }
+ controller_print_error_entry_action_unsupported_number(&main->program.error, &main->thread.cache.action, entry->flag & controller_entry_flag_is_e, action->parameters.array[1]);
}
}
else {
else {
action->status = controller_status_simplify_error(F_support_not);
- if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(main->program.error.to);
-
- fl_print_format("%r%[%QThe %r Item Action may only have '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_wait_s, main->program.error.notable);
- fl_print_format("%[' but instead has '%]", main->program.error.to, main->program.error.context, main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[0], main->program.error.notable);
- fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
-
- f_file_stream_unlock(main->program.error.to);
- }
+ controller_print_error_entry_action_invalid_allow_1(&main->program.error, &main->thread.cache.action, entry->flag & controller_entry_flag_is_e, action->parameters.array[0], controller_wait_s);
}
}
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_file_found_not) {
- controller_print_error_entry_action_execution_missing(&main->program.error, cache, is_entry, entry_action->parameters.array[0]);
+ controller_print_error_entry_action_execution_missing(&main->program.error, &cache->action, is_entry, entry_action->parameters.array[0]);
}
else {
controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fll_execute_into), F_true);
return F_status_set_error(F_execute);
}
else if (result != 0) {
- controller_print_error_entry_action_execution_failure(&main->program.error, cache, is_entry, result);
+ controller_print_error_entry_action_execution_failure(&main->program.error, &cache->action, is_entry, result);
return F_status_set_error(F_execute);
}
#endif
#ifndef _di_controller_print_error_entry_action_execution_failure_
- f_status_t controller_print_error_entry_action_execution_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const int code) {
+ f_status_t controller_print_error_entry_action_execution_failure(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t is_entry, const int code) {
- if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ 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;
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_error_entry_cache(print, &cache->action, is_entry);
+ controller_print_error_entry_cache(print, action, is_entry);
controller_unlock_print_flush(print->to, &main->thread);
#endif // _di_controller_print_error_entry_action_execution_failure_
#ifndef _di_controller_print_error_entry_action_execution_missing_
- f_status_t controller_print_error_entry_action_execution_missing(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name) {
+ f_status_t controller_print_error_entry_action_execution_missing(fl_print_t * const print, controller_cache_action_t * const action, 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 || !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;
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
- controller_print_error_entry_cache(print, &cache->action, is_entry);
+ controller_print_error_entry_cache(print, action, is_entry);
controller_unlock_print_flush(print->to, &main->thread);
}
#endif // _di_controller_print_error_entry_action_execution_missing_
+#ifndef _di_controller_print_error_entry_action_invalid_allow_1_
+ f_status_t controller_print_error_entry_action_invalid_allow_1(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t is_entry, const f_string_static_t has, const f_string_static_t allow) {
+
+ 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 %r Item Action may only have '%]", 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, allow, print->notable);
+ fl_print_format("%[' but instead has '%]", print->to, print->context, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, has, print->notable);
+ fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
+
+ controller_print_error_entry_cache(print, action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_error_entry_action_invalid_allow_1_
+
+#ifndef _di_controller_print_error_entry_action_invalid_allow_3_
+ f_status_t controller_print_error_entry_action_invalid_allow_3(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t is_entry, const f_string_static_t has, const f_string_static_t allow_1, const f_string_static_t allow_2, const f_string_static_t allow_3) {
+
+ 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 %r Item Action must have one of '%]", 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_r_single_s.string, print->to, print->notable, allow_1, 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, allow_2, 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, allow_3, print->notable);
+ fl_print_format("%[' but instead has '%]", print->to, print->context, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, has, print->notable);
+ fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
+
+ controller_print_error_entry_cache(print, action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_error_entry_action_invalid_allow_3_
+
+#ifndef _di_controller_print_error_entry_action_unsupported_number_
+ f_status_t controller_print_error_entry_action_unsupported_number(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t is_entry, const f_string_static_t has) {
+
+ 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 %r Item Action parameter '%]", 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, has, print->notable);
+ fl_print_format("%[' is not a valid supported number.%]%r", print->to, print->context, print->context, f_string_eol_s);
+
+ controller_print_error_entry_cache(print, action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_error_entry_action_unsupported_number_
+
#ifdef __cplusplus
} // extern "C"
#endif
* This does not alter print.custom.setting.state.status.
*
* Must not be NULL.
- * @param cache
- * The cache.
+ * @param action
+ * The Action cache.
*
* Must not be NULL.
* @param is_entry
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_controller_print_error_entry_action_execution_failure_
- extern f_status_t controller_print_error_entry_action_execution_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const int code);
+ extern f_status_t controller_print_error_entry_action_execution_failure(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t is_entry, const int code);
#endif // _di_controller_print_error_entry_action_execution_failure_
/**
* This does not alter print.custom.setting.state.status.
*
* Must not be NULL.
- * @param cache
- * The cache.
+ * @param action
+ * The Action cache.
*
* Must not be NULL.
* @param is_entry
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_controller_print_error_entry_action_execution_missing_
- extern f_status_t controller_print_error_entry_action_execution_missing(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name);
+ extern f_status_t controller_print_error_entry_action_execution_missing(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t is_entry, const f_string_static_t name);
#endif // _di_controller_print_error_entry_action_execution_missing_
+/**
+ * Print an error when an Item Action only supports a single value and the wrong value is given.
+ *
+ * The one in the function name represents that this only accepts a single value.
+ *
+ * @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 is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param has
+ * The invalid value that is not supported.
+ * @param allow
+ * The allowed value that is supported.
+ *
+ * @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_entry_action_invalid_allow_1_
+ extern f_status_t controller_print_error_entry_action_invalid_allow_1(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t is_entry, const f_string_static_t has, const f_string_static_t allow);
+#endif // _di_controller_print_error_entry_action_invalid_allow_1_
+
+/**
+ * Print an error when an Item Action only supports specific values and the wrong value is given.
+ *
+ * The three in the function name represents that this only accepts one of three named values.
+ *
+ * @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 is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param has
+ * The invalid value that is not supported.
+ * @param allow_1
+ * The first allowed value that is supported.
+ * @param allow_2
+ * The second allowed value that is supported.
+ * @param allow_3
+ * The third allowed value that is supported.
+ *
+ * @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_entry_action_invalid_allow_3_
+ extern f_status_t controller_print_error_entry_action_invalid_allow_3(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t is_entry, const f_string_static_t has, const f_string_static_t allow_1, const f_string_static_t allow_2, const f_string_static_t allow_3);
+#endif // _di_controller_print_error_entry_action_invalid_allow_3_
+
+/**
+ * Print an error when an Item Action is not a valid 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 action
+ * 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 has
+ * The invalid value that is not supported.
+ *
+ * @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_entry_action_unsupported_number_
+ extern f_status_t controller_print_error_entry_action_unsupported_number(fl_print_t * const print, controller_cache_action_t * const action, const uint8_t is_entry, const f_string_static_t has);
+#endif // _di_controller_print_error_entry_action_unsupported_number_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _di_controller_print_error_rule_action_second_
#ifndef _di_controller_print_error_rule_action_type_unsupported_
- f_status_t controller_print_error_rule_action_type_unsupported(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t type) {
+ f_status_t controller_print_error_rule_action_type_unsupported(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t type, const f_string_t message) {
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;
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);
+ fl_print_format("%[' while attempting to %S.%]%r", print->to, print->context, message, print->context, f_string_eol_s);
controller_print_error_rule_cache(print, action, F_true);
* Must not be NULL.
* @param type
* The Action type name.
+ * @param message
+ * A specific message on what is being attempted by the action.
*
* @return
* F_okay on success.
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_controller_print_error_rule_action_type_unsupported_
- extern f_status_t controller_print_error_rule_action_type_unsupported(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t type);
+ extern f_status_t controller_print_error_rule_action_type_unsupported(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t type, const f_string_t message);
#endif // _di_controller_print_error_rule_action_type_unsupported_
/**
string = &f_string_empty_s;
}
- fl_print_format(" %[%r%]", print->to, print->set->important, controller_mode_s, print->set->important, f_string_eol_s);
+ fl_print_format(" %[%r%]", print->to, print->set->important, controller_mode_s, print->set->important);
if (string->used) {
fl_print_format(" %r", print->to, *string);
string = &f_string_empty_s;
}
- fl_print_format(" %[%r%]", print->to, print->set->important, controller_session_s, print->set->important, f_string_eol_s);
+ fl_print_format(" %[%r%]", print->to, print->set->important, controller_session_s, print->set->important);
if (string->used) {
fl_print_format(" %r", print->to, *string, f_string_eol_s);
string = &f_string_empty_s;
}
- fl_print_format(" %[%r%]", print->to, print->set->important, controller_show_s, print->set->important, f_string_eol_s);
+ fl_print_format(" %[%r%]", print->to, print->set->important, controller_show_s, print->set->important);
if (string->used) {
fl_print_format(" %r", print->to, *string, f_string_eol_s);
#ifndef _di_controller_print_entry_output_execute_simulate_
f_status_t controller_print_entry_output_execute_simulate(fl_print_t * const print, controller_instance_t * const instance, const f_string_static_t program, const f_string_statics_t arguments) {
- 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 (!print || !print->custom || !instance) return F_status_set_error(F_output_not);
controller_t * const main = (controller_t *) print->custom;
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print rule execute output functionality.
+ * Provides the print output rule execute functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
controller_lock_print(print->to, &main->thread);
- fl_print_format("%rProcessing Rule Item Action '%[%r%]', adding ", print->to, f_string_eol_s, main->program.context.set.title, name, main->program.context.set.title);
- fl_print_format("'%[%/Q%]' of ", print->to, main->program.context.set.notable, buffer, range_1, main->program.context.set.notable);
- fl_print_format("'%[%/Q%]/", print->to, main->program.context.set.important, buffer, range_2, main->program.context.set.important);
- fl_print_format("%[%/Q%]'.%r", print->to, main->program.context.set.important, buffer, range_3, main->program.context.set.important, f_string_eol_s);
+ fl_print_format("%rProcessing Rule Item Action '%[%r%]', adding ", print->to, f_string_eol_s, print->set->title, name, print->set->title);
+ fl_print_format("'%[%/Q%]' of ", print->to, print->set->notable, buffer, range_1, print->set->notable);
+ fl_print_format("'%[%/Q%]/", print->to, print->set->important, buffer, range_2, print->set->important);
+ fl_print_format("%[%/Q%]'.%r", print->to, print->set->important, buffer, range_3, print->set->important, f_string_eol_s);
controller_unlock_print_flush(print->to, &main->thread);
}
#endif // _di_controller_print_output_rule_execute_setting_simulate_adding_range_3_
+#ifndef _di_controller_print_output_rule_execute_setting_empty_set_
+ f_status_t controller_print_output_rule_execute_setting_empty_set(fl_print_t * const print, const f_string_static_t name) {
+
+ 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 Rule Item Action '%[%Q%]' setting value to an empty set.%r", print->to, f_string_eol_s, print->set->title, name, print->set->title, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_output_rule_execute_setting_empty_set_
+
#ifdef __cplusplus
} // extern "C"
#endif
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print rule setting output functionality.
+ * Provides the print output rule "setting" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
extern f_status_t controller_print_output_rule_execute_setting_simulate_adding_range_3(fl_print_t * const print, const f_string_static_t name, const f_string_static_t buffer, const f_range_t range_1, const f_range_t range_2, const f_range_t range_3);
#endif // _di_controller_print_output_rule_execute_setting_simulate_adding_range_3_
+/**
+ * Print message about processing a Rule Item Action where the setting value is being set to an empty set.
+ *
+ * @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 name
+ * The Rule 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.
+ */
+#ifndef _di_controller_print_output_rule_execute_setting_empty_set_
+ extern f_status_t controller_print_output_rule_execute_setting_empty_set(fl_print_t * const print, const f_string_static_t name);
+#endif // _di_controller_print_output_rule_execute_setting_empty_set_
+
#ifdef __cplusplus
} // extern "C"
#endif
--- /dev/null
+#include "../../../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_output_rule_validate_
+ f_status_t controller_output_rule_validate(fl_print_t * const print, controller_cache_t * const cache, controller_rule_t * const rule, const uint8_t action, const uint8_t options) {
+
+ if (!print || !print->custom || !cache || !rule) return F_status_set_error(F_output_not);
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ f_number_unsigned_t i = 0;
+ f_number_unsigned_t j = 0;
+
+ // Find at least one of the requested action.
+ {
+ bool missing = F_true;
+
+ for (; i < rule->items.used; ++i) {
+
+ for (j = 0; j < rule->items.array[i].actions.used; ++j) {
+
+ if (!action || rule->items.array[i].actions.array[j].type == action) {
+ missing = F_false;
+
+ break;
+ }
+ } // for
+ } // for
+
+ if (missing) {
+ controller_lock_print(print->to, &main->thread);
+
+ if (rule->items.used) {
+ fl_print_format("%rRule '", print->to, f_string_eol_s);
+ fl_print_format("%[%Q%]' has no '", print->to, print->set->title, rule->name, print->set->title);
+ fl_print_format("%[%r%]' action to execute and would '", print->to, print->set->title, controller_convert_rule_action_type_string(action), print->set->title);
+ fl_print_format("%[%r%]' because it is '", print->to, print->set->important, options & controller_instance_option_require_e ? controller_fail_s : controller_succeed_s, print->set->important);
+ fl_print_format("%[%r%]'.%r", print->to, print->set->important, options & controller_instance_option_require_e ? controller_required_s : controller_optional_s, print->set->important, f_string_eol_s);
+ }
+ else {
+ fl_print_format("%rRule '", print->to, f_string_eol_s);
+ fl_print_format("%[%Q%]' has no known '", print->to, print->set->title, rule->name, print->set->title);
+ fl_print_format("%[%r %r%]' (such as ", print->to, print->set->title, controller_rule_s, controller_type_s, print->set->title);
+ fl_print_format("'%[%r%]', ", print->to, print->set->title, controller_command_s, print->set->title);
+ fl_print_format("'%[%r%]', ", print->to, print->set->title, controller_service_s, print->set->title);
+ fl_print_format("'%[%r%]', or ", print->to, print->set->title, controller_script_s, print->set->title);
+ fl_print_format("'%[%r%]'", print->to, print->set->title, controller_utility_s, print->set->title);
+ fl_print_format(") and would '%[%r%]' because it is '", print->to, print->set->important, options & controller_instance_option_require_e ? controller_fail_s : controller_succeed_s, print->set->important);
+ fl_print_format("%[%r%]'.%r", print->to, print->set->important, options & controller_instance_option_require_e ? controller_required_s : controller_optional_s, print->set->important, f_string_eol_s);
+ }
+
+ controller_unlock_print_flush(print->to, &main->thread);
+ }
+ }
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%rRule %[%Q%] {%r", print->to, f_string_eol_s, print->set->title, rule->alias, print->set->title, f_string_eol_s);
+
+ // Name.
+ fl_print_format(" %[%r%] %Q%r", print->to, print->set->important, controller_name_s, print->set->important, rule->name, f_string_eol_s);
+
+ // Capability.
+ fl_print_format(" %[%r%] ", print->to, print->set->important, controller_capability_s, print->set->important);
+
+ if (f_capability_supported()) {
+ if (rule->capability) {
+ cache->action.generic.used = 0;
+
+ if (F_status_is_error_not(f_capability_to_text(rule->capability, &cache->action.generic))) {
+ f_print_dynamic_safely(cache->action.generic, print->to);
+ }
+ }
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+ }
+ else {
+ fl_print_format("%[(unsupported)%]%r", print->to, print->set->warning, print->set->warning, f_string_eol_s);
+ }
+
+ // Control Group.
+ fl_print_format(" %[%r%]", print->to, print->set->important, controller_cgroup_s, print->set->important);
+
+ if (rule->has & controller_rule_has_cgroup_d) {
+ fl_print_format(" %r", print->to, rule->cgroup.as_new ? controller_new_s : controller_existing_s);
+
+ for (i = 0; i < rule->cgroup.groups.used; ++i) {
+
+ if (rule->cgroup.groups.array[i].used) {
+ fl_print_format(" %Q", print->to, rule->cgroup.groups.array[i]);
+ }
+ } // for
+ }
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ // How.
+ fl_print_format(" %[%r%] %r%r", print->to, print->set->important, controller_how_s, print->set->important, options & controller_instance_option_asynchronous_e ? controller_asynchronous_s : controller_synchronous_s, f_string_eol_s);
+
+ // Nice.
+ fl_print_format(" %[%r%]", print->to, print->set->important, controller_nice_s, print->set->important);
+
+ if (rule->has & controller_rule_has_nice_d) {
+ fl_print_format(" %i", print->to, rule->nice);
+ }
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ // Scheduler.
+ fl_print_format(" %[%r%]", print->to, print->set->important, controller_scheduler_s, print->set->important);
+
+ if (rule->has & controller_rule_has_scheduler_d) {
+ f_string_static_t policy = f_string_static_t_initialize;
+
+ if (rule->scheduler.policy == SCHED_BATCH) {
+ policy = controller_batch_s;
+ }
+ else if (rule->scheduler.policy == SCHED_DEADLINE) {
+ policy = controller_deadline_s;
+ }
+ else if (rule->scheduler.policy == SCHED_FIFO) {
+ policy = controller_fifo_s;
+ }
+ else if (rule->scheduler.policy == SCHED_IDLE) {
+ policy = controller_idle_s;
+ }
+ else if (rule->scheduler.policy == SCHED_OTHER) {
+ policy = controller_other_s;
+ }
+ else if (rule->scheduler.policy == SCHED_RR) {
+ policy = controller_round_robin_s;
+ }
+
+ fl_print_format(" %r %i", print->to, policy, rule->scheduler.priority);
+ }
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ // Engine.
+ if (rule->engine_arguments.used) {
+ fl_print_format(" %[%r%] %Q", print->to, print->set->important, controller_engine_s, print->set->important, rule->engine);
+
+ for (i = 0; i < rule->engine_arguments.used; ++i) {
+
+ if (rule->engine_arguments.array[i].used) {
+ fl_print_format(" %Q", print->to, rule->engine_arguments.array[i]);
+ }
+ } // for
+
+ fl_print_format("%r", print->to, f_string_eol_s);
+ }
+ else {
+ fl_print_format(" %[%r%] %Q%r", print->to, print->set->important, controller_engine_s, print->set->important, rule->engine, f_string_eol_s);
+ }
+
+ // User.
+ fl_print_format(" %[%r%]", print->to, print->set->important, controller_user_s, print->set->important);
+
+ if (rule->has & controller_rule_has_user_d) {
+ fl_print_format(" %i", print->to, rule->user);
+ }
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ // Wait.
+ fl_print_format(" %[%r%] %r%r", print->to, print->set->important, controller_wait_s, print->set->important, options & controller_instance_option_wait_e ? controller_yes_s : controller_no_s, f_string_eol_s);
+
+ // Affinity.
+ fl_print_format(" %[%r%] {%r", print->to, print->set->important, controller_affinity_s, print->set->important, f_string_eol_s);
+
+ for (i = 0; i < rule->affinity.used; ++i) {
+ fl_print_format(" %i%r", print->to, rule->affinity.array[i], f_string_eol_s);
+ } // for
+
+ // Define.
+ fl_print_format(" }%r %[%r%] {%r", print->to, f_string_eol_s, print->set->important, controller_define_s, print->set->important, f_string_eol_s);
+
+ for (i = 0; i < rule->define.used; ++i) {
+
+ if (rule->define.array[i].key.used && rule->define.array[i].value.used) {
+ fl_print_format(" %Q %[=%] %Q%r", print->to, rule->define.array[i].key, print->set->important, print->set->important, rule->define.array[i].value, f_string_eol_s);
+ }
+ } // for
+
+ // Environment.
+ fl_print_format(" }%r %[%r%] {%r", print->to, f_string_eol_s, print->set->important, controller_environment_s, print->set->important, f_string_eol_s);
+
+ for (i = 0; i < rule->environment.used; ++i) {
+
+ if (rule->environment.array[i].used) {
+ fl_print_format(" %Q%r", print->to, rule->environment.array[i], f_string_eol_s);
+ }
+ } // for
+
+ fl_print_format(" }%r %[%r%] {%r", print->to, f_string_eol_s, print->set->important, controller_parameter_s, print->set->important, f_string_eol_s);
+
+ // Parameter.
+ for (i = 0; i < rule->parameter.used; ++i) {
+
+ if (rule->parameter.array[i].key.used && rule->parameter.array[i].value.used) {
+ fl_print_format(" %Q %[=%] %Q%r", print->to, rule->parameter.array[i].key, print->set->important, print->set->important, rule->parameter.array[i].value, f_string_eol_s);
+ }
+ } // for
+
+ // Group.
+ fl_print_format(" }%r %[%r%] {%r", print->to, f_string_eol_s, print->set->important, controller_group_s, print->set->important, f_string_eol_s);
+
+ if (rule->has & controller_rule_has_group_d) {
+ fl_print_format(" %i%r", print->to, rule->group, f_string_eol_s);
+
+ for (i = 0; i < rule->groups.used; ++i) {
+ fl_print_format(" %i%r", print->to, rule->groups.array[i], f_string_eol_s);
+ } // for
+ }
+
+ // Limit.
+ fl_print_format(" }%r %[%r%] {%r", print->to, f_string_eol_s, print->set->important, controller_limit_s, print->set->important, f_string_eol_s);
+
+ for (i = 0; i < rule->limits.used; ++i) {
+ fl_print_format(" %Q %[=%] %un %un%r", print->to, controller_rule_setting_limit_type_name(rule->limits.array[i].type), print->set->important, print->set->important, rule->limits.array[i].value.rlim_cur, rule->limits.array[i].value.rlim_max, f_string_eol_s);
+ } // for
+
+ // On.
+ fl_print_format(" }%r %[%r%] {%r", print->to, f_string_eol_s, print->set->important, controller_on_s, print->set->important, f_string_eol_s);
+
+ for (i = 0; i < rule->ons.used; ++i) {
+
+ fl_print_format(" %[%r%] {%r", print->to, print->set->important, controller_action_s, print->set->important, f_string_eol_s);
+
+ {
+ f_string_static_t action = f_string_static_t_initialize;
+
+ if (rule->ons.array[i].action == controller_rule_action_type_freeze_e) {
+ action = controller_freeze_s;
+ }
+ else if (rule->ons.array[i].action == controller_rule_action_type_kill_e) {
+ action = controller_kill_s;
+ }
+ else if (rule->ons.array[i].action == controller_rule_action_type_pause_e) {
+ action = controller_pause_s;
+ }
+ else if (rule->ons.array[i].action == controller_rule_action_type_reload_e) {
+ action = controller_reload_s;
+ }
+ else if (rule->ons.array[i].action == controller_rule_action_type_restart_e) {
+ action = controller_restart_s;
+ }
+ else if (rule->ons.array[i].action == controller_rule_action_type_resume_e) {
+ action = controller_resume_s;
+ }
+ else if (rule->ons.array[i].action == controller_rule_action_type_start_e) {
+ action = controller_start_s;
+ }
+ else if (rule->ons.array[i].action == controller_rule_action_type_stop_e) {
+ action = controller_stop_s;
+ }
+ else if (rule->ons.array[i].action == controller_rule_action_type_thaw_e) {
+ action = controller_thaw_s;
+ }
+
+ fl_print_format(" %[%r%] %r%r", print->to, print->set->important, controller_type_s, print->set->important, action, f_string_eol_s);
+ }
+
+ fl_print_format(" %[%r%] {%r", print->to, print->set->important, controller_need_s, print->set->important, f_string_eol_s);
+
+ for (j = 0; j < rule->ons.array[i].need.used; ++j) {
+
+ if (rule->ons.array[i].need.array[j].used) {
+ fl_print_format(" %Q%r", print->to, rule->ons.array[i].need.array[j], f_string_eol_s);
+ }
+ } // for
+
+ fl_print_format(" }%r %[%r%] {%r", print->to, f_string_eol_s, print->set->important, controller_want_s, print->set->important, f_string_eol_s);
+
+ for (j = 0; j < rule->ons.array[i].want.used; ++j) {
+
+ if (rule->ons.array[i].want.array[j].used) {
+ fl_print_format(" %Q%r", print->to, rule->ons.array[i].want.array[j], f_string_eol_s);
+ }
+ } // for
+
+ fl_print_format(" }%r %[%r%] {%r", print->to, f_string_eol_s, print->set->important, controller_wish_s, print->set->important, f_string_eol_s);
+
+ for (j = 0; j < rule->ons.array[i].wish.used; ++j) {
+
+ if (rule->ons.array[i].wish.array[j].used) {
+ fl_print_format(" %Q%r", print->to, rule->ons.array[i].wish.array[j], f_string_eol_s);
+ }
+ } // for
+
+ fl_print_format(" }%r }%r", print->to, f_string_eol_s, f_string_eol_s);
+ } // for
+
+ fl_print_format(" }%r", print->to, f_string_eol_s);
+
+ // Items.
+ if (rule->items.used) {
+ controller_rule_action_t *action = 0;
+ controller_rule_item_t *item = 0;
+ controller_rule_rerun_item_t *rerun_item = 0;
+
+ f_number_unsigned_t j = 0;
+ f_number_unsigned_t k = 0;
+ f_number_unsigned_t l = 0;
+
+ for (i = 0; i < rule->items.used; ++i) {
+
+ item = &rule->items.array[i];
+
+ fl_print_format(" %[%r%] {%r", print->to, print->set->important, controller_item_s, print->set->important, f_string_eol_s);
+
+ // Type.
+ fl_print_format(" %[%r%] %Q%r", print->to, print->set->important, controller_type_s, print->set->important, controller_convert_rule_item_type_string(item->type), f_string_eol_s);
+
+ // Pid file.
+ fl_print_format(" %[%r%]", print->to, print->set->important, controller_pid_file_s, print->set->important);
+ if (item->pid_file.used) {
+ fl_print_format(" %Q", print->to, item->pid_file);
+ }
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ // With.
+ fl_print_format(" %[%r%]", print->to, print->set->important, controller_with_s, print->set->important);
+ if (item->with & controller_with_full_path_d) {
+ fl_print_format(" %r", print->to, controller_full_path_s);
+ }
+ if (item->with & controller_with_session_new_d) {
+ fl_print_format(" %r", print->to, controller_session_new_s);
+ }
+ if (item->with & controller_with_session_same_d) {
+ fl_print_format(" %r", print->to, controller_session_same_s);
+ }
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ // Actions.
+ for (j = 0; j < item->actions.used; ++j) {
+
+ action = &item->actions.array[j];
+
+ fl_print_format(" %[%r%] {%r", print->to, print->set->important, controller_action_s, print->set->important, f_string_eol_s);
+ fl_print_format(" %[%r%] %r%r", print->to, print->set->important, controller_type_s, print->set->important, controller_convert_rule_action_type_string(action->type), f_string_eol_s);
+
+ if (item->type == controller_rule_item_type_script_e || item->type == controller_rule_item_type_utility_e) {
+ fl_print_format(" %[%r%] {%r", print->to, print->set->important, controller_parameter_s, print->set->important, f_string_eol_s);
+
+ if (action->parameters.used) {
+ if (action->parameters.array[0].used) {
+ f_print_terminated(" ", print->to);
+
+ for (k = 0; k < action->parameters.array[0].used; ++k) {
+
+ if (action->parameters.array[0].string[k] == f_fss_eol_s.string[0]) {
+ if (k + 1 < action->parameters.array[0].used) {
+ fl_print_format("%r ", print->to, f_string_eol_s);
+ }
+ }
+ else {
+ f_print_character_safely(action->parameters.array[0].string[k], print->to);
+ }
+ } // for
+ }
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+ }
+
+ fl_print_format(" }%r", print->to, f_string_eol_s);
+ }
+ else {
+ 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
+ }
+
+ if (action->ikis.used) {
+ fl_print_format(" %[%r%] {%r", print->to, print->set->important, controller_iki_s, print->set->important, f_string_eol_s);
+
+ for (k = 0; k < action->ikis.used; ++k) {
+
+ for (l = 0; l < action->ikis.array[j].vocabulary.used; ++l) {
+
+ fl_print_format(" %[[%]%ul%[]%]", print->to, print->set->important, print->set->important, k, print->set->important, print->set->important);
+ fl_print_format(" %/Q %[:%] %/Q%r", print->to, action->parameters.array[k], action->ikis.array[k].vocabulary.array[l], print->set->important, print->set->important, action->parameters.array[k], action->ikis.array[k].content.array[l], f_string_eol_s);
+ } // for
+ } // for
+
+ fl_print_format(" }%r", print->to, f_string_eol_s);
+ }
+
+ fl_print_format(" }%r", print->to, f_string_eol_s);
+ } // for
+
+ // Rerun.
+ fl_print_format(" %[%r%] {%r", print->to, print->set->important, controller_rerun_s, print->set->important, f_string_eol_s);
+ for (j = 0; j < controller_rule_action_execute_type__enum_size_e; ++j) {
+
+ for (k = 0; k < 2; ++k) {
+ if (!k && (item->reruns[j].is & controller_rule_rerun_is_failure_d)) {
+ rerun_item = &item->reruns[j].failure;
+ }
+ else if (k && (item->reruns[j].is & controller_rule_rerun_is_success_d)) {
+ rerun_item = &item->reruns[j].success;
+ }
+ else {
+ rerun_item = 0;
+ continue;
+ }
+
+ fl_print_format(" %[", print->to, print->set->important);
+ switch (j) {
+ case controller_rule_action_execute_type_freeze_e:
+ f_print_dynamic_raw(controller_freeze_s, print->to);
+ break;
+
+ case controller_rule_action_execute_type_kill_e:
+ f_print_dynamic_raw(controller_kill_s, print->to);
+ break;
+
+ case controller_rule_action_execute_type_pause_e:
+ f_print_dynamic_raw(controller_pause_s, print->to);
+ break;
+
+ case controller_rule_action_execute_type_reload_e:
+ f_print_dynamic_raw(controller_reload_s, print->to);
+ break;
+
+ case controller_rule_action_execute_type_restart_e:
+ f_print_dynamic_raw(controller_restart_s, print->to);
+ break;
+
+ case controller_rule_action_execute_type_resume_e:
+ f_print_dynamic_raw(controller_resume_s, print->to);
+ break;
+
+ case controller_rule_action_execute_type_start_e:
+ f_print_dynamic_raw(controller_start_s, print->to);
+ break;
+
+ case controller_rule_action_execute_type_stop_e:
+ f_print_dynamic_raw(controller_stop_s, print->to);
+ break;
+
+ case controller_rule_action_execute_type_thaw_e:
+ f_print_dynamic_raw(controller_thaw_s, print->to);
+ break;
+
+ default:
+ break;
+ }
+
+ fl_print_format("%] %r", print->to, print->set->important, k ? controller_success_s : controller_failure_s);
+ fl_print_format(" %r %ul %r %ul", print->to, controller_delay_s, rerun_item->delay, controller_max_s, rerun_item->max);
+
+ if (!k && (item->reruns[j].is & controller_rule_rerun_is_failure_reset_d) || k && (item->reruns[j].is & controller_rule_rerun_is_success_reset_d)) {
+ fl_print_format(" %r", print->to, controller_reset_s);
+ }
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+ } // for
+ } // for
+ 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);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_output_rule_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 output rule "validate" functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_output_rule_validate_h
+#define _controller_main_print_output_rule_validate_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Perform a simulated execution of the given rule.
+ *
+ * This simply prints information about the rule.
+ *
+ * This automatically sets the rule's status to F_complete.
+ *
+ * @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 rule
+ * The rule to process.
+ *
+ * Must not be NULL.
+ * @param action
+ * The action to perform based on the action type codes.
+ * @param options
+ * A number using bits to represent specific boolean options.
+ * If no bits set, then operate normally in a synchronous manner.
+ * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
+ * If bit controller_instance_option_asynchronous_e, then run asynchronously.
+ *
+ * @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_output_rule_validate_
+ extern f_status_t controller_output_rule_validate(fl_print_t * const print, controller_cache_t * const cache, controller_rule_t * const rule, const uint8_t action, const uint8_t options);
+#endif // _di_controller_output_rule_validate_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_output_rule_validate_h
break;
default:
- controller_print_error_rule_action_type_unsupported(&main->program.error, &instance->cache.action, controller_convert_rule_action_type_string(instance->action));
+ controller_print_error_rule_action_type_unsupported(&main->program.error, &instance->cache.action, controller_convert_rule_action_type_string(instance->action), "execute rule");
return F_status_set_error(F_parameter);
}
}
if ((instance->options & controller_instance_option_simulate_validate_e) == controller_instance_option_simulate_validate_e) {
- controller_rule_validate(main, &instance->cache, instance->rule, instance->action, instance->options);
+ switch (instance->action) {
+ case controller_rule_action_type_freeze_e:
+ case controller_rule_action_type_kill_e:
+ case controller_rule_action_type_pause_e:
+ case controller_rule_action_type_reload_e:
+ case controller_rule_action_type_restart_e:
+ case controller_rule_action_type_resume_e:
+ case controller_rule_action_type_start_e:
+ case controller_rule_action_type_stop_e:
+ case controller_rule_action_type_thaw_e:
+ controller_output_rule_validate(&main->program.output, &instance->cache, &instance->rule, instance->action, instance->options);
+
+ break;
+
+ default:
+ controller_print_error_rule_action_type_unsupported(&main->program.error, &instance->cache.action, controller_convert_rule_action_type_string(instance->action), "validate rule execution");
+
+ break;
+ }
}
f_number_unsigned_t i = 0;
controller_print_error_rule_setting_values(&main->program.error, cache, controller_environment_s, i);
}
else {
- if (main->program.error.verbosity == f_console_verbosity_debug_e || (main->program.error.verbosity == f_console_verbosity_verbose_e && (main->setting.flag & controller_main_flag_simulate_e))) {
- controller_lock_print(main->program.output.to, &main->thread);
-
- fl_print_format("%rProcessing Rule Item Action '%[%r%]' setting value to an empty set.%r", main->program.output.to, f_string_eol_s, main->program.context.set.title, controller_environment_s, main->program.context.set.title, f_string_eol_s); // TODO: don't forget to update these as well.
-
- controller_unlock_print_flush(main->program.output.to, &main->thread);
- }
+ controller_print_output_rule_execute_setting_empty_set(&main->program.output, controller_environment_s);
}
continue;
-#include "../controller.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _di_controller_rule_validate_
- void controller_rule_validate(controller_t * const main, controller_cache_t * const cache, const controller_rule_t rule, const uint8_t action, const uint8_t options) {
-
- if (!main || !cache) return;
-
- switch (action) {
- case controller_rule_action_type_freeze_e:
- case controller_rule_action_type_kill_e:
- case controller_rule_action_type_pause_e:
- case controller_rule_action_type_reload_e:
- case controller_rule_action_type_restart_e:
- case controller_rule_action_type_resume_e:
- case controller_rule_action_type_start_e:
- case controller_rule_action_type_stop_e:
- case controller_rule_action_type_thaw_e:
- 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(action), main->program.error.notable);
- fl_print_format("%[' while attempting to validate rule execution.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
-
- controller_print_error_rule_cache(&main->program.error, &cache->action, F_true);
-
- controller_unlock_print_flush(main->program.error.to, &main->thread);
- }
-
- return;
- }
-
- f_number_unsigned_t i = 0;
- f_number_unsigned_t j = 0;
-
- // Find at least one of the requested action.
- {
- bool missing = F_true;
-
- for (; i < rule.items.used; ++i) {
-
- for (j = 0; j < rule.items.array[i].actions.used; ++j) {
-
- if (!action || rule.items.array[i].actions.array[j].type == action) {
- missing = F_false;
-
- break;
- }
- } // for
- } // for
-
- if (missing) {
- controller_lock_print(main->program.output.to, &main->thread);
-
- if (rule.items.used) {
- fl_print_format("%rRule '", main->program.output.to, f_string_eol_s);
- fl_print_format("%[%Q%]' has no '", main->program.output.to, main->program.context.set.title, rule.name, main->program.context.set.title);
- fl_print_format("%[%r%]' action to execute and would '", main->program.output.to, main->program.context.set.title, controller_convert_rule_action_type_string(action), main->program.context.set.title);
- fl_print_format("%[%r%]' because it is '", main->program.output.to, main->program.context.set.important, options & controller_instance_option_require_e ? controller_fail_s : controller_succeed_s, main->program.context.set.important);
- fl_print_format("%[%r%]'.%r", main->program.output.to, main->program.context.set.important, options & controller_instance_option_require_e ? controller_required_s : controller_optional_s, main->program.context.set.important, f_string_eol_s);
- }
- else {
- fl_print_format("%rRule '", main->program.output.to, f_string_eol_s);
- fl_print_format("%[%Q%]' has no known '", main->program.output.to, main->program.context.set.title, rule.name, main->program.context.set.title);
- fl_print_format("%[%r %r%]' (such as ", main->program.output.to, main->program.context.set.title, controller_rule_s, controller_type_s, main->program.context.set.title);
- fl_print_format("'%[%r%]', ", main->program.output.to, main->program.context.set.title, controller_command_s, main->program.context.set.title);
- fl_print_format("'%[%r%]', ", main->program.output.to, main->program.context.set.title, controller_service_s, main->program.context.set.title);
- fl_print_format("'%[%r%]', or ", main->program.output.to, main->program.context.set.title, controller_script_s, main->program.context.set.title);
- fl_print_format("'%[%r%]'", main->program.output.to, main->program.context.set.title, controller_utility_s, main->program.context.set.title);
- fl_print_format(") and would '%[%r%]' because it is '", main->program.output.to, main->program.context.set.important, options & controller_instance_option_require_e ? controller_fail_s : controller_succeed_s, main->program.context.set.important);
- fl_print_format("%[%r%]'.%r", main->program.output.to, main->program.context.set.important, options & controller_instance_option_require_e ? controller_required_s : controller_optional_s, main->program.context.set.important, f_string_eol_s);
- }
-
- controller_unlock_print_flush(main->program.output.to, &main->thread);
- }
- }
-
- controller_lock_print(main->program.output.to, &main->thread);
-
- fl_print_format("%rRule %[%Q%] {%r", main->program.output.to, f_string_eol_s, main->program.context.set.title, rule.alias, main->program.context.set.title, f_string_eol_s);
-
- // Name.
- fl_print_format(" %[%r%] %Q%r", main->program.output.to, main->program.context.set.important, controller_name_s, main->program.context.set.important, rule.name, f_string_eol_s);
-
- // Capability.
- fl_print_format(" %[%r%] ", main->program.output.to, main->program.context.set.important, controller_capability_s, main->program.context.set.important);
-
- if (f_capability_supported()) {
- if (rule.capability) {
- cache->action.generic.used = 0;
-
- if (F_status_is_error_not(f_capability_to_text(rule.capability, &cache->action.generic))) {
- f_print_dynamic_safely(cache->action.generic, main->program.output.to);
- }
- }
-
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
- }
- else {
- fl_print_format("%[(unsupported)%]%r", main->program.output.to, main->program.context.set.warning, main->program.context.set.warning, f_string_eol_s);
- }
-
- // Control Group.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_cgroup_s, main->program.context.set.important);
-
- if (rule.has & controller_rule_has_cgroup_d) {
- fl_print_format(" %r", main->program.output.to, rule.cgroup.as_new ? controller_new_s : controller_existing_s);
-
- for (i = 0; i < rule.cgroup.groups.used; ++i) {
-
- if (rule.cgroup.groups.array[i].used) {
- fl_print_format(" %Q", main->program.output.to, rule.cgroup.groups.array[i]);
- }
- } // for
- }
-
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
-
- // How.
- fl_print_format(" %[%r%] %r%r", main->program.output.to, main->program.context.set.important, controller_how_s, main->program.context.set.important, options & controller_instance_option_asynchronous_e ? controller_asynchronous_s : controller_synchronous_s, f_string_eol_s);
-
- // Nice.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_nice_s, main->program.context.set.important);
-
- if (rule.has & controller_rule_has_nice_d) {
- fl_print_format(" %i", main->program.output.to, rule.nice);
- }
-
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
-
- // Scheduler.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_scheduler_s, main->program.context.set.important);
-
- if (rule.has & controller_rule_has_scheduler_d) {
- f_string_static_t policy = f_string_static_t_initialize;
-
- if (rule.scheduler.policy == SCHED_BATCH) {
- policy = controller_batch_s;
- }
- else if (rule.scheduler.policy == SCHED_DEADLINE) {
- policy = controller_deadline_s;
- }
- else if (rule.scheduler.policy == SCHED_FIFO) {
- policy = controller_fifo_s;
- }
- else if (rule.scheduler.policy == SCHED_IDLE) {
- policy = controller_idle_s;
- }
- else if (rule.scheduler.policy == SCHED_OTHER) {
- policy = controller_other_s;
- }
- else if (rule.scheduler.policy == SCHED_RR) {
- policy = controller_round_robin_s;
- }
-
- fl_print_format(" %r %i", main->program.output.to, policy, rule.scheduler.priority);
- }
-
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
-
- // Engine.
- if (rule.engine_arguments.used) {
- fl_print_format(" %[%r%] %Q", main->program.output.to, main->program.context.set.important, controller_engine_s, main->program.context.set.important, rule.engine);
-
- for (i = 0; i < rule.engine_arguments.used; ++i) {
-
- if (rule.engine_arguments.array[i].used) {
- fl_print_format(" %Q", main->program.output.to, rule.engine_arguments.array[i]);
- }
- } // for
-
- fl_print_format("%r", main->program.output.to, f_string_eol_s);
- }
- else {
- fl_print_format(" %[%r%] %Q%r", main->program.output.to, main->program.context.set.important, controller_engine_s, main->program.context.set.important, rule.engine, f_string_eol_s);
- }
-
- // User.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_user_s, main->program.context.set.important);
-
- if (rule.has & controller_rule_has_user_d) {
- fl_print_format(" %i", main->program.output.to, rule.user);
- }
-
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
-
- // Wait.
- fl_print_format(" %[%r%] %r%r", main->program.output.to, main->program.context.set.important, controller_wait_s, main->program.context.set.important, options & controller_instance_option_wait_e ? controller_yes_s : controller_no_s, f_string_eol_s);
-
- // Affinity.
- fl_print_format(" %[%r%] {%r", main->program.output.to, main->program.context.set.important, controller_affinity_s, main->program.context.set.important, f_string_eol_s);
-
- for (i = 0; i < rule.affinity.used; ++i) {
- fl_print_format(" %i%r", main->program.output.to, rule.affinity.array[i], f_string_eol_s);
- } // for
-
- // Define.
- fl_print_format(" }%r %[%r%] {%r", main->program.output.to, f_string_eol_s, main->program.context.set.important, controller_define_s, main->program.context.set.important, f_string_eol_s);
-
- for (i = 0; i < rule.define.used; ++i) {
-
- if (rule.define.array[i].key.used && rule.define.array[i].value.used) {
- fl_print_format(" %Q %[=%] %Q%r", main->program.output.to, rule.define.array[i].key, main->program.context.set.important, main->program.context.set.important, rule.define.array[i].value, f_string_eol_s);
- }
- } // for
-
- // Environment.
- fl_print_format(" }%r %[%r%] {%r", main->program.output.to, f_string_eol_s, main->program.context.set.important, controller_environment_s, main->program.context.set.important, f_string_eol_s);
-
- for (i = 0; i < rule.environment.used; ++i) {
-
- if (rule.environment.array[i].used) {
- fl_print_format(" %Q%r", main->program.output.to, rule.environment.array[i], f_string_eol_s);
- }
- } // for
-
- fl_print_format(" }%r %[%r%] {%r", main->program.output.to, f_string_eol_s, main->program.context.set.important, controller_parameter_s, main->program.context.set.important, f_string_eol_s);
-
- // Parameter.
- for (i = 0; i < rule.parameter.used; ++i) {
-
- if (rule.parameter.array[i].key.used && rule.parameter.array[i].value.used) {
- fl_print_format(" %Q %[=%] %Q%r", main->program.output.to, rule.parameter.array[i].key, main->program.context.set.important, main->program.context.set.important, rule.parameter.array[i].value, f_string_eol_s);
- }
- } // for
-
- // Group.
- fl_print_format(" }%r %[%r%] {%r", main->program.output.to, f_string_eol_s, main->program.context.set.important, controller_group_s, main->program.context.set.important, f_string_eol_s);
-
- if (rule.has & controller_rule_has_group_d) {
- fl_print_format(" %i%r", main->program.output.to, rule.group, f_string_eol_s);
-
- for (i = 0; i < rule.groups.used; ++i) {
- fl_print_format(" %i%r", main->program.output.to, rule.groups.array[i], f_string_eol_s);
- } // for
- }
-
- // Limit.
- fl_print_format(" }%r %[%r%] {%r", main->program.output.to, f_string_eol_s, main->program.context.set.important, controller_limit_s, main->program.context.set.important, f_string_eol_s);
-
- for (i = 0; i < rule.limits.used; ++i) {
- fl_print_format(" %Q %[=%] %un %un%r", main->program.output.to, controller_rule_setting_limit_type_name(rule.limits.array[i].type), main->program.context.set.important, main->program.context.set.important, rule.limits.array[i].value.rlim_cur, rule.limits.array[i].value.rlim_max, f_string_eol_s);
- } // for
-
- // On.
- fl_print_format(" }%r %[%r%] {%r", main->program.output.to, f_string_eol_s, main->program.context.set.important, controller_on_s, main->program.context.set.important, f_string_eol_s);
-
- for (i = 0; i < rule.ons.used; ++i) {
-
- 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);
-
- {
- f_string_static_t action = f_string_static_t_initialize;
-
- if (rule.ons.array[i].action == controller_rule_action_type_freeze_e) {
- action = controller_freeze_s;
- }
- else if (rule.ons.array[i].action == controller_rule_action_type_kill_e) {
- action = controller_kill_s;
- }
- else if (rule.ons.array[i].action == controller_rule_action_type_pause_e) {
- action = controller_pause_s;
- }
- else if (rule.ons.array[i].action == controller_rule_action_type_reload_e) {
- action = controller_reload_s;
- }
- else if (rule.ons.array[i].action == controller_rule_action_type_restart_e) {
- action = controller_restart_s;
- }
- else if (rule.ons.array[i].action == controller_rule_action_type_resume_e) {
- action = controller_resume_s;
- }
- else if (rule.ons.array[i].action == controller_rule_action_type_start_e) {
- action = controller_start_s;
- }
- else if (rule.ons.array[i].action == controller_rule_action_type_stop_e) {
- action = controller_stop_s;
- }
- else if (rule.ons.array[i].action == controller_rule_action_type_thaw_e) {
- action = controller_thaw_s;
- }
-
- fl_print_format(" %[%r%] %r%r", main->program.output.to, main->program.context.set.important, controller_type_s, main->program.context.set.important, action, f_string_eol_s);
- }
-
- fl_print_format(" %[%r%] {%r", main->program.output.to, main->program.context.set.important, controller_need_s, main->program.context.set.important, f_string_eol_s);
-
- for (j = 0; j < rule.ons.array[i].need.used; ++j) {
-
- if (rule.ons.array[i].need.array[j].used) {
- fl_print_format(" %Q%r", main->program.output.to, rule.ons.array[i].need.array[j], f_string_eol_s);
- }
- } // for
-
- fl_print_format(" }%r %[%r%] {%r", main->program.output.to, f_string_eol_s, main->program.context.set.important, controller_want_s, main->program.context.set.important, f_string_eol_s);
-
- for (j = 0; j < rule.ons.array[i].want.used; ++j) {
-
- if (rule.ons.array[i].want.array[j].used) {
- fl_print_format(" %Q%r", main->program.output.to, rule.ons.array[i].want.array[j], f_string_eol_s);
- }
- } // for
-
- fl_print_format(" }%r %[%r%] {%r", main->program.output.to, f_string_eol_s, main->program.context.set.important, controller_wish_s, main->program.context.set.important, f_string_eol_s);
-
- for (j = 0; j < rule.ons.array[i].wish.used; ++j) {
-
- if (rule.ons.array[i].wish.array[j].used) {
- fl_print_format(" %Q%r", main->program.output.to, rule.ons.array[i].wish.array[j], f_string_eol_s);
- }
- } // for
-
- fl_print_format(" }%r }%r", main->program.output.to, f_string_eol_s, f_string_eol_s);
- } // for
-
- fl_print_format(" }%r", main->program.output.to, f_string_eol_s);
-
- // Items.
- if (rule.items.used) {
- controller_rule_action_t *action = 0;
- controller_rule_item_t *item = 0;
- controller_rule_rerun_item_t *rerun_item = 0;
-
- f_number_unsigned_t j = 0;
- f_number_unsigned_t k = 0;
- f_number_unsigned_t l = 0;
-
- for (i = 0; i < rule.items.used; ++i) {
-
- item = &rule.items.array[i];
-
- fl_print_format(" %[%r%] {%r", main->program.output.to, main->program.context.set.important, controller_item_s, main->program.context.set.important, f_string_eol_s);
-
- // Type.
- fl_print_format(" %[%r%] %Q%r", main->program.output.to, main->program.context.set.important, controller_type_s, main->program.context.set.important, controller_convert_rule_item_type_string(item->type), 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 (item->pid_file.used) {
- fl_print_format(" %Q", main->program.output.to, item->pid_file);
- }
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
-
- // With.
- fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_with_s, main->program.context.set.important);
- if (item->with & controller_with_full_path_d) {
- fl_print_format(" %r", main->program.output.to, controller_full_path_s);
- }
- if (item->with & controller_with_session_new_d) {
- fl_print_format(" %r", main->program.output.to, controller_session_new_s);
- }
- if (item->with & controller_with_session_same_d) {
- fl_print_format(" %r", main->program.output.to, controller_session_same_s);
- }
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
-
- // Actions.
- for (j = 0; j < item->actions.used; ++j) {
-
- action = &item->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);
- fl_print_format(" %[%r%] %r%r", main->program.output.to, main->program.context.set.important, controller_type_s, main->program.context.set.important, controller_convert_rule_action_type_string(action->type), f_string_eol_s);
-
- if (item->type == controller_rule_item_type_script_e || item->type == controller_rule_item_type_utility_e) {
- 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);
-
- if (action->parameters.used) {
- if (action->parameters.array[0].used) {
- f_print_terminated(" ", main->program.output.to);
-
- for (k = 0; k < action->parameters.array[0].used; ++k) {
-
- if (action->parameters.array[0].string[k] == f_fss_eol_s.string[0]) {
- if (k + 1 < action->parameters.array[0].used) {
- fl_print_format("%r ", main->program.output.to, f_string_eol_s);
- }
- }
- else {
- f_print_character_safely(action->parameters.array[0].string[k], main->program.output.to);
- }
- } // for
- }
-
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
- }
-
- fl_print_format(" }%r", main->program.output.to, f_string_eol_s);
- }
- else {
- 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
- }
-
- if (action->ikis.used) {
- fl_print_format(" %[%r%] {%r", main->program.output.to, main->program.context.set.important, controller_iki_s, main->program.context.set.important, f_string_eol_s);
-
- for (k = 0; k < action->ikis.used; ++k) {
-
- for (l = 0; l < action->ikis.array[j].vocabulary.used; ++l) {
-
- fl_print_format(" %[[%]%ul%[]%]", main->program.output.to, main->program.context.set.important, main->program.context.set.important, k, main->program.context.set.important, main->program.context.set.important);
- fl_print_format(" %/Q %[:%] %/Q%r", main->program.output.to, action->parameters.array[k], action->ikis.array[k].vocabulary.array[l], main->program.context.set.important, main->program.context.set.important, action->parameters.array[k], action->ikis.array[k].content.array[l], f_string_eol_s);
- } // for
- } // 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);
- } // for
-
- // Rerun.
- fl_print_format(" %[%r%] {%r", main->program.output.to, main->program.context.set.important, controller_rerun_s, main->program.context.set.important, f_string_eol_s);
- for (j = 0; j < controller_rule_action_execute_type__enum_size_e; ++j) {
-
- for (k = 0; k < 2; ++k) {
- if (!k && (item->reruns[j].is & controller_rule_rerun_is_failure_d)) {
- rerun_item = &item->reruns[j].failure;
- }
- else if (k && (item->reruns[j].is & controller_rule_rerun_is_success_d)) {
- rerun_item = &item->reruns[j].success;
- }
- else {
- rerun_item = 0;
- continue;
- }
-
- fl_print_format(" %[", main->program.output.to, main->program.context.set.important);
- switch (j) {
- case controller_rule_action_execute_type_freeze_e:
- f_print_dynamic_raw(controller_freeze_s, main->program.output.to);
- break;
-
- case controller_rule_action_execute_type_kill_e:
- f_print_dynamic_raw(controller_kill_s, main->program.output.to);
- break;
-
- case controller_rule_action_execute_type_pause_e:
- f_print_dynamic_raw(controller_pause_s, main->program.output.to);
- break;
-
- case controller_rule_action_execute_type_reload_e:
- f_print_dynamic_raw(controller_reload_s, main->program.output.to);
- break;
-
- case controller_rule_action_execute_type_restart_e:
- f_print_dynamic_raw(controller_restart_s, main->program.output.to);
- break;
-
- case controller_rule_action_execute_type_resume_e:
- f_print_dynamic_raw(controller_resume_s, main->program.output.to);
- break;
-
- case controller_rule_action_execute_type_start_e:
- f_print_dynamic_raw(controller_start_s, main->program.output.to);
- break;
-
- case controller_rule_action_execute_type_stop_e:
- f_print_dynamic_raw(controller_stop_s, main->program.output.to);
- break;
-
- case controller_rule_action_execute_type_thaw_e:
- f_print_dynamic_raw(controller_thaw_s, main->program.output.to);
- break;
-
- default:
- break;
- }
-
- fl_print_format("%] %r", main->program.output.to, main->program.context.set.important, k ? controller_success_s : controller_failure_s);
- fl_print_format(" %r %ul %r %ul", main->program.output.to, controller_delay_s, rerun_item->delay, controller_max_s, rerun_item->max);
-
- if (!k && (item->reruns[j].is & controller_rule_rerun_is_failure_reset_d) || k && (item->reruns[j].is & controller_rule_rerun_is_success_reset_d)) {
- fl_print_format(" %r", main->program.output.to, controller_reset_s);
- }
-
- f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
- } // for
- } // 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);
- } // for
- }
-
- fl_print_format("}%r", main->program.output.to, f_string_eol_s);
-
- controller_unlock_print_flush(main->program.output.to, &main->thread);
- }
-#endif // _di_controller_rule_validate_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-/**
- * FLL - Level 3
- *
- * Project: Controller
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Provides the rule "validate" functionality.
- *
- * This is auto-included and should not need to be explicitly included.
- */
-#ifndef _controller_main_rule_validate_h
-#define _controller_main_rule_validate_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Perform a simulated execution of the given rule.
- *
- * This simply prints information about the rule.
- *
- * This automatically sets the rule's status to F_complete.
- *
- * @param main
- * The main program data.
- *
- * Must not be NULL.
- *
- * This does not alter main.setting.state.status.
- * @param rule
- * The rule to process.
- * @param action
- * The action to perform based on the action type codes.
- * @param options
- * A number using bits to represent specific boolean options.
- * If no bits set, then operate normally in a synchronous manner.
- * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
- * If bit controller_instance_option_asynchronous_e, then run asynchronously.
- * @param cache
- * A structure for containing and caching relevant data.
- */
-#ifndef _di_controller_rule_validate_
- extern void controller_rule_validate(controller_t * const main, controller_cache_t * const cache, const controller_rule_t rule, const uint8_t action, const uint8_t options);
-#endif // _di_controller_rule_validate_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _controller_main_rule_validate_h