The verbose messages should be distinguishing between an entry and an exit now.
When both --simulate and --test are specified, the printout should include both the entry and the exit.
Previously, only the entry was printed.
The wait all should only be triggered to wait for all processes at the current moment in time.
Furthermore, the read lock is being held too long (for the entire loop).
Maintain the read lock long enough to build a list of all processes to wait for.
fll_error_file_print(main.data->error, F_status_set_fine(status), "controller_file_pid_create", F_true, main.setting->path_pid.string, "create", fll_error_file_type_file);
- controller_entry_error_print_cache(main.data->error, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->error, cache->action);
controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print);
}
fll_error_file_print(main.data->warning, F_status_set_fine(status), "controller_file_pid_create", F_true, main.setting->path_pid.string, "create", fll_error_file_type_file);
- controller_entry_error_print_cache(main.data->warning, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->warning, cache->action);
controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print);
}
f_macro_array_lengths_t_increase_by(status, cache->ats, controller_default_allocation_step)
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, main.thread);
return status;
}
status = controller_string_dynamic_append_terminated(entry->items.array[0].name, &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main.thread);
return status;
}
status2 = controller_string_dynamic_append_terminated(controller_entry_action_type_name(actions->array[cache->ats.array[at_j]].type), &cache->action.name_action);
if (F_status_is_error(status2)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, main.thread);
return status2;
}
fprintf(main.data->warning.to.stream, "%c", f_string_eol_s[0]);
fprintf(main.data->warning.to.stream, "%s%sMultiple '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s);
fprintf(main.data->warning.to.stream, "%s%s%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string, controller_string_ready_s, main.data->warning.notable.after->string);
- fprintf(main.data->warning.to.stream, "%s' entry item actions detected; only the first will be used.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]);
+ fprintf(main.data->warning.to.stream, "%s' %s item actions detected; only the first will be used.%s%c", main.data->warning.context.before->string, is_entry ? controller_string_entry_s : controller_string_exit_s, main.data->warning.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main.data->warning, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->warning, cache->action);
controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print);
}
f_thread_mutex_lock(&main.thread->lock.print);
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item named '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item named '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, entry->items.array[i].name.string, main.data->error.notable.after->string);
fprintf(main.data->error.to.stream, "%s' cannot be executed because recursion is not allowed.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main.data->error, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->error, cache->action);
controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print);
}
f_macro_array_lengths_t_increase_by(status2, cache->ats, controller_default_allocation_step)
if (F_status_is_error(status2)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status2), "f_macro_array_lengths_t_increase_by", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status2), "f_macro_array_lengths_t_increase_by", F_true, main.thread);
return status2;
}
status2 = controller_string_dynamic_append_terminated(entry->items.array[i].name, &cache->action.name_item);
if (F_status_is_error(status2)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, main.thread);
return status2;
}
f_thread_mutex_lock(&main.thread->lock.print);
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item named '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item named '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, actions->array[cache->ats.array[at_j]].parameters.array[0].string, main.data->error.notable.after->string);
fprintf(main.data->error.to.stream, "%s' does not exist.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main.data->error, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->error, cache->action);
controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print);
}
status2 = controller_string_dynamic_append_terminated(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
if (F_status_is_error(status2)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status2), "controller_string_dynamic_append_terminated", F_true, main.thread);
return status2;
}
f_macro_array_lengths_t_increase_by(status, cache->ats, controller_default_allocation_step)
if (F_status_is_error(status)) {
- controller_entry_error_print(main->data->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, main->thread);
+ controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, main->thread);
return status;
}
status = controller_string_dynamic_append_terminated(entry->items.array[cache->ats.array[0]].name, &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_entry_error_print(main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread);
+ controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread);
return status;
}
- if (simulate) {
+ if (simulate || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "Processing %sentry item '", (failsafe ? "failsafe " : ""));
+ fprintf(main->data->output.stream, "Processing %s%s item '", (failsafe ? "failsafe " : ""), is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, cache->action.name_item.string, main->data->context.set.title.after->string);
fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]);
status = controller_string_dynamic_append_terminated(controller_entry_action_type_name(entry_action->type), &cache->action.name_action);
if (F_status_is_error(status)) {
- controller_entry_error_print(main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread);
+ controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread);
return status;
}
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "The entry item action '");
+ fprintf(main->data->output.stream, "The %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, cache->action.name_action.string, main->data->context.set.title.after->string);
if (entry_action->parameters.used) {
}
}
else if (entry_action->code & controller_entry_rule_code_require) {
-
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->error.to.stream, "%s%sThe entry item action '", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s);
+ fprintf(main->data->error.to.stream, "%s%sThe %s item action '", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->error.to.stream, "%s%s%s", main->data->error.context.after->string, main->data->error.notable.before->string, cache->action.name_action.string);
if (entry_action->parameters.used) {
fprintf(main->data->error.to.stream, "%s%sfailed%s", main->data->error.context.after->string, main->data->error.notable.before->string, main->data->error.notable.after->string);
fprintf(main->data->error.to.stream, "%s state, skipping execution.%s%c", main->data->error.context.before->string, main->data->error.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main->data->error, cache->action);
+ controller_entry_error_print_cache(is_entry, main->data->error, cache->action);
controller_print_unlock_flush(main->data->error.to.stream, &main->thread->lock.print);
}
return F_status_is_error(F_require);
}
- else if (main->data->warning.verbosity == f_console_verbosity_debug) {
+ else if (main->data->warning.verbosity == f_console_verbosity_verbose || main->data->warning.verbosity == f_console_verbosity_debug) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->warning.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->warning.to.stream, "%s%sThe entry item action '", main->data->warning.context.before->string, main->data->warning.prefix ? main->data->warning.prefix : f_string_empty_s);
+ fprintf(main->data->warning.to.stream, "%s%sThe %s item action '", main->data->warning.context.before->string, main->data->warning.prefix ? main->data->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->warning.to.stream, "%s%s%s", main->data->warning.context.after->string, main->data->warning.notable.before->string, cache->action.name_action.string);
if (entry_action->parameters.used) {
fprintf(main->data->warning.to.stream, "%s%sfailed%s", main->data->warning.context.after->string, main->data->warning.notable.before->string, main->data->warning.notable.after->string);
fprintf(main->data->warning.to.stream, "%s state, skipping execution.%s%c", main->data->warning.context.before->string, main->data->warning.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main->data->warning, cache->action);
+ controller_entry_error_print_cache(is_entry, main->data->warning, cache->action);
controller_print_unlock_flush(main->data->warning.to.stream, &main->thread->lock.print);
}
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "The entry item action '");
+ fprintf(main->data->output.stream, "The %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, cache->action.name_action.string, main->data->context.set.title.after->string);
if (entry_action->parameters.used) {
controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print);
}
}
- else if (main->data->warning.verbosity == f_console_verbosity_debug) {
+ else if (main->data->warning.verbosity == f_console_verbosity_debug || main->data->error.verbosity == f_console_verbosity_verbose) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->warning.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->warning.to.stream, "%s%sThe entry item action '", main->data->warning.context.before->string, main->data->warning.prefix ? main->data->warning.prefix : f_string_empty_s);
+ fprintf(main->data->warning.to.stream, "%s%sThe %s item action '", main->data->warning.context.before->string, main->data->warning.prefix ? main->data->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->warning.to.stream, "%s%s", main->data->warning.notable.before->string, cache->action.name_action.string);
if (entry_action->parameters.used) {
fprintf(main->data->warning.to.stream, "%s%sfailed%s", main->data->warning.context.after->string, main->data->warning.notable.before->string, main->data->warning.notable.after->string);
fprintf(main->data->warning.to.stream, "%s state, skipping.%s%c", main->data->warning.context.before->string, main->data->warning.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main->data->warning, cache->action);
+ controller_entry_error_print_cache(is_entry, main->data->warning, cache->action);
controller_print_unlock_flush(main->data->warning.to.stream, &main->thread->lock.print);
}
}
if (entry_action->type == controller_entry_action_type_ready) {
-
if (entry_action->code & controller_entry_rule_code_wait) {
- if (simulate) {
+ if (simulate || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "Waiting before processing entry item action '");
+ fprintf(main->data->output.stream, "Waiting before processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_ready_s, main->data->context.set.title.after->string);
fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]);
}
if (main->setting->ready == controller_setting_ready_wait) {
- if (simulate) {
+ if (simulate || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "Processing entry item action '");
+ fprintf(main->data->output.stream, "Processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_ready_s, main->data->context.set.title.after->string);
fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]);
controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print);
}
}
- else {
+
+ if (!simulate) {
controller_perform_ready(is_entry, *main, cache);
if (F_status_is_error(status)) return status;
main->setting->ready = controller_setting_ready_yes;
}
- else if (simulate) {
+ else if (simulate || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "Ignoring entry item action '");
+ fprintf(main->data->output.stream, "Ignoring %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_ready_s, main->data->context.set.title.after->string);
fprintf(main->data->output.stream, "', state already is ready.%c", f_string_eol_s[0]);
}
}
else if (entry_action->type == controller_entry_action_type_item) {
-
if (entry_action->number == 0 || entry_action->number >= entry->items.used || failsafe && entry_action->number == main->setting->failsafe_item_id) {
// This should not happen if the pre-process is working as designed, but in case it doesn't, return a critical error to prevent infinite recursion and similar errors.
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->error.to.stream, "%s%sInvalid entry item index ", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s);
+ fprintf(main->data->error.to.stream, "%s%sInvalid %s item index ", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->error.to.stream, "%s%s%llu%s", main->data->error.context.after->string, main->data->error.notable.before->string, entry_action->number, main->data->error.notable.after->string);
fprintf(main->data->error.to.stream, "%s detected.%s%c", main->data->error.context.before->string, main->data->error.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main->data->error, cache->action);
+ controller_entry_error_print_cache(is_entry, main->data->error, cache->action);
controller_print_unlock_flush(main->data->error.to.stream, &main->thread->lock.print);
}
f_macro_array_lengths_t_increase_by(status, cache->ats, controller_default_allocation_step)
if (F_status_is_error(status)) {
- controller_entry_error_print(main->data->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, main->thread);
+ controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "f_macro_array_lengths_t_increase_by", F_true, main->thread);
return status;
}
status = controller_string_dynamic_append_terminated(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_entry_error_print(main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread);
+ controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread);
return status;
}
- if (simulate) {
+ if (simulate || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "Processing entry item '");
+ fprintf(main->data->output.stream, "Processing %s item '", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, cache->action.name_item.string, main->data->context.set.title.after->string);
fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]);
f_thread_unlock(&main->thread->lock.rule);
if (F_status_is_error(status)) {
- controller_entry_error_print(main->data->error, cache->action, F_status_set_fine(status), "controller_rules_increase", F_true, main->thread);
+ controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "controller_rules_increase", F_true, main->thread);
return status;
}
f_thread_unlock(&main->thread->lock.rule);
- if (simulate) {
+ if (simulate || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "%s entry item rule '", entry_action->type == controller_entry_action_type_consider ? "Considering" : "Processing");
+ fprintf(main->data->output.stream, "%s %s item rule '", entry_action->type == controller_entry_action_type_consider ? "Considering" : "Processing", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, alias_rule.string, main->data->context.set.title.after->string);
fprintf(main->data->output.stream, "'.%c", f_string_eol_s[0]);
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
- controller_entry_error_print_cache(main->data->error, cache->action);
+ controller_entry_error_print_cache(is_entry, main->data->error, cache->action);
controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print);
}
}
else if (entry_action->type == controller_entry_action_type_timeout) {
- if (simulate) {
+ if (simulate || main->data->error.verbosity == f_console_verbosity_verbose) {
f_string_t code = "";
if (entry_action->code == controller_entry_timeout_code_kill) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "Processing entry item action '");
+ fprintf(main->data->output.stream, "Processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_timeout_s, main->data->context.set.title.after->string);
fprintf(main->data->output.stream, "' setting '");
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.important.before->string, code, main->data->context.set.important.after->string);
fprintf(main->data->warning.to.stream, "%c", f_string_eol_s[0]);
fprintf(main->data->warning.to.stream, "%s%sFailsafe may not be specified when running in failsafe, ignoring.%s%c", main->data->warning.context.before->string, main->data->warning.prefix ? main->data->warning.prefix : f_string_empty_s, main->data->warning.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main->data->warning, cache->action);
+ controller_entry_error_print_cache(is_entry, main->data->warning, cache->action);
controller_print_unlock_flush(main->data->warning.to.stream, &main->thread->lock.print);
}
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->error.to.stream, "%s%sInvalid entry item index ", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s);
+ fprintf(main->data->error.to.stream, "%s%sInvalid %s item index ", main->data->error.context.before->string, main->data->error.prefix ? main->data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->error.to.stream, "%s%s%llu%s", main->data->error.context.after->string, main->data->error.notable.before->string, entry_action->number, main->data->error.notable.after->string);
fprintf(main->data->error.to.stream, "%s detected.%s%c", main->data->error.context.before->string, main->data->error.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main->data->error, cache->action);
+ controller_entry_error_print_cache(is_entry, main->data->error, cache->action);
controller_print_unlock_flush(main->data->error.to.stream, &main->thread->lock.print);
}
main->setting->failsafe_enabled = F_true;
main->setting->failsafe_item_id = entry_action->number;
- if (simulate) {
+ if (simulate || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
- fprintf(main->data->output.stream, "Processing entry item action '");
+ fprintf(main->data->output.stream, "Processing %s item action '", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.title.before->string, controller_string_failsafe_s, main->data->context.set.title.after->string);
fprintf(main->data->output.stream, "' setting value to '");
fprintf(main->data->output.stream, "%s%s%s", main->data->context.set.important.before->string, entry->items.array[main->setting->failsafe_item_id].name.string, main->data->context.set.important.after->string);
status = controller_string_dynamic_append_terminated(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_entry_error_print(main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread);
+ controller_entry_error_print(is_entry, main->data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_append_terminated", F_true, main->thread);
break;
}
#endif // _di_controller_entry_actions_increase_by_
#ifndef _di_controller_entry_actions_read_
- f_status_t controller_entry_actions_read(const f_string_range_t content_range, controller_main_t main, controller_cache_t *cache, controller_entry_actions_t *actions) {
+ f_status_t controller_entry_actions_read(const bool is_entry, const f_string_range_t content_range, controller_main_t main, controller_cache_t *cache, controller_entry_actions_t *actions) {
f_status_t status = F_none;
f_status_t status_action = F_none;
}
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, main.thread);
return status;
}
status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread);
return status;
}
status = controller_entry_actions_increase_by(cache->object_actions.used, actions);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "controller_entry_actions_increase_by", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_entry_actions_increase_by", F_true, main.thread);
return status;
}
status = f_fss_count_lines(cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread);
break;
}
status = controller_string_dynamic_rip_nulless_terminated(cache->buffer_file, cache->object_actions.array[i], &cache->action.name_action);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, main.thread);
break;
}
}
else {
if (main.data->warning.verbosity == f_console_verbosity_debug) {
- fprintf(main.data->warning.to.stream, "%s%sUnknown entry item action '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s);
+ fprintf(main.data->warning.to.stream, "%s%sUnknown %s item action '", main.data->warning.context.before->string, main.data->warning.prefix ? main.data->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main.data->warning.to.stream, "%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string);
f_print_dynamic(main.data->warning.to.stream, cache->action.name_action);
fprintf(main.data->warning.to.stream, "%s", main.data->warning.notable.after->string);
fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main.data->warning, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->warning, cache->action);
}
continue;
if (main.data->error.verbosity != f_console_verbosity_quiet) {
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item action '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item action '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, cache->action.name_action.string, main.data->error.notable.after->string);
fprintf(main.data->error.to.stream, "%s' requires ", main.data->error.context.before->string);
status = f_string_dynamics_increase_by(allocate, &action->parameters);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true, main.thread);
action->status = status;
status = f_string_dynamic_partial_append_nulless(cache->buffer_file, cache->content_actions.array[i].array[j], &action->parameters.array[j]);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, main.thread);
action->status = status;
status = fll_path_canonical(action->parameters.array[0].string, &cache->buffer_path);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "fll_path_canonical", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fll_path_canonical", F_true, main.thread);
action->status = status;
if (main.data->error.verbosity != f_console_verbosity_quiet) {
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item action must not have an empty string for a path (the first parameter).%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item action must not have an empty string for a path (the first parameter).%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s, main.data->error.context.after->string, f_string_eol_s[0]);
}
}
status = f_file_name_base(action->parameters.array[1].string, action->parameters.array[1].used, &cache->buffer_path);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, main.thread);
if (F_status_set_fine(status) == F_memory_not) {
status_action = status;
status = f_string_dynamic_terminate_after(&cache->buffer_path);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, main.thread);
action->status = status;
}
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item action second parameter '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item action second parameter '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, action->parameters.array[1].string, main.data->error.notable.after->string);
fprintf(main.data->error.to.stream, "%s' must be a base path name, such as '", main.data->error.context.before->string);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, cache->buffer_path.string, main.data->error.notable.after->string);
if (main.data->error.verbosity != f_console_verbosity_quiet) {
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item action must not have an empty string for a rule name (the second parameter).%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item action must not have an empty string for a rule name (the second parameter).%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s, main.data->error.context.after->string, f_string_eol_s[0]);
}
}
if (main.data->error.verbosity != f_console_verbosity_quiet) {
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item action third parameter (and beyond) must be one of '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item action third parameter (and beyond) must be one of '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_asynchronous_s, main.data->error.notable.after->string);
fprintf(main.data->error.to.stream, "%s', '", main.data->error.context.before->string);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_require_s, main.data->error.notable.after->string);
if (main.data->error.verbosity != f_console_verbosity_quiet) {
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item action may not specify the reserved item '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item action may not specify the reserved item '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_main_s, main.data->error.notable.after->string);
fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
}
if (main.data->error.verbosity != f_console_verbosity_quiet) {
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item action must have one of '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item action must have one of '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_kill_s, main.data->error.notable.after->string);
fprintf(main.data->error.to.stream, "%s', '", main.data->error.context.before->string);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_start_s, main.data->error.notable.after->string);
}
if (F_status_set_fine(status) == F_memory_not) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, main.thread);
status_action = status;
break;
if (main.data->error.verbosity != f_console_verbosity_quiet) {
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item action parameter '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item action parameter '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, action->parameters.array[1].string, main.data->error.notable.after->string);
fprintf(main.data->error.to.stream, "%s' is not a valid supported number.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
}
if (main.data->error.verbosity != f_console_verbosity_quiet) {
fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
- fprintf(main.data->error.to.stream, "%s%sThe entry item action may only have '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s);
+ fprintf(main.data->error.to.stream, "%s%sThe %s item action may only have '", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_wait_s, main.data->error.notable.after->string);
fprintf(main.data->error.to.stream, "%s' but instead has '", main.data->error.context.before->string);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, action->parameters.array[0].string, main.data->error.notable.after->string);
#endif // _di_controller_entry_actions_read_
#ifndef _di_controller_entry_error_print_
- void controller_entry_error_print(const fll_error_print_t print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, controller_thread_t *thread) {
+ void controller_entry_error_print(const bool is_entry, const fll_error_print_t print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, controller_thread_t *thread) {
if (print.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&thread->lock.print);
fll_error_print(print, status, function, fallback);
- controller_entry_error_print_cache(print, cache);
+ controller_entry_error_print_cache(is_entry, print, cache);
controller_print_unlock_flush(print.to.stream, &thread->lock.print);
}
#endif // _di_controller_entry_error_print_
#ifndef _di_controller_entry_error_print_cache_
- void controller_entry_error_print_cache(const fll_error_print_t print, const controller_cache_action_t cache) {
+ void controller_entry_error_print_cache(const bool is_entry, const fll_error_print_t print, const controller_cache_action_t cache) {
fprintf(print.to.stream, "%c", f_string_eol_s[0]);
fprintf(print.to.stream, "%s%sWhile processing ", print.context.before->string, print.prefix ? print.prefix : f_string_empty_s);
}
if (cache.name_item.used) {
- fprintf(print.to.stream, "entry item '");
+ fprintf(print.to.stream, "%s item '", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, cache.name_item.string, print.notable.after->string);
fprintf(print.to.stream, "%s' on line ", print.context.before->string);
fprintf(print.to.stream, "%s%s%llu%s", print.context.after->string, print.notable.before->string, cache.line_item, print.notable.after->string);
}
if (cache.name_file.used) {
- fprintf(print.to.stream, "entry file '");
+ fprintf(print.to.stream, "%s file '", is_entry ? controller_string_entry_s : controller_string_exit_s);
fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, cache.name_file.string, print.notable.after->string);
fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]);
}
status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread);
}
}
}
status = controller_entry_items_increase_by(cache->object_items.used, &entry->items);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "controller_entry_items_increase_by", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_entry_items_increase_by", F_true, main.thread);
}
else {
status = controller_entry_items_increase_by(controller_default_allocation_step, &entry->items);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "controller_entry_items_increase_by", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_entry_items_increase_by", F_true, main.thread);
break;
}
status = controller_string_dynamic_partial_append_terminated(cache->buffer_file, cache->object_items.array[i], &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_partial_append_terminated", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_partial_append_terminated", F_true, main.thread);
break;
}
status = f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread);
break;
}
fprintf(main.data->warning.to.stream, "%s%s%s%s", main.data->warning.context.after->string, main.data->warning.notable.before->string, cache->action.name_file.string, main.data->warning.notable.after->string);
fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main.data->warning, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->warning, cache->action);
controller_print_unlock_flush(main.data->warning.to.stream, &main.thread->lock.print);
}
break;
}
- status = controller_entry_actions_read(*range, main, cache, &entry->items.array[at].actions);
+ status = controller_entry_actions_read(is_entry, *range, main, cache, &entry->items.array[at].actions);
if (F_status_is_error(status)) {
f_thread_mutex_lock(&main.thread->lock.print);
- controller_entry_error_print_cache(main.data->error, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->error, cache->action);
controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print);
fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, action->parameters.array[0].string, main.data->error.notable.after->string);
fprintf(main.data->error.to.stream, "%s' does not exist.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main.data->error, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->error, cache->action);
controller_print_unlock_flush(main.data->error.to.stream, &main.thread->lock.print);
}
}
if (F_status_is_error(status)) {
- controller_entry_error_print_cache(main.data->error, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->error, cache->action);
entry->status = controller_status_simplify_error(F_status_set_fine(status));
}
}
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, main.thread);
return status;
}
status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, main.thread);
return status;
}
status = f_fss_count_lines(cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, main.thread);
break;
}
status = controller_string_dynamic_rip_nulless_terminated(cache->buffer_file, cache->object_actions.array[i], &cache->action.name_action);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, main.thread);
+ controller_entry_error_print(is_entry, main.data->error, cache->action, F_status_set_fine(status), "controller_string_dynamic_rip_nulless_terminated", F_true, main.thread);
break;
}
fprintf(main.data->warning.to.stream, "%s", main.data->warning.notable.after->string);
fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main.data->warning, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->warning, cache->action);
}
continue;
fprintf(main.data->warning.to.stream, "%s", main.data->warning.notable.after->string);
fprintf(main.data->warning.to.stream, "%s'.%s%c", main.data->warning.context.before->string, main.data->warning.context.after->string, f_string_eol_s[0]);
- controller_entry_error_print_cache(main.data->warning, cache->action);
+ controller_entry_error_print_cache(is_entry, main.data->warning, cache->action);
}
continue;
/**
* Read the entry list, extracting all items and values.
*
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
* @param content_range
* The range in the list buffer representing the content.
* @param main
* @see fll_fss_extended_read()
*/
#ifndef _di_controller_entry_actions_read_
- extern f_status_t controller_entry_actions_read(const f_string_range_t content_range, controller_main_t main, controller_cache_t *cache, controller_entry_actions_t *actions) f_gcc_attribute_visibility_internal;
+ extern f_status_t controller_entry_actions_read(const bool is_entry, const f_string_range_t content_range, controller_main_t main, controller_cache_t *cache, controller_entry_actions_t *actions) f_gcc_attribute_visibility_internal;
#endif // _di_controller_entry_actions_read_
/**
* Print the entry related error, locking the print mutex during the print.
*
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
* @param print
* Designates how printing is to be performed.
* @param cache
* @see controller_entry_error_print_cache()
*/
#ifndef _di_controller_entry_error_print_
- extern void controller_entry_error_print(const fll_error_print_t print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, controller_thread_t *thread) f_gcc_attribute_visibility_internal;
+ extern void controller_entry_error_print(const bool is_entry, const fll_error_print_t print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, controller_thread_t *thread) f_gcc_attribute_visibility_internal;
#endif // _di_controller_entry_error_print_
/**
*
* This neither locks the thread nor does it check to see if output is enabled or disabled.
*
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
* @param print
* Designates how printing is to be performed.
* @param cache
* @see controller_entry_read()
*/
#ifndef _di_controller_entry_error_print_cache_
- extern void controller_entry_error_print_cache(const fll_error_print_t print, const controller_cache_action_t cache) f_gcc_attribute_visibility_internal;
+ extern void controller_entry_error_print_cache(const bool is_entry, const fll_error_print_t print, const controller_cache_action_t cache) f_gcc_attribute_visibility_internal;
#endif // _di_controller_entry_error_print_cache_
/**
}
if (options & controller_process_option_simulate) {
-
if (main.data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main.thread->lock.print);
}
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache.action, F_status_set_fine(status), "f_type_array_lengths_resize", F_true, main.thread);
+ controller_error_print(main.data->error, F_status_set_fine(status), "f_type_array_lengths_resize", F_true, main.thread);
}
else {
for (f_array_length_t i = 0; i < stack.used; ++i) {
status = f_string_dynamic_append(cache.action.name_item, &process->cache.action.name_item);
}
else {
- controller_entry_error_print(main.data->error, cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, main.thread);
+ controller_error_print(main.data->error, F_status_set_fine(status), "f_string_dynamic_append", F_true, main.thread);
}
}
status = f_thread_create(0, &process->id_thread, controller_thread_process, (void *) process);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, cache.action, F_status_set_fine(status), "f_thread_create", F_true, main.thread);
+ controller_error_print(main.data->error, F_status_set_fine(status), "f_thread_create", F_true, main.thread);
}
}
else {
}
if (!action || F_status_is_error(status) && (process->state == controller_process_state_active || process->state == controller_process_state_busy)) {
+
status = controller_lock_write_process(process, main.thread, &process->lock);
if (status == F_signal || F_status_is_error(status)) {
f_thread_unlock(&main.thread->lock.rule);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, process->cache.action, F_status_set_fine(status), "controller_rule_copy", F_true, main.thread);
+ controller_error_print(main.data->error, F_status_set_fine(status), "controller_rule_copy", F_true, main.thread);
}
else if (!process->action) {
status = f_type_array_lengths_increase(&process->stack);
if (F_status_is_error(status)) {
- controller_entry_error_print(main.data->error, process->cache.action, F_status_set_fine(status), "f_type_array_lengths_increase", F_true, main.thread);
+ controller_error_print(main.data->error, F_status_set_fine(status), "f_type_array_lengths_increase", F_true, main.thread);
}
else {
f_thread_unlock(&process->lock);
f_status_t status_lock = F_none;
if (caller) {
- controller_lock_read_process(caller, main.thread, &main.thread->lock.process);
+ status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process);
}
else {
- controller_lock_read(is_normal, main.thread, &main.thread->lock.process);
+ status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process);
}
if (status_lock == F_signal || F_status_is_error(status_lock)) {
f_status_t status = F_none;
bool required_not_run = F_false;
+ bool skip = F_false;
f_array_length_t i = 0;
f_array_length_t j = 0;
- controller_process_t *process = 0;
+ // build a list of what to wait for so that anything new after this point will not be waited for.
+ const f_array_length_t process_total = main.thread->processs.used;
+ controller_process_t *process_list[process_total];
- bool skip = F_false;
+ for (; i < process_total; ++i) {
+ process_list[i] = main.thread->processs.array[i];
+ } // for
+
+ f_thread_unlock(&main.thread->lock.process);
- for (; i < main.thread->processs.used; ++i) {
+ for (i = 0; i < process_total; ++i) {
if (caller) {
if (!controller_thread_is_enabled_process(caller, main.thread)) break;
if (!controller_thread_is_enabled(is_normal, main.thread)) break;
}
- process = main.thread->processs.array[i];
+ // re-establish main process read lock to wait for or protect from the cleanup thread while checking the read process.
+ if (caller) {
+ status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process);
+ }
+ else {
+ status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process);
+ }
+
+ if (status_lock == F_signal || F_status_is_error(status_lock)) break;
+
+ if (!process_list[i]) {
+ f_thread_unlock(&main.thread->lock.process);
+
+ continue;
+ }
if (caller) {
+ status_lock = controller_lock_read_process(caller, main.thread, &process_list[i]->active);
+ }
+ else {
+ status_lock = controller_lock_read(is_normal, main.thread, &process_list[i]->active);
+ }
+
+ if (status_lock == F_signal || F_status_is_error(status_lock)) {
f_thread_unlock(&main.thread->lock.process);
+ break;
+ }
+
+ // once the active lock is obtained, then the main process read lock can be safely released.
+ f_thread_unlock(&main.thread->lock.process);
+
+ if (caller) {
if (caller) {
status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.rule);
}
status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.rule);
}
- if (status_lock == F_signal || F_status_is_error(status_lock)) break;
+ if (status_lock == F_signal || F_status_is_error(status_lock)) {
+ f_thread_unlock(&process_list[i]->active);
+
+ break;
+ }
- if (fl_string_dynamic_compare(caller->rule.alias, process->rule.alias) == F_equal_to) {
+ if (fl_string_dynamic_compare(caller->rule.alias, process_list[i]->rule.alias) == F_equal_to) {
f_thread_unlock(&main.thread->lock.rule);
+ f_thread_unlock(&process_list[i]->active);
continue;
}
if (!controller_thread_is_enabled(is_normal, main.thread)) break;
}
- if (main.thread->processs.array[caller->stack.array[j]] && fl_string_dynamic_compare(process->rule.alias, main.thread->processs.array[caller->stack.array[j]]->rule.alias) == F_equal_to) {
+ if (main.thread->processs.array[caller->stack.array[j]] && fl_string_dynamic_compare(process_list[i]->rule.alias, main.thread->processs.array[caller->stack.array[j]]->rule.alias) == F_equal_to) {
skip = F_true;
}
f_thread_unlock(&main.thread->lock.rule);
- if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process);
- }
- else {
- status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process);
- }
+ if (skip) {
+ f_thread_unlock(&process_list[i]->active);
- if (status_lock == F_signal || F_status_is_error(status_lock)) break;
- if (skip) continue;
- }
-
- if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &process->active);
- }
- else {
- status_lock = controller_lock_read(is_normal, main.thread, &process->active);
- }
-
- if (status_lock == F_signal || F_status_is_error(status_lock)) {
- f_thread_unlock(&main.thread->lock.process);
-
- break;
+ continue;
+ }
}
- f_thread_unlock(&main.thread->lock.process);
-
if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &process->lock);
+ status_lock = controller_lock_read_process(caller, main.thread, &process_list[i]->lock);
}
else {
- status_lock = controller_lock_read(is_normal, main.thread, &process->lock);
+ status_lock = controller_lock_read(is_normal, main.thread, &process_list[i]->lock);
}
if (status_lock == F_signal || F_status_is_error(status_lock)) {
- f_thread_unlock(&process->active);
+ f_thread_unlock(&process_list[i]->active);
break;
}
if (required) {
- if (!(process->options & controller_process_option_require)) {
- f_thread_unlock(&process->lock);
- f_thread_unlock(&process->active);
-
- if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process);
- }
- else {
- status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process);
- }
-
- if (status_lock == F_signal || F_status_is_error(status_lock)) break;
+ if (!(process_list[i]->options & controller_process_option_require)) {
+ f_thread_unlock(&process_list[i]->lock);
+ f_thread_unlock(&process_list[i]->active);
continue;
}
}
- if (!process->state || process->state == controller_process_state_idle || process->state == controller_process_state_done) {
+ if (!process_list[i]->state || process_list[i]->state == controller_process_state_idle || process_list[i]->state == controller_process_state_done) {
- if (process->state == controller_process_state_done) {
- f_thread_unlock(&process->lock);
+ if (process_list[i]->state == controller_process_state_done) {
+ f_thread_unlock(&process_list[i]->lock);
if (caller) {
- status_lock = controller_lock_write_process(process, main.thread, &process->lock);
+ status_lock = controller_lock_write_process(process_list[i], main.thread, &process_list[i]->lock);
}
else {
- status_lock = controller_lock_write(is_normal, main.thread, &process->lock);
+ status_lock = controller_lock_write(is_normal, main.thread, &process_list[i]->lock);
}
if (status_lock == F_signal || F_status_is_error(status_lock)) {
controller_lock_error_critical_print(main.data->error, F_status_set_fine(status_lock), F_false, main.thread);
- f_thread_unlock(&process->active);
+ f_thread_unlock(&process_list[i]->active);
return status_lock;
}
- if (process->state == controller_process_state_done) {
- f_thread_unlock(&process->active);
+ if (process_list[i]->state == controller_process_state_done) {
+ f_thread_unlock(&process_list[i]->active);
- if (f_thread_lock_write_try(&process->active) == F_none) {
+ if (f_thread_lock_write_try(&process_list[i]->active) == F_none) {
- controller_thread_join(&process->id_thread);
+ controller_thread_join(&process_list[i]->id_thread);
- process->state = controller_process_state_idle;
+ process_list[i]->state = controller_process_state_idle;
- f_thread_unlock(&process->active);
+ f_thread_unlock(&process_list[i]->active);
- f_thread_mutex_lock(&process->wait_lock);
- f_thread_condition_signal_all(&process->wait);
- f_thread_mutex_unlock(&process->wait_lock);
+ f_thread_mutex_lock(&process_list[i]->wait_lock);
+ f_thread_condition_signal_all(&process_list[i]->wait);
+ f_thread_mutex_unlock(&process_list[i]->wait_lock);
}
if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &process->active);
+ status_lock = controller_lock_read_process(caller, main.thread, &process_list[i]->active);
}
else {
- status_lock = controller_lock_read(is_normal, main.thread, &process->active);
+ status_lock = controller_lock_read(is_normal, main.thread, &process_list[i]->active);
}
if (status_lock == F_signal || F_status_is_error(status_lock)) {
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&process_list[i]->lock);
break;
}
}
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&process_list[i]->lock);
if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &process->lock);
+ status_lock = controller_lock_read_process(caller, main.thread, &process_list[i]->lock);
}
else {
- status_lock = controller_lock_read(is_normal, main.thread, &process->lock);
+ status_lock = controller_lock_read(is_normal, main.thread, &process_list[i]->lock);
}
if (status_lock == F_signal || F_status_is_error(status_lock)) break;
}
- if (required && (process->options & controller_process_option_require)) {
- if (controller_rule_status_is_error(process->action, process->rule)) {
+ if (required && (process_list[i]->options & controller_process_option_require)) {
+ if (controller_rule_status_is_error(process_list[i]->action, process_list[i]->rule)) {
status = F_status_set_error(F_require);
- f_thread_unlock(&process->lock);
- f_thread_unlock(&process->active);
-
- if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process);
- }
- else {
- status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process);
- }
+ f_thread_unlock(&process_list[i]->lock);
+ f_thread_unlock(&process_list[i]->active);
break;
}
- else if (controller_rule_status_is_available(process->action, process->rule)) {
+ else if (controller_rule_status_is_available(process_list[i]->action, process_list[i]->rule)) {
required_not_run = F_true;
}
}
- f_thread_unlock(&process->lock);
- f_thread_unlock(&process->active);
-
- if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process);
- }
- else {
- status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process);
- }
+ f_thread_unlock(&process_list[i]->lock);
+ f_thread_unlock(&process_list[i]->active);
- if (status_lock == F_signal || F_status_is_error(status_lock)) break;
if (F_status_set_fine(status) == F_require) break;
continue;
}
- if (!controller_rule_status_is_error(process->action, process->rule) && (process->state == controller_process_state_active || process->state == controller_process_state_busy)) {
- f_thread_unlock(&process->lock);
+ if (!controller_rule_status_is_error(process_list[i]->action, process_list[i]->rule) && (process_list[i]->state == controller_process_state_active || process_list[i]->state == controller_process_state_busy)) {
+ f_thread_unlock(&process_list[i]->lock);
- status = controller_process_wait(main, process);
+ status = controller_process_wait(main, process_list[i]);
if (status == F_signal) {
- f_thread_unlock(&process->active);
-
- if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process);
- }
- else {
- status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process);
- }
+ f_thread_unlock(&process_list[i]->active);
break;
}
if (required) {
if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &process->lock);
+ status_lock = controller_lock_read_process(caller, main.thread, &process_list[i]->lock);
}
else {
- status_lock = controller_lock_read(is_normal, main.thread, &process->lock);
+ status_lock = controller_lock_read(is_normal, main.thread, &process_list[i]->lock);
}
if (status_lock == F_signal || F_status_is_error(status_lock)) {
- f_thread_unlock(&process->active);
+ f_thread_unlock(&process_list[i]->active);
break;
}
- if ((process->options & controller_process_option_require)) {
- f_thread_unlock(&process->lock);
+ if ((process_list[i]->options & controller_process_option_require)) {
+ f_thread_unlock(&process_list[i]->lock);
- if (controller_rule_status_is_error(process->action, process->rule)) {
+ if (controller_rule_status_is_error(process_list[i]->action, process_list[i]->rule)) {
status = F_status_set_error(F_require);
- f_thread_unlock(&process->active);
-
- if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process);
- }
- else {
- status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process);
- }
-
+ f_thread_unlock(&process_list[i]->active);
break;
}
}
else {
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&process_list[i]->lock);
}
}
}
else {
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&process_list[i]->lock);
}
- f_thread_unlock(&process->active);
+ f_thread_unlock(&process_list[i]->active);
- if (caller) {
- status_lock = controller_lock_read_process(caller, main.thread, &main.thread->lock.process);
- }
- else {
- status_lock = controller_lock_read(is_normal, main.thread, &main.thread->lock.process);
- }
-
- if (status_lock == F_signal || F_status_is_error(status_lock)) break;
if (status == F_signal || F_status_set_fine(status) == F_require) break;
} // for
return status_lock;
}
- f_thread_unlock(&main.thread->lock.process);
-
if (caller) {
if (!controller_thread_is_enabled_process(caller, main.thread)) {
return F_signal;
* - controller_rule_action_type_start
* - controller_rule_action_type_stop
* @param options
- * A number using bits to represent specific boolean options.
+ * Process options to consider when executing.
* If bit controller_process_option_simulate, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
* @param main
* The main data.
* This requires that a read lock be set on process->lock before being called.
*
* @param type
- * The item type code.
+ * The item type ID.
* @param action
* The action to perform based on the action type codes.
*
* @param arguments
* The arguments to pass to the program.
* @param options
- * A number using bits to represent specific boolean options.
+ * Process options to consider when executing.
* If bit controller_process_option_simulate, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
* @param main
* The main data.
* @param arguments
* The arguments to pass to the program.
* @param options
- * A number using bits to represent specific boolean options.
+ * Process options to consider when executing.
* If bit controller_process_option_simulate, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
* @param with
* The "with" option flags.
}
if (F_status_is_error(status) || status == F_signal || !(data->parameters[controller_parameter_validate].result == f_console_result_none || data->parameters[controller_parameter_test].result == f_console_result_found)) {
- // do nothing
+
+ if (main.data->parameters[controller_parameter_validate].result == f_console_result_found) {
+ const controller_main_entry_t entry = controller_macro_main_entry_t_initialize(&main, main.setting);
+
+ status = f_thread_create(0, &thread.id_entry, &controller_thread_exit, (void *) &entry);
+
+ if (F_status_is_error(status)) {
+ if (data->error.verbosity != f_console_verbosity_quiet) {
+ controller_error_print(data->error, F_status_set_fine(status), "f_thread_create", F_true, &thread);
+ }
+ }
+ else {
+ controller_thread_join(&thread.id_entry);
+
+ status = thread.status;
+ }
+ }
}
else {
if (data->parameters[controller_parameter_validate].result == f_console_result_none && setting->mode == controller_setting_mode_service) {