#endif
#ifndef _di_controller_init_process_entry_setup_
- f_status_t controller_init_process_entry_setup(controller_t * const main, controller_cache_t * const cache, controller_entry_t * const entry, const uint8_t is_entry) {
+ f_status_t controller_init_process_entry_setup(controller_t * const main, controller_entry_t * const entry) {
- if (!main || !entry || !cache) return F_status_set_error(F_parameter);
+ if (!main || !entry) return F_status_set_error(F_parameter);
entry->session = controller_entry_session_new_e;
* The main program data.
*
* Must not be NULL.
- * @param cache
- * The cache.
- *
- * Must not be NULL.
* @param entry
* The entry data.
*
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_controller_init_process_entry_setup_
- extern f_status_t controller_init_process_entry_setup(controller_t * const main, controller_cache_t * const cache, controller_entry_t * const entry, const uint8_t is_entry);
+ extern f_status_t controller_init_process_entry_setup(controller_t * const main, controller_entry_t * const entry);
#endif // _di_controller_init_process_entry_setup_
#ifdef __cplusplus
* Controller Entry flags.
*
* controller_entry_flag_*_e:
- * - none_e: No flags are set.
- * - timeout_exit_no_e: The exit timeout is disabled.
- * - timeout_kill_no_e: The kill timeout is disabled for Rules by default.
- * - timeout_start_no_e: The start timeout is disabled for Rules by default.
- * - timeout_stop_no_e: The stop timeout is disabled for Rules by default.
+ * - none: No flags are set.
+ * - is: Designate that this is an entry rather than an exit.
+ * - timeout_exit_no: The exit timeout is disabled.
+ * - timeout_kill_no: The kill timeout is disabled for Rules by default.
+ * - timeout_start_no: The start timeout is disabled for Rules by default.
+ * - timeout_stop_no: The stop timeout is disabled for Rules by default.
*/
#ifndef _di_controller_entry_flag_e_
enum {
controller_entry_flag_none_e = 0x0,
- controller_entry_flag_timeout_exit_no_e = 0x1,
- controller_entry_flag_timeout_kill_no_e = 0x2,
- controller_entry_flag_timeout_start_no_e = 0x4,
- controller_entry_flag_timeout_stop_no_e = 0x8,
+ controller_entry_flag_is_e = 0x1,
+ controller_entry_flag_timeout_exit_no_e = 0x2,
+ controller_entry_flag_timeout_kill_no_e = 0x4,
+ controller_entry_flag_timeout_start_no_e = 0x8,
+ controller_entry_flag_timeout_stop_no_e = 0x10,
}; // enum
#endif // _di_controller_entry_flag_e_
fll_program_data_delete(&main->program);
- controller_cache_delete(&main->cache);
controller_process_delete(&main->process);
controller_setting_delete(&main->setting);
controller_thread_delete(&main->thread);
*/
#ifndef _di_controller_t_
typedef struct {
- f_status_t (*process_entry_setup)(controller_t * const main, controller_cache_t * const cache, controller_entry_t * const entry, const uint8_t is_entry);
+ f_status_t (*process_entry_setup)(controller_t * const main, controller_entry_t * const entry);
} controller_callback_t;
#define controller_callback_t_initialize \
* Properties:
* - program: The main program data.
*
- * - cache: The cache.
* - callback: The callbacks.
* - process: The process data.
* - setting: The settings data.
struct controller_t_ {
fll_program_data_t program;
- controller_cache_t cache;
controller_callback_t callback;
controller_process_t process;
controller_setting_t setting;
#define controller_t_initialize \
{ \
fll_program_data_t_initialize, \
- controller_cache_t_initialize, \
controller_callback_t_initialize, \
controller_process_t_initialize, \
controller_setting_t_initialize, \
* Entry and Exit files are essentially the same structure with minor differences in settings and behavior.
* The structure is identical and due to lacking any particularly good name to represent both "entry" or "exit", the name "entry" is being used for both.
*
+ * A special macro_controller_entry_t_initialize_1() is provided to easily initialize with a specific set of flags.
+ *
* Properties:
* - define: Any defines (environment variables) made available to all Rules in this entry for IKI substitution or just as environment variables.
- * - flag: A set of flags, primarily used to designate that timeouts are disabled.
+ * - flag: A set of flags associated with the entry.
* - items: The array of entry items.
* - parameter: Any parameters made available to all Rules in this entry for IKI substitution.
* - pid: The PID file generation setting.
f_string_maps_t_initialize, \
controller_entry_items_t_initialize, \
}
+
+ #define macro_controller_entry_t_initialize_1(flag) { \
+ F_known_not, \
+ controller_entry_pid_require_e, \
+ 0, \
+ 0, \
+ flag, \
+ controller_thread_exit_timeout_d, \
+ 0, \
+ 0, \
+ 0, \
+ f_string_maps_t_initialize, \
+ f_string_maps_t_initialize, \
+ controller_entry_items_t_initialize, \
+ }
#endif // _di_controller_entry_t_
/**
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
controller_control_t_initialize, \
- controller_entry_t_initialize, \
+ macro_controller_entry_t_initialize_1(controller_entry_flag_is_e), \
controller_entry_t_initialize, \
controller_rules_t_initialize, \
}
#endif
#ifndef _di_controller_entry_read_
- f_status_t controller_entry_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_entry) {
+ f_status_t controller_entry_read(controller_t * const main, controller_entry_t * const entry) {
- if (!main || !cache) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
f_status_t status = F_okay;
-
- controller_entry_t * const entry = is_entry ? &main->process.entry : &main->process.exit;
+ f_number_unsigned_t i = 0;
entry->status = F_known_not;
entry->items.used = 0;
entry->session = controller_entry_session_same_e;
if (main->callback.process_entry_setup) {
- status = main->callback.process_entry_setup(main, cache, entry, is_entry);
+ status = main->callback.process_entry_setup(main, entry);
}
- cache->action.line_action = 0;
- cache->action.line_item = 0;
-
- cache->timestamp.seconds = 0;
- cache->timestamp.seconds_nano = 0;
+ main->thread.cache.action.line_action = 0;
+ main->thread.cache.action.line_item = 0;
- cache->comments.used = 0;
- cache->delimits.used = 0;
+ main->thread.cache.timestamp.seconds = 0;
+ main->thread.cache.timestamp.seconds_nano = 0;
- cache->content_action.used = 0;
+ main->thread.cache.comments.used = 0;
+ main->thread.cache.delimits.used = 0;
- {
- f_number_unsigned_t i = 0;
+ main->thread.cache.content_action.used = 0;
- for (; i < cache->content_actions.used; ++i) {
- cache->content_actions.array[i].used = 0;
- } // for
+ for (; i < main->thread.cache.content_actions.used; ++i) {
+ main->thread.cache.content_actions.array[i].used = 0;
+ } // for
- for (i = 0; i < cache->content_items.used; ++i) {
- cache->content_items.array[i].used = 0;
- } // for
- }
+ for (i = 0; i < main->thread.cache.content_items.used; ++i) {
+ main->thread.cache.content_items.array[i].used = 0;
+ } // for
- cache->content_actions.used = 0;
- cache->content_items.used = 0;
+ main->thread.cache.content_actions.used = 0;
+ main->thread.cache.content_items.used = 0;
- cache->object_actions.used = 0;
- cache->object_items.used = 0;
+ main->thread.cache.object_actions.used = 0;
+ main->thread.cache.object_items.used = 0;
- cache->buffer_file.used = 0;
- cache->buffer_path.used = 0;
+ main->thread.cache.buffer_file.used = 0;
+ main->thread.cache.buffer_path.used = 0;
- cache->action.name_file.used = 0;
- cache->action.name_action.used = 0;
- cache->action.name_item.used = 0;
+ main->thread.cache.action.name_file.used = 0;
+ main->thread.cache.action.name_action.used = 0;
+ main->thread.cache.action.name_item.used = 0;
if (F_status_is_error_not(status)) {
- if (is_entry) {
- status = controller_file_load(main, cache, F_true, controller_entries_s, main->process.name_entry, controller_entry_s);
+ if (entry->flag & controller_entry_flag_is_e) {
+ status = controller_file_load(main, F_true, controller_entries_s, main->process.name_entry, controller_entry_s);
}
else {
- status = controller_file_load(main, cache, F_false, controller_exits_s, main->process.name_entry, controller_exit_s);
+ status = controller_file_load(main, F_false, controller_exits_s, main->process.name_entry, controller_exit_s);
if (status == F_file_found_not) return F_file_found_not;
}
}
if (F_status_is_error_not(status)) {
- if (cache->buffer_file.used) {
- controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_entry, main);
+ if (main->thread.cache.buffer_file.used) {
+ 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);
- f_range_t range = macro_f_range_t_initialize_2(cache->buffer_file.used);
+ f_range_t range = macro_f_range_t_initialize_2(main->thread.cache.buffer_file.used);
- fll_fss_basic_list_read(cache->buffer_file, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments, &state);
+ fll_fss_basic_list_read(main->thread.cache.buffer_file, &range, &main->thread.cache.object_items, &main->thread.cache.content_items, &main->thread.cache.delimits, 0, &main->thread.cache.comments, &state);
if (F_status_is_error(status)) {
controller_print_error_status(&main->program.error, macro_controller_f(fll_fss_basic_list_read), F_status_set_fine(status));
}
else {
- f_fss_apply_delimit(cache->delimits, &cache->buffer_file, &state);
+ 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, cache, is_entry, F_status_set_fine(status), macro_controller_f(f_fss_apply_delimit), 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_fss_apply_delimit), F_true);
}
}
}
else {
- if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
- controller_lock_print(main->program.error.to, &main->thread);
-
- fll_print_format("%r%[%QThe %r file is empty.%]%r", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, is_entry ? controller_entry_s : is_entry ? controller_entry_s : controller_exit_s, main->program.error.context, f_string_eol_s);
-
- controller_unlock_print_flush(main->program.error.to, &main->thread);
- }
-
- status = F_status_set_error(F_data_not);
- }
+ 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) && cache->object_items.used) {
- status = f_memory_array_increase_by(cache->object_items.used, sizeof(f_range_t), (void **) &cache->object_items.array, &cache->object_items.used, &cache->object_items.size);
+ if (F_status_is_error_not(status) && main->thread.cache.object_items.used) {
+ status = f_memory_array_increase_by(main->thread.cache.object_items.used, sizeof(f_range_t), (void **) &main->thread.cache.object_items.array, &main->thread.cache.object_items.used, &main->thread.cache.object_items.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_by), F_true);
+ controller_print_error_entry(&main->program.error, cache, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_memory_array_increase_by), F_true);
}
else {
uint8_t code = 0;
f_range_t *range = 0;
-
f_number_unsigned_t at = 0;
- f_number_unsigned_t i = 0;
f_number_unsigned_t j = 0;
-
f_state_t state = f_state_t_initialize;
- for (; i < cache->object_items.used && controller_thread_is_enabled(is_entry, &main->thread); ++i) {
-
- if (code & 0x2) {
- code -= 0x2;
- }
+ for (; 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;
range = 0;
- cache->action.line_action = 0;
- cache->action.line_item = 0;
+ main->thread.cache.action.line_action = 0;
+ main->thread.cache.action.line_item = 0;
- cache->comments.used = 0;
- cache->delimits.used = 0;
+ main->thread.cache.comments.used = 0;
+ main->thread.cache.delimits.used = 0;
- cache->content_action.used = 0;
- cache->content_actions.used = 0;
+ main->thread.cache.content_action.used = 0;
+ main->thread.cache.content_actions.used = 0;
- cache->object_actions.used = 0;
+ main->thread.cache.object_actions.used = 0;
- cache->buffer_path.used = 0;
+ main->thread.cache.buffer_path.used = 0;
- cache->action.name_action.used = 0;
- cache->action.name_item.used = 0;
+ main->thread.cache.action.name_action.used = 0;
+ main->thread.cache.action.name_item.used = 0;
status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_entry_item_t), (void **) &entry->items.array, &entry->items.used, &entry->items.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, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
break;
}
- status = f_string_dynamic_partial_append(cache->buffer_file, cache->object_items.array[i], &cache->action.name_item);
+ status = f_string_dynamic_partial_append(main->thread.cache.buffer_file, main->thread.cache.object_items.array[i], &main->thread.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_partial_append), 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), F_true);
break;
}
- f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item, &main->setting.state);
+ f_fss_count_lines(main->thread.cache.buffer_file, main->thread.cache.object_items.array[i].start, &main->thread.cache.action.line_item, &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, entry->flag & controller_entry_flag_is_e, F_status_set_fine(status), macro_controller_f(f_fss_count_lines), F_true);
break;
}
- ++cache->action.line_item;
+ ++main->thread.cache.action.line_item;
for (j = (code & 0x1) ? 1 : 0; j < entry->items.used; ++j) {
- if (f_compare_dynamic(entry->items.array[j].name, cache->action.name_item) == F_equal_to) {
+ if (f_compare_dynamic(entry->items.array[j].name, main->thread.cache.action.name_item) == F_equal_to) {
if (main->program.warning.verbosity == f_console_verbosity_debug_e) {
controller_lock_print(main->program.warning.to, &main->thread);
- fl_print_format("%r%[%QIgnoring duplicate %r item '%]", main->program.warning.to, f_string_eol_s, main->program.warning.context, main->program.warning.prefix, is_entry ? controller_entry_s : controller_exit_s, main->program.warning.context);
- fl_print_format(f_string_format_Q_single_s.string, main->program.warning.to, main->program.warning.notable, cache->action.name_file, main->program.warning.notable);
+ fl_print_format("%r%[%QIgnoring duplicate %r item '%]", main->program.warning.to, f_string_eol_s, main->program.warning.context, main->program.warning.prefix, (entry->flag & controller_entry_flag_is_e) ? controller_entry_s : controller_exit_s, main->program.warning.context);
+ fl_print_format(f_string_format_Q_single_s.string, main->program.warning.to, main->program.warning.notable, main->thread.cache.action.name_file, main->program.warning.notable);
fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.warning.to, main->program.warning.context, main->program.warning.context, f_string_eol_s);
- controller_print_error_entry_cache(&main->program.warning, &cache->action, is_entry);
+ controller_print_error_entry_cache(&main->program.warning, &main->thread.cache.action, entry->flag & controller_entry_flag_is_e);
controller_unlock_print_flush(main->program.warning.to, &main->thread);
}
if (code & 0x2) continue;
- range = &cache->content_items.array[i].array[0];
+ range = &main->thread.cache.content_items.array[i].array[0];
- if (f_compare_dynamic(controller_main_s, cache->action.name_item) == F_equal_to) {
+ if (f_compare_dynamic(controller_main_s, main->thread.cache.action.name_item) == F_equal_to) {
code |= 0x1;
at = 0;
entry->items.used = 1;
}
}
- else if (f_compare_dynamic(controller_settings_s, cache->action.name_item) == F_equal_to) {
- status = controller_entry_setting_read(main, cache, is_entry, *range);
+ else if (f_compare_dynamic(controller_settings_s, main->thread.cache.action.name_item) == F_equal_to) {
+ status = controller_entry_setting_read(main, cache, entry->flag & controller_entry_flag_is_e, *range);
continue;
}
entry->items.used = 2;
}
- entry->items.array[at].line = cache->action.line_item;
+ entry->items.array[at].line = main->thread.cache.action.line_item;
- status = f_string_dynamic_append_nulless(cache->action.name_item, &entry->items.array[at].name);
+ status = f_string_dynamic_append_nulless(main->thread.cache.action.name_item, &entry->items.array[at].name);
if (F_status_is_error(status)) {
- controller_print_error(main->thread, &main->program.error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
+ controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append_nulless), F_status_set_fine(status));
break;
}
- status = controller_entry_actions_read(main, cache, is_entry, *range, &entry->items.array[at].actions);
+ status = controller_entry_actions_read(main, cache, entry->flag & controller_entry_flag_is_e, *range, &entry->items.array[at].actions);
if (F_status_is_error(status)) {
if (F_status_set_fine(status) != F_interrupt) {
controller_lock_print(main->program.error.to, &main->thread);
- controller_print_error_entry_cache(is_entry, &main->program.error, &cache->action);
+ controller_print_error_entry_cache(entry->flag & controller_entry_flag_is_e, &main->program.error, &main->thread.cache.action);
controller_unlock_print_flush(main->program.error.to, &main->thread);
}
}
} // for
- if (is_entry && F_status_set_fine(status) == F_interrupt) return status;
+ if (entry->flag & controller_entry_flag_is_e && F_status_set_fine(status) == F_interrupt) return status;
if (F_status_is_error_not(status)) {
- cache->action.name_action.used = 0;
- cache->action.name_item.used = 0;
+ main->thread.cache.action.name_action.used = 0;
+ main->thread.cache.action.name_item.used = 0;
if (!(code & 0x1)) {
- if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
- controller_lock_print(main->program.error.to, &main->thread);
-
- fl_print_format("%r%[%QThe required %r item '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, is_entry ? 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("%[' is not found.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
-
- controller_unlock_print_flush(main->program.error.to, &main->thread);
- }
-
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");
}
if (F_status_is_error_not(status)) {
for (j = 0; j < entry->items.array[i].actions.used; ++j) {
- if (!controller_thread_is_enabled(is_entry, &main->thread)) {
+ if (!controller_thread_is_enabled(entry->flag & controller_entry_flag_is_e, &main->thread)) {
return F_status_set_error(F_interrupt);
}
if (missing & 0x1) {
missing |= 0x2;
- cache->action.line_action = action->line;
- cache->action.line_item = entry->items.array[i].line;
+ main->thread.cache.action.line_action = action->line;
+ main->thread.cache.action.line_item = entry->items.array[i].line;
- status = f_string_dynamic_append_nulless(entry->items.array[i].name, &cache->action.name_item);
+ status = f_string_dynamic_append_nulless(entry->items.array[i].name, &main->thread.cache.action.name_item);
if (F_status_is_error(status)) {
- controller_print_error(main->thread, &main->program.error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
+ controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append_nulless), F_status_set_fine(status));
break;
}
- if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
- controller_lock_print(main->program.error.to, &main->thread);
-
- fl_print_format("%r%[%QThe required %r item '%]", main->program.error.to, f_string_eol_s, main->program.error.context, main->program.error.prefix, is_entry ? 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[0], main->program.error.notable);
- fl_print_format("%[' does not exist.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
-
- controller_print_error_entry_cache(is_entry, &main->program.error, &cache->action);
-
- controller_unlock_print_flush(main->program.error.to, &main->thread);
- }
+ controller_print_message_entry_item_required(&main->program.error, entry->flag & controller_entry_flag_is_e, "does not exist");
action->number = 0;
action->status = controller_status_simplify_error(F_found_not);
- cache->action.name_action.used = 0;
- cache->action.name_item.used = 0;
+ main->thread.cache.action.name_action.used = 0;
+ main->thread.cache.action.name_item.used = 0;
}
else {
action->number = k;
if (F_status_is_error(status)) {
if (F_status_set_fine(status) != F_interrupt) {
- controller_print_error_entry_cache(is_entry, &main->program.error, &cache->action);
+ controller_print_error_entry_cache(entry->flag & controller_entry_flag_is_e, &main->program.error, &main->thread.cache.action);
}
entry->status = controller_status_simplify_error(F_status_set_fine(status));
* The main program data.
*
* Must not be NULL.
- * @param cache
- * The cache for the specific thread.
- * This should be the cache global.thread->asynchronouss.array[global.id].cache.
+ * @param entry
+ * The entry data.
*
* 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.
* @see fll_fss_basic_list_read()
*/
#ifndef _di_controller_entry_read_
- extern f_status_t controller_entry_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_entry);
+ extern f_status_t controller_entry_read(controller_t * const main, controller_entry_t * const entry);
#endif // _di_controller_entry_read_
#ifdef __cplusplus
#endif
#ifndef _di_controller_entry_setting_read_
- f_status_t controller_entry_setting_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_entry, const f_range_t content_range) {
+ f_status_t controller_entry_setting_read(controller_t * const main, const uint8_t is_entry, const f_range_t content_range) {
+
+ if (!main) return F_status_set_error(F_parameter);
f_status_t status = F_okay;
f_number_unsigned_t i = 0;
- controller_entry_t *entry = is_entry ? &main->setting.entry : &main->setting.exit;
+ controller_entry_t * const entry = is_entry ? &main->setting.entry : &main->setting.exit;
f_state_t state = f_state_t_initialize;
for (; i < cache->object_actions.used; ++i) {
status = controller_path_canonical_relative(main->setting, cache->action.generic, &main->setting.path_control);
if (F_status_is_error(status)) {
- controller_print_error_entry_file(&main->program.error, cache, 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);
+ 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);
continue;
}
* The main program data.
*
* Must not be NULL.
- * @param cache
- * A structure for containing and caching relevant data.
- *
- * 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_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_file_mode_from_string().
+ * Errors (with error bit) from: f_file_mode_to_mode().
+ * Errors (with error bit) from: f_fss_apply_delimit().
+ * Errors (with error bit) from: f_fss_count_lines().
+ * Errors (with error bit) from: f_rip_dynamic_partial_nulless().
+ * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect().
+ * Errors (with error bit) from: fll_fss_extended_read().
+ *
+ * Errors (with error bit) from: controller_convert_group_id().
+ * Errors (with error bit) from: controller_convert_user_id().
+ * Errors (with error bit) from: controller_entry_setting_read_map().
+ * Errors (with error bit) from: controller_path_canonical_relative().
*
- * Errors (with error bit) from: controller_print_error_entry_file().
+ * @see f_file_mode_from_string()
+ * @see f_fss_apply_delimit()
+ * @see f_fss_count_lines()
+ * @see f_rip_dynamic_partial_nulless()
+ * @see fl_conversion_dynamic_partial_to_unsigned_detect()
+ * @see fll_fss_extended_read()
*
- * @see controller_print_error_entry_file()
+ * @see controller_convert_group_id()
+ * @see controller_convert_user_id()
+ * @see controller_entry_setting_read_map()
+ * @see controller_path_canonical_relative()
*/
#ifndef _di_controller_entry_setting_read_
- extern f_status_t controller_entry_setting_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_entry, const f_range_t content_range);
+ extern f_status_t controller_entry_setting_read(controller_t * const main, const uint8_t is_entry, const f_range_t content_range);
#endif // _di_controller_entry_setting_read_
/**
#endif
#ifndef _di_controller_file_load_
- f_status_t controller_file_load(controller_t * const main, controller_cache_t * const cache, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix) {
+ f_status_t controller_file_load(controller_t * const main, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix) {
- if (!main || !cache) return F_status_set_error(F_parameter);
+ if (!main) return F_status_set_error(F_parameter);
- f_status_t status = F_okay;
f_file_t file = f_file_t_initialize;
- cache->action.name_file.used = 0;
- cache->buffer_file.used = 0;
- cache->timestamp.seconds = 0;
- cache->timestamp.seconds_nano = 0;
+ main->thread.cache.action.name_file.used = 0;
+ main->thread.cache.buffer_file.used = 0;
+ main->thread.cache.timestamp.seconds = 0;
+ main->thread.cache.timestamp.seconds_nano = 0;
- status = f_string_dynamic_append(path_prefix, &cache->action.name_file);
+ f_status_t status = f_string_dynamic_append(path_prefix, &main->thread.cache.action.name_file);
if (F_status_is_error_not(status)) {
- status = f_string_dynamic_append(f_path_separator_s, &cache->action.name_file);
+ status = f_string_dynamic_append(f_path_separator_s, &main->thread.cache.action.name_file);
}
if (F_status_is_error_not(status)) {
- status = f_string_dynamic_append(path_name, &cache->action.name_file);
+ status = f_string_dynamic_append(path_name, &main->thread.cache.action.name_file);
}
if (F_status_is_error_not(status)) {
- status = f_string_dynamic_append(f_path_extension_separator_s, &cache->action.name_file);
+ status = f_string_dynamic_append(f_path_extension_separator_s, &main->thread.cache.action.name_file);
}
if (F_status_is_error_not(status)) {
- status = f_string_dynamic_append(path_suffix, &cache->action.name_file);
+ status = f_string_dynamic_append(path_suffix, &main->thread.cache.action.name_file);
}
if (F_status_is_error(status)) {
f_string_static_t path = f_string_static_t_initialize;
if (main->setting.path_setting.used) {
- path.used = main->setting.path_setting.used + F_path_separator_s_length + cache->action.name_file.used;
+ path.used = main->setting.path_setting.used + F_path_separator_s_length + main->thread.cache.action.name_file.used;
}
else {
- path.used = cache->action.name_file.used;
+ path.used = main->thread.cache.action.name_file.used;
}
f_char_t path_string[path.used + 1];
if (main->setting.path_setting.used) {
memcpy(path_string, main->setting.path_setting.string, sizeof(f_char_t) * main->setting.path_setting.used);
- memcpy(path_string + main->setting.path_setting.used + F_path_separator_s_length, cache->action.name_file.string, sizeof(f_char_t) * cache->action.name_file.used);
+ memcpy(path_string + main->setting.path_setting.used + F_path_separator_s_length, main->thread.cache.action.name_file.string, sizeof(f_char_t) * main->thread.cache.action.name_file.used);
path_string[main->setting.path_setting.used] = f_path_separator_s.string[0];
}
else {
- memcpy(path_string, cache->action.name_file.string, sizeof(f_char_t) * cache->action.name_file.used);
+ memcpy(path_string, main->thread.cache.action.name_file.string, sizeof(f_char_t) * main->thread.cache.action.name_file.used);
}
path_string[path.used] = 0;
}
}
else {
- status = f_file_stream_read(file, &cache->buffer_file);
+ status = f_file_stream_read(file, &main->thread.cache.buffer_file);
if (F_status_is_error(status)) {
controller_print_error_file_status(&main->program.error, macro_controller_f(f_file_stream_read), path, f_file_operation_read_s, fll_error_file_type_file_e, F_status_set_fine(status));
controller_print_error_file_status(&main->program.error, macro_controller_f(f_file_stat), path, f_file_operation_stat_s, fll_error_file_type_file_e, F_status_set_fine(status));
}
else {
- cache->timestamp.seconds = stat_file.st_ctim.tv_sec;
- cache->timestamp.seconds_nano = stat_file.st_ctim.tv_nsec;
+ main->thread.cache.timestamp.seconds = stat_file.st_ctim.tv_sec;
+ main->thread.cache.timestamp.seconds_nano = stat_file.st_ctim.tv_nsec;
}
}
* @param main
* The main program data.
*
- * Must not be NULL.
- * @param cache
- * The following within the cache is updated:
+ * The following within the main.thread.cache is updated:
* - name_file: The partial path of the file is inserted.
* - buffer_file: The contents of the file is inserted.
* - timestamp: This is updated to reflect the last changed timestamp.
* @see f_string_append()
*/
#ifndef _di_controller_file_load_
- extern f_status_t controller_file_load(controller_t * const main, controller_cache_t * const cache, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix);
+ extern f_status_t controller_file_load(controller_t * const main, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix);
#endif // _di_controller_file_load_
/**
else {
main->setting.flag |= controller_setting_flag_pid_created_e;
- controller_print_debug_perform_pid_file_create_success(&main->program.debug, is_entry);
+ controller_print_debug_perform_pid_file_create_success(&main->program.debug);
}
}
#endif // _di_controller_perform_ready_
#ifndef _di_controller_perform_ready_socket_
- f_status_t controller_perform_ready_socket(controller_t * const main, const uint8_t is_entry) {
+ f_status_t controller_perform_ready_socket(controller_t * const main) {
f_status_t status = F_okay;
* 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.
*
* @return
* F_okay on success.
* @see f_thread_create()
*/
#ifndef _di_controller_perform_ready_socket_
- extern f_status_t controller_perform_ready_socket(controller_t * const main, const uint8_t is_entry);
+ extern f_status_t controller_perform_ready_socket(controller_t * const main);
#endif // _di_controller_perform_ready_socket_
#ifdef __cplusplus
#endif // _di_controller_print_debug_perform_pid_file_create_problem_
#ifndef _di_controller_print_debug_perform_pid_file_create_success_
- f_status_t controller_print_debug_perform_pid_file_create_success(fl_print_t * const print, const uint8_t is_entry) {
+ f_status_t controller_print_debug_perform_pid_file_create_success(fl_print_t * const print) {
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 is_entry
- * If TRUE, then this operates as an entry.
- * If FALSE, then this operates as an exit.
*
* @return
* F_okay on success.
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_controller_print_debug_perform_pid_file_create_success_
- extern f_status_t controller_print_debug_perform_pid_file_create_success(fl_print_t * const print, const uint8_t is_entry);
+ extern f_status_t controller_print_debug_perform_pid_file_create_success(fl_print_t * const print);
#endif // _di_controller_print_debug_perform_pid_file_create_success_
#ifdef __cplusplus
#endif
#ifndef _di_controller_print_error_entry_
- f_status_t controller_print_error_entry(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback) {
+ f_status_t controller_print_error_entry(fl_print_t * const print, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback) {
- if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
if (status == F_interrupt) return F_status_set_error(F_output_not);
f_file_stream_lock(print->to);
- controller_print_error_entry_cache(print, &cache->action, is_entry);
+ controller_print_error_entry_cache(print, &main->thread.cache.action, is_entry);
controller_unlock_print_flush(print->to, &main->thread);
#endif // _di_controller_print_error_entry_cache_
#ifndef _di_controller_print_error_entry_file_
- f_status_t controller_print_error_entry_file(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
+ f_status_t controller_print_error_entry_file(fl_print_t * const print, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
f_file_stream_lock(print->to);
- controller_print_error_entry_cache(print, &cache->action, is_entry);
+ controller_print_error_entry_cache(print, &main->thread.cache.action, is_entry);
controller_unlock_print_flush(print->to, &main->thread);
* This does not alter print.custom.setting.state.status.
*
* Must not be NULL.
- * @param cache
- * The cache.
- *
- * Must not be NULL.
* @param is_entry
* If TRUE, then this loads as an entry.
* If FALSE, then this loads as an exit.
* @see controller_print_error_entry_cache()
*/
#ifndef _di_controller_print_error_entry_
- extern f_status_t controller_print_error_entry(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback);
+ extern f_status_t controller_print_error_entry(fl_print_t * const print, const uint8_t is_entry, const f_status_t status, const char * const function, const bool fallback);
#endif // _di_controller_print_error_entry_
/**
- * Print additional error/warning information in addition to existing error that is found within the cache.
+ * Print additional error/warning information in addition to existing error that is found within the given action cache.
*
* This is explicitly intended to be used in addition to the error message.
*
* This does not alter print.custom.setting.state.status.
*
* Must not be NULL.
- * @param cache
- * The cache.
- *
- * Must not be NULL.
* @param is_entry
* If TRUE, then this loads as an entry.
* If FALSE, then this loads as an exit.
* F_output_not (with error bit) if setting is NULL.
*
* @see fll_error_file_print()
- * @see controller_print_error_entry_cache()
*/
#ifndef _di_controller_print_error_entry_file_
- extern f_status_t controller_print_error_entry_file(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_status_t status, const char * const function, const uint8_t fallback, const f_string_static_t name, const f_string_static_t operation, const uint8_t type);
+ extern f_status_t controller_print_error_entry_file(fl_print_t * const print, const uint8_t is_entry, const f_status_t status, const char * const function, const uint8_t fallback, const f_string_static_t name, const f_string_static_t operation, const uint8_t type);
#endif // _di_controller_print_error_entry_file_
#ifdef __cplusplus
extern "C" {
#endif
+#ifndef _di_controller_print_message_entry_item_done_
+ f_status_t controller_print_message_entry_item_done(fl_print_t * const print, const uint8_t is_entry, const uint8_t failsafe, const f_string_static_t name) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%rDone processing %r item '", 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("'.%r%r", print->to, f_string_eol_s, failsafe ? f_string_eol_s : f_string_empty_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_message_entry_item_done_
+
#ifndef _di_controller_print_message_entry_item_executing_
f_status_t controller_print_message_entry_item_executing(fl_print_t * const print, const uint8_t is_entry, f_string_dynamics_t * const parameters) {
}
#endif // _di_controller_print_message_entry_item_process_
-#ifndef _di_controller_print_message_entry_item_done_
- f_status_t controller_print_message_entry_item_done(fl_print_t * const print, const uint8_t is_entry, const uint8_t failsafe, const f_string_static_t name) {
+#ifndef _di_controller_print_message_entry_item_required_
+ f_status_t controller_print_message_entry_item_required(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name, const f_string_t detail) {
if (!print || !print->custom) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
controller_lock_print(print->to, &main->thread);
- fl_print_format("%rDone processing %r item '", print->to, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
+ fl_print_format("%r%[%QThe required %r item '%]", print->to, f_string_eol_s, print->context, print->prefix, 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("'.%r%r", print->to, f_string_eol_s, failsafe ? f_string_eol_s : f_string_empty_s);
+ fl_print_format("' %Q.", print->to, reason, f_string_eol_s);
+
+ controller_print_error_entry_cache(print, &main->thread.cache.action, is_entry);
controller_unlock_print_flush(print->to, &main->thread);
return F_okay;
}
-#endif // _di_controller_print_message_entry_item_done_
+#endif // _di_controller_print_message_entry_item_required_
#ifndef _di_controller_print_message_entry_item_rule_
f_status_t controller_print_message_entry_item_rule(fl_print_t * const print, controller_entry_t * const entry, controller_entry_action_t * const action, const uint8_t is_entry, const f_string_static_t alias_rule) {
#endif
/**
+ * Print message about processing an item.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param failsafe
+ * If TRUE, then running in failsafe.
+ * If FALSE, then running normally.
+ * @param name
+ * The item name.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fll_error_file_print()
+ * @see controller_print_error_entry_cache()
+ */
+#ifndef _di_controller_print_message_entry_item_done_
+ extern f_status_t controller_print_message_entry_item_done(fl_print_t * const print, const uint8_t is_entry, const uint8_t failsafe, const f_string_static_t name);
+#endif // _di_controller_print_message_entry_item_done_
+
+/**
* Print message about the entry item executing.
*
* @param print
#endif // _di_controller_print_message_entry_item_process_
/**
- * Print message about processing an item.
+ * Print message about a problem with an entry item.
*
* @param print
* The output structure to print to.
* @param is_entry
* If TRUE, then this loads as an entry.
* If FALSE, then this loads as an exit.
- * @param failsafe
- * If TRUE, then running in failsafe.
- * If FALSE, then running normally.
* @param name
* The item name.
+ * @param detail
+ * The details regarding the problem with the required entry item.
*
* @return
* F_okay on success.
* @see fll_error_file_print()
* @see controller_print_error_entry_cache()
*/
-#ifndef _di_controller_print_message_entry_item_done_
- extern f_status_t controller_print_message_entry_item_done(fl_print_t * const print, const uint8_t is_entry, const uint8_t failsafe, const f_string_static_t name);
-#endif // _di_controller_print_message_entry_item_done_
+#ifndef _di_controller_print_message_entry_item_required_
+ extern f_status_t controller_print_message_entry_item_required(fl_print_t * const print, const uint8_t is_entry, const f_string_static_t name, const f_string_t detail);
+#endif // _di_controller_print_message_entry_item_required_
/**
* Print warning message about multiple actions for a specified item.
f_status_t * const status = &main->thread.status;
- *status = controller_entry_read(main, F_true);
+ *status = controller_entry_read(main, &main->process.entry);
if (F_status_set_fine(*status) == F_interrupt) {
main->process.ready = controller_process_ready_abort_e;
f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
controller_t * const main = (controller_t *) argument;
- controller_cache_t * const cache = &main->thread.cache;
f_status_t * const status = &main->thread.status;
- *status = controller_entry_read(main, F_false);
+ *status = controller_entry_read(main, &main->process.exit);
if (F_status_set_fine(*status) == F_interrupt) {
main->process.ready = controller_process_ready_abort_e;