fll_program_print_help_option(output, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output.");
fll_program_print_help_option(output, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number.");
- fprintf(output.stream, "%c", f_string_eol[0]);
+ fprintf(output.stream, "%c", f_string_eol_s[0]);
fll_program_print_help_option(output, context, controller_short_daemon, controller_long_daemon, f_console_symbol_short_enable, f_console_symbol_long_enable, " Run in daemon only mode (do not process the entry).");
fll_program_print_help_option(output, context, controller_short_interruptable, controller_long_interruptable, f_console_symbol_short_enable, f_console_symbol_long_enable, "Designate that this program can be interrupted.");
data->warning.notable = data->context.set.notable;
}
else {
- data->error.context.before = &fll_error_string_null_s;
- data->error.context.after = &fll_error_string_null_s;
- data->error.notable.before = &fll_error_string_null_s;
- data->error.notable.after = &fll_error_string_null_s;
-
- data->warning.context.before = &fll_error_string_null_s;
- data->warning.context.after = &fll_error_string_null_s;
- data->warning.notable.before = &fll_error_string_null_s;
- data->warning.notable.after = &fll_error_string_null_s;
+ data->context.set.warning.before = &f_color_set_string_null_s;
+ data->context.set.warning.after = &f_color_set_string_null_s;
+ data->context.set.error.before = &f_color_set_string_null_s;
+ data->context.set.error.after = &f_color_set_string_null_s;
+ data->context.set.title.before = &f_color_set_string_null_s;
+ data->context.set.title.after = &f_color_set_string_null_s;
+ data->context.set.notable.before = &f_color_set_string_null_s;
+ data->context.set.notable.after = &f_color_set_string_null_s;
+ data->context.set.important.before = &f_color_set_string_null_s;
+ data->context.set.important.after = &f_color_set_string_null_s;
+ data->context.set.standout.before = &f_color_set_string_null_s;
+ data->context.set.standout.after = &f_color_set_string_null_s;
+ data->context.set.normal.before = &f_color_set_string_null_s;
+ data->context.set.normal.after = &f_color_set_string_null_s;
+ data->context.set.normal_reset.before = &f_color_set_string_null_s;
+ data->context.set.normal_reset.after = &f_color_set_string_null_s;
+
+ data->error.context.before = &f_color_set_string_null_s;
+ data->error.context.after = &f_color_set_string_null_s;
+ data->error.notable.before = &f_color_set_string_null_s;
+ data->error.notable.after = &f_color_set_string_null_s;
+
+ data->warning.context.before = &f_color_set_string_null_s;
+ data->warning.context.after = &f_color_set_string_null_s;
+ data->warning.notable.before = &f_color_set_string_null_s;
+ data->warning.notable.after = &f_color_set_string_null_s;
}
if (F_status_is_error(status)) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
- fprintf(data->error.to.stream, "%c", f_string_eol[0]);
+ fprintf(data->error.to.stream, "%c", f_string_eol_s[0]);
}
controller_delete_data(data);
if (data->parameters[controller_parameter_settings].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fprintf(data->error.to.stream, "%s%sThe parameter '", data->error.context.before->string, data->error.prefix ? data->error.prefix : "");
+ fprintf(data->error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data->error.to.stream, "%s%sThe parameter '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s);
fprintf(data->error.to.stream, "%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, f_console_symbol_long_enable, controller_long_settings, data->error.notable.after->string);
- fprintf(data->error.to.stream, "%s' was specified, but no value was given.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol[0]);
+ fprintf(data->error.to.stream, "%s' was specified, but no value was given.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]);
}
status = F_status_set_error(F_parameter);
if (data->parameters[controller_parameter_pid].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fprintf(data->error.to.stream, "%s%sThe parameter '", data->error.context.before->string, data->error.prefix ? data->error.prefix : "");
+ fprintf(data->error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data->error.to.stream, "%s%sThe parameter '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s);
fprintf(data->error.to.stream, "%s%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, f_console_symbol_long_enable, controller_long_pid, data->error.notable.after->string);
- fprintf(data->error.to.stream, "%s' was specified, but no value was given.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol[0]);
+ fprintf(data->error.to.stream, "%s' was specified, but no value was given.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]);
}
status = F_status_set_error(F_parameter);
}
else {
if (data->warning.verbosity == f_console_verbosity_debug) {
- fprintf(data->warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data->warning.to.stream, "%s%sThe parameter '", data->warning.context.before->string, data->warning.prefix ? data->warning.prefix : "");
+ fprintf(data->warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data->warning.to.stream, "%s%sThe parameter '", data->warning.context.before->string, data->warning.prefix ? data->warning.prefix : f_string_empty_s);
fprintf(data->warning.to.stream, "%s%s%s%s%s", data->warning.context.after->string, data->warning.notable.before->string, f_console_symbol_long_enable, controller_long_pid, data->warning.notable.after->string);
- fprintf(data->warning.to.stream, "%s' must be a file path but instead is an empty string, falling back to the default.%s%c", data->warning.context.before->string, data->warning.context.after->string, f_string_eol[0]);
+ fprintf(data->warning.to.stream, "%s' must be a file path but instead is an empty string, falling back to the default.%s%c", data->warning.context.before->string, data->warning.context.after->string, f_string_eol_s[0]);
}
}
}
if (data->parameters[controller_parameter_validate].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fprintf(data->error.to.stream, "%s%sThe parameter '", data->error.context.before->string, data->error.prefix ? data->error.prefix : "");
+ fprintf(data->error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data->error.to.stream, "%s%sThe parameter '", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s);
fprintf(data->error.to.stream, "%s%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, f_console_symbol_long_enable, controller_long_validate, data->error.notable.after->string);
fprintf(data->error.to.stream, "%s' must not be specified with the parameter '", data->error.context.before->string);
fprintf(data->error.to.stream, "%s%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, f_console_symbol_long_enable, controller_long_daemon, data->error.notable.after->string);
- fprintf(data->error.to.stream, "%s'.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol[0]);
+ fprintf(data->error.to.stream, "%s'.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]);
}
status = F_status_set_error(F_parameter);
if (f_file_exists(setting.path_pid.string) == F_true) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fprintf(data->error.to.stream, "%s%sThe pid file must not already exist.%s%c", data->error.context.before->string, data->error.prefix ? data->error.prefix : "", data->error.context.after->string, f_string_eol[0]);
+ fprintf(data->error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data->error.to.stream, "%s%sThe pid file must not already exist.%s%c", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s, data->error.context.after->string, f_string_eol_s[0]);
}
status = F_status_set_error(F_available_not);
if (f_file_exists(setting.path_pid.string) == F_true) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fprintf(data->error.to.stream, "%s%sThe pid file must not already exist.%s%c", data->error.context.before->string, data->error.prefix ? data->error.prefix : "", data->error.context.after->string, f_string_eol[0]);
+ fprintf(data->error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data->error.to.stream, "%s%sThe pid file must not already exist.%s%c", data->error.context.before->string, data->error.prefix ? data->error.prefix : f_string_empty_s, data->error.context.after->string, f_string_eol_s[0]);
}
status = F_status_set_error(F_available_not);
// ensure a newline is always put at the end of the program execution, unless in quiet mode.
if (data->error.verbosity != f_console_verbosity_quiet) {
if (F_status_is_error(status)) {
- fprintf(data->error.to.stream, "%c", f_string_eol[0]);
+ fprintf(data->error.to.stream, "%c", f_string_eol_s[0]);
}
}
extern "C" {
#endif
+#ifndef _di_controller_entry_action_type_name_
+ f_string_static_t controller_entry_action_type_name(const uint8_t type) {
+
+ f_string_static_t buffer = f_string_static_t_initialize;
+
+ switch (type) {
+ case controller_entry_action_type_consider:
+ buffer.string = controller_string_consider;
+ buffer.used = controller_string_consider_length;
+ break;
+
+ case controller_entry_action_type_failsafe:
+ buffer.string = controller_string_failsafe;
+ buffer.used = controller_string_failsafe_length;
+ break;
+
+ case controller_entry_action_type_item:
+ buffer.string = controller_string_item;
+ buffer.used = controller_string_item_length;
+ break;
+
+ case controller_entry_action_type_ready:
+ buffer.string = controller_string_ready;
+ buffer.used = controller_string_ready_length;
+ break;
+
+ case controller_entry_action_type_rule:
+ buffer.string = controller_string_rule;
+ buffer.used = controller_string_rule_length;
+ break;
+
+ case controller_entry_action_type_timeout:
+ buffer.string = controller_string_timeout;
+ buffer.used = controller_string_timeout_length;
+ break;
+ }
+
+ buffer.size = buffer.used;
+
+ return buffer;
+ }
+#endif // _di_controller_entry_action_type_name_
+
#ifndef _di_controller_entry_actions_increase_by_
f_return_status controller_entry_actions_increase_by(const f_array_length_t amount, controller_entry_actions_t *actions) {
break;
}
- cache->line_action++;
- action->line = cache->line_action;
+ action->line = ++cache->line_action;
status = fl_string_dynamic_rip_nulless(cache->buffer_file, cache->object_actions.array[i], &cache->name_action);
}
else {
if (data.warning.verbosity == f_console_verbosity_debug) {
- fprintf(data.warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data.warning.to.stream, "%s%sUnknown entry item type.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : "", data.warning.context.after->string, f_string_eol[0]);
+ fprintf(data.warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.warning.to.stream, "%s%sUnknown entry item type.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s, data.warning.context.after->string, f_string_eol_s[0]);
controller_entry_error_print(data.warning, *cache);
}
action->status = F_status_set_error(F_parameter);
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe entry item action '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe entry item action '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, cache->name_action.string, data.error.notable.after->string);
fprintf(data.error.to.stream, "%s' requires ", data.error.context.before->string);
if (action->type == controller_entry_action_type_failsafe || action->type == controller_entry_action_type_item) {
fprintf(data.error.to.stream, "%s%s%llu%s", data.error.context.after->string, data.error.notable.before->string, cache->line_action, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s or more parameters.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s or more parameters.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
}
else {
uint8_t parameters = 0;
fprintf(data.error.to.stream, "exactly ", data.error.context.before->string);
fprintf(data.error.to.stream, "%s%s%u%s", data.error.context.after->string, parameters, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s parameters.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s parameters.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
}
}
}
}
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe entry item action must not have an empty string for a path (the first parameter).%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : "", data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe entry item action must not have an empty string for a path (the first parameter).%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s, data.error.context.after->string, f_string_eol_s[0]);
}
}
break;
}
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe entry item action second parameter '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe entry item action second parameter '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, action->parameters.array[1].string, data.error.notable.after->string);
fprintf(data.error.to.stream, "%s' must be a base path name, such as '", data.error.context.before->string);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, cache->buffer_path.string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
}
action->status = F_status_set_error(F_parameter);
}
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe entry item action must not have an empty string for a rule name (the second parameter).%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : "", data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe entry item action must not have an empty string for a rule name (the second parameter).%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s, data.error.context.after->string, f_string_eol_s[0]);
}
}
}
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe entry item action third parameter (and beyond) must be one of '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe entry item action third parameter (and beyond) must be one of '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, controller_string_asynchronous, data.error.notable.after->string);
fprintf(data.error.to.stream, "%s', '", data.error.context.before->string);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, controller_string_require, data.error.notable.after->string);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, controller_string_wait, data.error.notable.after->string);
fprintf(data.error.to.stream, "%s' but instead has '", data.error.context.before->string);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, action->parameters.array[j].string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
}
}
} // for
}
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe entry item action may not specify the reserved item '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe entry item action may not specify the reserved item '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, controller_string_main, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
}
}
}
}
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe entry item action must have one of '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe entry item action must have one of '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, controller_string_kill, data.error.notable.after->string);
fprintf(data.error.to.stream, "%s', '", data.error.context.before->string);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, controller_string_start, data.error.notable.after->string);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, controller_string_stop, data.error.notable.after->string);
fprintf(data.error.to.stream, "%s' but instead has '", data.error.context.before->string);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, action->parameters.array[0].string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
}
}
}
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe entry item action parameter '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe entry item action parameter '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, action->parameters.array[1].string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s' is not a valid supported number.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s' is not a valid supported number.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
}
}
}
void controller_entry_error_print(const fll_error_print_t output, const controller_cache_t cache) {
if (output.verbosity != f_console_verbosity_quiet) {
- fprintf(output.to.stream, "%c", f_string_eol[0]);
- fprintf(output.to.stream, "%s%sWhile processing ", output.context.before->string, output.prefix ? output.prefix : "");
+ fprintf(output.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(output.to.stream, "%s%sWhile processing ", output.context.before->string, output.prefix ? output.prefix : f_string_empty_s);
if (cache.name_action.used) {
fprintf(output.to.stream, "action '");
if (cache.name_file.used) {
fprintf(output.to.stream, "file '");
fprintf(output.to.stream, "%s%s%s%s", output.context.after->string, output.notable.before->string, cache.name_file.string, output.notable.after->string);
- fprintf(output.to.stream, "%s'.%s%c", output.context.before->string, output.context.after->string, f_string_eol[0]);
+ fprintf(output.to.stream, "%s'.%s%c", output.context.before->string, output.context.after->string, f_string_eol_s[0]);
}
}
}
}
else {
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe entry file is empty.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : "", data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe entry file is empty.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s, data.error.context.after->string, f_string_eol_s[0]);
}
status = F_status_set_error(F_data_not);
if (fl_string_dynamic_compare(entry->items.array[j].name, cache->name_item) == F_equal_to) {
if (data.warning.verbosity == f_console_verbosity_debug) {
- fprintf(data.warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data.warning.to.stream, "%s%sIgnoring duplicate entry item '", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : "");
+ fprintf(data.warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.warning.to.stream, "%s%sIgnoring duplicate entry item '", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s);
fprintf(data.warning.to.stream, "%s%s%s%s", data.warning.context.after->string, data.warning.notable.before->string, cache->name_file.string, data.warning.notable.after->string);
- fprintf(data.warning.to.stream, "%s'.%s%c", data.warning.context.before->string, data.warning.context.after->string, f_string_eol[0]);
+ fprintf(data.warning.to.stream, "%s'.%s%c", data.warning.context.before->string, data.warning.context.after->string, f_string_eol_s[0]);
controller_entry_error_print(data.warning, *cache);
}
if (!(code & 0x1)) {
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe required entry item '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe required entry item '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, controller_string_main, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s' was not found.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s' was not found.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
}
status = F_status_set_error(F_found_not);
}
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
fprintf(data.error.to.stream, "The requested entry item '");
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, action->parameters.array[0].string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s' does not exist.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s' does not exist.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
controller_entry_error_print(data.error, *cache);
}
extern "C" {
#endif
+#ifndef _di_controller_rule_action_method_name_
+ f_string_static_t controller_rule_action_method_name(const uint8_t type) {
+
+ f_string_static_t buffer = f_string_static_t_initialize;
+
+ switch (type) {
+ case controller_rule_action_method_extended:
+ buffer.string = controller_rule_action_method_string_extended;
+ buffer.used = controller_rule_action_method_string_extended_length;
+ break;
+
+ case controller_rule_action_method_extended_list:
+ buffer.string = controller_rule_action_method_string_extended_list;
+ buffer.used = controller_rule_action_method_string_extended_list_length;
+ break;
+ }
+
+ buffer.size = buffer.used;
+
+ return buffer;
+ }
+#endif // _di_controller_rule_action_method_name_
+
#ifndef _di_controller_rule_action_read_
f_return_status controller_rule_action_read(const controller_data_t data, const f_string_static_t buffer, f_fss_object_t *object, f_fss_content_t *content, controller_rule_action_t *action) {
f_status_t status = F_none;
}
#endif // _di_controller_rule_action_read_
+#ifndef _di_controller_rule_action_type_name_
+ f_string_static_t controller_rule_action_type_name(const uint8_t type) {
+
+ f_string_static_t buffer = f_string_static_t_initialize;
+
+ switch (type) {
+ case controller_rule_action_type_create:
+ buffer.string = controller_string_create;
+ buffer.used = controller_string_create_length;
+ break;
+
+ case controller_rule_action_type_group:
+ buffer.string = controller_string_group;
+ buffer.used = controller_string_group_length;
+ break;
+
+ case controller_rule_action_type_kill:
+ buffer.string = controller_string_kill;
+ buffer.used = controller_string_kill_length;
+ break;
+
+ case controller_rule_action_type_restart:
+ buffer.string = controller_string_restart;
+ buffer.used = controller_string_restart_length;
+ break;
+
+ case controller_rule_action_type_reload:
+ buffer.string = controller_string_reload;
+ buffer.used = controller_string_reload_length;
+ break;
+
+ case controller_rule_action_type_start:
+ buffer.string = controller_string_start;
+ buffer.used = controller_string_start_length;
+ break;
+
+ case controller_rule_action_type_stop:
+ buffer.string = controller_string_stop;
+ buffer.used = controller_string_stop_length;
+ break;
+
+ case controller_rule_action_type_use:
+ buffer.string = controller_string_use;
+ buffer.used = controller_string_use_length;
+ break;
+
+ case controller_rule_action_type_user:
+ buffer.string = controller_string_user;
+ buffer.used = controller_string_user_length;
+ break;
+ }
+
+ buffer.size = buffer.used;
+
+ return buffer;
+ }
+#endif // _di_controller_rule_action_type_name_
+
#ifndef _di_controller_rule_actions_increase_by_
f_return_status controller_rule_actions_increase_by(const f_array_length_t amount, controller_rule_actions_t *actions) {
break;
}
- actions->array[actions->used].line += item->line;
+ actions->array[actions->used].line += ++item->line;
actions->array[actions->used].parameters.used = 0;
actions->array[actions->used].status = F_known_not;
fll_error_print(data.error, F_status_set_fine(status), "f_fss_count_lines", F_true);
}
else {
- actions->array[0].line += item->line;
+ actions->array[0].line += ++item->line;
actions->array[0].parameters.used = 0;
actions->array[0].status = F_known_not;
if (F_status_is_error_not(status) && status == F_data_not) {
if (data.warning.verbosity == f_console_verbosity_debug) {
- fprintf(data.warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data.warning.to.stream, "%s%sAction is empty, nothing to do.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : "", data.warning.context.after->string, f_string_eol[0]);
+ fprintf(data.warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.warning.to.stream, "%s%sAction is empty, nothing to do.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s, data.warning.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.warning, *cache, F_true);
}
void controller_rule_error_print(const fll_error_print_t output, const controller_cache_t cache, const bool item) {
if (output.verbosity != f_console_verbosity_quiet) {
- fprintf(output.to.stream, "%c", f_string_eol[0]);
- fprintf(output.to.stream, "%s%sWhile processing ", output.context.before->string, output.prefix ? output.prefix : "");
+ fprintf(output.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(output.to.stream, "%s%sWhile processing ", output.context.before->string, output.prefix ? output.prefix : f_string_empty_s);
if (cache.name_action.used) {
fprintf(output.to.stream, "%s '", item ? "action" : "value");
if (cache.name_file.used) {
fprintf(output.to.stream, "file '");
fprintf(output.to.stream, "%s%s%s%s", output.context.after->string, output.notable.before->string, cache.name_file.string, output.notable.after->string);
- fprintf(output.to.stream, "%s'.%s%c", output.context.before->string, output.context.after->string, f_string_eol[0]);
+ fprintf(output.to.stream, "%s'.%s%c", output.context.before->string, output.context.after->string, f_string_eol_s[0]);
}
}
}
#endif // _di_controller_rule_error_print_
+#ifndef _di_controller_rule_execute_
+ f_return_status controller_rule_execute(const controller_data_t data, const controller_cache_t cache, const f_array_length_t index, controller_setting_t *setting) {
+ // @todo
+ }
+#endif // _di_controller_rule_execute_
+
#ifndef _di_controller_rule_find_loaded_
f_array_length_t controller_rule_find_loaded(const controller_data_t data, const controller_setting_t setting, const f_string_static_t rule_id) {
f_array_length_t i = 0;
if (range.start >= range.stop || range.start >= cache->buffer_item.used) {
if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) {
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sUnterminated FSS Extended List at end of rule file.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : "", data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sUnterminated FSS Extended List at end of rule file.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s, data.error.context.after->string, f_string_eol_s[0]);
}
status = F_status_set_error(FL_fss_found_object_content_not);
break;
}
- cache->line_action += item->line;
+ cache->line_action += ++item->line;
cache->name_action.used = 0;
status = fl_string_dynamic_rip_nulless(cache->buffer_item, cache->range_action, &cache->name_action);
}
else {
if (data.warning.verbosity == f_console_verbosity_debug) {
- fprintf(data.warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data.warning.to.stream, "%s%sUnknown rule item action type.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : "", data.warning.context.after->string, f_string_eol[0]);
+ fprintf(data.warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.warning.to.stream, "%s%sUnknown rule item action type.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s, data.warning.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.warning, *cache, F_true);
}
if (multiple) {
if (item->actions.type == controller_rule_action_type_create || item->actions.type == controller_rule_action_type_group || item->actions.type == controller_rule_action_type_use || item->actions.type == controller_rule_action_type_user) {
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sFSS Extended List is not allowed for this rule item action type.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : "", data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sFSS Extended List is not allowed for this rule item action type.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s, data.error.context.after->string, f_string_eol_s[0]);
}
status = F_status_set_error(F_supported_not);
}
#endif // _di_controller_rule_item_read_
+#ifndef _di_controller_rule_item_type_name_
+ f_string_static_t controller_rule_item_type_name(const uint8_t type) {
+
+ f_string_static_t buffer = f_string_static_t_initialize;
+
+ switch (type) {
+ case controller_rule_item_type_command:
+ buffer.string = controller_string_command;
+ buffer.used = controller_string_command_length;
+ break;
+
+ case controller_rule_item_type_script:
+ buffer.string = controller_string_script;
+ buffer.used = controller_string_script_length;
+ break;
+
+ case controller_rule_item_type_service:
+ buffer.string = controller_string_service;
+ buffer.used = controller_string_service_length;
+ break;
+
+ case controller_rule_item_type_setting:
+ buffer.string = controller_string_setting;
+ buffer.used = controller_string_setting_length;
+ break;
+ }
+
+ buffer.size = buffer.used;
+
+ return buffer;
+ }
+#endif // _di_controller_rule_item_type_name_
+
#ifndef _di_controller_rule_items_increase_by_
f_return_status controller_rule_items_increase_by(const f_array_length_t amount, controller_rule_items_t *items) {
}
#endif // _di_controller_rule_items_increase_by_
-#ifndef _di_controller_rule_read_
- f_return_status controller_rule_read(const controller_data_t data, const controller_setting_t setting, const f_string_static_t rule_id, controller_cache_t *cache, controller_rule_t *rule) {
- f_status_t status = F_none;
-
- bool for_item = F_true;
-
- rule->status = F_known_not;
-
- f_macro_time_spec_t_clear(rule->timestamp);
-
- rule->id.used = 0;
- rule->name.used = 0;
-
- rule->define.used = 0;
- rule->parameter.used = 0;
-
- rule->environment.used = 0;
- rule->need.used = 0;
- rule->want.used = 0;
- rule->wish.used = 0;
-
- rule->items.used = 0;
-
- cache->line_item = 0;
- cache->line_action = 0;
-
- cache->range_action.start = 1;
- cache->range_action.stop = 0;
-
- cache->comments.used = 0;
- cache->delimits.used = 0;
-
- cache->buffer_file.used = 0;
- cache->buffer_item.used = 0;
- cache->buffer_path.used = 0;
-
- cache->content_items.used = 0;
-
- cache->object_items.used = 0;
-
- cache->name_action.used = 0;
- cache->name_file.used = 0;
- cache->name_item.used = 0;
-
- status = fl_string_dynamic_append_nulless(rule_id, &rule->id);
-
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true);
- }
- else {
- status = controller_file_load(data, setting, controller_string_rules, rule->id, controller_string_rule, controller_string_rules_length, controller_string_rule_length, cache);
- }
-
- if (F_status_is_error_not(status)) {
- rule->timestamp = cache->timestamp;
-
- if (cache->buffer_file.used) {
- f_string_range_t range = f_macro_string_range_t_initialize(cache->buffer_file.used);
-
- status = fll_fss_basic_list_read(cache->buffer_file, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments);
-
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true);
- }
- else {
- status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file);
-
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true);
- }
- }
- }
- }
-
- if (F_status_is_error_not(status) && cache->object_items.used) {
- status = controller_rule_items_increase_by(cache->object_items.used, &rule->items);
-
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "controller_rule_items_increase_by", F_true);
- }
- else {
- for (f_array_length_t i = 0; i < cache->object_items.used; ++i) {
-
- cache->line_item = 0;
- cache->line_action = 0;
-
- cache->range_action.start = 1;
- cache->range_action.stop = 0;
-
- cache->comments.used = 0;
- cache->delimits.used = 0;
-
- cache->content_action.used = 0;
- cache->content_actions.used = 0;
-
- cache->object_actions.used = 0;
-
- cache->buffer_item.used = 0;
- cache->buffer_path.used = 0;
-
- cache->name_action.used = 0;
- cache->name_item.used = 0;
-
- for_item = F_true;
-
- status = f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->line_item);
-
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "f_fss_count_lines", F_true);
- break;
- }
-
- rule->items.array[rule->items.used].line = cache->line_item;
-
- status = fl_string_dynamic_rip_nulless(cache->buffer_file, cache->object_items.array[i], &cache->name_item);
-
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_rip_nulless", F_true);
- break;
- }
-
- status = fl_string_dynamic_terminate_after(&cache->name_item);
-
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_terminate_after", F_true);
- break;
- }
-
- if (fl_string_dynamic_compare_string(controller_string_settings, cache->name_item, controller_string_settings_length) == F_equal_to) {
- rule->items.array[rule->items.used].type = 0;
- }
- else if (fl_string_dynamic_compare_string(controller_string_command, cache->name_item, controller_string_command_length) == F_equal_to) {
- rule->items.array[rule->items.used].type = controller_rule_item_type_command;
- }
- else if (fl_string_dynamic_compare_string(controller_string_script, cache->name_item, controller_string_script_length) == F_equal_to) {
- rule->items.array[rule->items.used].type = controller_rule_item_type_script;
- }
- else if (fl_string_dynamic_compare_string(controller_string_service, cache->name_item, controller_string_service_length) == F_equal_to) {
- rule->items.array[rule->items.used].type = controller_rule_item_type_service;
- }
- else {
- if (data.warning.verbosity == f_console_verbosity_debug) {
- fprintf(data.warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data.warning.to.stream, "%s%sUnknown rule item type.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : "", data.warning.context.after->string, f_string_eol[0]);
-
- controller_rule_error_print(data.warning, *cache, F_true);
- }
-
- continue;
- }
-
- status = fl_string_dynamic_partial_append(cache->buffer_file, cache->content_items.array[i].array[0], &cache->buffer_item);
-
- if (F_status_is_error(status)) {
- fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_partial_append", F_true);
- break;
- }
-
- if (rule->items.array[rule->items.used].type) {
- status = controller_rule_item_read(data, cache, &rule->items.array[rule->items.used]);
- if (F_status_is_error(status)) break;
-
- rule->items.used++;
- }
- else {
- for_item = F_false;
-
- status = controller_rule_setting_read(data, cache, rule);
-
- if (F_status_is_error(status)) {
- if (F_status_set_fine(status) == F_memory_not || F_status_set_fine(status) == F_memory_allocation || F_status_set_fine(status) == F_memory_reallocation) {
- break;
- }
- }
- }
- } // for
- }
- }
-
- if (F_status_is_error(status)) {
- controller_rule_error_print(data.error, *cache, for_item);
-
- rule->status = controller_status_simplify(F_status_set_fine(status));
- return F_false;
- }
-
- rule->status = F_none;
- return F_true;
- }
-#endif // _di_controller_rule_read_
-
#ifndef _di_controller_rule_process_
f_return_status controller_rule_process(const controller_data_t data, const f_array_length_t index, const bool simulate, controller_setting_t *setting, controller_cache_t *cache) {
if (cache->stack.array[i] == index) {
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe rule '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe rule '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, setting->rules.array[i].name.string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s' is already on the execution stack, this recursion is prohibited.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s' is already on the execution stack, this recursion is prohibited.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.error, *cache, F_true);
}
}
}
- cache->stack.array[cache->stack.used++] = index;
-
cache->name_action.used = 0;
cache->name_item.used = 0;
cache->name_file.used = 0;
return status;
}
+ cache->stack.array[cache->stack.used++] = index;
+
controller_rule_t *rule = &setting->rules.array[index];
{
f_array_length_t k = 0;
f_array_length_t at = 0;
- f_string_dynamics_t *dynamics[] = {
+ f_string_dynamics_t * const dynamics[] = {
&rule->need,
&rule->want,
&rule->wish,
if (i == 0) {
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe needed rule '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe needed rule '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, dynamics[i]->array[j].string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s' was not found.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s' was not found.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.error, *cache, F_true);
}
}
else {
if (data.warning.verbosity == f_console_verbosity_debug) {
- fprintf(data.warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data.warning.to.stream, "%s%sThe %s rule '", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : "", i == 1 ? "wanted" : "wished for");
+ fprintf(data.warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.warning.to.stream, "%s%sThe %s rule '", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s, i == 1 ? "wanted" : "wished for");
fprintf(data.warning.to.stream, "%s%s%s%s", data.warning.context.after->string, data.error.notable.before->string, dynamics[i]->array[j].string, data.warning.notable.after->string);
- fprintf(data.warning.to.stream, "%s' was not found.%s%c", data.warning.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.warning.to.stream, "%s' was not found.%s%c", data.warning.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.warning, *cache, F_true);
}
if (i == 0 || i == 1 || F_status_set_fine(status) == F_memory_not || F_status_set_fine(status) == F_memory_allocation || F_status_set_fine(status) == F_memory_reallocation) {
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe %s rule '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "", i ? "wanted" : "needed");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe %s rule '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s, i ? "wanted" : "needed");
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, dynamics[i]->array[j].string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s' failed during execution.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s' failed during execution.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.error, *cache, F_true);
}
}
else {
if (data.warning.verbosity == f_console_verbosity_debug) {
- fprintf(data.warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data.warning.to.stream, "%s%sThe wished for rule '", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : "");
+ fprintf(data.warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.warning.to.stream, "%s%sThe wished for rule '", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s);
fprintf(data.warning.to.stream, "%s%s%s%s", data.warning.context.after->string, data.error.notable.before->string, dynamics[i]->array[j].string, data.warning.notable.after->string);
- fprintf(data.warning.to.stream, "%s' failed during execution.%s%c", data.warning.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.warning.to.stream, "%s' failed during execution.%s%c", data.warning.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.warning, *cache, F_true);
}
if (i == 0 || i == 1) {
if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe %s rule '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "", i ? "wanted" : "needed");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe %s rule '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s, i ? "wanted" : "needed");
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, dynamics[i]->array[j].string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s' is in a failed state.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s' is in a failed state.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.error, *cache, F_true);
}
}
else {
if (data.warning.verbosity == f_console_verbosity_debug) {
- fprintf(data.warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data.warning.to.stream, "%s%sThe wished for rule '", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : "");
+ fprintf(data.warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.warning.to.stream, "%s%sThe wished for rule '", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s);
fprintf(data.warning.to.stream, "%s%s%s%s", data.warning.context.after->string, data.error.notable.before->string, dynamics[i]->array[j].string, data.warning.notable.after->string);
- fprintf(data.warning.to.stream, "%s' is in a failed state.%s%c", data.warning.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.warning.to.stream, "%s' is in a failed state.%s%c", data.warning.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.warning, *cache, F_true);
}
if (F_status_is_error_not(status)) {
if (simulate) {
- //status = controller_rule_simulate();
+ controller_rule_simulate(data, *cache, index, setting);
}
else {
- //status = controller_rule_execute();
+ status = controller_rule_execute(data, *cache, index, setting);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data.error, F_status_set_fine(status), "controller_rule_execute", F_true);
+ controller_rule_error_print(data.error, *cache, F_true);
+
+ return status;
+ }
}
}
}
#endif // _di_controller_rule_process_
+#ifndef _di_controller_rule_read_
+ f_return_status controller_rule_read(const controller_data_t data, const controller_setting_t setting, const f_string_static_t rule_id, controller_cache_t *cache, controller_rule_t *rule) {
+ f_status_t status = F_none;
+
+ bool for_item = F_true;
+
+ rule->status = F_known_not;
+
+ f_macro_time_spec_t_clear(rule->timestamp);
+
+ rule->id.used = 0;
+ rule->name.used = 0;
+
+ rule->define.used = 0;
+ rule->parameter.used = 0;
+
+ rule->environment.used = 0;
+ rule->need.used = 0;
+ rule->want.used = 0;
+ rule->wish.used = 0;
+
+ rule->items.used = 0;
+
+ cache->line_item = 0;
+ cache->line_action = 0;
+
+ cache->range_action.start = 1;
+ cache->range_action.stop = 0;
+
+ cache->comments.used = 0;
+ cache->delimits.used = 0;
+
+ cache->buffer_file.used = 0;
+ cache->buffer_item.used = 0;
+ cache->buffer_path.used = 0;
+
+ cache->content_items.used = 0;
+
+ cache->object_items.used = 0;
+
+ cache->name_action.used = 0;
+ cache->name_file.used = 0;
+ cache->name_item.used = 0;
+
+ status = fl_string_dynamic_append_nulless(rule_id, &rule->id);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true);
+ }
+ else {
+ status = controller_file_load(data, setting, controller_string_rules, rule->id, controller_string_rule, controller_string_rules_length, controller_string_rule_length, cache);
+ }
+
+ if (F_status_is_error_not(status)) {
+ rule->timestamp = cache->timestamp;
+
+ if (cache->buffer_file.used) {
+ f_string_range_t range = f_macro_string_range_t_initialize(cache->buffer_file.used);
+
+ status = fll_fss_basic_list_read(cache->buffer_file, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data.error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true);
+ }
+ else {
+ status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data.error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true);
+ }
+ }
+ }
+ }
+
+ if (F_status_is_error_not(status) && cache->object_items.used) {
+ status = controller_rule_items_increase_by(cache->object_items.used, &rule->items);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data.error, F_status_set_fine(status), "controller_rule_items_increase_by", F_true);
+ }
+ else {
+ for (f_array_length_t i = 0; i < cache->object_items.used; ++i) {
+
+ cache->line_item = 0;
+ cache->line_action = 0;
+
+ cache->range_action.start = 1;
+ cache->range_action.stop = 0;
+
+ cache->comments.used = 0;
+ cache->delimits.used = 0;
+
+ cache->content_action.used = 0;
+ cache->content_actions.used = 0;
+
+ cache->object_actions.used = 0;
+
+ cache->buffer_item.used = 0;
+ cache->buffer_path.used = 0;
+
+ cache->name_action.used = 0;
+ cache->name_item.used = 0;
+
+ for_item = F_true;
+
+ status = f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->line_item);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data.error, F_status_set_fine(status), "f_fss_count_lines", F_true);
+ break;
+ }
+
+ rule->items.array[rule->items.used].line = ++cache->line_item;
+
+ status = fl_string_dynamic_rip_nulless(cache->buffer_file, cache->object_items.array[i], &cache->name_item);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_rip_nulless", F_true);
+ break;
+ }
+
+ status = fl_string_dynamic_terminate_after(&cache->name_item);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_terminate_after", F_true);
+ break;
+ }
+
+ if (fl_string_dynamic_compare_string(controller_string_setting, cache->name_item, controller_string_setting_length) == F_equal_to) {
+ rule->items.array[rule->items.used].type = 0;
+ }
+ else if (fl_string_dynamic_compare_string(controller_string_command, cache->name_item, controller_string_command_length) == F_equal_to) {
+ rule->items.array[rule->items.used].type = controller_rule_item_type_command;
+ }
+ else if (fl_string_dynamic_compare_string(controller_string_script, cache->name_item, controller_string_script_length) == F_equal_to) {
+ rule->items.array[rule->items.used].type = controller_rule_item_type_script;
+ }
+ else if (fl_string_dynamic_compare_string(controller_string_service, cache->name_item, controller_string_service_length) == F_equal_to) {
+ rule->items.array[rule->items.used].type = controller_rule_item_type_service;
+ }
+ else {
+ if (data.warning.verbosity == f_console_verbosity_debug) {
+ fprintf(data.warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.warning.to.stream, "%s%sUnknown rule item type.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s, data.warning.context.after->string, f_string_eol_s[0]);
+
+ controller_rule_error_print(data.warning, *cache, F_true);
+ }
+
+ continue;
+ }
+
+ status = fl_string_dynamic_partial_append(cache->buffer_file, cache->content_items.array[i].array[0], &cache->buffer_item);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_partial_append", F_true);
+ break;
+ }
+
+ if (rule->items.array[rule->items.used].type) {
+ status = controller_rule_item_read(data, cache, &rule->items.array[rule->items.used]);
+ if (F_status_is_error(status)) break;
+
+ rule->items.used++;
+ }
+ else {
+ for_item = F_false;
+
+ status = controller_rule_setting_read(data, cache, rule);
+
+ if (F_status_is_error(status)) {
+ if (F_status_set_fine(status) == F_memory_not || F_status_set_fine(status) == F_memory_allocation || F_status_set_fine(status) == F_memory_reallocation) {
+ break;
+ }
+ }
+ }
+ } // for
+ }
+ }
+
+ if (F_status_is_error(status)) {
+ controller_rule_error_print(data.error, *cache, for_item);
+
+ rule->status = controller_status_simplify(F_status_set_fine(status));
+ return F_false;
+ }
+
+ rule->status = F_none;
+ return F_true;
+ }
+#endif // _di_controller_rule_read_
+
#ifndef _di_controller_rule_setting_read_
f_return_status controller_rule_setting_read(const controller_data_t data, controller_cache_t *cache, controller_rule_t *rule) {
f_status_t status = F_none;
}
else {
if (data.warning.verbosity == f_console_verbosity_debug) {
- fprintf(data.warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data.warning.to.stream, "%s%sUnknown rule setting.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : "", data.warning.context.after->string, f_string_eol[0]);
+ fprintf(data.warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.warning.to.stream, "%s%sUnknown rule setting.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s, data.warning.context.after->string, f_string_eol_s[0]);
+
+ fprintf(data.warning.to.stream, "%s%sUnknown rule setting '", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s);
+ fprintf(data.warning.to.stream, "%s%s%s%s", data.warning.context.after->string, data.warning.notable.before->string, cache->name_item.string, data.warning.notable.after->string);
+ fprintf(data.warning.to.stream, "%s'.%s%c", data.warning.context.before->string, data.warning.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.warning, *cache, F_false);
}
if (!cache->content_actions.array[i].used) {
if (data.warning.verbosity == f_console_verbosity_debug) {
- fprintf(data.warning.to.stream, "%c", f_string_eol[0]);
- fprintf(data.warning.to.stream, "%s%sEmpty rule setting.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : "", data.warning.context.after->string, f_string_eol[0]);
+ fprintf(data.warning.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.warning.to.stream, "%s%sEmpty rule setting.%s%c", data.warning.context.before->string, data.warning.prefix ? data.warning.prefix : f_string_empty_s, data.warning.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.warning, *cache, F_false);
}
if (type == controller_rule_setting_type_define || type == controller_rule_setting_type_parameter) {
if (cache->content_actions.array[i].used != 2) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sRule setting requires exactly two Content.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : "", data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sRule setting requires exactly two Content.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.error, *cache, F_false);
}
if (setting_value->used || cache->content_actions.array[i].used != 1) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sRule setting requires exactly one Content.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : "", data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sRule setting requires exactly one Content.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.error, *cache, F_false);
if (status == F_false || F_status_set_fine(status) == F_complete_not_utf) {
if (status == F_false) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sRule setting has an invalid name '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sRule setting has an invalid name '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, setting_value->string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s', there must be at least 1 graph character.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s', there must be at least 1 graph character.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.error, *cache, F_false);
if (status == F_false || F_status_set_fine(status) == F_complete_not_utf) {
if (status == F_false) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sRule setting has an invalid environment variable name '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sRule setting has an invalid environment variable name '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, setting_values->array[setting_values->used].string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.error, *cache, F_false);
}
if (cache->content_actions.array[i].used != 2) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sRule setting requires exactly two Content.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : "", data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sRule setting requires exactly two Content.%s%c", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s, data.error.context.after->string, f_string_eol_s[0]);
controller_rule_error_print(data.error, *cache, F_false);
continue;
}
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fprintf(data.error.to.stream, "%s%sThe rule item action second parameter '", data.error.context.before->string, data.error.prefix ? data.error.prefix : "");
+ fprintf(data.error.to.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.error.to.stream, "%s%sThe rule item action second parameter '", data.error.context.before->string, data.error.prefix ? data.error.prefix : f_string_empty_s);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, setting_values->array[setting_values->used + 1].string, data.error.notable.after->string);
fprintf(data.error.to.stream, "%s' must be a base path name, such as '", data.error.context.before->string);
fprintf(data.error.to.stream, "%s%s%s%s", data.error.context.after->string, data.error.notable.before->string, cache->buffer_path.string, data.error.notable.after->string);
- fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol[0]);
+ fprintf(data.error.to.stream, "%s'.%s%c", data.error.context.before->string, data.error.context.after->string, f_string_eol_s[0]);
}
setting_values->array[setting_values->used].used = 0;
}
#endif // _di_controller_rule_setting_read_
+#ifndef _di_controller_rule_simulate_
+ void controller_rule_simulate(const controller_data_t data, const controller_cache_t cache, const f_array_length_t index, controller_setting_t *setting) {
+
+ controller_rule_t * const rule = &setting->rules.array[index];
+
+ fprintf(data.output.stream, "%c", f_string_eol_s[0]);
+ fprintf(data.output.stream, "Rule %s%s%s {%c", data.context.set.title.before->string, rule->id.used ? rule->id.string : f_string_empty_s, data.context.set.title.after->string, f_string_eol_s[0]);
+ fprintf(data.output.stream, " %s%s%s %s%c", data.context.set.important.before->string, controller_string_name, data.context.set.important.after->string, rule->name.used ? rule->name.string : f_string_empty_s, f_string_eol_s[0]);
+ fprintf(data.output.stream, " %s%s%s %s%c", data.context.set.important.before->string, controller_string_control_group, data.context.set.important.after->string, rule->control_group.used ? rule->control_group.string : f_string_empty_s, f_string_eol_s[0]);
+
+ f_array_length_t i = 0;
+
+ fprintf(data.output.stream, " %s%s%s {%c", data.context.set.important.before->string, controller_string_define, data.context.set.important.after->string, f_string_eol_s[0]);
+
+ if (rule->define.used) {
+ for (; i < rule->define.used; ++i) {
+
+ if (rule->define.array[i].name.used && rule->define.array[i].value.used) {
+ fprintf(data.output.stream, " %s %s=%s %s%c", rule->define.array[i].name.string, data.context.set.important.before->string, data.context.set.important.after->string, rule->define.array[i].value.string, f_string_eol_s[0]);
+ }
+ } // for
+ }
+
+ fprintf(data.output.stream, " }%c", f_string_eol_s[0]);
+
+ fprintf(data.output.stream, " %s%s%s {%c", data.context.set.important.before->string, controller_string_parameter, data.context.set.important.after->string, f_string_eol_s[0]);
+
+ if (rule->parameter.used) {
+ for (i = 0; i < rule->parameter.used; ++i) {
+
+ if (rule->parameter.array[i].name.used && rule->parameter.array[i].value.used) {
+ fprintf(data.output.stream, " %s %s=%s %s%c", rule->parameter.array[i].name.string, data.context.set.important.before->string, data.context.set.important.after->string, rule->parameter.array[i].value.string, f_string_eol_s[0]);
+ }
+ } // for
+ }
+
+ fprintf(data.output.stream, " }%c", f_string_eol_s[0]);
+
+ fprintf(data.output.stream, " %s%s%s {%c", data.context.set.important.before->string, controller_string_environment, data.context.set.important.after->string, f_string_eol_s[0]);
+
+ if (rule->environment.used) {
+ for (i = 0; i < rule->environment.used; ++i) {
+
+ if (rule->environment.array[i].used) {
+ fprintf(data.output.stream, " %s%c", rule->environment.array[i].string, f_string_eol_s[0]);
+ }
+ } // for
+ }
+
+ fprintf(data.output.stream, " }%c", f_string_eol_s[0]);
+
+ fprintf(data.output.stream, " %s%s%s {%c", data.context.set.important.before->string, controller_string_need, data.context.set.important.after->string, f_string_eol_s[0]);
+
+ if (rule->need.used) {
+ for (i = 0; i < rule->need.used; ++i) {
+
+ if (rule->need.array[i].used) {
+ fprintf(data.output.stream, " %s%c", rule->need.array[i].string, f_string_eol_s[0]);
+ }
+ } // for
+ }
+
+ fprintf(data.output.stream, " }%c", f_string_eol_s[0]);
+
+ fprintf(data.output.stream, " %s%s%s {%c", data.context.set.important.before->string, controller_string_want, data.context.set.important.after->string, f_string_eol_s[0]);
+
+ if (rule->want.used) {
+ for (i = 0; i < rule->want.used; ++i) {
+
+ if (rule->want.array[i].used) {
+ fprintf(data.output.stream, " %s%c", rule->want.array[i].string, f_string_eol_s[0]);
+ }
+ } // for
+ }
+
+ fprintf(data.output.stream, " }%c", f_string_eol_s[0]);
+
+ fprintf(data.output.stream, " %s%s%s {%c", data.context.set.important.before->string, controller_string_wish, data.context.set.important.after->string, f_string_eol_s[0]);
+
+ if (rule->wish.used) {
+ for (i = 0; i < rule->wish.used; ++i) {
+
+ if (rule->wish.array[i].used) {
+ fprintf(data.output.stream, " %s%c", rule->wish.array[i].string, f_string_eol_s[0]);
+ }
+ } // for
+ }
+
+ fprintf(data.output.stream, " }%c", f_string_eol_s[0]);
+
+ fprintf(data.output.stream, " %s%s%s {%c", data.context.set.important.before->string, controller_string_item, data.context.set.important.after->string, f_string_eol_s[0]);
+
+ if (rule->items.used) {
+ controller_rule_action_t *action = 0;
+ controller_rule_item_t *item = 0;
+
+ f_array_length_t j = 0;
+
+ for (i = 0; i < rule->items.used; ++i) {
+
+ item = &rule->items.array[i];
+
+ fprintf(data.output.stream, " %s%s%s %s%c", data.context.set.important.before->string, controller_string_type, data.context.set.important.after->string, controller_rule_item_type_name(item->type).string, f_string_eol_s[0]);
+
+ fprintf(data.output.stream, " %s%s%s {%c", data.context.set.important.before->string, controller_string_action, data.context.set.important.after->string, f_string_eol_s[0]);
+
+ for (j = 0; j < item->actions.used; ++j) {
+
+ action = &item->actions.array[j];
+
+ // action method
+ // action type
+ // action parameters
+ }
+
+ fprintf(data.output.stream, " }%c", f_string_eol_s[0]);
+ } // for
+
+ fprintf(data.output.stream, " }%c", f_string_eol_s[0]);
+ }
+
+ fprintf(data.output.stream, "}%c%c", f_string_eol_s[0], f_string_eol_s[0]);
+
+ setting->rules.array[index].status = F_complete;
+ }
+#endif // _di_controller_rule_simulate_
+
#ifndef _di_controller_rules_increase_by_
f_return_status controller_rules_increase_by(const f_array_length_t amount, controller_rules_t *rules) {