From 80d52241cda7a57d878185a770f23a5f5e38b0f7 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 30 Mar 2025 18:03:03 -0500 Subject: [PATCH] Cleanup: The FLL FSS Status String strings. Remove the granular define wrapping structure that I am not using anymore. Make sure to use the proper `_s_` naming strategy. Simplify some of the names. --- build/stand_alone/firewall.config.h | 2 +- .../fll_fss_status_string/c/fss_status_string.c | 235 +++++++++------------ .../fll_fss_status_string/c/fss_status_string.h | 112 +++++----- 3 files changed, 158 insertions(+), 191 deletions(-) diff --git a/build/stand_alone/firewall.config.h b/build/stand_alone/firewall.config.h index 486d19d..4c47e62 100644 --- a/build/stand_alone/firewall.config.h +++ b/build/stand_alone/firewall.config.h @@ -2143,8 +2143,8 @@ #define _di_fll_fss_snatch_together_ #define _di_fll_fss_status_codes_ #define _di_fll_fss_status_error_ -#define _di_fll_fss_status_string_ #define _di_fll_fss_status_string_from_ +#define _di_fll_fss_status_string_s_ #define _di_fll_fss_status_string_to_ #define _di_fll_fss_status_success_ #define _di_fll_fss_status_warning_ diff --git a/level_2/fll_fss_status_string/c/fss_status_string.c b/level_2/fll_fss_status_string/c/fss_status_string.c index 7322689..e02bbc1 100644 --- a/level_2/fll_fss_status_string/c/fss_status_string.c +++ b/level_2/fll_fss_status_string/c/fss_status_string.c @@ -4,32 +4,23 @@ extern "C" { #endif -#ifndef _di_fll_fss_status_string_ - #ifndef _di_fll_fss_status_error_ - const f_string_static_t fll_fss_status_format_s = macro_f_string_static_t_initialize_1(FLL_fss_status_format_s, 0, FLL_fss_status_format_s_length); - const f_string_static_t fll_fss_status_format_eos_s = macro_f_string_static_t_initialize_1(FLL_fss_status_format_eos_s, 0, FLL_fss_status_format_eos_s_length); - #endif // _di_fll_fss_status_error_ - - #ifndef _di_fll_fss_status_warning_ - const f_string_static_t fll_fss_status_accepted_invalid_s = macro_f_string_static_t_initialize_1(FLL_fss_status_accepted_invalid_s, 0, FLL_fss_status_accepted_invalid_s_length); - const f_string_static_t fll_fss_status_accepted_invalid_eos_s = macro_f_string_static_t_initialize_1(FLL_fss_status_accepted_invalid_eos_s, 0, FLL_fss_status_accepted_invalid_eos_s_length); - #endif // _di_fll_fss_status_warning_ - - #ifndef _di_fll_fss_status_success_ - const f_string_static_t fll_fss_status_found_content_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_content_s, 0, FLL_fss_status_found_content_s_length); - const f_string_static_t fll_fss_status_found_content_not_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_content_not_s, 0, FLL_fss_status_found_content_not_s_length); - const f_string_static_t fll_fss_status_found_object_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_object_s, 0, FLL_fss_status_found_object_s_length); - const f_string_static_t fll_fss_status_found_object_content_not_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_object_content_not_s, 0, FLL_fss_status_found_object_content_not_s_length); - const f_string_static_t fll_fss_status_found_object_not_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_object_not_s, 0, FLL_fss_status_found_object_not_s_length); - #endif // _di_fll_fss_status_success_ - - #ifndef _di_fll_fss_status_codes_ - const f_string_static_t fll_fss_status_found_comment_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_comment_s, 0, FLL_fss_status_found_comment_s_length); - #endif // _di_fll_fss_status_codes_ - - const f_string_static_t fll_fss_status_status_code_first_s = macro_f_string_static_t_initialize_1(FLL_fss_status_status_code_first_s, 0, FLL_fss_status_status_code_first_s_length); - const f_string_static_t fll_fss_status_status_code_last_s = macro_f_string_static_t_initialize_1(FLL_fss_status_status_code_last_s, 0, FLL_fss_status_status_code_last_s_length); -#endif // _di_FLL_fss_status_string_ +#ifndef _di_fll_fss_status_s_ + const f_string_static_t fll_fss_status_accepted_invalid_s = macro_f_string_static_t_initialize_1(FLL_fss_status_accepted_invalid_s, 0, FLL_fss_status_accepted_invalid_s_length); + const f_string_static_t fll_fss_status_accepted_invalid_eos_s = macro_f_string_static_t_initialize_1(FLL_fss_status_accepted_invalid_eos_s, 0, FLL_fss_status_accepted_invalid_eos_s_length); + + const f_string_static_t fll_fss_status_code_first_s = macro_f_string_static_t_initialize_1(FLL_fss_status_code_first_s, 0, FLL_fss_status_code_first_s_length); + const f_string_static_t fll_fss_status_code_last_s = macro_f_string_static_t_initialize_1(FLL_fss_status_code_last_s, 0, FLL_fss_status_code_last_s_length); + + const f_string_static_t fll_fss_status_format_s = macro_f_string_static_t_initialize_1(FLL_fss_status_format_s, 0, FLL_fss_status_format_s_length); + const f_string_static_t fll_fss_status_format_eos_s = macro_f_string_static_t_initialize_1(FLL_fss_status_format_eos_s, 0, FLL_fss_status_format_eos_s_length); + + const f_string_static_t fll_fss_status_found_comment_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_comment_s, 0, FLL_fss_status_found_comment_s_length); + const f_string_static_t fll_fss_status_found_content_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_content_s, 0, FLL_fss_status_found_content_s_length); + const f_string_static_t fll_fss_status_found_content_not_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_content_not_s, 0, FLL_fss_status_found_content_not_s_length); + const f_string_static_t fll_fss_status_found_object_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_object_s, 0, FLL_fss_status_found_object_s_length); + const f_string_static_t fll_fss_status_found_object_content_not_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_object_content_not_s, 0, FLL_fss_status_found_object_content_not_s_length); + const f_string_static_t fll_fss_status_found_object_not_s = macro_f_string_static_t_initialize_1(FLL_fss_status_found_object_not_s, 0, FLL_fss_status_found_object_not_s_length); +#endif // _di_fll_fss_status_s_ #ifndef _di_fll_fss_status_string_from_ f_status_t fll_fss_status_string_from(const f_string_static_t name, f_status_t * const code) { @@ -37,91 +28,83 @@ extern "C" { if (!code) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - f_status_t status = F_okay; - if (!name.used) return F_data_not; // Numbers are not valid status code strings. - status = f_conversion_character_is_decimal(name.string[0]); + { + const f_status_t status = f_conversion_character_is_decimal(name.string[0]); - if (status == F_true) return F_status_set_error(F_data); - if (F_status_is_error(status)) return status; + if (status == F_true) return F_status_set_error(F_data); + if (F_status_is_error(status)) return status; + } - #ifndef _di_fll_fss_status_error_ - if (f_compare_dynamic(name, fll_fss_status_format_s) == F_equal_to) { - *code = F_fss_format; + if (f_compare_dynamic(name, fll_fss_status_format_s) == F_equal_to) { + *code = F_fss_format; - return F_okay; - } + return F_okay; + } - if (f_compare_dynamic(name, fll_fss_status_format_eos_s) == F_equal_to) { - *code = F_fss_format_eos; + if (f_compare_dynamic(name, fll_fss_status_format_eos_s) == F_equal_to) { + *code = F_fss_format_eos; - return F_okay; - } - #endif // _di_fll_fss_status_error_ + return F_okay; + } - #ifndef _di_fll_fss_status_warning_ - if (f_compare_dynamic(name, fll_fss_status_accepted_invalid_s) == F_equal_to) { - *code = F_fss_accepted_invalid; + if (f_compare_dynamic(name, fll_fss_status_accepted_invalid_s) == F_equal_to) { + *code = F_fss_accepted_invalid; - return F_okay; - } + return F_okay; + } - if (f_compare_dynamic(name, fll_fss_status_accepted_invalid_eos_s) == F_equal_to) { - *code = F_fss_accepted_invalid_eos; + if (f_compare_dynamic(name, fll_fss_status_accepted_invalid_eos_s) == F_equal_to) { + *code = F_fss_accepted_invalid_eos; - return F_okay; - } - #endif // _di_fll_fss_status_warning_ + return F_okay; + } - #ifndef _di_fll_fss_status_success_ - if (f_compare_dynamic(name, fll_fss_status_found_object_s) == F_equal_to) { - *code = F_fss_found_object; + if (f_compare_dynamic(name, fll_fss_status_found_object_s) == F_equal_to) { + *code = F_fss_found_object; - return F_okay; - } + return F_okay; + } - if (f_compare_dynamic(name, fll_fss_status_found_content_s) == F_equal_to) { - *code = F_fss_found_content; + if (f_compare_dynamic(name, fll_fss_status_found_content_s) == F_equal_to) { + *code = F_fss_found_content; - return F_okay; - } + return F_okay; + } - if (f_compare_dynamic(name, fll_fss_status_found_object_not_s) == F_equal_to) { - *code = F_fss_found_object_not; + if (f_compare_dynamic(name, fll_fss_status_found_object_not_s) == F_equal_to) { + *code = F_fss_found_object_not; - return F_okay; - } + return F_okay; + } - if (f_compare_dynamic(name, fll_fss_status_found_content_not_s) == F_equal_to) { - *code = F_fss_found_content_not; + if (f_compare_dynamic(name, fll_fss_status_found_content_not_s) == F_equal_to) { + *code = F_fss_found_content_not; - return F_okay; - } + return F_okay; + } - if (f_compare_dynamic(name, fll_fss_status_found_object_content_not_s) == F_equal_to) { - *code = F_fss_found_object_content_not; + if (f_compare_dynamic(name, fll_fss_status_found_object_content_not_s) == F_equal_to) { + *code = F_fss_found_object_content_not; - return F_okay; - } - #endif // _di_fll_fss_status_success_ + return F_okay; + } - #ifndef _di_fll_fss_status_codes_ - if (f_compare_dynamic(name, fll_fss_status_found_comment_s) == F_equal_to) { - *code = F_fss_found_object; + if (f_compare_dynamic(name, fll_fss_status_found_comment_s) == F_equal_to) { + *code = F_fss_found_object; - return F_okay; - } - #endif // _di_fll_fss_status_codes_ + return F_okay; + } - if (f_compare_dynamic(name, fll_fss_status_status_code_first_s) == F_equal_to) { + if (f_compare_dynamic(name, fll_fss_status_code_first_s) == F_equal_to) { *code = F_fss_status_code_first; return F_okay; } - if (f_compare_dynamic(name, fll_fss_status_status_code_last_s) == F_equal_to) { + if (f_compare_dynamic(name, fll_fss_status_code_last_s) == F_equal_to) { *code = F_fss_status_code_last; return F_okay; @@ -140,60 +123,52 @@ extern "C" { const f_status_t unmasked_code = F_status_set_fine(code); switch (unmasked_code) { - #ifndef _di_fll_fss_status_error_ - case F_fss_format: - *name = fll_fss_status_format_s; - break; - - case F_fss_format_eos: - *name = fll_fss_status_format_eos_s; - break; - #endif // _di_fll_fss_status_error_ - - #ifndef _di_fll_fss_status_warning_ - case F_fss_accepted_invalid: - *name = fll_fss_status_accepted_invalid_s; - break; - - case F_fss_accepted_invalid_eos: - *name = fll_fss_status_accepted_invalid_eos_s; - break; - #endif // _di_fll_fss_status_warning_ - - #ifndef _di_fll_fss_status_success_ - case F_fss_found_object: - *name = fll_fss_status_found_object_s; - break; - - case F_fss_found_content: - *name = fll_fss_status_found_content_s; - break; - - case F_fss_found_object_not: - *name = fll_fss_status_found_object_not_s; - break; - - case F_fss_found_content_not: - *name = fll_fss_status_found_content_not_s; - break; - - case F_fss_found_object_content_not: - *name = fll_fss_status_found_object_content_not_s; - break; - #endif // _di_fll_fss_status_success_ - - #ifndef _di_fll_fss_status_codes_ - case F_fss_found_comment: - *name = fll_fss_status_found_comment_s; - break; - #endif // _di_fll_fss_status_codes_ + case F_fss_format: + *name = fll_fss_status_format_s; + break; + + case F_fss_format_eos: + *name = fll_fss_status_format_eos_s; + break; + + case F_fss_accepted_invalid: + *name = fll_fss_status_accepted_invalid_s; + break; + + case F_fss_accepted_invalid_eos: + *name = fll_fss_status_accepted_invalid_eos_s; + break; + + case F_fss_found_object: + *name = fll_fss_status_found_object_s; + break; + + case F_fss_found_content: + *name = fll_fss_status_found_content_s; + break; + + case F_fss_found_object_not: + *name = fll_fss_status_found_object_not_s; + break; + + case F_fss_found_content_not: + *name = fll_fss_status_found_content_not_s; + break; + + case F_fss_found_object_content_not: + *name = fll_fss_status_found_object_content_not_s; + break; + + case F_fss_found_comment: + *name = fll_fss_status_found_comment_s; + break; case F_fss_status_code_first: - *name = fll_fss_status_status_code_first_s; + *name = fll_fss_status_code_first_s; break; case F_fss_status_code_last: - *name = fll_fss_status_status_code_last_s; + *name = fll_fss_status_code_last_s; break; default: diff --git a/level_2/fll_fss_status_string/c/fss_status_string.h b/level_2/fll_fss_status_string/c/fss_status_string.h index befe7d4..0988f30 100644 --- a/level_2/fll_fss_status_string/c/fss_status_string.h +++ b/level_2/fll_fss_status_string/c/fss_status_string.h @@ -29,66 +29,58 @@ extern "C" { #endif -#ifndef _di_fll_fss_status_string_ - #ifndef _di_fll_fss_status_error_ - #define FLL_fss_status_format_s "F_fss_format" - #define FLL_fss_status_format_eos_s "F_fss_format_eos" - - #define FLL_fss_status_format_s_length 12 - #define FLL_fss_status_format_eos_s_length 16 - - extern const f_string_static_t fll_fss_status_format_s; - extern const f_string_static_t fll_fss_status_format_eos_s; - #endif // _di_fll_fss_status_error_ - - #ifndef _di_fll_fss_status_warning_ - #define FLL_fss_status_accepted_invalid_s "F_fss_accepted_invalid" - #define FLL_fss_status_accepted_invalid_eos_s "F_fss_accepted_invalid_eos" - - #define FLL_fss_status_accepted_invalid_s_length 22 - #define FLL_fss_status_accepted_invalid_eos_s_length 26 - - extern const f_string_static_t fll_fss_status_accepted_invalid_s; - extern const f_string_static_t fll_fss_status_accepted_invalid_eos_s; - #endif // _di_fll_fss_status_warning_ - - #ifndef _di_fll_fss_status_success_ - #define FLL_fss_status_found_content_s "F_fss_found_content" - #define FLL_fss_status_found_content_not_s "F_fss_found_content_not" - #define FLL_fss_status_found_object_s "F_fss_found_object" - #define FLL_fss_status_found_object_content_not_s "F_fss_found_object_content_not" - #define FLL_fss_status_found_object_not_s "F_fss_found_object_not" - - #define FLL_fss_status_found_content_s_length 19 - #define FLL_fss_status_found_content_not_s_length 23 - #define FLL_fss_status_found_object_s_length 18 - #define FLL_fss_status_found_object_content_not_s_length 30 - #define FLL_fss_status_found_object_not_s_length 22 - - extern const f_string_static_t fll_fss_status_found_content_s; - extern const f_string_static_t fll_fss_status_found_content_not_s; - extern const f_string_static_t fll_fss_status_found_object_s; - extern const f_string_static_t fll_fss_status_found_object_content_not_s; - extern const f_string_static_t fll_fss_status_found_object_not_s; - #endif // _di_fll_fss_status_success_ - - #ifndef _di_fll_fss_status_codes_ - #define FLL_fss_status_found_comment_s "F_fss_found_comment" - - #define FLL_fss_status_found_comment_s_length 19 - - extern const f_string_static_t fll_fss_status_found_comment_s; - #endif // _di_fll_fss_status_codes_ - - #define FLL_fss_status_status_code_first_s "F_fss_status_code_first" - #define FLL_fss_status_status_code_last_s "F_fss_status_code_last" - - #define FLL_fss_status_status_code_first_s_length 23 - #define FLL_fss_status_status_code_last_s_length 22 - - extern const f_string_static_t fll_fss_status_status_code_first_s; - extern const f_string_static_t fll_fss_status_status_code_last_s; -#endif // _di_fll_fss_status_string_ +/** + * The fll_fss_status_*_s strings. + */ +#ifndef _di_fll_fss_status_s_ + #define FLL_fss_status_accepted_invalid_s "F_fss_accepted_invalid" + #define FLL_fss_status_accepted_invalid_eos_s "F_fss_accepted_invalid_eos" + + #define FLL_fss_status_code_first_s "F_fss_status_code_first" + #define FLL_fss_status_code_last_s "F_fss_status_code_last" + + #define FLL_fss_status_format_s "F_fss_format" + #define FLL_fss_status_format_eos_s "F_fss_format_eos" + + #define FLL_fss_status_found_comment_s "F_fss_found_comment" + #define FLL_fss_status_found_content_s "F_fss_found_content" + #define FLL_fss_status_found_content_not_s "F_fss_found_content_not" + #define FLL_fss_status_found_object_s "F_fss_found_object" + #define FLL_fss_status_found_object_content_not_s "F_fss_found_object_content_not" + #define FLL_fss_status_found_object_not_s "F_fss_found_object_not" + + #define FLL_fss_status_accepted_invalid_s_length 22 + #define FLL_fss_status_accepted_invalid_eos_s_length 26 + + #define FLL_fss_status_code_first_s_length 23 + #define FLL_fss_status_code_last_s_length 22 + + #define FLL_fss_status_format_s_length 12 + #define FLL_fss_status_format_eos_s_length 16 + + #define FLL_fss_status_found_comment_s_length 19 + #define FLL_fss_status_found_content_s_length 19 + #define FLL_fss_status_found_content_not_s_length 23 + #define FLL_fss_status_found_object_s_length 18 + #define FLL_fss_status_found_object_content_not_s_length 30 + #define FLL_fss_status_found_object_not_s_length 22 + + extern const f_string_static_t fll_fss_status_accepted_invalid_s; + extern const f_string_static_t fll_fss_status_accepted_invalid_eos_s; + + extern const f_string_static_t fll_fss_status_code_first_s; + extern const f_string_static_t fll_fss_status_code_last_s; + + extern const f_string_static_t fll_fss_status_format_s; + extern const f_string_static_t fll_fss_status_format_eos_s; + + extern const f_string_static_t fll_fss_status_found_comment_s; + extern const f_string_static_t fll_fss_status_found_content_s; + extern const f_string_static_t fll_fss_status_found_content_not_s; + extern const f_string_static_t fll_fss_status_found_object_s; + extern const f_string_static_t fll_fss_status_found_object_content_not_s; + extern const f_string_static_t fll_fss_status_found_object_not_s; +#endif // _di_fll_fss_status_s_ /** * Convert FSS status codes from their string equivalents to a status code. -- 1.8.3.1