From 19b16c857ee085b514814a793e297e5563f8e3d9 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 1 Jul 2024 23:36:27 -0500 Subject: [PATCH] Progress: Continue migrating the project. --- sources/c/main/print/error/rule/setting.c | 22 +- sources/c/main/print/error/rule/setting.h | 40 +++- sources/c/main/print/warning/rule/setting.c | 26 ++- sources/c/main/print/warning/rule/setting.h | 28 +++ sources/c/main/rule/setting.c | 347 +++++++++++++--------------- sources/c/main/rule/setting.h | 34 +++ 6 files changed, 286 insertions(+), 211 deletions(-) diff --git a/sources/c/main/print/error/rule/setting.c b/sources/c/main/print/error/rule/setting.c index e598661..764ebb3 100644 --- a/sources/c/main/print/error/rule/setting.c +++ b/sources/c/main/print/error/rule/setting.c @@ -5,26 +5,20 @@ extern "C" { #endif #ifndef _di_controller_print_error_rule_setting_ - f_status_t controller_print_error_rule_setting(fl_print_t * const print, controller_cache_t * const cache, const f_string_t message, const f_number_unsigned_t index, const f_number_unsigned_t line_item) { + f_status_t controller_print_error_rule_setting(fl_print_t * const print, controller_cache_action_t * const action, const f_string_t message, const f_string_static_t buffer, const f_number_unsigned_t line_start, const f_number_unsigned_t line_item, f_state_t * const state) { - if (!print || !print->custom || !cache) return F_status_set_error(F_output_not); + if (!print || !print->custom || !action || !state) return F_status_set_error(F_output_not); if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not; controller_t * const main = (controller_t *) print->custom; - f_state_t state = f_state_t_initialize; - - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[index].start, &cache->action.line_item, &main->setting.state); - - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, action, buffer, line_start, line_item, state); controller_lock_print(print->to, &main->thread); fl_print_format("%r%[%QRule setting %S.%]%r", print->to, f_string_eol_s, print->context, print->prefix, message, print->context, f_string_eol_s); - controller_print_error_rule_cache(print, &cache->action, F_false); + controller_print_error_rule_cache(print, action, F_false); controller_unlock_print_flush(print->to, &main->thread); @@ -38,18 +32,14 @@ extern "C" { #endif // _di_controller_print_error_rule_setting_value_unsupported_ #ifndef _di_controller_print_error_rule_setting_with_range_ - f_status_t controller_print_error_rule_setting_with_range(fl_print_t * const print, controller_cache_action_t * const action, const f_string_t before, const f_string_static_t buffer, const f_range_t range_object, const f_range_t range_content, const f_string_t after, const f_number_unsigned_t line_item) { + f_status_t controller_print_error_rule_setting_with_range(fl_print_t * const print, controller_cache_action_t * const action, const f_string_t before, const f_string_static_t buffer, const f_range_t range_content, const f_string_t after, const f_number_unsigned_t line_start, const f_number_unsigned_t line_item, f_state_t * const state) { if (!print || !print->custom || !action) return F_status_set_error(F_output_not); if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not; controller_t * const main = (controller_t *) print->custom; - // Get the current line number within the settings item. - action->line_item = line_item; - f_fss_count_lines(buffer, range_object.start, &action->line_item, &main->setting.state); - - action->line_action = ++action->line_item; + controller_rule_setting_line_action(main, action, buffer, line_start, line_item, state); controller_lock_print(print->to, &main->thread); diff --git a/sources/c/main/print/error/rule/setting.h b/sources/c/main/print/error/rule/setting.h index a209cde..c7821fc 100644 --- a/sources/c/main/print/error/rule/setting.h +++ b/sources/c/main/print/error/rule/setting.h @@ -23,21 +23,33 @@ extern "C" { * This is intended only to be used for simple messages. * * @param print - * The error or warning output structure. + * The output structure to print to. + * + * This requires print.custom to be controller_t. + * + * This does not alter print.custom.setting.state.status. * * Must not be NULL. - * @param cache - * A structure for containing and caching relevant data. + * @param action + * The Action cache. + * + * This alters action.line_item to get the current line. * * Must not be NULL. * @param message * The string to append to the message being printed. - * @param index - * The position in the object actions cache representing the object. + * @param buffer + * The buffer representing the content where the lines will be counted from. + * @param line_start + * The position where to start counting lines. * @param line_item * The current line number. - * @param thread - * The thread data. + * @param state + * The state information + * + * The state.status is modified. + * + * Must not be NULL. * * @return * F_okay on success. @@ -46,7 +58,7 @@ extern "C" { * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_controller_print_error_rule_setting_ - extern f_status_t controller_print_error_rule_setting(fl_print_t * const print, controller_cache_t * const cache, const f_string_t message, const f_number_unsigned_t index, const f_number_unsigned_t line_item); + extern f_status_t controller_print_error_rule_setting(fl_print_t * const print, controller_cache_action_t * const action, const f_string_t message, const f_string_static_t buffer, const f_number_unsigned_t line_start, const f_number_unsigned_t line_item, f_state_t * const state); #endif // _di_controller_print_error_rule_setting_ /** @@ -73,14 +85,20 @@ extern "C" { * The string to add to the message being printed (before the value). * @param buffer * The buffer representing the Rule settings. - * @param range_object - * The range within the buffer representing the setting Object. * @param range_content * The range within the buffer representing the setting Content. * @param after * The string to add to the message being printed (after the value). + * @param line_start + * The position where to start counting lines. * @param line_item * The current line number. + * @param state + * The state information + * + * The state.status is modified. + * + * Must not be NULL. * * @return * F_okay on success. @@ -89,7 +107,7 @@ extern "C" { * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_controller_print_error_rule_setting_with_range_ - extern f_status_t controller_print_error_rule_setting_with_range(fl_print_t * const print, controller_cache_action_t * const action, const f_string_t before, const f_string_static_t buffer, const f_range_t range_object, const f_range_t range_content, const f_string_t after, const f_number_unsigned_t line_item); + extern f_status_t controller_print_error_rule_setting_with_range(fl_print_t * const print, controller_cache_action_t * const action, const f_string_t before, const f_string_static_t buffer, const f_range_t range_content, const f_string_t after, const f_number_unsigned_t line_start, const f_number_unsigned_t line_item, f_state_t * const state); #endif // _di_controller_print_error_rule_setting_with_range_ /** diff --git a/sources/c/main/print/warning/rule/setting.c b/sources/c/main/print/warning/rule/setting.c index 12cb864..38bdca9 100644 --- a/sources/c/main/print/warning/rule/setting.c +++ b/sources/c/main/print/warning/rule/setting.c @@ -4,7 +4,29 @@ extern "C" { #endif -#ifndef _di_controller_print_warning_setting_item_unknown_ +#ifndef _di_controller_print_warning_rule_setting_empty_ + f_status_t controller_print_warning_rule_setting_empty(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t name) { + + if (!print || !print->custom || !action) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_debug_e) return F_output_not; + + controller_t * const main = (controller_t *) print->custom; + + controller_lock_print(print->to, &main->thread); + + fl_print_format("%r%[%QUnknown Rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context); + fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable); + fl_print_format(f_string_format_sentence_end_quote_s.string, print->to, print->context, print->context, f_string_eol_s); + + controller_print_error_rule_cache(print, action, F_true); + + controller_unlock_print_flush(print->to, &main->thread); + + return F_okay; + } +#endif // _di_controller_print_warning_rule_setting_empty_ + +#ifndef _di_controller_print_warning_rule_setting_unknown_ f_status_t controller_print_warning_rule_setting_unknown(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t name) { if (!print || !print->custom || !action) return F_status_set_error(F_output_not); @@ -24,7 +46,7 @@ extern "C" { return F_okay; } -#endif // _di_controller_print_warning_setting_item_unknown_ +#endif // _di_controller_print_warning_rule_setting_unknown_ #ifdef __cplusplus } // extern "C" diff --git a/sources/c/main/print/warning/rule/setting.h b/sources/c/main/print/warning/rule/setting.h index 5deec88..51f86a1 100644 --- a/sources/c/main/print/warning/rule/setting.h +++ b/sources/c/main/print/warning/rule/setting.h @@ -40,6 +40,34 @@ extern "C" { * * F_output_not (with error bit) if setting is NULL. */ +#ifndef _di_controller_print_warning_rule_setting_empty_ + extern f_status_t controller_print_warning_rule_setting_empty(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t name); +#endif // _di_controller_print_warning_rule_setting_empty_ + +/** + * Print warning message about the Rule Item being unknown. + * + * @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. + * + * Must not be NULL. + * @param action + * The action cache. + * + * Must not be NULL. + * @param name + * The Item name that is unknown. + * + * @return + * F_okay on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + */ #ifndef _di_controller_print_warning_rule_setting_unknown_ extern f_status_t controller_print_warning_rule_setting_unknown(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t name); #endif // _di_controller_print_warning_rule_setting_unknown_ diff --git a/sources/c/main/rule/setting.c b/sources/c/main/rule/setting.c index 6b72e11..c7d4d7b 100644 --- a/sources/c/main/rule/setting.c +++ b/sources/c/main/rule/setting.c @@ -85,6 +85,34 @@ extern "C" { } #endif // _di_controller_rule_setting_limit_type_name_ +#ifndef _di_controller_rule_setting_line_action_ + f_status_t controller_rule_setting_line_action(controller_t * const main, controller_cache_action_t * const action, const f_string_static_t buffer, const f_number_unsigned_t start, const f_number_unsigned_t line, f_state_t * const state) { + + if (!main || !action || !state) return F_status_set_error(F_parameter); + + action->line_item = line; + + { + // Save the original status, to reset it before returning. + const f_status_t original = state->status; + + f_fss_count_lines(buffer, start, &action->line_item, state); + + if (F_status_is_error(state->status)) { + state->status = original; + + return state->status; + } + + state->status = original; + } + + action->line_action = ++action->line_item; + + return F_okay; + } +#endif // _di_controller_rule_setting_line_action_ + #ifndef _di_controller_rule_setting_read_ f_status_t controller_rule_setting_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, controller_rule_t * const rule) { @@ -147,13 +175,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -211,12 +237,7 @@ extern "C" { } else { if (main->program.warning.verbosity == f_console_verbosity_debug_e) { - - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); - - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); controller_print_warning_rule_setting_unknown(&main->program.warning, &cache->action, cache->action.name_item); } @@ -231,13 +252,15 @@ extern "C" { state.status = f_string_dynamic_partial_append_nulless(cache->buffer_item, range2, &cache->action.name_action); if (F_status_is_error(state.status)) { - controller_print_error_rule(&main->program.error, &cache->action, F_status_set_fine(state.status), macro_controller_f(f_string_dynamic_partial_append_nulless), F_true, F_false); + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } + + controller_print_error_rule(&main->program.error, &cache->action, F_status_set_fine(state.status), macro_controller_f(f_string_dynamic_partial_append_nulless), F_true, F_false); controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); @@ -257,12 +280,7 @@ extern "C" { else { if (empty_disallow) { if (main->program.warning.verbosity == f_console_verbosity_debug_e) { - - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); - - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); controller_lock_print(main->program.warning.to, &main->thread); @@ -279,7 +297,7 @@ extern "C" { if (type == controller_rule_setting_type_affinity_e) { if (!cache->content_actions.array[i].used) { - controller_print_error_rule_setting(&main->program.error, cache, "requires one or more Content", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "requires one or more Content", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -318,13 +336,13 @@ extern "C" { if (state.status == F_data_not || state.status == F_number || state.status == F_number_overflow || state.status == F_number_underflow || state.status == F_number_negative || state.status == F_number_decimal) { if (state.status == F_number_underflow) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[j], ", the number is too small for this system", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->content_actions.array[i].array[j], ", the number is too small for this system", cache->object_actions.array[i].start, line_item, &state); } else if (state.status == F_number_overflow || state.status == F_number_positive) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[j], ", the number is too large for this system", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->content_actions.array[i].array[j], ", the number is too large for this system", cache->object_actions.array[i].start, line_item, &state); } else { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid number", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[j], ", only whole numbers are allowed for an affinity value", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid number", cache->buffer_item, cache->content_actions.array[i].array[j], ", only whole numbers are allowed for an affinity value", cache->object_actions.array[i].start, line_item, &state); } state.status = F_status_set_error(F_valid_not); @@ -356,7 +374,7 @@ extern "C" { if (type == controller_rule_setting_type_define_e || type == controller_rule_setting_type_parameter_e) { if (cache->content_actions.array[i].used != 2) { - controller_print_error_rule_setting(&main->program.error, cache, "requires exactly two Content", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "requires exactly two Content", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -387,13 +405,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -416,13 +432,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -442,13 +456,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -462,7 +474,7 @@ extern "C" { if (type == controller_rule_setting_type_cgroup_e) { if (cache->content_actions.array[i].used < 2 || rule->has & controller_rule_has_cgroup_d) { - controller_print_error_rule_setting(&main->program.error, cache, "requires two or more Content", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "requires two or more Content", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -478,7 +490,7 @@ extern "C" { rule->cgroup.as_new = F_true; } else { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unknown option", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[0], "", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unknown option", cache->buffer_item, cache->content_actions.array[i].array[0], "", cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -534,13 +546,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -554,7 +564,7 @@ extern "C" { if (type == controller_rule_setting_type_limit_e) { if (cache->content_actions.array[i].used != 3) { - controller_print_error_rule_setting(&main->program.error, cache, "requires three Content", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "requires three Content", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -613,12 +623,7 @@ extern "C" { } else { if (main->program.error.verbosity == f_console_verbosity_debug_e) { - - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); - - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); controller_lock_print(main->program.error.to, &main->thread); @@ -642,12 +647,7 @@ extern "C" { if (type == rule->limits.array[j].type) { if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); - - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); controller_lock_print(main->program.error.to, &main->thread); @@ -683,13 +683,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -714,13 +712,13 @@ extern "C" { if (state.status == F_data_not || state.status == F_number || state.status == F_number_overflow || state.status == F_number_underflow || state.status == F_number_negative || state.status == F_number_positive || state.status == F_number_decimal) { if (state.status == F_number_underflow) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[j], ", the number is too small for this system", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->content_actions.array[i].array[j], ", the number is too small for this system", cache->object_actions.array[i].start, line_item, &state); } else if (state.status == F_number_overflow) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[j], ", the number is too large for this system", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->content_actions.array[i].array[j], ", the number is too large for this system", cache->object_actions.array[i].start, line_item, &state); } else { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[j], ", only whole numbers are allowed for a resource limit value", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->content_actions.array[i].array[j], ", only whole numbers are allowed for a resource limit value", cache->object_actions.array[i].start, line_item, &state); } state.status = F_status_set_error(F_valid_not); @@ -772,7 +770,7 @@ extern "C" { } if (setting_value->used || !cache->content_actions.array[i].used) { - controller_print_error_rule_setting(&main->program.error, cache, "requires one or more Content", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "requires one or more Content", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -816,13 +814,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -831,12 +827,11 @@ extern "C" { if (state.status == F_false || F_status_set_fine(state.status) == F_complete_not_utf) { if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; } if (state.status == F_false) { @@ -893,13 +888,11 @@ extern "C" { setting_value->used = 0; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -912,7 +905,7 @@ extern "C" { if (type == controller_rule_setting_type_scheduler_e) { if (cache->content_actions.array[i].used < 1 || cache->content_actions.array[i].used > 2 || rule->has & controller_rule_has_scheduler_d) { - controller_print_error_rule_setting(&main->program.error, cache, "requires either one or two Content", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "requires either one or two Content", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -946,7 +939,7 @@ extern "C" { rule->scheduler.priority = 49; } else { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unknown scheduler", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[0], "", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unknown scheduler", cache->buffer_item, cache->content_actions.array[i].array[0], "", cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -976,12 +969,13 @@ extern "C" { if ((zero_only && number) || (!zero_only && (number < 1 || number > 99)) || state.status == F_data_not || state.status == F_number || state.status == F_number_overflow || state.status == F_number_negative || state.status == F_number_positive) { if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } controller_lock_print(main->program.error.to, &main->thread); @@ -1010,7 +1004,7 @@ extern "C" { } } else { - controller_print_error_rule(&main->program.error, &cache->action, state.status, macro_controller_f(fl_conversion_dynamic_partial_to_signed_detect), F_true, F_false); + controller_print_error_rule(&main->program.error, &cache->action, F_status_set_fine(state.status), macro_controller_f(fl_conversion_dynamic_partial_to_signed_detect), F_true, F_false); state.status = F_status_set_error(state.status); if (F_status_is_error_not(status_return)) { @@ -1033,7 +1027,7 @@ extern "C" { if (type == controller_rule_setting_type_timeout_e) { if (cache->content_actions.array[i].used != 2) { - controller_print_error_rule_setting(&main->program.error, cache, "requires exactly two Content", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "requires exactly two Content", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -1055,12 +1049,13 @@ extern "C" { } else { if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } controller_lock_print(main->program.error.to, &main->thread); @@ -1097,20 +1092,21 @@ extern "C" { state.status = F_status_set_fine(state.status); if (state.status == F_number_overflow) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[1], ", the number is too large for this system", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an unsupported number", cache->buffer_item, cache->content_actions.array[i].array[1], ", the number is too large for this system", cache->object_actions.array[i].start, line_item, &state); } else if (state.status == F_data_not || state.status == F_number || state.status == F_number_underflow || state.status == F_number_negative || state.status == F_number_positive || state.status == F_number_decimal) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid number", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[1], ", only positive whole numbers are allowed", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid number", cache->buffer_item, cache->content_actions.array[i].array[1], ", only positive whole numbers are allowed", cache->object_actions.array[i].start, line_item, &state); } else { + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } - controller_print_error_rule(&main->program.error, &cache->action, state.status, macro_controller_f(fl_conversion_dynamic_partial_to_signed_detect), F_true, F_false); + controller_print_error_rule(&main->program.error, &cache->action, F_status_set_fine(state.status), macro_controller_f(fl_conversion_dynamic_partial_to_signed_detect), F_true, F_false); } if (F_status_is_error_not(status_return)) { @@ -1157,7 +1153,7 @@ extern "C" { if (type == controller_rule_setting_type_capability_e || type == controller_rule_setting_type_nice_e || type == controller_rule_setting_type_user_e) { if (cache->content_actions.array[i].used != 1 || type == controller_rule_setting_type_capability_e && rule->capability || type == controller_rule_setting_type_group_e && (rule->has & controller_rule_has_group_d) || type == controller_rule_setting_type_nice_e && (rule->has & controller_rule_has_nice_d) || type == controller_rule_setting_type_user_e && (rule->has & controller_rule_has_user_d)) { - controller_print_error_rule_setting(&main->program.error, cache, "requires exactly one Content", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "requires exactly one Content", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -1172,12 +1168,13 @@ extern "C" { state.status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &cache->action.generic); if (F_status_is_error(state.status)) { + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } controller_lock_print(main->program.error.to, &main->thread); @@ -1202,12 +1199,13 @@ extern "C" { if (F_status_is_error(state.status) && F_status_set_fine(state.status) != F_support_not) { if (F_status_set_fine(state.status) == F_memory_not) { + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } controller_lock_print(main->program.error.to, &main->thread); @@ -1222,7 +1220,7 @@ extern "C" { break; } - controller_print_error_rule_setting(&main->program.error, cache, "failed to process the capabilities", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "failed to process the capabilities", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -1252,12 +1250,13 @@ extern "C" { if (number < -20 || number > 19 || state.status == F_data_not || state.status == F_number || state.status == F_number_overflow || state.status == F_number_underflow || state.status == F_number_decimal) { if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } controller_lock_print(main->program.error.to, &main->thread); @@ -1279,7 +1278,7 @@ extern "C" { } } else { - controller_print_error_rule(&main->program.error, &cache->action, state.status, macro_controller_f(fl_conversion_dynamic_partial_to_signed_detect), F_true, F_false); + controller_print_error_rule(&main->program.error, &cache->action, F_status_set_fine(state.status), macro_controller_f(fl_conversion_dynamic_partial_to_signed_detect), F_true, F_false); state.status = F_status_set_error(state.status); if (F_status_is_error_not(status_return)) { @@ -1297,12 +1296,13 @@ extern "C" { state.status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &cache->action.generic); if (F_status_is_error(state.status)) { + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } controller_lock_print(main->program.error.to, &main->thread); @@ -1338,23 +1338,24 @@ extern "C" { state.status = F_status_set_fine(state.status); if (state.status == F_exist_not) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid user", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[0], ", because no user was found by that name", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid user", cache->buffer_item, cache->content_actions.array[i].array[0], ", because no user was found by that name", cache->object_actions.array[i].start, line_item, &state); } else if (state.status == F_number_too_large) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid user", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[0], ", because the given ID is too large", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid user", cache->buffer_item, cache->content_actions.array[i].array[0], ", because the given ID is too large", cache->object_actions.array[i].start, line_item, &state); } else if (state.status == F_number) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid user", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[0], ", because the given ID is not a valid supported number", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid user", cache->buffer_item, cache->content_actions.array[i].array[0], ", because the given ID is not a valid supported number", cache->object_actions.array[i].start, line_item, &state); } else { + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } - controller_print_error_rule(&main->program.error, &cache->action, state.status, macro_controller_f(controller_convert_user_id), F_true, F_false); + controller_print_error_rule(&main->program.error, &cache->action, F_status_set_fine(state.status), macro_controller_f(controller_convert_user_id), F_true, F_false); controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); } @@ -1382,7 +1383,7 @@ extern "C" { if (type == controller_rule_setting_type_group_e) { if (!cache->content_actions.array[i].used) { - controller_print_error_rule_setting(&main->program.error, cache, "requires one or more Content", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "requires one or more Content", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -1412,13 +1413,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -1429,23 +1428,24 @@ extern "C" { state.status = F_status_set_fine(state.status); if (state.status == F_exist_not) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid group", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[j], ", because no group was found by that name", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid group", cache->buffer_item, cache->content_actions.array[i].array[j], ", because no group was found by that name", cache->object_actions.array[i].start, line_item, &state); } else if (state.status == F_number_too_large) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid group", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[j], ", because the given ID is too large", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid group", cache->buffer_item, cache->content_actions.array[i].array[j], ", because the given ID is too large", cache->object_actions.array[i].start, line_item, &state); } else if (state.status == F_number) { - controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid group", cache->buffer_item, cache->object_actions.array[i], cache->content_actions.array[i].array[j], ", because the given ID is not a valid supported number", line_item); + controller_print_error_rule_setting_with_range(&main->program.error, &cache->action, " has an invalid group", cache->buffer_item, cache->content_actions.array[i].array[j], ", because the given ID is not a valid supported number", cache->object_actions.array[i].start, line_item, &state); } else { + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } - controller_print_error_rule(&main->program.error, &cache->action, state.status, macro_controller_f(f_account_group_id_by_name), F_true, F_false); + controller_print_error_rule(&main->program.error, &cache->action, F_status_set_fine(state.status), macro_controller_f(f_account_group_id_by_name), F_true, F_false); controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); } @@ -1490,13 +1490,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -1520,13 +1518,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -1534,12 +1530,13 @@ extern "C" { state.status = controller_validate_environment_name(setting_values->array[setting_values->used]); if (state.status == F_false || F_status_set_fine(state.status) == F_complete_not_utf) { + { + const f_status_t original = state.status; - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - cache->action.line_action = ++cache->action.line_item; + state.status = original; + } if (state.status == F_false) { if (main->program.error.verbosity > f_console_verbosity_quiet_e) { @@ -1598,7 +1595,7 @@ extern "C" { // The "on" Rule Setting. if (cache->content_actions.array[i].used != 4) { - controller_print_error_rule_setting(&main->program.error, cache, "requires exactly four Content", i, line_item); + controller_print_error_rule_setting(&main->program.error, &cache->action, "requires exactly four Content", cache->buffer_item, cache->object_actions.array[i].start, line_item, &state); if (F_status_is_error_not(status_return)) { status_return = F_status_set_error(F_valid_not); @@ -1636,12 +1633,7 @@ extern "C" { } else { if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); - - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); f_thread_mutex_lock(&main->thread.lock.print); @@ -1687,12 +1679,7 @@ extern "C" { } else { if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); - - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); controller_lock_print(main->program.error.to, &main->thread); @@ -1730,13 +1717,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } @@ -1756,13 +1741,11 @@ extern "C" { status_return = state.status; } - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item, &state); + const f_status_t original = state.status; - cache->action.line_action = ++cache->action.line_item; + controller_rule_setting_line_action(main, &cache->action, cache->buffer_item, cache->object_actions.array[i].start, cache->action.line_item, &state); - controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(state.status)); + controller_print_error_rule_item(&main->program.error, &cache->action, F_false, F_status_set_fine(original)); continue; } diff --git a/sources/c/main/rule/setting.h b/sources/c/main/rule/setting.h index aecc3b5..7541cec 100644 --- a/sources/c/main/rule/setting.h +++ b/sources/c/main/rule/setting.h @@ -45,6 +45,40 @@ extern "C" { #endif // di_controller_rule_setting_limit_type_name_ /** + * Get the current line number relative to the start position within the buffer. + * + * @param main + * The main program data. + * + * Must not be NULL. + * @param action + * The Action cache. + * + * This alters the action.line_item to perform the calculation. + * This alters the action.line_action to save the line number. + * Both action.line_item and action.line_action should be the same after this function succeeds. + * + * Must not be NULL. + * @param buffer + * The string containing the lines to count. + * @param start + * The start position in the buffer where counting begins. + * @param line + * The current line number to start counting from. + * @param state + * The state data. + * + * The state.status is modified. + * + * Must not be NULL. + * + * @see f_fss_count_lines() + */ +#ifndef _di_controller_rule_setting_line_action_ + extern f_status_t controller_rule_setting_line_action(controller_t * const main, controller_cache_action_t * const action, const f_string_static_t buffer, const f_number_unsigned_t start, const f_number_unsigned_t line, f_state_t * const state); +#endif // _di_controller_rule_setting_line_action_ + +/** * Read the content within the buffer, extracting all valid settings. * * This will perform additional FSS read functions as appropriate. -- 1.8.3.1