From: Kevin Day Date: Thu, 17 Aug 2023 23:44:27 +0000 (-0500) Subject: Update: Use F_okay instead of F_none as the first status code. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=57f6b32000ecd40ab4b1a101a5c4def6c2243190;p=fll Update: Use F_okay instead of F_none as the first status code. This change is in two parts. This part is just changing the status codes. The next part will be changing all code using the status code F_none as the standard return to instead use F_okay. I believe that F_okay makes more semantic sense than F_none when providing a standard code. The original idea of F_none is that there are no errors. I think "okay" is even more accurate. Furthermore, the F_okay better matches the return code of the HTTP standard "HTTP 200 Okay". --- diff --git a/level_0/f_execute/c/execute.c b/level_0/f_execute/c/execute.c index c63bbc2..d497880 100644 --- a/level_0/f_execute/c/execute.c +++ b/level_0/f_execute/c/execute.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_f_execute_status_from_status_ uint8_t f_execute_status_from_status(f_status_t status) { - if (F_status_set_fine(status) == F_none) return F_execute_none; + if (F_status_set_fine(status) == F_okay) return F_execute_okay; if (F_status_set_fine(status) == F_access) return F_execute_access; if (F_status_set_fine(status) == F_buffer) return F_execute_buffer; if (F_status_set_fine(status) == F_busy) return F_execute_busy; @@ -117,7 +117,7 @@ extern "C" { #ifndef _di_f_execute_status_to_status_ f_status_t f_execute_status_to_status(uint8_t status) { - if (status == F_execute_none) return F_none; + if (status == F_execute_okay) return F_okay; if (status == F_execute_access) return F_access; if (status == F_execute_bad) return F_execute_not; if (status == F_execute_buffer) return F_buffer; diff --git a/level_0/f_execute/c/execute/common.h b/level_0/f_execute/c/execute/common.h index 4fa42f2..90fe40e 100644 --- a/level_0/f_execute/c/execute/common.h +++ b/level_0/f_execute/c/execute/common.h @@ -41,7 +41,7 @@ extern "C" { */ #ifndef _di_f_execute_e_ enum { - F_execute_none = 0, + F_execute_okay = 0, F_execute_failure, F_execute_parameter, F_execute_access, diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index d3809b1..a3a0c76 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -124,7 +124,7 @@ extern "C" { * 1) F_false, must always evaluate to 0. * 2) F_true, must always evaluate to 1 and will conflict with F_signal_hangup. * 3) All f_signal_*, these numbers must map directly to the standard signal codes. - * 4) F_none, this is intended to be the default return code and the return code representing the standard start code. + * 4) F_okay, this is intended to be the default return code and the return code representing the standard start code. * 5) F_status_code_last, this is intended to designate the last code provided by level_0 status project. * All code sets started by another project (such as FSS status codes) must start at this number + 1 with a code start map. */ @@ -202,7 +202,8 @@ extern "C" { // Basic. // Start at 197 to allow compatibility with the reserved bash return codes (keep in mind fss return codes can be larger than 255). - F_none = 197, + F_okay = 197, + F_okay_not, F_abort, F_abort_not, F_absolute, @@ -211,6 +212,8 @@ extern "C" { F_address_not, F_again, F_again_not, + F_all, + F_all_not, F_ascii, F_ascii_not, F_atomic, @@ -378,10 +381,10 @@ extern "C" { F_nice_not, F_no, F_no_not, + F_none, + F_none_not, F_object, F_object_not, - F_okay, - F_okay_not, F_once, F_once_not, F_option, @@ -457,6 +460,8 @@ extern "C" { F_size_not, F_skip, F_skip_not, + F_some, + F_some_not, F_space, F_space_not, F_start, diff --git a/level_0/f_status_string/c/status_string.c b/level_0/f_status_string/c/status_string.c index f791ed0..7f26946 100644 --- a/level_0/f_status_string/c/status_string.c +++ b/level_0/f_status_string/c/status_string.c @@ -77,7 +77,8 @@ extern "C" { const f_string_static_t f_status_signal_reserved_64_s = macro_f_string_static_t_initialize_1(F_status_signal_reserved_64_s, 0, F_status_signal_reserved_64_s_length); // Basic. - const f_string_static_t f_status_none_s = macro_f_string_static_t_initialize_1(F_status_none_s, 0, F_status_none_s_length); + const f_string_static_t f_status_okay_s = macro_f_string_static_t_initialize_1(F_status_okay_s, 0, F_status_okay_s_length); + const f_string_static_t f_status_okay_not_s = macro_f_string_static_t_initialize_1(F_status_okay_not_s, 0, F_status_okay_not_s_length); const f_string_static_t f_status_abort_s = macro_f_string_static_t_initialize_1(F_status_abort_s, 0, F_status_abort_s_length); const f_string_static_t f_status_abort_not_s = macro_f_string_static_t_initialize_1(F_status_abort_not_s, 0, F_status_abort_not_s_length); const f_string_static_t f_status_absolute_s = macro_f_string_static_t_initialize_1(F_status_absolute_s, 0, F_status_absolute_s_length); @@ -86,6 +87,8 @@ extern "C" { const f_string_static_t f_status_address_not_s = macro_f_string_static_t_initialize_1(F_status_address_not_s, 0, F_status_address_not_s_length); const f_string_static_t f_status_again_s = macro_f_string_static_t_initialize_1(F_status_again_s, 0, F_status_again_s_length); const f_string_static_t f_status_again_not_s = macro_f_string_static_t_initialize_1(F_status_again_not_s, 0, F_status_again_not_s_length); + const f_string_static_t f_status_all_s = macro_f_string_static_t_initialize_1(F_status_all_s, 0, F_status_all_s_length); + const f_string_static_t f_status_all_not_s = macro_f_string_static_t_initialize_1(F_status_all_not_s, 0, F_status_all_not_s_length); const f_string_static_t f_status_ascii_s = macro_f_string_static_t_initialize_1(F_status_ascii_s, 0, F_status_ascii_s_length); const f_string_static_t f_status_ascii_not_s = macro_f_string_static_t_initialize_1(F_status_ascii_not_s, 0, F_status_ascii_not_s_length); const f_string_static_t f_status_atomic_s = macro_f_string_static_t_initialize_1(F_status_atomic_s, 0, F_status_atomic_s_length); @@ -253,10 +256,10 @@ extern "C" { const f_string_static_t f_status_nice_not_s = macro_f_string_static_t_initialize_1(F_status_nice_not_s, 0, F_status_nice_not_s_length); const f_string_static_t f_status_no_s = macro_f_string_static_t_initialize_1(F_status_no_s, 0, F_status_no_s_length); const f_string_static_t f_status_no_not_s = macro_f_string_static_t_initialize_1(F_status_no_not_s, 0, F_status_no_not_s_length); + const f_string_static_t f_status_none_s = macro_f_string_static_t_initialize_1(F_status_none_s, 0, F_status_none_s_length); + const f_string_static_t f_status_none_not_s = macro_f_string_static_t_initialize_1(F_status_none_not_s, 0, F_status_none_not_s_length); const f_string_static_t f_status_object_s = macro_f_string_static_t_initialize_1(F_status_object_s, 0, F_status_object_s_length); const f_string_static_t f_status_object_not_s = macro_f_string_static_t_initialize_1(F_status_object_not_s, 0, F_status_object_not_s_length); - const f_string_static_t f_status_okay_s = macro_f_string_static_t_initialize_1(F_status_okay_s, 0, F_status_okay_s_length); - const f_string_static_t f_status_okay_not_s = macro_f_string_static_t_initialize_1(F_status_okay_not_s, 0, F_status_okay_not_s_length); const f_string_static_t f_status_once_s = macro_f_string_static_t_initialize_1(F_status_once_s, 0, F_status_once_s_length); const f_string_static_t f_status_once_not_s = macro_f_string_static_t_initialize_1(F_status_once_not_s, 0, F_status_once_not_s_length); const f_string_static_t f_status_option_s = macro_f_string_static_t_initialize_1(F_status_option_s, 0, F_status_option_s_length); @@ -332,6 +335,8 @@ extern "C" { const f_string_static_t f_status_signal_not_s = macro_f_string_static_t_initialize_1(F_status_signal_not_s, 0, F_status_signal_not_s_length); const f_string_static_t f_status_skip_s = macro_f_string_static_t_initialize_1(F_status_skip_s, 0, F_status_skip_s_length); const f_string_static_t f_status_skip_not_s = macro_f_string_static_t_initialize_1(F_status_skip_not_s, 0, F_status_skip_not_s_length); + const f_string_static_t f_status_some_s = macro_f_string_static_t_initialize_1(F_status_some_s, 0, F_status_some_s_length); + const f_string_static_t f_status_some_not_s = macro_f_string_static_t_initialize_1(F_status_some_not_s, 0, F_status_some_not_s_length); const f_string_static_t f_status_space_s = macro_f_string_static_t_initialize_1(F_status_space_s, 0, F_status_space_s_length); const f_string_static_t f_status_space_not_s = macro_f_string_static_t_initialize_1(F_status_space_not_s, 0, F_status_space_not_s_length); const f_string_static_t f_status_start_s = macro_f_string_static_t_initialize_1(F_status_start_s, 0, F_status_start_s_length); @@ -496,7 +501,6 @@ extern "C" { const f_string_static_t f_status_none_eof_s = macro_f_string_static_t_initialize_1(F_status_none_eof_s, 0, F_status_none_eof_s_length); const f_string_static_t f_status_none_eol_s = macro_f_string_static_t_initialize_1(F_status_none_eol_s, 0, F_status_none_eol_s_length); const f_string_static_t f_status_none_eos_s = macro_f_string_static_t_initialize_1(F_status_none_eos_s, 0, F_status_none_eos_s_length); - const f_string_static_t f_status_none_not_s = macro_f_string_static_t_initialize_1(F_status_none_not_s, 0, F_status_none_not_s_length); const f_string_static_t f_status_none_start_s = macro_f_string_static_t_initialize_1(F_status_none_start_s, 0, F_status_none_start_s_length); const f_string_static_t f_status_none_stop_s = macro_f_string_static_t_initialize_1(F_status_none_stop_s, 0, F_status_none_stop_s_length); const f_string_static_t f_status_data_s = macro_f_string_static_t_initialize_1(F_status_data_s, 0, F_status_data_s_length); @@ -1003,8 +1007,13 @@ extern "C" { break; // Basic. - case F_none: - *name = f_status_none_s; + case F_okay: + *name = f_status_okay_s; + + break; + + case F_okay_not: + *name = f_status_okay_not_s; break; @@ -1048,6 +1057,16 @@ extern "C" { break; + case F_all: + *name = f_status_all_s; + + break; + + case F_all_not: + *name = f_status_all_not_s; + + break; + case F_ascii: *name = f_status_ascii_s; @@ -1873,23 +1892,23 @@ extern "C" { break; - case F_object: - *name = f_status_object_s; + case F_none: + *name = f_status_none_s; break; - case F_object_not: - *name = f_status_object_not_s; + case F_none_not: + *name = f_status_none_not_s; break; - case F_okay: - *name = f_status_okay_s; + case F_object: + *name = f_status_object_s; break; - case F_okay_not: - *name = f_status_okay_not_s; + case F_object_not: + *name = f_status_object_not_s; break; @@ -2268,6 +2287,16 @@ extern "C" { break; + case F_some: + *name = f_status_some_s; + + break; + + case F_some_not: + *name = f_status_some_not_s; + + break; + case F_space: *name = f_status_space_s; diff --git a/level_0/f_status_string/c/status_string.h b/level_0/f_status_string/c/status_string.h index ed3c7c8..0d4bd77 100644 --- a/level_0/f_status_string/c/status_string.h +++ b/level_0/f_status_string/c/status_string.h @@ -230,7 +230,8 @@ extern "C" { extern const f_string_static_t f_status_signal_reserved_64_s; // Basic. - #define F_status_none_s "F_none" + #define F_status_okay_s "F_okay" + #define F_status_okay_not_s "F_okay_not" #define F_status_abort_s "F_abort" #define F_status_abort_not_s "F_abort_not" #define F_status_absolute_s "F_absolute" @@ -239,6 +240,8 @@ extern "C" { #define F_status_address_not_s "F_address_not" #define F_status_again_s "F_again" #define F_status_again_not_s "F_again_not" + #define F_status_all_s "F_all" + #define F_status_all_not_s "F_all_not" #define F_status_ascii_s "F_ascii" #define F_status_ascii_not_s "F_ascii_not" #define F_status_atomic_s "F_atomic" @@ -406,10 +409,10 @@ extern "C" { #define F_status_nice_not_s "F_nice_not" #define F_status_no_s "F_no" #define F_status_no_not_s "F_no_not" + #define F_status_none_s "F_none" + #define F_status_none_not_s "F_none_not" #define F_status_object_s "F_object" #define F_status_object_not_s "F_object_not" - #define F_status_okay_s "F_okay" - #define F_status_okay_not_s "F_okay_not" #define F_status_once_s "F_once" #define F_status_once_not_s "F_once_not" #define F_status_option_s "F_option" @@ -485,6 +488,8 @@ extern "C" { #define F_status_signal_not_s "F_signal_not" #define F_status_skip_s "F_skip" #define F_status_skip_not_s "F_skip_not" + #define F_status_some_s "F_some" + #define F_status_some_not_s "F_some_not" #define F_status_space_s "F_space" #define F_status_space_not_s "F_space_not" #define F_status_start_s "F_start" @@ -544,7 +549,8 @@ extern "C" { #define F_status_yes_s "F_yes" #define F_status_yes_not_s "F_yes_not" - #define F_status_none_s_length 6 + #define F_status_okay_s_length 6 + #define F_status_okay_not_s_length 10 #define F_status_abort_s_length 7 #define F_status_abort_not_s_length 11 #define F_status_absolute_s_length 10 @@ -553,6 +559,8 @@ extern "C" { #define F_status_address_not_s_length 13 #define F_status_again_s_length 7 #define F_status_again_not_s_length 11 + #define F_status_all_s_length 5 + #define F_status_all_not_s_length 9 #define F_status_ascii_s_length 7 #define F_status_ascii_not_s_length 11 #define F_status_atomic_s_length 8 @@ -720,10 +728,10 @@ extern "C" { #define F_status_nice_not_s_length 10 #define F_status_no_s_length 4 #define F_status_no_not_s_length 8 + #define F_status_none_s_length 6 + #define F_status_none_not_s_length 10 #define F_status_object_s_length 8 #define F_status_object_not_s_length 12 - #define F_status_okay_s_length 6 - #define F_status_okay_not_s_length 10 #define F_status_once_s_length 6 #define F_status_once_not_s_length 10 #define F_status_option_s_length 8 @@ -799,6 +807,8 @@ extern "C" { #define F_status_signal_not_s_length 12 #define F_status_skip_s_length 6 #define F_status_skip_not_s_length 10 + #define F_status_some_s_length 6 + #define F_status_some_not_s_length 10 #define F_status_space_s_length 7 #define F_status_space_not_s_length 11 #define F_status_start_s_length 7 @@ -858,7 +868,8 @@ extern "C" { #define F_status_yes_s_length 5 #define F_status_yes_not_s_length 9 - extern const f_string_static_t f_status_none_s; + extern const f_string_static_t f_status_okay_s; + extern const f_string_static_t f_status_okay_not_s; extern const f_string_static_t f_status_abort_s; extern const f_string_static_t f_status_abort_not_s; extern const f_string_static_t f_status_absolute_s; @@ -867,6 +878,8 @@ extern "C" { extern const f_string_static_t f_status_address_not_s; extern const f_string_static_t f_status_again_s; extern const f_string_static_t f_status_again_not_s; + extern const f_string_static_t f_status_all_s; + extern const f_string_static_t f_status_all_not_s; extern const f_string_static_t f_status_ascii_s; extern const f_string_static_t f_status_ascii_not_s; extern const f_string_static_t f_status_atomic_s; @@ -1036,10 +1049,10 @@ extern "C" { extern const f_string_static_t f_status_nice_not_s; extern const f_string_static_t f_status_no_s; extern const f_string_static_t f_status_no_not_s; + extern const f_string_static_t f_status_none_s; + extern const f_string_static_t f_status_none_not_s; extern const f_string_static_t f_status_object_s; extern const f_string_static_t f_status_object_not_s; - extern const f_string_static_t f_status_okay_s; - extern const f_string_static_t f_status_okay_not_s; extern const f_string_static_t f_status_once_s; extern const f_string_static_t f_status_once_not_s; extern const f_string_static_t f_status_option_s; @@ -1115,6 +1128,8 @@ extern "C" { extern const f_string_static_t f_status_signal_not_s; extern const f_string_static_t f_status_skip_s; extern const f_string_static_t f_status_skip_not_s; + extern const f_string_static_t f_status_some_s; + extern const f_string_static_t f_status_some_not_s; extern const f_string_static_t f_status_space_s; extern const f_string_static_t f_status_space_not_s; extern const f_string_static_t f_status_start_s; @@ -1437,7 +1452,6 @@ extern "C" { #define F_status_none_eof_s "F_none_eof" #define F_status_none_eol_s "F_none_eol" #define F_status_none_eos_s "F_none_eos" - #define F_status_none_not_s "F_none_not" #define F_status_none_start_s "F_none_start" #define F_status_none_stop_s "F_none_stop" #define F_status_data_s "F_data" @@ -1469,7 +1483,6 @@ extern "C" { #define F_status_none_eof_s_length 10 #define F_status_none_eol_s_length 10 #define F_status_none_eos_s_length 10 - #define F_status_none_not_s_length 10 #define F_status_none_start_s_length 12 #define F_status_none_stop_s_length 11 #define F_status_data_s_length 6 @@ -1501,7 +1514,6 @@ extern "C" { extern const f_string_static_t f_status_none_eof_s; extern const f_string_static_t f_status_none_eol_s; extern const f_string_static_t f_status_none_eos_s; - extern const f_string_static_t f_status_none_not_s; extern const f_string_static_t f_status_none_start_s; extern const f_string_static_t f_status_none_stop_s; extern const f_string_static_t f_status_data_s; diff --git a/level_0/f_status_string/tests/unit/c/test-status_string-to.c b/level_0/f_status_string/tests/unit/c/test-status_string-to.c index 9ea094a..b1785c5 100644 --- a/level_0/f_status_string/tests/unit/c/test-status_string-to.c +++ b/level_0/f_status_string/tests/unit/c/test-status_string-to.c @@ -96,7 +96,8 @@ void test__f_status_string_to__works(void **state) { F_signal_reserved_62, F_signal_reserved_63, F_signal_reserved_64, - F_none, + F_okay, + F_okay_not, F_abort, F_abort_not, F_absolute, @@ -105,6 +106,8 @@ void test__f_status_string_to__works(void **state) { F_address_not, F_again, F_again_not, + F_all, + F_all_not, F_ascii, F_ascii_not, F_atomic, @@ -272,10 +275,10 @@ void test__f_status_string_to__works(void **state) { F_nice_not, F_no, F_no_not, + F_none, + F_none_not, F_object, F_object_not, - F_okay, - F_okay_not, F_once, F_once_not, F_option, @@ -351,6 +354,8 @@ void test__f_status_string_to__works(void **state) { F_size_not, F_skip, F_skip_not, + F_some, + F_some_not, F_space, F_space_not, F_start, @@ -654,7 +659,7 @@ void test__f_status_string_to__works(void **state) { const f_string_static_t status_strings[] = { f_status_false_s, f_status_true_s, - f_status_true_s, // This is F_signal_hangup, but it overlaps and falls back to F_true. + f_status_signal_hangup_s, f_status_signal_interrupt_s, f_status_signal_quit_s, f_status_signal_illegal_s, @@ -718,7 +723,8 @@ void test__f_status_string_to__works(void **state) { f_status_signal_reserved_62_s, f_status_signal_reserved_63_s, f_status_signal_reserved_64_s, - f_status_none_s, + f_status_okay_s, + f_status_okay_not_s, f_status_abort_s, f_status_abort_not_s, f_status_absolute_s, @@ -727,6 +733,8 @@ void test__f_status_string_to__works(void **state) { f_status_address_not_s, f_status_again_s, f_status_again_not_s, + f_status_all_s, + f_status_all_not_s, f_status_ascii_s, f_status_ascii_not_s, f_status_atomic_s, @@ -894,10 +902,10 @@ void test__f_status_string_to__works(void **state) { f_status_nice_not_s, f_status_no_s, f_status_no_not_s, + f_status_none_s, + f_status_none_not_s, f_status_object_s, f_status_object_not_s, - f_status_okay_s, - f_status_okay_not_s, f_status_once_s, f_status_once_not_s, f_status_option_s, @@ -973,6 +981,8 @@ void test__f_status_string_to__works(void **state) { f_status_size_not_s, f_status_skip_s, f_status_skip_not_s, + f_status_some_s, + f_status_some_not_s, f_status_space_s, f_status_space_not_s, f_status_start_s, @@ -1273,7 +1283,7 @@ void test__f_status_string_to__works(void **state) { f_status_status_code_last_s, }; - for (uint16_t i = 0; i < 619; ++i) { + for (uint16_t i = 0; i < 624; ++i) { f_string_static_t result = f_string_static_t_initialize;