build_sources_library main/print/message.c main/print/message/entry.c main/print/message/entry/action.c main/print/message/entry/item.c
build_sources_library main/print/verbose.c
build_sources_library main/print/warning.c main/print/warning/entry/action.c main/print/warning/entry/item.c main/print/warning/entry/setting.c
-build_sources_library main/signal.c main/time.c
+build_sources_library main/signal.c main/status.c main/time.c
build_sources_library main/thread.c main/thread/cleanup.c main/thread/control.c main/thread/entry.c main/thread/instance.c main/thread/is.c main/thread/rule.c main/thread/signal.c
build_sources_library main/validate.c
build_sources_headers main/print/message.h main/print/message/entry.h main/print/message/entry/action.h main/print/message/entry/item.h
build_sources_headers main/print/verbose.h
build_sources_headers main/print/warning.h main/print/warning/entry/action.h main/print/warning/entry/item.h main/print/warning/entry/setting.h
-build_sources_headers main/signal.h main/time.h
+build_sources_headers main/signal.h main/status.h main/time.h
build_sources_headers main/thread.h main/thread/cleanup.h main/thread/control.h main/thread/entry.h main/thread/instance.h main/thread/is.h main/thread/rule.h main/thread/signal.h
build_sources_headers main/validate.h
int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
controller_t data = controller_t_initialize;
- controller_process_t process = controller_process_t_initialize;
- controller_thread_t thread = controller_thread_t_initialize;
data.program.debug.flag |= controller_print_flag_debug_e | controller_print_flag_out_e;
data.program.error.flag |= controller_print_flag_error_e | controller_print_flag_out_e;
data.program.pipe = fll_program_data_pipe_input_e;
}
- data.process = &process;
data.setting.flag |= controller_main_flag_interruptible_e;
- data.thread = &thread;
fll_program_standard_set_up(&data.program);
int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
controller_t data = controller_t_initialize;
- controller_process_t process = controller_process_t_initialize;
- controller_thread_t thread = controller_thread_t_initialize;
data.program.debug.flag |= controller_print_flag_debug_e | controller_print_flag_out_e;
data.program.error.flag |= controller_print_flag_error_e | controller_print_flag_out_e;
}
data.callback.process_entry_setup = &controller_init_process_entry_setup;
- data.process = &process;
data.setting.flag &= ~controller_main_flag_interruptible_e;
- data.thread = &thread;
process.entry.pid = controller_entry_pid_disable_e;
process.entry.show = controller_entry_show_init_e;
if (main->program.parameters.array[controller_parameter_settings_e].locations.used) {
index = main->program.parameters.array[controller_parameter_settings_e].values.array[main->program.parameters.array[controller_parameter_settings_e].values.used - 1];
- controller_path_canonical_relative(main, main->process.path_current, args[index], &main->process.path_setting);
+ main->setting.state.status = controller_path_canonical_relative(main, main->process.path_current, args[index], &main->process.path_setting);
if (F_status_is_error(main->setting.state.status)) {
controller_print_error_file(&main->program.error, macro_controller_f(controller_path_canonical_relative), args[index], f_file_operation_verify_s, fll_error_file_type_path_e);
index = main->program.parameters.array[controller_parameter_cgroup_e].values.array[main->program.parameters.array[controller_parameter_cgroup_e].values.used - 1];
if (args[index].used) {
- controller_path_canonical_relative(main, main->process.path_current, args[index], &main->process.path_cgroup);
+ main->setting.state.status = controller_path_canonical_relative(main, main->process.path_current, args[index], &main->process.path_cgroup);
if (F_status_is_error(main->setting.state.status)) {
controller_print_error_file(&main->program.error, macro_controller_f(controller_path_canonical_relative), args[index], f_file_operation_verify_s, fll_error_file_type_path_e);
"f_thread_create",
"f_time_spec_millisecond",
"fl_conversion_dynamic_partial_to_signed_detect",
+ "fl_conversion_dynamic_partial_to_unsigned_detect",
"fl_conversion_dynamic_to_unsigned_detect ",
"fl_environment_load_names",
"fl_fss_extended_list_content_read",
controller_f_f_thread_create_e,
controller_f_f_time_spec_millisecond_e,
controller_f_fl_conversion_dynamic_partial_to_signed_detect_e,
+ controller_f_fl_conversion_dynamic_partial_to_unsigned_detect_e,
controller_f_fl_conversion_dynamic_to_unsigned_detect_e,
controller_f_fl_environment_load_names_e,
controller_f_fl_fss_extended_list_content_read_e,
#include <program/controller/main/common.h>
#include <program/controller/main/convert.h>
#include <program/controller/main/entry.h>
+#include <program/controller/main/entry/action.h>
#include <program/controller/main/entry/preprocess.h>
#include <program/controller/main/entry/process.h>
#include <program/controller/main/entry/setting.h>
#include <program/controller/main/print/warning/entry/item.h>
#include <program/controller/main/print/warning/entry/setting.h>
#include <program/controller/main/signal.h>
+#include <program/controller/main/status.h>
#include <program/controller/main/time.h>
#include <program/controller/main/thread/cleanup.h>
#include <program/controller/main/thread/control.h>
}
else {
controller_print_error_file_status(&main->program.error, macro_controller_f(controller_file_load), (entry->flag & controller_entry_flag_is_e) ? controller_entry_s : controller_exit_s, f_file_operation_read_s, fll_error_file_type_file_e, F_status_set_fine(status));
+ }
}
if (F_status_is_error_not(status) && main->thread.cache.object_items.used) {
f_number_unsigned_t j = 0;
f_state_t state = f_state_t_initialize;
- for (; i < main->thread.cache.object_items.used && controller_thread_is_enabled(entry->flag & controller_entry_flag_is_e, &main->thread); ++i) {
+ for (i = 0; i < main->thread.cache.object_items.used && controller_thread_is_enabled(entry->flag & controller_entry_flag_is_e, &main->thread); ++i) {
code &= ~0x2;
at = 0;
break;
}
- status = controller_entry_action_read(main, entry->flag & controller_entry_flag_is_e, *range, &entry->items.array[at].actions);
+ status = controller_entry_action_read(main, entry, *range, &entry->items.array[at].actions);
if (F_status_is_error(status)) {
if (F_status_set_fine(status) != F_interrupt) {
if (entry->flag & controller_entry_flag_is_e && F_status_set_fine(status) == F_interrupt) return status;
if (F_status_is_error_not(status)) {
- main->thread.cache.action.name_action.used = 0;
- main->thread.cache.action.name_item.used = 0;
-
if (!(code & 0x1)) {
status = F_status_set_error(F_found_not);
- controller_print_message_entry_item_required(&main->program.error, entry->flag & controller_entry_flag_is_e, "is not found");
+ controller_print_message_entry_item_required(&main->program.error, entry->flag & controller_entry_flag_is_e, main->thread.cache.action.name_item, "is not found");
}
+ main->thread.cache.action.name_action.used = 0;
+ main->thread.cache.action.name_item.used = 0;
+
if (F_status_is_error_not(status)) {
controller_entry_action_t *action = 0;
main->thread.cache.action.line_action = action->line;
main->thread.cache.action.line_item = entry->items.array[i].line;
+ main->thread.cache.action.name_item.used = 0;
status = f_string_dynamic_append_nulless(entry->items.array[i].name, &main->thread.cache.action.name_item);
break;
}
- controller_print_message_entry_item_required(&main->program.error, entry->flag & controller_entry_flag_is_e, "does not exist");
+ controller_print_message_entry_item_required(&main->program.error, entry->flag & controller_entry_flag_is_e, main->thread.cache.action.name_item, "does not exist");
action->number = 0;
action->status = controller_status_simplify_error(F_found_not);
}
if (F_status_is_error(status)) {
+ entry->status = controller_status_simplify_error(F_status_set_fine(status));
+
if (F_status_set_fine(status) != F_interrupt) {
controller_print_error_entry_cache(&main->program.error, &main->thread.cache.action, entry->flag & controller_entry_flag_is_e);
}
-
- entry->status = controller_status_simplify_error(F_status_set_fine(status));
}
else {
entry->status = F_okay;
#endif
#ifndef _di_controller_entry_action_read_
- f_status_t controller_entry_action_read(controller_t * const main, const uint8_t is_entry, f_range_t range, controller_entry_actions_t * const actions) {
+ f_status_t controller_entry_action_read(controller_t * const main, controller_entry_t * const entry, const f_range_t range, controller_entry_actions_t * const actions) {
- if (!main || !actions) return F_status_set_error(F_parameter);
+ if (!main || !entry || !actions) return F_status_set_error(F_parameter);
f_status_t status = F_okay;
f_status_t status_action = F_okay;
main->thread.cache.content_actions.array[--main->thread.cache.content_actions.used].used = 0;
} // while
+ controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(entry->flag & controller_entry_flag_is_e, main);
+ f_state_t state = macro_f_state_t_initialize_1(controller_allocation_large_d, controller_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+
{
- controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize_1(is_entry, global.thread);
- f_state_t state = macro_f_state_t_initialize_1(controller_common_allocation_large_d, controller_common_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_range_t content_range = range;
fll_fss_extended_read(main->thread.cache.buffer_file, &content_range, &main->thread.cache.object_actions, &main->thread.cache.content_actions, 0, 0, &main->thread.cache.delimits, 0, &state);
}
- if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fll_fss_extended_read), F_true);
+ if (F_status_is_error(state.status)) {
+ controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(state.status), macro_controller_f(fll_fss_extended_read), F_true);
- return status;
+ return state.status;
}
- f_state_t state = f_state_t_initialize;
-
f_fss_apply_delimit(main->thread.cache.delimits, &main->thread.cache.buffer_file, &state);
- if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true);
+ if (F_status_is_error(state.status)) {
+ controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(state.status), macro_controller_f(f_fss_apply_delimit), F_true);
- return status;
+ return state.status;
}
main->thread.cache.delimits.used = 0;
- status f_memory_array_increase_by(main->thread.cache.object_actions.used, sizeof(controller_entry_action_t), (void **) &actions->array, &actions->used, &actions->size);
+ status = f_memory_array_increase_by(main->thread.cache.object_actions.used, sizeof(controller_entry_action_t), (void **) &actions->array, &actions->used, &actions->size);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
+ controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
return status;
}
action->status = F_known_not;
action->parameters.used = 0;
- f_fss_count_lines(main->thread.cache.buffer_file, main->thread.cache.object_actions.array[i].start, &main->thread.cache.action.line_action, &global.main->setting.state);
+ f_fss_count_lines(main->thread.cache.buffer_file, main->thread.cache.object_actions.array[i].start, &main->thread.cache.action.line_action, &state);
- if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
+ if (F_status_is_error(state.status)) {
+ status = state.status;
+
+ controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
break;
}
status = f_rip_dynamic_partial_nulless(main->thread.cache.buffer_file, main->thread.cache.object_actions.array[i], &main->thread.cache.action.name_action);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+ controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
break;
}
actions->array[actions->used].type = controller_entry_action_type_timeout_e;
}
else {
- if (global.main->program.warning.verbosity == f_console_verbosity_debug_e) {
- controller_lock_print(global.main->program.warning.to, global.thread);
-
- fl_print_format("%r%[%QUnknown %r item action '%]", global.main->program.warning.to, f_string_eol_s, global.main->program.warning.context, global.main->program.warning.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.warning.context);
- fl_print_format(f_string_format_Q_single_s.string, global.main->program.warning.to, global.main->program.warning.notable, main->thread.cache.action.name_action, global.main->program.warning.notable);
- fl_print_format(f_string_format_sentence_end_quote_s.string, global.main->program.warning.to, global.main->program.warning.context, global.main->program.warning.context, f_string_eol_s);
-
- controller_entry_print_error_cache(is_entry, &global.main->program.warning, main->thread.cache.action);
-
- controller_unlock_print_flush(global.main->program.warning.to, global.thread);
- }
+ controller_print_warning_entry_action_unknown(&main->program.warning, &main->thread.cache, entry->flag & controller_entry_flag_is_e, main->thread.cache.action.name_action);
continue;
}
}
if (main->thread.cache.content_actions.array[i].used < at_least || main->thread.cache.content_actions.array[i].used > at_most) {
- action->status = F_status_set_error(F_parameter);
+ action->status = controller_status_simplify_error(F_parameter);
- if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
- f_thread_mutex_lock(&global.thread->lock.print);
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+ f_thread_mutex_lock(&main->thread.lock.print);
- f_file_stream_lock(global.main->program.error.to);
+ f_file_stream_lock(main->program.error.to);
- fl_print_format("%r%[%QThe %r item action '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, main->thread.cache.action.name_action, global.main->program.error.notable);
- fl_print_format("%[' requires ", global.main->program.error.to, global.main->program.error.context);
+ fl_print_format("%r%[%QThe %r item action '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+ fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, main->thread.cache.action.name_action, main->program.error.notable);
+ fl_print_format("%[' requires ", main->program.error.to, main->program.error.context);
if (at_least == at_most) {
- f_print_terminated("exactly ", global.main->program.error.to);
+ f_print_terminated("exactly ", main->program.error.to);
}
- fl_print_format("%]%[%un%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.notable, at_least, global.main->program.error.notable);
+ fl_print_format("%]%[%un%]", main->program.error.to, main->program.error.context, main->program.error.notable, at_least, main->program.error.notable);
if (action->type == controller_entry_action_type_consider_e || controller_entry_action_type_is_rule(action->type)) {
- fl_print_format("%[ or more parameters.%]%r", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+ fl_print_format("%[ or more parameters.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
}
else {
if (at_least == at_most) {
- fl_print_format("%[ parameters.%]%r", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+ fl_print_format("%[ parameters.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
}
else {
- fl_print_format("%[ to %]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
- fl_print_format("%[%un%]", global.main->program.error.to, global.main->program.error.notable, at_most, global.main->program.error.notable);
- fl_print_format("%[ parameters.%]%r", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+ fl_print_format("%[ to %]", main->program.error.to, main->program.error.context, main->program.error.context);
+ fl_print_format("%[%un%]", main->program.error.to, main->program.error.notable, at_most, main->program.error.notable);
+ fl_print_format("%[ parameters.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
}
}
- f_file_stream_unlock(global.main->program.error.to);
+ f_file_stream_unlock(main->program.error.to);
- f_thread_mutex_unlock(&global.thread->lock.print);
+ f_thread_mutex_unlock(&main->thread.lock.print);
}
}
else {
status = f_memory_array_increase_by(allocate, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
+ controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
action->status = status;
status = f_memory_array_increase_by((main->thread.cache.content_actions.array[i].array[j].stop - main->thread.cache.content_actions.array[i].array[j].start) + 1, sizeof(f_char_t), (void **) &action->parameters.array[j].string, &action->parameters.array[j].used, &action->parameters.array[j].size);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
+ controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
break;
}
status = f_string_dynamic_partial_append_nulless(main->thread.cache.buffer_file, main->thread.cache.content_actions.array[i].array[j], &action->parameters.array[j]);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_partial_append_nulless), F_true);
+ controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_string_dynamic_partial_append_nulless), F_true);
break;
}
if (action->parameters.array[0].used) {
// Force the path to be canonical (removing all '../' parts).
- status = controller_path_canonical_relative(global.setting, action->parameters.array[0], &main->thread.cache.buffer_path);
+ status = controller_path_canonical_relative(main, main->process.path_current, action->parameters.array[0], &main->thread.cache.buffer_path);
if (F_status_is_error(status)) {
- controller_entry_print_error_file(is_entry, &global.main->program.error, main->thread.cache.action, F_status_set_fine(status), "controller_path_canonical_relative", F_true, main->thread.cache.action.generic, f_file_operation_analyze_s, fll_error_file_type_path_e, global.thread);
+ controller_print_error_entry_file(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true, main->thread.cache.action.generic, f_file_operation_analyze_s, fll_error_file_type_path_e);
action->status = status;
}
}
else {
- action->status = F_status_set_error(F_parameter);
+ action->status = controller_status_simplify_error(F_parameter);
if (F_status_is_error_not(status_action)) {
status_action = action->status;
}
- if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
- fll_print_format("%r%[%QThe %r item action must not have an empty string for a path (the first parameter).%]%r", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context, f_string_eol_s);
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+ fll_print_format("%r%[%QThe %r item action must not have an empty string for a path (the first parameter).%]%r", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context, f_string_eol_s);
}
}
status = f_file_name_base(action->parameters.array[1], &main->thread.cache.buffer_path);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_file_name_base), F_true);
+ controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_file_name_base), F_true);
if (F_status_set_fine(status) == F_memory_not) {
- status_action = status;
+ status_action = controller_status_simplify_error(status);
break;
}
- action->status = status;
+ action->status = controller_status_simplify_error(status);
if (F_status_is_error_not(status_action)) {
status_action = status;
}
else {
if (f_compare_dynamic(action->parameters.array[1], main->thread.cache.buffer_path) == F_equal_to_not) {
- if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(global.main->program.error.to);
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->program.error.to);
- fl_print_format("%r%[%QThe %r item action second parameter '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[1], global.main->program.error.notable);
- fl_print_format("%[' must be a base path name, such as '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, main->thread.cache.buffer_path, global.main->program.error.notable);
- fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+ fl_print_format("%r%[%QThe %r item action second parameter '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+ fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[1], main->program.error.notable);
+ fl_print_format("%[' must be a base path name, such as '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+ fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, main->thread.cache.buffer_path, main->program.error.notable);
+ fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
- f_file_stream_unlock(global.main->program.error.to);
+ f_file_stream_unlock(main->program.error.to);
}
- action->status = F_status_set_error(F_parameter);
+ action->status = controller_status_simplify_error(F_parameter);
if (F_status_is_error_not(status_action)) {
status_action = action->status;
}
}
else {
- action->status = F_status_set_error(F_parameter);
+ action->status = controller_status_simplify_error(F_parameter);
if (F_status_is_error_not(status_action)) {
status_action = action->status;
}
- if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
- fll_print_format("%r%[%QThe %r item action must not have an empty string for a rule name (the second parameter).%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context, f_string_eol_s);
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+ fll_print_format("%r%[%QThe %r item action must not have an empty string for a rule name (the second parameter).%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context, f_string_eol_s);
}
}
}
else {
if (action->status == F_okay) {
- action->status = F_status_set_error(F_support_not);
+ action->status = controller_status_simplify_error(F_support_not);
if (F_status_is_error_not(status_action)) {
status_action = action->status;
}
}
- if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(global.main->program.error.to);
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->program.error.to);
- fl_print_format("%r%[%QThe %r item action third parameter (and beyond) must be one of '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_asynchronous_s, global.main->program.error.notable);
- fl_print_format("%[', '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_require_s, global.main->program.error.notable);
- fl_print_format("%[', or '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_wait_s, global.main->program.error.notable);
- fl_print_format("%[' but instead has '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[j], global.main->program.error.notable);
- fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+ fl_print_format("%r%[%QThe %r item action third parameter (and beyond) must be one of '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+ fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_asynchronous_s, main->program.error.notable);
+ fl_print_format("%[', '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+ fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_require_s, main->program.error.notable);
+ fl_print_format("%[', or '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+ fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_wait_s, main->program.error.notable);
+ fl_print_format("%[' but instead has '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+ fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[j], main->program.error.notable);
+ fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
- f_file_stream_unlock(global.main->program.error.to);
+ f_file_stream_unlock(main->program.error.to);
}
}
} // for
}
else if (action->type == controller_entry_action_type_failsafe_e || action->type == controller_entry_action_type_item_e) {
if (f_compare_dynamic(controller_main_s, action->parameters.array[0]) == F_equal_to) {
- action->status = F_status_set_error(F_support_not);
+ action->status = controller_status_simplify_error(F_support_not);
if (F_status_is_error_not(status_action)) {
status_action = action->status;
}
- if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(global.main->program.error.to);
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->program.error.to);
- fl_print_format("%r%[%QThe %r item action may not specify the reserved item '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_main_s, global.main->program.error.notable);
- fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+ fl_print_format("%r%[%QThe %r item action may not specify the reserved item '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+ fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_main_s, main->program.error.notable);
+ fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
- f_file_stream_unlock(global.main->program.error.to);
+ f_file_stream_unlock(main->program.error.to);
}
}
}
action->code = controller_entry_timeout_code_stop_d;
}
else {
- action->status = F_status_set_error(F_support_not);
+ action->status = controller_status_simplify_error(F_support_not);
if (F_status_is_error_not(status_action)) {
status_action = action->status;
}
- if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(global.main->program.error.to);
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->program.error.to);
- fl_print_format("%r%[%QThe %r item action must have one of '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_kill_s, global.main->program.error.notable);
- fl_print_format("%[', '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_start_s, global.main->program.error.notable);
- fl_print_format("%[', or '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_stop_s, global.main->program.error.notable);
- fl_print_format("%[' but instead has '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[0], global.main->program.error.notable);
- fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+ fl_print_format("%r%[%QThe %r item action must have one of '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+ fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_kill_s, main->program.error.notable);
+ fl_print_format("%[', '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+ fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_start_s, main->program.error.notable);
+ fl_print_format("%[', or '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+ fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_stop_s, main->program.error.notable);
+ fl_print_format("%[' but instead has '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+ fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[0], main->program.error.notable);
+ fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
- f_file_stream_unlock(global.main->program.error.to);
+ f_file_stream_unlock(main->program.error.to);
}
}
action->number = 0;
if (status == F_data_not) {
- action->status = F_status_set_error(F_number);
+ action->status = controller_status_simplify_error(F_number);
}
else {
action->status = controller_status_simplify_error(F_status_set_fine(status));
}
if (F_status_set_fine(status) == F_memory_not) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_to_unsigned_detect), F_true);
+ controller_print_error_entry(&main->program.error, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_to_unsigned_detect), F_true);
status_action = status;
break;
}
- if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(global.main->program.error.to);
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->program.error.to);
- fl_print_format("%r%[%QThe %r item action parameter '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[1], global.main->program.error.notable);
- fl_print_format("%[' is not a valid supported number.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+ fl_print_format("%r%[%QThe %r item action parameter '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+ fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[1], main->program.error.notable);
+ fl_print_format("%[' is not a valid supported number.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
- f_file_stream_unlock(global.main->program.error.to);
+ f_file_stream_unlock(main->program.error.to);
}
}
}
action->code |= controller_entry_rule_code_wait_d;
}
else {
- action->status = F_status_set_error(F_support_not);
+ action->status = controller_status_simplify_error(F_support_not);
- if (global.main->program.error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(global.main->program.error.to);
+ if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->program.error.to);
- fl_print_format("%r%[%QThe %r item action may only have '%]", global.main->program.error.to, f_string_eol_s, global.main->program.error.context, global.main->program.error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->program.error.context);
- fl_print_format(f_string_format_r_single_s.string, global.main->program.error.to, global.main->program.error.notable, controller_wait_s, global.main->program.error.notable);
- fl_print_format("%[' but instead has '%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context);
- fl_print_format(f_string_format_Q_single_s.string, global.main->program.error.to, global.main->program.error.notable, action->parameters.array[0], global.main->program.error.notable);
- fl_print_format("%['.%]", global.main->program.error.to, global.main->program.error.context, global.main->program.error.context, f_string_eol_s);
+ fl_print_format("%r%[%QThe %r item action may only have '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, entry->flag & controller_entry_flag_is_e ? controller_entry_s : controller_exit_s, main->program.error.context);
+ fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_wait_s, main->program.error.notable);
+ fl_print_format("%[' but instead has '%]", main->program.error.to, main->program.error.context, main->program.error.context);
+ fl_print_format(f_string_format_Q_single_s.string, main->program.error.to, main->program.error.notable, action->parameters.array[0], main->program.error.notable);
+ fl_print_format("%['.%]", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
- f_file_stream_unlock(global.main->program.error.to);
+ f_file_stream_unlock(main->program.error.to);
}
}
}
++actions->used;
} // for
- if (F_status_is_error(status_action)) {
- return status_action;
+ return F_status_is_error(status_action) ? status_action : status;
+ }
+#endif // _di_controller_entry_action_read_
+
+#ifndef _di_controller_entry_action_type_name_
+ f_string_static_t controller_entry_action_type_name(const uint8_t type) {
+
+ switch (type) {
+ case controller_entry_action_type_consider_e:
+ return controller_consider_s;
+
+ case controller_entry_action_type_execute_e:
+ return controller_execute_s;
+
+ case controller_entry_action_type_failsafe_e:
+ return controller_failsafe_s;
+
+ case controller_entry_action_type_freeze_e:
+ return controller_freeze_s;
+
+ case controller_entry_action_type_item_e:
+ return controller_item_s;
+
+ case controller_entry_action_type_kexec_e:
+ return controller_kexec_s;
+
+ case controller_entry_action_type_kill_e:
+ return controller_kill_s;
+
+ case controller_entry_action_type_pause_e:
+ return controller_pause_s;
+
+ case controller_entry_action_type_ready_e:
+ return controller_ready_s;
+
+ case controller_entry_action_type_reboot_e:
+ return controller_reboot_s;
+
+ case controller_entry_action_type_reload_e:
+ return controller_reload_s;
+
+ case controller_entry_action_type_restart_e:
+ return controller_restart_s;
+
+ case controller_entry_action_type_resume_e:
+ return controller_resume_s;
+
+ case controller_entry_action_type_shutdown_e:
+ return controller_shutdown_s;
+
+ case controller_entry_action_type_start_e:
+ return controller_start_s;
+
+ case controller_entry_action_type_stop_e:
+ return controller_stop_s;
+
+ case controller_entry_action_type_thaw_e:
+ return controller_thaw_s;
+
+ case controller_entry_action_type_timeout_e:
+ return controller_timeout_s;
}
- return status;
+ return f_string_empty_s;
}
-#endif // _di_controller_entry_action_read_
+#endif // _di_controller_entry_action_type_name_
+
+#ifndef _di_controller_entry_action_type_is_rule_
+ f_status_t controller_entry_action_type_is_rule(uint8_t type) {
+
+ switch (type) {
+ case controller_entry_action_type_freeze_e:
+ case controller_entry_action_type_kill_e:
+ case controller_entry_action_type_pause_e:
+ case controller_entry_action_type_reload_e:
+ case controller_entry_action_type_restart_e:
+ case controller_entry_action_type_resume_e:
+ case controller_entry_action_type_start_e:
+ case controller_entry_action_type_stop_e:
+ case controller_entry_action_type_thaw_e:
+ return F_true;
+ }
+
+ return F_false;
+ }
+#endif // _di_controller_entry_action_type_is_rule_
+
+#ifndef _di_controller_entry_action_type_to_rule_action_type_
+ uint8_t controller_entry_action_type_to_rule_action_type(uint8_t type) {
+
+ switch (type) {
+ case controller_entry_action_type_freeze_e:
+ return controller_rule_action_type_freeze_e;
+
+ case controller_entry_action_type_kill_e:
+ return controller_rule_action_type_kill_e;
+
+ case controller_entry_action_type_pause_e:
+ return controller_rule_action_type_pause_e;
+
+ case controller_entry_action_type_reload_e:
+ return controller_rule_action_type_reload_e;
+
+ case controller_entry_action_type_restart_e:
+ return controller_rule_action_type_restart_e;
+
+ case controller_entry_action_type_resume_e:
+ return controller_rule_action_type_resume_e;
+
+ case controller_entry_action_type_start_e:
+ return controller_rule_action_type_start_e;
+
+ case controller_entry_action_type_stop_e:
+ return controller_rule_action_type_stop_e;
+
+ case controller_entry_action_type_thaw_e:
+ return controller_rule_action_type_thaw_e;
+ }
+
+ return 0;
+ }
+#endif // _di_controller_entry_action_type_to_rule_action_type_
#ifdef __cplusplus
} // extern "C"
* The main program data.
*
* Must not be NULL.
- * @param is_entry
- * If TRUE, then this operates as an entry.
- * If FALSE, then this operates as an exit.
+ * @param entry
+ * The entry.
+ *
+ * Must not be NULL.
* @param range
* The range in the list buffer representing the content.
* @param actions
* @return
* F_okay on success.
*
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
* Errors (with error bit) from: controller_entry_actions_increase_by().
* Errors (with error bit) from: f_fss_apply_delimit().
* Errors (with error bit) from: f_fss_count_lines().
* @see fll_fss_extended_read()
*/
#ifndef _di_controller_entry_action_read_
- extern f_status_t controller_entry_action_read(controller_t * const main, const uint8_t is_entry, const f_range_t range, controller_entry_actions_t * const actions);
+ extern f_status_t controller_entry_action_read(controller_t * const main, controller_entry_t * const entry, const f_range_t range, controller_entry_actions_t * const actions);
#endif // _di_controller_entry_action_read_
+/**
+ * Determine if the Entry Action type code represents a Rule type.
+ *
+ * @param type
+ * The type code to compare against.
+ *
+ * @return
+ * TRUE if Rule type.
+ * FALSE otherwise.
+ */
+#ifndef _di_controller_entry_action_type_is_rule_
+ extern f_status_t controller_entry_action_type_is_rule(uint8_t type);
+#endif // _di_controller_entry_action_type_is_rule_
+
+/**
+ * Get a string representing the Entry Action type.
+ *
+ * @param type
+ * The Entry Action type code.
+ *
+ * @return
+ * The string with used > 0 on success.
+ * The string with used == 0 if no match was found.
+ */
+#ifndef _di_controller_entry_action_type_name_
+ extern f_string_static_t controller_entry_action_type_name(const uint8_t type);
+#endif // _di_controller_entry_action_type_name_
+
+/**
+ * Convert the Entry Action type to Rule Action type.
+ *
+ * @param type
+ * The Entry Action type.
+ *
+ * @return
+ * TRUE if Rule type.
+ * FALSE otherwise.
+ */
+#ifndef _di_controller_entry_action_type_to_rule_action_type_
+ extern uint8_t controller_entry_action_type_to_rule_action_type(uint8_t type);
+#endif // _di_controller_entry_action_type_to_rule_action_type_
+
#ifdef __cplusplus
} // extern "C"
#endif
uint8_t error_has = F_false;
// This effectively sets the read for an entry and resets the ready for an exit.
- main->setting.ready = controller_setting_ready_no_e;
+ main->process.ready = controller_process_ready_no_e;
cache->ats.used = 0;
status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
return status;
}
status = f_string_dynamic_append_nulless(entry->items.array[0].name, &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status;
}
status2 = f_string_dynamic_append_nulless(controller_entry_action_type_name(actions->array[cache->ats.array[at_j]].type), &cache->action.name_action);
if (F_status_is_error(status2)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status2;
}
if (actions->array[cache->ats.array[at_j]].type == controller_entry_action_type_ready_e) {
- if (main->setting.ready == controller_setting_ready_wait_e) {
+ if (main->process.ready == controller_process_ready_wait_e) {
controller_print_warning_entry_action_multiple(&main->program.warning, cache, is_entry, controller_ready_s);
}
else {
- main->setting.ready = controller_setting_ready_wait_e;
+ main->process.ready = controller_process_ready_wait_e;
}
}
else if (actions->array[cache->ats.array[at_j]].type == controller_entry_action_type_item_e) {
status2 = f_memory_array_increase(controller_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
if (F_status_is_error(status2)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_memory_array_increase), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status2), macro_controller_f(f_memory_array_increase), F_true);
return status2;
}
status2 = f_string_dynamic_append_nulless(entry->items.array[i].name, &cache->action.name_item);
if (F_status_is_error(status2)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status2;
}
status2 = f_string_dynamic_append_nulless(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
if (F_status_is_error(status2)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status2), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status2;
}
if (!controller_thread_is_enabled(is_entry, &main->thread)) return F_status_set_error(F_interrupt);
// If ready is not found in the entry, then default to always ready.
- if (main->setting.ready == controller_setting_ready_no_e) {
- main->setting.ready = controller_setting_ready_yes_e;
+ if (main->process.ready == controller_process_ready_no_e) {
+ main->process.ready = controller_process_ready_yes_e;
}
return status;
status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
return status;
}
status = f_string_dynamic_append_nulless(entry->items.array[cache->ats.array[0]].name, &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status;
}
}
// The pre-process determines if ready is explicitly specified within the entry file and if it is not start as ready.
- if (main->setting.ready == controller_setting_ready_yes_e) {
+ if (main->process.ready == controller_process_ready_yes_e) {
status = controller_perform_ready(main, is_entry);
if (F_status_is_error(status)) return status;
}
status = f_string_dynamic_append_nulless(controller_entry_action_type_name(entry_action->type), &cache->action.name_action);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status;
}
}
if (entry_action->type == controller_entry_action_type_ready_e) {
- if ((entry_action->code & controller_entry_rule_code_wait_d) || main->setting.ready == controller_setting_ready_wait_e) {
+ if ((entry_action->code & controller_entry_rule_code_wait_d) || main->process.ready == controller_process_ready_wait_e) {
if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e || entry->show == controller_entry_show_init_e) {
controller_print_message_entry_action_wait(&main->program.message, is_entry, controller_ready_s);
}
}
}
- if (main->setting.ready == controller_setting_ready_yes_e) {
+ if (main->process.ready == controller_process_ready_yes_e) {
if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e) {
controller_print_message_entry_action_ready(&main->program.message, is_entry, controller_ready_s);
}
status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &cache->ats.array, &cache->ats.used, &cache->ats.size);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
return status;
}
status = f_string_dynamic_append_nulless(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
return status;
}
f_thread_unlock(&main->thread.lock.rule);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_rules_increase), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_rules_increase), F_true);
return status;
}
}
// Designate the action as failed.
- entry_action->status = F_status_set_error(F_failure);
+ entry_action->status = controller_status_simplify_error(F_failure);
if (!(main->setting.flag & controller_main_flag_simulate_e)) {
f_thread_unlock(&main->thread.lock.rule);
controller_print_error_entry_action_execution_missing(&main->program.error, cache, is_entry, entry_action->parameters.array[0]);
}
else {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(fll_execute_into), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fll_execute_into), F_true);
}
return F_status_set_error(F_execute);
status = f_string_dynamic_append_nulless(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_string_dynamic_append_nulless), F_true);
break;
}
if (F_status_is_error(status_lock)) return status_lock;
// Check to see if any required processes failed, but do not do this if already operating in failsafe.
- if (F_status_is_error_not(status) && !failsafe && !(main->setting.flag & controller_main_flag_validate_e) && main->setting.mode != controller_setting_mode_helper_e) {
+ if (F_status_is_error_not(status) && !failsafe && !(main->setting.flag & controller_main_flag_validate_e) && main->setting.mode != controller_process_mode_helper_e) {
const f_status_t status_wait = controller_rule_wait_all(main, is_entry, F_true);
if (F_status_is_error(status_wait)) return status_wait;
if (status_wait == F_require) return F_status_set_error(F_require);
}
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(fll_fss_extended_read), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fll_fss_extended_read), F_true);
return status;
}
}
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), F_true);
return status;
}
f_fss_count_lines(cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action, &main->setting.state);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
break;
}
status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->object_actions.array[i], &cache->action.name_action);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
break;
}
status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->content_actions.array[i].array[0], &cache->action.generic);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
break;
}
main->setting.path_control.used = 0;
- status = controller_path_canonical_relative(main->setting, cache->action.generic, &main->setting.path_control);
+ status = controller_path_canonical_relative(main, main->process.path_current, cache->action.generic, &main->process.path_control);
if (F_status_is_error(status)) {
controller_print_error_entry_file(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true, cache->action.generic, f_file_operation_analyze_s, fll_error_file_type_path_e);
else if (is_entry && f_compare_dynamic(controller_control_group_s, cache->action.name_action) == F_equal_to) {
gid_t number = 0;
- status = controller_convert_group_id(cache->buffer_file, cache->content_actions.array[i].array[0], cache, &number);
+ status = controller_convert_group_id(cache, cache->buffer_file, cache->content_actions.array[i].array[0], &number);
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
controller_print_error_entry_setting_with_range(&main->program.error, cache, is_entry, " has an invalid group", cache->content_actions.array[i].array[0], ", because the given ID is not a valid supported number");
}
else {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_group_id), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_group_id), F_true);
}
continue;
status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->content_actions.array[i].array[0], &cache->action.generic);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
break;
}
status = f_file_mode_to_mode(mode_file, &mode);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_file_mode_to_mode), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_file_mode_to_mode), F_true);
continue;
}
else if (is_entry && f_compare_dynamic(controller_control_user_s, cache->action.name_action) == F_equal_to) {
uid_t number = 0;
- status = controller_convert_user_id(cache->buffer_file, cache->content_actions.array[i].array[0], cache, &number);
+ status = controller_convert_user_id(cache, cache->buffer_file, cache->content_actions.array[i].array[0], &number);
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
controller_print_error_entry_setting_with_range(&main->program.error, cache, is_entry, " has an invalid user", cache->content_actions.array[i].array[0], ", because the given ID is not a valid supported number");
}
else {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_user_id), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_convert_user_id), F_true);
}
continue;
status = controller_entry_setting_read_map(cache->buffer_file, cache->content_actions.array[i], &entry->define);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
continue;
}
}
if (f_compare_dynamic_partial_string(controller_service_s.string, cache->buffer_file, controller_service_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) {
- main->setting.mode = controller_setting_mode_service_e;
+ main->setting.mode = controller_process_mode_service_e;
}
else if (f_compare_dynamic_partial_string(controller_helper_s.string, cache->buffer_file, controller_helper_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) {
- main->setting.mode = controller_setting_mode_helper_e;
+ main->setting.mode = controller_process_mode_helper_e;
}
else if (f_compare_dynamic_partial_string(controller_program_s.string, cache->buffer_file, controller_program_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) {
- main->setting.mode = controller_setting_mode_program_e;
+ main->setting.mode = controller_process_mode_program_e;
}
else {
controller_entry_setting_read_print_setting_unknown_action_value(main, is_entry, *cache, i);
status = controller_entry_setting_read_map(cache->buffer_file, cache->content_actions.array[i], &entry->parameter);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_entry_setting_read_map), F_true);
continue;
}
status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->content_actions.array[i].array[0], &cache->action.generic);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_rip_dynamic_partial_nulless), F_true);
continue;
}
main->setting.path_pid.used = 0;
- status = controller_path_canonical_relative(main->setting, cache->action.generic, &main->setting.path_pid);
+ status = controller_path_canonical_relative(main, main->process.path_current, cache->action.generic, &main->setting.path_pid);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true);
continue;
}
*time = time_previous;
if (F_status_set_fine(status) == F_memory_not) {
- controller_print_error_entry(&main->program.error, cache, is_entry, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_partial_to_unsigned_detect), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(fl_conversion_dynamic_partial_to_unsigned_detect), F_true);
continue;
}
#endif
#ifndef _di_controller_path_canonical_relative_
- void controller_path_canonical_relative(controller_t * const main, const f_string_static_t current, const f_string_static_t source, f_string_dynamic_t * const destination) {
+ f_status_t controller_path_canonical_relative(controller_t * const main, const f_string_static_t current, const f_string_static_t source, f_string_dynamic_t * const destination) {
- if (!main || !destination) return;
+ if (!main || !destination) return F_status_set_error(F_parameter);
- main->setting.state.status = fl_path_canonical(source, destination);
- if (F_status_is_error(main->setting.state.status)) return;
+ {
+ const f_status_t status = fl_path_canonical(source, destination);
+ if (F_status_is_error(status)) return status;
+ }
if (destination->used >= current.used) {
const f_range_t range = macro_f_range_t_initialize_2(current.used);
}
}
- main->setting.state.status = F_okay;
+ return F_okay;
}
#endif // _di_controller_path_canonical_relative_
* The resulting relative canonical path.
* The destination will be completely replaced on success.
*
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
* @see fl_path_canonical()
*
* @see memmove()
*/
#ifndef _di_controller_path_canonical_relative_
- extern void controller_path_canonical_relative(controller_t * const main, const f_string_static_t current, const f_string_static_t source, f_string_dynamic_t * const destination);
+ extern f_status_t controller_path_canonical_relative(controller_t * const main, const f_string_static_t current, const f_string_static_t source, f_string_dynamic_t * const destination);
#endif // _di_controller_path_canonical_relative_
#ifdef __cplusplus
// Always return immediately on memory errors.
if (F_status_set_fine(status) == F_memory_not) {
- controller_print_error_perform_pid_file_create(&main->program.error, macro_controller_f(controller_file_pid_create), is_entry);
+ controller_print_error_perform_pid_file_create(&main->program.error, F_status_set_fine(status), macro_controller_f(controller_file_pid_create), is_entry);
return status;
}
- controller_print_debug_perform_pid_file_create_problem(&main->program.debug, macro_controller_f(controller_file_pid_create), is_entry);
+ controller_print_debug_perform_pid_file_create_problem(&main->program.debug, F_status_set_fine(status), macro_controller_f(controller_file_pid_create), is_entry);
status = F_okay;
}
#endif // _di_controller_print_debug_perform_pid_file_control_socket_
#ifndef _di_controller_print_debug_perform_pid_file_create_problem_
- f_status_t controller_print_debug_perform_pid_file_create_problem(fl_print_t * const print, const f_string_t function, const f_status_t status, const uint8_t is_entry) {
+ f_status_t controller_print_debug_perform_pid_file_create_problem(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t is_entry) {
if (!print || !print->custom) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_debug_e) return F_output_not;
* This requires print.custom to be controller_t.
*
* This does not alter print.custom.setting.state.status.
- * @param function
- * The name of the function associated with the error.
* @param status
* The status code to process.
* Make sure this has F_status_set_fine() called if the status code has any error or warning bits.
+ * @param function
+ * The name of the function associated with the error.
* @param is_entry
* If TRUE, then this operates as an entry.
* If FALSE, then this operates as an exit.
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_controller_print_debug_perform_pid_file_create_problem_
- extern f_status_t controller_print_debug_perform_pid_file_create_problem(fl_print_t * const print, const f_string_t function, const f_status_t status, const uint8_t is_entry);
+ extern f_status_t controller_print_debug_perform_pid_file_create_problem(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t is_entry);
#endif // _di_controller_print_debug_perform_pid_file_create_problem_
/**
#endif
#ifndef _di_controller_print_error_perform_pid_file_create_
- f_status_t controller_print_error_perform_pid_file_create(fl_print_t * const print, const f_string_t function, const f_status_t status, const uint8_t is_entry) {
+ f_status_t controller_print_error_perform_pid_file_create(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t is_entry) {
if (!print || !print->custom) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
* This requires print.custom to be controller_t.
*
* This does not alter print.custom.setting.state.status.
- * @param function
- * The name of the function associated with the error.
* @param status
* The status code to process.
* Make sure this has F_status_set_fine() called if the status code has any error or warning bits.
+ * @param function
+ * The name of the function associated with the error.
* @param is_entry
* If TRUE, then this operates as an entry.
* If FALSE, then this operates as an exit.
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_controller_print_error_perform_pid_file_create_
- extern f_status_t controller_print_error_perform_pid_file_create(fl_print_t * const print, const f_string_t function, const f_status_t status, const uint8_t is_entry);
+ extern f_status_t controller_print_error_perform_pid_file_create(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t is_entry);
#endif // _di_controller_print_error_perform_pid_file_create_
#ifdef __cplusplus
}
#endif // _di_controller_print_message_entry_action_parameters_
+#ifndef _di_controller_print_message_entry_action_ready_
+ f_status_t controller_print_message_entry_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_normal_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%rIgnoring %r item action '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->set.title, name, print->set.title);
+ fl_print_format("', state already is ready.%r", print->to, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_message_entry_action_ready_
+
#ifndef _di_controller_print_message_entry_action_state_
f_status_t controller_print_message_entry_action_state(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry) {
}
#endif // _di_controller_print_message_entry_action_state_failed_
-#ifndef _di_controller_print_message_entry_action_ready_
- f_status_t controller_print_message_entry_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
- if (print->verbosity < f_console_verbosity_normal_e) return F_output_not;
-
- controller_t * const main = (controller_t *) print->custom;
-
- controller_lock_print(print->to, &main->thread);
-
- fl_print_format("%rIgnoring %r item action '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->set.title, name, print->set.title);
- fl_print_format("', state already is ready.%r", print->to, f_string_eol_s);
-
- controller_unlock_print_flush(print->to, &main->thread);
-
- return F_okay;
- }
-#endif // _di_controller_print_message_entry_action_ready_
-
#ifndef _di_controller_print_message_entry_action_wait_
f_status_t controller_print_message_entry_action_wait(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name) {
#endif // _di_controller_print_message_entry_action_parameters_
/**
- * Print message about entry action state.
+ * Print message about the specified entry item action being in the ready state.
+ *
+ * This generally only applies to the "ready" entry item action.
*
* @param print
* The output structure to print to.
* This does not alter print.custom.setting.state.status.
*
* Must not be NULL.
- * @param cache
- * The cache.
- *
- * Must not be NULL.
- * @param action
- * The entry action.
- *
- * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param name
+ * The item name.
*
* @return
* F_okay on success.
*
* F_output_not (with error bit) if setting is NULL.
*/
-#ifndef _di_controller_print_message_entry_action_state_
- extern f_status_t controller_print_message_entry_action_state(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry);
-#endif // _di_controller_print_message_entry_action_state_
+#ifndef _di_controller_print_message_entry_action_ready_
+ extern f_status_t controller_print_message_entry_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
+#endif // _di_controller_print_message_entry_action_ready_
/**
- * Print message about entry action state having failed.
+ * Print message about entry action state.
*
* @param print
* The output structure to print to.
* The entry action.
*
* Must not be NULL.
- * @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
*
* @return
* F_okay on success.
*
* F_output_not (with error bit) if setting is NULL.
*/
-#ifndef _di_controller_print_message_entry_action_state_failed_
- extern f_status_t controller_print_message_entry_action_state_failed(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry);
-#endif // _di_controller_print_message_entry_action_state_failed_
+#ifndef _di_controller_print_message_entry_action_state_
+ extern f_status_t controller_print_message_entry_action_state(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry);
+#endif // _di_controller_print_message_entry_action_state_
/**
- * Print message about the specified entry item action being in the ready state.
- *
- * This generally only applies to the "ready" entry item action.
+ * Print message about entry action state having failed.
*
* @param print
* The output structure to print to.
* This does not alter print.custom.setting.state.status.
*
* Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param action
+ * The entry action.
+ *
+ * Must not be NULL.
* @param is_entry
* If TRUE, then this loads as an entry.
* If FALSE, then this loads as an exit.
- * @param name
- * The item name.
*
* @return
* F_okay on success.
*
* F_output_not (with error bit) if setting is NULL.
*/
-#ifndef _di_controller_print_message_entry_action_ready_
- extern f_status_t controller_print_message_entry_action_ready(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name);
-#endif // _di_controller_print_message_entry_action_ready_
+#ifndef _di_controller_print_message_entry_action_state_failed_
+ extern f_status_t controller_print_message_entry_action_state_failed(fl_print_t * const print, controller_cache_t * const cache, controller_entry_action_t * const action, const uint8_t is_entry);
+#endif // _di_controller_print_message_entry_action_state_failed_
/**
* Print message about waiting for the specified entry item action.
// Mode.
- if (main->setting.mode == controller_setting_mode_service_e) {
+ if (main->setting.mode == controller_process_mode_service_e) {
string = &controller_mode_s;
}
- else if (main->setting.mode == controller_setting_mode_helper_e) {
+ else if (main->setting.mode == controller_process_mode_helper_e) {
string = &controller_helper_s;
}
- else if (main->setting.mode == controller_setting_mode_program_e) {
+ else if (main->setting.mode == controller_process_mode_program_e) {
string = &controller_program_s;
}
else {
}
#endif // _di_controller_print_warning_entry_action_multiple_
+#ifndef _di_controller_print_warning_entry_action_unknown_
+ f_status_t controller_print_warning_entry_action_unknown(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_debug_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QUnknown %r item action '%]", print->to, f_string_eol_s, print->context, print->prefix, is_entry ? controller_entry_s : controller_exit_s, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
+ fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
+
+ controller_print_error_rule_cache(print, &cache->action, F_true);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_warning_entry_action_unknown_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern f_status_t controller_print_warning_entry_action_multiple(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name);
#endif // _di_controller_print_warning_entry_action_multiple_
+/**
+ * Print warnng message about a entry item action being unknown.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * Must not be NULL.
+ * @param cache
+ * A structure for containing and caching relevant data.
+ *
+ * Must not be NULL.
+ * @param name
+ * The parameter name whose value is unknown.
+ * @param unknown
+ * The unknown value.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ */
+#ifndef _di_controller_print_warning_entry_action_unknown_
+ extern f_status_t controller_print_warning_entry_action_unknown(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name);
+#endif // _di_controller_print_warning_entry_action_unknown_
+
#ifdef __cplusplus
} // extern "C"
#endif
else if (type == controller_rule_setting_type_user_e) {
uid_t number = 0;
- status = controller_convert_user_id(cache->buffer_item, cache->content_actions.array[i].array[0], cache, &number);
+ status = controller_convert_user_id(cache, cache->buffer_item, cache->content_actions.array[i].array[0], &number);
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
continue;
}
- status = controller_convert_group_id(cache->buffer_item, cache->content_actions.array[i].array[j], cache, &number);
+ status = controller_convert_group_id(cache, cache->buffer_item, cache->content_actions.array[i].array[j], &number);
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
--- /dev/null
+#include "controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_status_simplify_error_
+ f_status_t controller_status_simplify_error(const f_status_t status) {
+
+ switch (status) {
+ case F_memory_not:
+ return F_status_set_error(F_memory);
+
+ case F_file_open_max:
+ case F_space_not:
+ case F_busy:
+ return F_status_set_error(F_resource);
+
+ case F_access_denied:
+ case F_filesystem_quota_block:
+ case F_prohibited:
+ case F_input_output:
+ return F_status_set_error(F_access);
+
+ case F_complete_not_utf:
+ case F_complete_not_utf_block:
+ case F_complete_not_utf_eof:
+ case F_complete_not_utf_eol:
+ case F_complete_not_utf_eos:
+ case F_complete_not_utf_stop:
+ return F_status_set_error(F_encoding);
+
+ case F_number:
+ case F_number_negative:
+ case F_number_positive:
+ case F_number_overflow:
+ return F_status_set_error(F_number);
+
+ case F_parameter:
+ case F_found_not:
+ case F_interrupt:
+ case F_support_not:
+ case F_critical:
+ return F_status_set_error(status);
+
+ case F_valid_not:
+ return F_status_set_error(F_valid_not);
+
+ default:
+ return F_status_set_error(F_failure);
+ };
+ }
+#endif // _di_controller_status_simplify_error_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides status functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_status_h
+#define _controller_status_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Given a wide range of status codes (that are errors), simplify them down to a smaller subset.
+ *
+ * @param status
+ * The status code (without the error bit set) to simplify.
+ *
+ * @return
+ * The status code (with error bit set) mapped to a status code from a subset of status codes.
+ */
+#ifndef _di_controller_status_simplify_error_
+ extern f_status_t controller_status_simplify_error(const f_status_t status);
+#endif // _di_controller_status_simplify_error_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_status_h