From: Kevin Day Date: Wed, 8 May 2024 02:52:45 +0000 (-0500) Subject: Progress: Continue migrating the project. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=59f29705e36f034a48f742e99c95d4b92e2439af;p=controller Progress: Continue migrating the project. --- diff --git a/data/build/dependencies b/data/build/dependencies index 37668f9..b436ddd 100644 --- a/data/build/dependencies +++ b/data/build/dependencies @@ -35,6 +35,7 @@ fl_control_group fl_conversion fl_directory fl_environment +fl_execute fl_fss fl_iki fl_path diff --git a/data/build/settings b/data/build/settings index 3157770..be6b199 100644 --- a/data/build/settings +++ b/data/build/settings @@ -34,14 +34,14 @@ build_language c build_libraries -lc -lcap build_libraries-individual -lfll_control_group -lfll_error -lfll_execute -lfll_fss -lfll_print -lfll_program -lfll_status_string build_libraries-individual_thread -lf_thread -build_libraries-individual -lfl_control_group -lfl_conversion -lfl_directory -lfl_environment -lfl_fss -lfl_iki -lfl_path -lfl_print +build_libraries-individual -lfl_control_group -lfl_conversion -lfl_directory -lfl_environment -lfl_execute -lfl_fss -lfl_iki -lfl_path -lfl_print build_libraries-individual -lf_account -lf_capability -lf_color -lf_compare -lf_console -lf_control_group -lf_conversion -lf_directory -lf_environment -lf_execute -lf_file -lf_fss -lf_iki -lf_limit -lf_memory -lf_parse -lf_path -lf_pipe -lf_print -lf_rip -lf_signal -lf_socket -lf_status_string -lf_string -lf_time -lf_type_array -lf_utf build_libraries-individual_thread -lf_thread build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library main/common.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c -build_sources_library main/common/type/cache.c main/common/type/control.c main/common/type/entry.c main/common/type/global.c main/common/type/lock.c main/common/type/instance.c main/common/type/program.c main/common/type/rule.c main/common/type/thread.c +build_sources_library main/common/type/cache.c main/common/type/control.c main/common/type/entry.c main/common/type/execute.c main/common/type/global.c main/common/type/lock.c main/common/type/instance.c main/common/type/program.c main/common/type/rule.c main/common/type/thread.c build_sources_library main/common/string/general.c main/common/string/rule.c build_sources_library main/instance.c main/path.c build_sources_library main/rule.c main/rule/action.c main/rule/execute.c main/rule/expand.c main/rule/instance.c main/rule/is.c main/rule/item.c main/rule/parameter.c main/rule/read.c main/rule/setting.c main/rule/validate.c main/rule/wait.c @@ -52,7 +52,7 @@ build_sources_headers main/common.h main/controller.h main/common/define.h main/ build_sources_headers main/common/define/control.h main/common/define/entry.h main/common/define/rule.h main/common/define/thread.h build_sources_headers main/common/enumeration/control.h main/common/enumeration/entry.h main/common/enumeration/instance.h main/common/enumeration/program.h main/common/enumeration/rule.h main/common/enumeration/thread.h build_sources_headers main/common/string/general.h main/common/string/rule.h -build_sources_headers main/common/type/cache.h main/common/type/control.h main/common/type/entry.h main/common/type/global.h main/common/type/lock.h main/common/type/instance.h main/common/type/program.h main/common/type/rule.h main/common/type/thread.h +build_sources_headers main/common/type/cache.h main/common/type/control.h main/common/type/entry.h main/common/type/execute.h main/common/type/global.h main/common/type/lock.h main/common/type/instance.h main/common/type/program.h main/common/type/rule.h main/common/type/thread.h build_sources_headers main/instance.h main/path.h build_sources_headers main/rule.h main/rule/action.h main/rule/execute.h main/rule/expand.h main/rule/instance.h main/rule/is.h main/rule/item.h main/rule/parameter.h main/rule/read.h main/rule/setting.h main/rule/validate.h main/rule/wait.h build_sources_headers main/print/data.h main/print/debug.h main/print/error.h main/print/lock.h main/print/message.h main/print/rule.h main/print/verbose.h main/print/warning.h diff --git a/sources/c/main/common/print.c b/sources/c/main/common/print.c index 94f9f4f..7ee611b 100644 --- a/sources/c/main/common/print.c +++ b/sources/c/main/common/print.c @@ -7,21 +7,34 @@ extern "C" { #ifndef _di_controller_f_a_ const f_string_t controller_f_a[] = { "controller_rule_actions_increase_by", + "controller_rule_copy", + "controller_rule_items_increase_by", "controller_path_canonical_relative", + "controller_pids_increase", "f_console_parameter_process", + "f_environment_get_all", "f_fss_apply_delimit", "f_fss_count_lines", "f_memory_array_increase", + "f_memory_array_increase_by", "f_path_current", "f_rip_dynamic_partial", + "f_rip_dynamic_partial_nulless", "f_string_append_assure", "f_string_dynamic_append", + "f_string_dynamic_append_nulless", + "f_string_dynamic_partial_append", "f_string_dynamic_partial_append_nulless", "f_string_dynamic_partial_mash_nulless", + "f_string_maps_append", "f_thread_create", "fl_conversion_dynamic_partial_to_signed_detect", + "fl_environment_load_names", "fl_fss_extended_list_content_read", + "fl_fss_extended_list_object_read", "fl_iki_read", + "fll_execute_program", + "fll_fss_basic_list_read", "fll_fss_extended_read", "fll_fss_extended_content_read", "fll_fss_extended_list_content_read", diff --git a/sources/c/main/common/print.h b/sources/c/main/common/print.h index dd5543d..91c2f55 100644 --- a/sources/c/main/common/print.h +++ b/sources/c/main/common/print.h @@ -40,21 +40,34 @@ extern "C" { #ifndef _di_controller_f_e_ enum { controller_f_controller_rule_actions_increase_by_e, + controller_f_controller_rule_copy_e, + controller_f_controller_rule_items_increase_by_e, controller_f_controller_path_canonical_relative_e, + controller_f_controller_pids_increase_e, controller_f_f_console_parameter_process_e, + controller_f_f_environment_get_all_e, controller_f_f_fss_apply_delimit_e, controller_f_f_fss_count_lines_e, controller_f_f_memory_array_increase_e, + controller_f_f_memory_array_increase_by_e, controller_f_f_path_current_e, controller_f_f_rip_dynamic_partial_e, + controller_f_f_rip_dynamic_partial_nulless_e, controller_f_f_string_append_assure_e, controller_f_f_string_dynamic_append_e, + controller_f_f_string_dynamic_append_nulless_e, + controller_f_f_string_dynamic_partial_append_e, controller_f_f_string_dynamic_partial_append_nulless_e, controller_f_f_string_dynamic_partial_mash_nulless_e, + controller_f_f_string_maps_append_e, controller_f_f_thread_create_e, controller_f_fl_conversion_dynamic_partial_to_signed_detect_e, + controller_f_fl_environment_load_names_e, controller_f_fl_fss_extended_list_content_read_e, + controller_f_fl_fss_extended_list_object_read_e, controller_f_fl_iki_read_e, + controller_f_fll_execute_program_e, + controller_f_fll_fss_basic_list_read_e, controller_f_fll_fss_extended_read_e, controller_f_fll_fss_extended_content_read_e, controller_f_fll_fss_extended_list_content_read_e, diff --git a/sources/c/main/common/type/cache.c b/sources/c/main/common/type/cache.c index d495e7d..98d3ba5 100644 --- a/sources/c/main/common/type/cache.c +++ b/sources/c/main/common/type/cache.c @@ -28,7 +28,7 @@ extern "C" { f_memory_arrays_resize(0, sizeof(f_ranges_t), (void **) &cache->content_actions.array, &cache->content_actions.used, &cache->content_actions.size, &f_rangess_delete_callback); f_memory_arrays_resize(0, sizeof(f_ranges_t), (void **) &cache->content_items.array, &cache->content_items.used, &cache->content_items.size, &f_rangess_delete_callback); - controller_cache_action_delete_simple(&cache->action); + controller_cache_action_delete(&cache->action); } #endif // _di_controller_cache_delete_ diff --git a/sources/c/main/common/type/execute.c b/sources/c/main/common/type/execute.c new file mode 100644 index 0000000..1362473 --- /dev/null +++ b/sources/c/main/common/type/execute.c @@ -0,0 +1,9 @@ +#include "../../controller.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/sources/c/main/common/type/execute.h b/sources/c/main/common/type/execute.h new file mode 100644 index 0000000..27720a6 --- /dev/null +++ b/sources/c/main/common/type/execute.h @@ -0,0 +1,46 @@ +/** + * FLL - Level 3 + * + * Project: Controller + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the common execute type structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _controller_main_common_type_execute_h +#define _controller_main_common_type_execute_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * A structure for passing execution arguments to the execute functions. + * + * parameter: All parameters sent to the program on execution. + * as: All special properties to apply, such as cpu affinity. + */ +#ifndef _di_controller_execute_set_t_ + typedef struct { + fl_execute_parameter_t parameter; + fl_execute_as_t as; + } controller_execute_set_t; + + #define controller_execute_set_t_initialize_1 { \ + fl_execute_parameter_t_initialize, \ + fl_execute_as_t_initialize \ + } + + #define macro_controller_execute_set_t_initialize_1(option, wait, environment, signals, main, as) { \ + macro_fl_execute_parameter_t_initialize_1(option, wait, environment, signals, main), \ + as, \ + } +#endif // _di_controller_execute_set_t_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _controller_main_common_type_execute_h diff --git a/sources/c/main/common/type/lock.c b/sources/c/main/common/type/lock.c index 40a868c..3882982 100644 --- a/sources/c/main/common/type/lock.c +++ b/sources/c/main/common/type/lock.c @@ -11,7 +11,7 @@ extern "C" { f_thread_mutex_delete(&lock->cancel); f_thread_mutex_delete(&lock->print); - f_thread_lock_delete(&lock->process); + f_thread_lock_delete(&lock->instance); f_thread_lock_delete(&lock->rule); f_thread_condition_delete(&lock->alert_condition); @@ -20,7 +20,7 @@ extern "C" { memset(&lock->cancel, 0, sizeof(f_thread_mutex_t)); memset(&lock->print, 0, sizeof(f_thread_mutex_t)); - memset(&lock->process, 0, sizeof(f_thread_lock_t)); + memset(&lock->instance, 0, sizeof(f_thread_lock_t)); memset(&lock->rule, 0, sizeof(f_thread_lock_t)); memset(&lock->alert_condition, 0, sizeof(f_thread_condition_t)); diff --git a/sources/c/main/common/type/rule.c b/sources/c/main/common/type/rule.c index 2516436..0cc50ad 100644 --- a/sources/c/main/common/type/rule.c +++ b/sources/c/main/common/type/rule.c @@ -29,8 +29,8 @@ extern "C" { f_capability_delete(&rule->capability); } - controller_rule_ons_delete(&rule->ons); - controller_rule_items_delete(&rule->items); + f_memory_arrays_resize(0, sizeof(controller_rule_on_t), (void **) &rule->ons.array, &rule->ons.used, &rule->ons.size, &controller_rule_ons_delete_callback); + f_memory_arrays_resize(0, sizeof(controller_rule_item_t), (void **) &rule->items.array, &rule->items.used, &rule->items.size, &controller_rule_items_delete_callback); } #endif // _di_controller_rule_delete_ @@ -45,20 +45,20 @@ extern "C" { } #endif // _di_controller_rule_action_delete_ -#ifndef _di_controller_rule_actions_delete_ - void controller_rule_actions_delete(controller_rule_actions_t * const actions) { +#ifndef _di_controller_rule_actions_delete_callback_ + f_status_t controller_rule_actions_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - if (!actions) return; + { + controller_rule_action_t * const controller_rule_actions = (controller_rule_action_t *) void_array; - actions->used = actions->size; - - while (actions->used) { - controller_rule_action_delete(&actions->array[--actions->used]); - } // while + for (f_number_unsigned_t i = start; i < stop; ++i) { + controller_rule_action_delete(&controller_rule_actions[i]); + } // for + } - f_memory_array_resize(0, sizeof(controller_rule_action_t), (void **) &actions->array, &actions->used, &actions->size); + return F_okay; } -#endif // _di_controller_rule_actions_delete_ +#endif // _di_controller_rule_actions_delete_callback_ #ifndef _di_controller_rule_item_delete_ void controller_rule_item_delete(controller_rule_item_t * const item) { @@ -66,25 +66,24 @@ extern "C" { if (!item) return; f_memory_array_resize(0, sizeof(f_char_t), (void **) &item->pid_file.string, &item->pid_file.used, &item->pid_file.size); - - controller_rule_actions_delete(&item->actions); + f_memory_arrays_resize(0, sizeof(controller_rule_action_t), (void **) &item->actions.array, &item->actions.used, &item->actions.size, &controller_rule_actions_delete_callback); } #endif // _di_controller_rule_item_delete_ -#ifndef _di_controller_rule_items_delete_ - void controller_rule_items_delete(controller_rule_items_t * const items) { - - if (!items) return; +#ifndef _di_controller_rule_items_delete_callback_ + f_status_t controller_rule_items_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - items->used = items->size; + { + controller_rule_item_t * const controller_rule_items = (controller_rule_item_t *) void_array; - while (items->used) { - controller_rule_item_delete(&items->array[--items->used]); - } // while + for (f_number_unsigned_t i = start; i < stop; ++i) { + controller_rule_item_delete(&controller_rule_items[i]); + } // for + } - f_memory_array_resize(0, sizeof(controller_rule_item_t), (void **) &items->array, &items->used, &items->size); + return F_okay; } -#endif // _di_controller_rule_items_delete_ +#endif // _di_controller_rule_items_delete_callback_ #ifndef _di_controller_rule_on_delete_ void controller_rule_on_delete(controller_rule_on_t * const on) { @@ -97,20 +96,20 @@ extern "C" { } #endif // _di_controller_rule_on_delete_ -#ifndef _di_controller_rule_ons_delete_ - void controller_rule_ons_delete(controller_rule_ons_t * const ons) { - - if (!ons) return; +#ifndef _di_controller_rule_ons_delete_callback_ + f_status_t controller_rule_ons_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - ons->used = ons->size; + { + controller_rule_on_t * const controller_rule_ons = (controller_rule_on_t *) void_array; - while (ons->used) { - controller_rule_on_delete(&ons->array[--ons->used]); - } // while + for (f_number_unsigned_t i = start; i < stop; ++i) { + controller_rule_on_delete(&controller_rule_ons[i]); + } // for + } - f_memory_array_resize(0, sizeof(controller_rule_on_t), (void **) &ons->array, &ons->used, &ons->size); + return F_okay; } -#endif // _di_controller_rule_ons_delete_ +#endif // _di_controller_rule_ons_delete_callback_ #ifndef _di_controller_rules_delete_ void controller_rules_delete(controller_rules_t * const rules) { diff --git a/sources/c/main/common/type/rule.h b/sources/c/main/common/type/rule.h index f4ae5a1..7ca3b9f 100644 --- a/sources/c/main/common/type/rule.h +++ b/sources/c/main/common/type/rule.h @@ -371,9 +371,6 @@ extern "C" { * @param rule * The rule to deallocate. * - * @see controller_rule_items_delete() - * @see controller_rule_ons_delete() - * * @see f_capability_delete() * @see f_memory_array_resize() * @see f_memory_arrays_resize() @@ -396,18 +393,30 @@ extern "C" { #endif // _di_controller_rule_action_delete_ /** - * Delete the Controller Rule Actions data. + * A callback intended to be passed to f_memory_arrays_resize() for an controller_rule_actions_t structure. * - * @param actions - * The Rule Actions data. + * This is only called when shrinking the array and generally should perform de-allocations. * - * @see controller_rule_action_delete() + * This does not do parameter checking. * - * @see f_memory_array_resize() + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_okay on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * @see controller_rule_action_delete() */ -#ifndef _di_controller_rule_actions_delete_ - extern void controller_rule_actions_delete(controller_rule_actions_t * const actions); -#endif // _di_controller_rule_actions_delete_ +#ifndef _di_controller_rule_actions_delete_callback_ + extern f_status_t controller_rule_actions_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_controller_rule_actions_delete_callback_ /** * Delete the Controller Rule Item data. @@ -422,20 +431,31 @@ extern "C" { #ifndef _di_controller_rule_item_delete_ extern void controller_rule_item_delete(controller_rule_item_t * const item); #endif // _di_controller_rule_item_delete_ - /** - * Delete the Controller Rule Items data. + * A callback intended to be passed to f_memory_arrays_resize() for an controller_rule_items_t structure. * - * @param items - * The Rule Items data. + * This is only called when shrinking the array and generally should perform de-allocations. * - * @see controller_rule_item_delete() + * This does not do parameter checking. * - * @see f_memory_array_resize() + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_okay on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * @see controller_rule_item_delete() */ -#ifndef _di_controller_rule_items_delete_ - extern void controller_rule_items_delete(controller_rule_items_t * const items); -#endif // _di_controller_rule_items_delete_ +#ifndef _di_controller_rule_items_delete_callback_ + extern f_status_t controller_rule_items_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_controller_rule_items_delete_callback_ /** * Delete the Controller Rule "on" data. @@ -450,18 +470,30 @@ extern "C" { #endif // _di_controller_rule_on_delete_ /** - * Delete the Controller Rule "ons" data. + * A callback intended to be passed to f_memory_arrays_resize() for an controller_rule_ons_t structure. * - * @param ons - * The Rule "ons" data. + * This is only called when shrinking the array and generally should perform de-allocations. * - * @see controller_rule_on_delete() + * This does not do parameter checking. * - * @see f_memory_delete() + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_okay on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * @see controller_rule_on_delete() */ -#ifndef _di_controller_rule_ons_delete_ - extern void controller_rule_ons_delete(controller_rule_ons_t * const ons); -#endif // _di_controller_rule_ons_delete_ +#ifndef _di_controller_rule_ons_delete_callback_ + extern f_status_t controller_rule_ons_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_controller_rule_ons_delete_callback_ /** * Delete the Controller Rules data. diff --git a/sources/c/main/controller.h b/sources/c/main/controller.h index ab28a4c..776e1ba 100644 --- a/sources/c/main/controller.h +++ b/sources/c/main/controller.h @@ -52,6 +52,7 @@ // FLL-1 includes. #include +#include #include #include @@ -80,6 +81,7 @@ #include #include #include +#include #include #include #include diff --git a/sources/c/main/print/error.c b/sources/c/main/print/error.c index 5bc6c20..f23c975 100644 --- a/sources/c/main/print/error.c +++ b/sources/c/main/print/error.c @@ -32,6 +32,18 @@ extern "C" { } #endif // _di_controller_main_print_error_file_ +#ifndef _di_controller_main_print_error_file_status_ + f_status_t controller_main_print_error_file_status(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type, const f_status_t status) { + + if (!print) return F_status_set_error(F_output_not); + if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not; + + fll_error_file_print(print, status, function, fll_error_file_flag_fallback_e, name, operation, type); + + return F_okay; + } +#endif // _di_controller_main_print_error_file_status_ + #ifndef _di_controller_main_print_error_status_ f_status_t controller_main_print_error_status(fl_print_t * const print, const f_string_t function, const f_status_t status) { diff --git a/sources/c/main/print/error.h b/sources/c/main/print/error.h index 71e8665..c4dc057 100644 --- a/sources/c/main/print/error.h +++ b/sources/c/main/print/error.h @@ -72,6 +72,40 @@ extern "C" { #endif // _di_controller_main_print_error_file_ /** + * Print file related error or warning messages. + * + * @param print + * The output structure to print to. + * Must not be NULL. + * + * The print.custom is expected to be of type fss_read_main_t. + * + * This does not alter print.custom.setting.state.status. + * @param function + * The name of the function where the error happened. + * Set to 0 to disable. + * @param name + * The name of the file or directory. + * @param operation + * The operation that fails, such as 'create' or 'access'. + * @param type + * A valid file type code from the fll_error_file_type enum. + * @param status + * The status code to print an error message about. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if a parameter is NULL. + * + * @see fll_error_file_print() + */ +#ifndef _di_controller_main_print_error_file_status_ + extern f_status_t controller_main_print_error_file_status(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type, const f_status_t status); +#endif // _di_controller_main_print_error_file_status_ + +/** * Print generic error message regarding a function failing in some way. * * @param print diff --git a/sources/c/main/rule.c b/sources/c/main/rule.c index a0a7abe..899b55a 100644 --- a/sources/c/main/rule.c +++ b/sources/c/main/rule.c @@ -90,7 +90,7 @@ extern "C" { if (source.ons.used) { if (destination->ons.used < source.ons.used) { - status = controller_rule_ons_resize(source.ons.used, &destination->ons); + status = f_memory_array_resize(source.ons.used, sizeof(controller_rule_on_t), (void **) &destination->ons.array, &destination->ons.used, &destination->ons.size); if (F_status_is_error(status)) return status; } @@ -149,7 +149,7 @@ extern "C" { controller_rule_action_t *action_destination = 0; if (source.items.used > destination->items.size) { - status = controller_rule_items_increase_by(source.items.used - destination->items.size, &destination->items); + status = f_memory_arrays_resize(source.items.used, sizeof(controller_rule_item_t), (void **) &destination->items.array, &destination->items.used, &destination->items.size, &controller_rule_items_delete_callback); if (F_status_is_error(status)) return status; } @@ -161,7 +161,7 @@ extern "C" { item_destination = &destination->items.array[i]; if (item_source->actions.used > item_destination->actions.size) { - status = controller_rule_actions_increase_by(item_source->actions.used - item_destination->actions.size, &item_destination->actions); + status = f_memory_arrays_resize(item_source->actions.used, sizeof(controller_rule_action_t), (void **) &item_destination->actions.array, &item_destination->actions.used, &item_destination->actions.size, &controller_rule_actions_delete_callback); if (F_status_is_error(status)) return status; } @@ -237,14 +237,12 @@ extern "C" { if (!global || !global->main || !global->thread) return F_status_set_error(F_parameter); - f_status_t status = F_okay; - alias->used = 0; - status = f_string_dynamic_partial_append_nulless(source, directory, alias); + f_status_t status = f_string_dynamic_partial_append_nulless(source, directory, alias); if (F_status_is_error(status)) { - controller_main_print_error(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless)); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status)); return status; } @@ -252,7 +250,7 @@ extern "C" { status = f_string_dynamic_append(f_path_separator_s, alias); if (F_status_is_error(status)) { - controller_main_print_error(&main->program.error, macro_controller_f(f_string_dynamic_append)); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status)); return status; } @@ -260,7 +258,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(source, basename, alias); if (F_status_is_error(status)) { - controller_main_print_error(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless)); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status)); return status; } diff --git a/sources/c/main/rule/action.c b/sources/c/main/rule/action.c index 52b0d19..c1b9059 100644 --- a/sources/c/main/rule/action.c +++ b/sources/c/main/rule/action.c @@ -7,8 +7,8 @@ extern "C" { #ifndef _di_controller_rule_action_method_name_ f_string_static_t controller_rule_action_method_name(const uint8_t type) { - if (type == controller_rule_action_method_extended_e) return controller_rule_action_method_string_extended_s; - if (type == controller_rule_action_method_extended_list_e) return controller_rule_action_method_string_extended_list_s; + if (type == controller_rule_action_method_extended_e) return controller_rule_action_method_extended_s; + if (type == controller_rule_action_method_extended_list_e) return controller_rule_action_method_extended_list_s; return f_string_empty_s; } @@ -38,8 +38,8 @@ extern "C" { f_status_t status = F_okay; - controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize_1(is_normal, 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); + controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, global->thread); + 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_number_unsigned_t i = 0; @@ -85,7 +85,7 @@ extern "C" { if (item->type == controller_rule_item_type_script_e || item->type == controller_rule_item_type_utility_e) { actions->array[actions->used].parameters.used = 0; - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size); if (F_status_is_error(status)) { controller_main_print_error(&global->main->program.error, macro_controller_f(f_memory_array_increase)); @@ -93,7 +93,7 @@ extern "C" { return status; } - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size); if (F_status_is_error(status)) { controller_main_print_error(&global->main->program.error, macro_controller_f(f_memory_array_increase)); @@ -160,7 +160,7 @@ extern "C" { for (i = 0; i < cache->object_actions.used; ++i) { - status = controller_rule_actions_increase_by(controller_common_allocation_small_d, actions); + status = controller_rule_actions_increase_by(controller_allocation_small_d, actions); if (F_status_is_error(status)) { controller_main_print_error(&global->main->program.error, macro_controller_f(controller_rule_actions_increase_by)); @@ -321,7 +321,7 @@ extern "C" { } // for } else if (item->type == controller_rule_item_type_script_e || item->type == controller_rule_item_type_utility_e) { - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size); if (F_status_is_error(status)) { controller_main_print_error(&global->main->program.error, macro_controller_f(f_memory_array_increase)); @@ -329,7 +329,7 @@ extern "C" { return status; } - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size); if (F_status_is_error(status)) { controller_main_print_error(&global->main->program.error, macro_controller_f(f_memory_array_increase)); diff --git a/sources/c/main/rule/execute.c b/sources/c/main/rule/execute.c index 0de8ba2..41b9e82 100644 --- a/sources/c/main/rule/execute.c +++ b/sources/c/main/rule/execute.c @@ -41,7 +41,7 @@ extern "C" { status = fll_control_group_prepare(process->rule.cgroup); if (F_status_is_error(status)) { - controller_print_error_file(global->thread, &global->main->program.error, F_status_set_fine(status), "fll_control_group_prepare", F_true, process->rule.cgroup.path, controller_rule_print_control_groups_prepare_s, fll_error_file_type_directory_e); + controller_main_print_error_file(&main->program.error, macro_controller_f(fll_control_group_prepare), process->rule.cgroup.path, controller_rule_print_control_groups_prepare_s, fll_error_file_type_directory_e); return status; } @@ -76,7 +76,7 @@ extern "C" { status = fl_environment_load_names(process->rule.environment, &environment); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "fl_environment_load_names", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(fl_environment_load_names), F_status_set_fine(status)); return status; } @@ -107,7 +107,7 @@ extern "C" { status = f_string_dynamic_append(entry->define.array[i].value, &environment.array[k].value); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_dynamic_append", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status)); return status; } @@ -120,7 +120,7 @@ extern "C" { status = f_string_maps_append(entry->define.array[i], &environment); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_maps_append", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status)); return status; } @@ -148,7 +148,7 @@ extern "C" { status = f_string_dynamic_append(process->rule.define.array[i].value, &environment.array[k].value); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_dynamic_append", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status)); return status; } @@ -161,7 +161,7 @@ extern "C" { status = f_string_maps_append(process->rule.define.array[i], &environment); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_maps_append", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status)); return status; } @@ -189,7 +189,7 @@ extern "C" { status = f_environment_get_all(&environment); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_environment_get_all", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_environment_get_all), F_status_set_fine(status)); return status; } @@ -199,7 +199,7 @@ extern "C" { status = f_string_maps_append(entry->define.array[i], &environment); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_maps_append", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status)); return status; } @@ -210,7 +210,7 @@ extern "C" { status = f_string_maps_append(process->rule.define.array[i], &environment); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_maps_append", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status)); return status; } @@ -471,7 +471,7 @@ extern "C" { status = controller_pids_increase(&process->childs); if (F_status_is_error(status)) { - controller_print_error(thread, &global->main->program.error, F_status_set_fine(status), "controller_pids_increase", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(controller_pids_increase), F_status_set_fine(status)); return status; } @@ -660,7 +660,7 @@ extern "C" { controller_rule_item_print_error_execute(type == controller_rule_item_type_script_e, program.used ? program : arguments.array[0], status, process); } else { - controller_print_error(thread, &global->main->program.error, F_status_set_fine(status), "fll_execute_program", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(fll_execute_program), F_status_set_fine(status)); } status = F_status_set_error(status); @@ -686,15 +686,15 @@ extern "C" { status = controller_pids_increase(&process->childs); if (F_status_is_error(status)) { - controller_print_error(thread, &global->main->program.error, F_status_set_fine(status), "controller_pids_increase", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(controller_pids_increase), F_status_set_fine(status)); return status; } - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &process->path_pids.array, &process->path_pids.used, &process->path_pids.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &process->path_pids.array, &process->path_pids.used, &process->path_pids.size); if (F_status_is_error(status)) { - controller_print_error(thread, &global->main->program.error, F_status_set_fine(status), "f_memory_array_increase", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_memory_array_increase), F_status_set_fine(status)); return status; } @@ -730,22 +730,16 @@ extern "C" { status = f_file_exists(pid_file, F_true); - if (F_status_is_error(status)) { - controller_print_error_file(thread, &global->main->program.error, F_status_set_fine(status), "f_file_exists", F_true, pid_file, f_file_operation_find_s, fll_error_file_type_file_e); + if (F_status_is_error(status) || status == F_true) { + controller_main_print_error_file_status(&global->main->program.error, macro_controller_f(f_file_exists), status == F_true ? F_file_found : F_status_set_fine(status), pid_file, f_file_operation_find_s, fll_error_file_type_file_e); return status; } - if (status == F_true) { - controller_print_error_file(thread, &global->main->program.error, F_file_found, "f_file_exists", F_true, pid_file, f_file_operation_find_s, fll_error_file_type_file_e); - - return F_status_set_error(F_file_found); - } - status = f_string_dynamic_append_nulless(pid_file, child_pid_file); if (F_status_is_error(status)) { - controller_print_error(thread, &global->main->program.error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append_nulless), F_status_set_fine(status)); return status; } @@ -919,7 +913,7 @@ extern "C" { controller_rule_item_print_error_execute(type == controller_rule_item_type_utility_e, program.used ? program : arguments.array[0], status, process); } else { - controller_print_error(thread, &global->main->program.error, F_status_set_fine(status), "fll_execute_program", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(fll_execute_program), F_status_set_fine(status)); } return F_status_set_error(status); diff --git a/sources/c/main/rule/expand.c b/sources/c/main/rule/expand.c index dbc6ef2..e76d144 100644 --- a/sources/c/main/rule/expand.c +++ b/sources/c/main/rule/expand.c @@ -32,7 +32,7 @@ extern "C" { iki_data = &action.ikis.array[process->cache.expanded.used]; // Allocate enough room plus an extra buffer to help reduce reallocations. - status = f_memory_array_increase_by(action.parameters.array[process->cache.expanded.used].used + controller_common_allocation_large_d, sizeof(f_char_t), (void **) &buffer->string, &buffer->used, &buffer->size); + status = f_memory_array_increase_by(action.parameters.array[process->cache.expanded.used].used + controller_allocation_large_d, sizeof(f_char_t), (void **) &buffer->string, &buffer->used, &buffer->size); // Apply the IKI delimits. for (i = 0; i < iki_data->delimits.used; ++i) { diff --git a/sources/c/main/rule/instance.c b/sources/c/main/rule/instance.c index e39a35c..da398d0 100644 --- a/sources/c/main/rule/instance.c +++ b/sources/c/main/rule/instance.c @@ -705,7 +705,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_memory_array_resize", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_memory_array_resize), F_status_set_fine(status)); } else { for (f_number_unsigned_t i = 0; i < stack.used; ++i) { @@ -727,7 +727,7 @@ extern "C" { status = f_string_dynamic_append(cache.action.name_item, &instance->cache.action.name_item); } else { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_dynamic_append", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status)); } } @@ -743,7 +743,7 @@ extern "C" { } if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_thread_create", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_thread_create), F_status_set_fine(status)); } } else { @@ -886,7 +886,7 @@ extern "C" { f_thread_unlock(&global->thread->lock.rule); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "controller_rule_copy", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(controller_rule_copy), F_status_set_fine(status)); } else if (!instance->action) { @@ -933,10 +933,10 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &instance->stack.array, &instance->stack.used, &instance->stack.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &instance->stack.array, &instance->stack.used, &instance->stack.size); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_memory_array_increase", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_memory_array_increase), F_status_set_fine(status)); } else { f_thread_unlock(&instance->lock); diff --git a/sources/c/main/rule/item.c b/sources/c/main/rule/item.c index 59bd3c6..dbbbe18 100644 --- a/sources/c/main/rule/item.c +++ b/sources/c/main/rule/item.c @@ -10,8 +10,8 @@ extern "C" { if (!global || !cache || !item) return F_status_set_error(F_parameter); f_status_t status = F_okay; - controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize_1(is_normal, 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); + controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, global->thread); + 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_item.used); f_number_unsigned_t last = 0; @@ -26,7 +26,7 @@ extern "C" { fl_fss_extended_list_object_read(cache->buffer_item, &range, &cache->range_action, &cache->delimits, &state); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "fl_fss_extended_list_object_read", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(fl_fss_extended_list_object_read), F_status_set_fine(status)); break; } @@ -43,7 +43,7 @@ extern "C" { fl_fss_extended_object_read(cache->buffer_item, &range, &cache->range_action, 0, &cache->delimits, &state); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "fl_fss_extended_object_read", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(fl_fss_extended_object_read), F_status_set_fine(status)); break; } @@ -55,7 +55,7 @@ extern "C" { f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_fss_apply_delimit", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_fss_apply_delimit), F_status_set_fine(status)); break; } @@ -63,7 +63,7 @@ extern "C" { f_fss_count_lines(cache->buffer_item, cache->range_action.start, &cache->action.line_action, &state); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_fss_count_lines", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_fss_count_lines), F_status_set_fine(status)); break; } @@ -74,7 +74,7 @@ extern "C" { status = f_rip_dynamic_partial_nulless(cache->buffer_item, cache->range_action, &cache->action.name_action); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_rip_dynamic_partial_nulless", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status)); break; } @@ -160,10 +160,10 @@ extern "C" { method = controller_rule_action_method_extended_e; } - status = controller_rule_actions_increase_by(controller_common_allocation_small_d, &item->actions); + status = controller_rule_actions_increase_by(controller_allocation_small_d, &item->actions); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(controller_rule_actions_increase_by), F_status_set_fine(status)); break; } diff --git a/sources/c/main/rule/parameter.c b/sources/c/main/rule/parameter.c index e706347..91d056d 100644 --- a/sources/c/main/rule/parameter.c +++ b/sources/c/main/rule/parameter.c @@ -19,24 +19,20 @@ extern "C" { status = f_memory_array_increase_by(content->used + 1, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); } else { - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); } - if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), content ? "f_memory_array_increase_by" : "f_memory_array_increase", F_true); - - return status; - } - - if (content) { - status = f_memory_array_increase_by(content->used + 1, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); - } - else { - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); + if (F_status_is_error_not(status)) { + if (content) { + status = f_memory_array_increase_by(content->used + 1, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); + } + else { + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); + } } if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), content ? "f_memory_array_increase_by" : "f_memory_array_increase", F_true); + controller_main_print_error_status(&global->main->program.error, content ? macro_controller_f(f_memory_array_increase_by) : macro_controller_f(f_memory_array_increase), F_status_set_fine(status)); return status; } @@ -50,7 +46,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, *object, &action->parameters.array[0]); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status)); return status; } @@ -62,16 +58,12 @@ extern "C" { if (content && content->used) { status = f_memory_array_increase_by(content->used, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size); - if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_memory_array_increase_by", F_true); - - return status; + if (F_status_is_error_not(status)) { + status = f_memory_array_increase_by(content->used, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); } - status = f_memory_array_increase_by(content->used, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size); - if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_memory_array_increase_by", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(status)); return status; } @@ -91,7 +83,7 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, content->array[i], &action->parameters.array[action->parameters.used]); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status)); return status; } @@ -103,7 +95,7 @@ extern "C" { fl_iki_read(&action->parameters.array[action->parameters.used], &range, &action->ikis.array[action->ikis.used], state); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "fl_iki_read", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(fl_iki_read), F_status_set_fine(status)); action->parameters.array[action->parameters.used].used = 0; diff --git a/sources/c/main/rule/read.c b/sources/c/main/rule/read.c index c90006b..a233a8d 100644 --- a/sources/c/main/rule/read.c +++ b/sources/c/main/rule/read.c @@ -168,7 +168,7 @@ extern "C" { status = f_string_dynamic_append_nulless(alias, &rule->alias); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append_nulless), F_status_set_fine(status)); } else { status = controller_file_load(global, F_true, controller_rules_s, rule->alias, controller_rule_s, cache); @@ -178,30 +178,32 @@ extern "C" { rule->timestamp = cache->timestamp; if (cache->buffer_file.used) { - controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize_1(is_normal, 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); + controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, global->thread); + 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); fll_fss_basic_list_read(cache->buffer_file, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments, &state); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true); + controller_main_print_error_status(&global->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); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_fss_apply_delimit", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_fss_apply_delimit), F_status_set_fine(status)); } } } } if (F_status_is_error_not(status) && cache->object_items.used) { - status = controller_rule_items_increase_by(cache->object_items.used, &rule->items); + if (rule->items.size < cache->object_items.size) { + status = f_memory_arrays_resize(cache->object_items.size, sizeof(controller_rule_item_t), (void **) &&rule->items.array, &rule->items.used, &rule->items.size, &controller_rule_items_delete_callback); + } if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "controller_rule_items_increase_by", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(controller_rule_items_increase_by), F_status_set_fine(status)); } else { f_number_unsigned_t i = 0; @@ -239,7 +241,7 @@ extern "C" { f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item, &global->main->setting.state); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_fss_count_lines", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_fss_count_lines), F_status_set_fine(status)); break; } @@ -249,7 +251,7 @@ extern "C" { status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->object_items.array[i], &cache->action.name_item); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_rip_dynamic_partial_nulless", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status)); break; } @@ -288,7 +290,7 @@ extern "C" { status = f_string_dynamic_partial_append(cache->buffer_file, cache->content_items.array[i].array[0], &cache->buffer_item); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_string_dynamic_partial_append", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status)); break; } diff --git a/sources/c/main/rule/setting.c b/sources/c/main/rule/setting.c index 7802ce3..d7086a0 100644 --- a/sources/c/main/rule/setting.c +++ b/sources/c/main/rule/setting.c @@ -15,8 +15,8 @@ extern "C" { f_range_t range = macro_f_range_t_initialize_2(cache->buffer_item.used); f_range_t range2 = f_range_t_initialize; - controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize_1(is_normal, 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); + controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, global->thread); + 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); fll_fss_extended_read(cache->buffer_item, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0, &state); @@ -223,7 +223,7 @@ extern "C" { for (j = 0; j < cache->content_actions.array[i].used; ++j, number = 0) { - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(int32_t), (void **) &rule->affinity.array, &rule->affinity.used, &rule->affinity.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(int32_t), (void **) &rule->affinity.array, &rule->affinity.used, &rule->affinity.size); if (F_status_is_error(status)) { controller_rule_print_error(global->thread, &global->main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false); @@ -301,7 +301,7 @@ extern "C" { setting_maps = &rule->parameter; } - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_string_map_t), (void **) &setting_maps->array, &setting_maps->used, &setting_maps->size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_map_t), (void **) &setting_maps->array, &setting_maps->used, &setting_maps->size); if (F_status_is_error(status)) { controller_rule_print_error(global->thread, &global->main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false); @@ -427,7 +427,7 @@ extern "C" { for (j = 1; j < cache->content_actions.array[i].used; ++j) { - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &rule->cgroup.groups.array, &rule->cgroup.groups.used, &rule->cgroup.groups.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &rule->cgroup.groups.array, &rule->cgroup.groups.used, &rule->cgroup.groups.size); if (F_status_is_error(status)) { controller_rule_print_error(global->thread, &global->main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false); @@ -595,7 +595,7 @@ extern "C" { if (F_status_is_error(status)) continue; - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_limit_set_t), (void **) &rule->limits.array, &rule->limits.used, &rule->limits.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_limit_set_t), (void **) &rule->limits.array, &rule->limits.used, &rule->limits.size); if (F_status_is_error(status)) { controller_rule_print_error(global->thread, &global->main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false); @@ -1070,7 +1070,7 @@ extern "C" { status = f_rip_dynamic_partial_nulless(cache->buffer_item, cache->content_actions.array[i].array[1], &cache->action.generic); if (F_status_is_error(status)) { - controller_print_error(global->thread, &global->main->program.error, F_status_set_fine(status), "f_rip_dynamic_partial_nulless", F_true); + controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(status)); break; } @@ -1324,7 +1324,7 @@ extern "C" { for (j = 0; j < cache->content_actions.array[i].used; ++j) { - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_int32s_t), (void **) &rule->groups.array, &rule->groups.used, &rule->groups.size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_int32s_t), (void **) &rule->groups.array, &rule->groups.used, &rule->groups.size); if (F_status_is_error(status)) { controller_rule_print_error(global->thread, &global->main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false); @@ -1402,7 +1402,7 @@ extern "C" { for (j = 0; j < cache->content_actions.array[i].used; ++j) { - status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &setting_values->array, &setting_values->used, &setting_values->size); + status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &setting_values->array, &setting_values->used, &setting_values->size); if (F_status_is_error(status)) { controller_rule_print_error(global->thread, &global->main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase", F_true, F_false); @@ -1639,7 +1639,7 @@ extern "C" { continue; } - status = f_memory_array_increase_by(controller_common_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &setting_values->array, &setting_values->used, &setting_values->size); + status = f_memory_array_increase_by(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &setting_values->array, &setting_values->used, &setting_values->size); if (F_status_is_error(status)) { controller_rule_print_error(global->thread, &global->main->program.error, cache->action, F_status_set_fine(status), "f_memory_array_increase_by", F_true, F_false);