]> Kevux Git Server - fll/commitdiff
Update: Add F_status status type and rename F_status_size_max_with_signal to F_status...
authorKevin Day <thekevinday@gmail.com>
Tue, 15 Mar 2022 04:38:07 +0000 (23:38 -0500)
committerKevin Day <thekevinday@gmail.com>
Tue, 15 Mar 2022 04:38:07 +0000 (23:38 -0500)
The max size for what is now called F_status_size_max_with_bits_d is (2^16)-1 and not 2^16.

level_0/f_status/c/status.h
level_0/f_status_string/c/status_string.c
level_0/f_status_string/c/status_string.h
level_2/fll_status_string/c/status_string.c
level_3/fss_status_code/c/private-fss_status_code.c
level_3/status_code/c/private-status_code.c

index 624ea638db04b18a69f477c7809fdbf9702bfd5a..9feaaa562148865cb20b461f7a4a3c8737c617f4 100644 (file)
@@ -36,16 +36,22 @@ extern "C" {
 
 /**
  * Status masks.
+ *
+ * The f_status_t is required to be exactly 16 bits, the first two high order bits represent error and warning respectively.
+ *
+ * The F_status_set_fine() is provided to remove the error, warning, and signal bits.
+ *
+ * F_status_size_*:
+ *   - max:           Maximum valid number representing a status code (without the error, signal, or warning bits).
+ *   - max_with_bits: Maximum valid number representing a status code including the error, signal, or warning bits.
  */
 #ifndef _di_f_status_masks_
-
-  // f_status_t is required to be exactly 16 bits, the first two high order bits represent error and warning respectively.
   #define F_status_bit_error   0x8000 // 1000 0000 0000 0000
   #define F_status_bit_signal  0xc000 // 1100 0000 0000 0000
   #define F_status_bit_warning 0x4000 // 0100 0000 0000 0000
 
-  #define F_status_mask_fine 0x3fff // 0011 1111 1111 1111
-  #define F_status_mask_code 0xc000 // 1100 0000 0000 0000
+  #define F_status_mask_fine 0x3fff   // 0011 1111 1111 1111
+  #define F_status_mask_code 0xc000   // 1100 0000 0000 0000
 
   #define F_status_is_error(status)   (status & F_status_bit_error)
   #define F_status_is_fine(status)    ((status & F_status_mask_code) == 0)
@@ -61,13 +67,10 @@ extern "C" {
   #define F_status_set_error(status)   (status | F_status_bit_error)
   #define F_status_set_signal(status)  (status | F_status_bit_signal)
   #define F_status_set_warning(status) (status | F_status_bit_warning)
+  #define F_status_set_fine(status)    (status & F_status_mask_fine)
 
-  // Use F_status_set_fine to remove the error, warning, and signal bits.
-  #define F_status_set_fine(status) (status & F_status_mask_fine)
-
-  // Maximum size of the status code.
-  #define F_status_size_max             0x3fff
-  #define F_status_size_max_with_signal 0x10000
+  #define F_status_size_max_d           0x3fff
+  #define F_status_size_max_with_bits_d 0xffff
 #endif // _di_f_status_masks_
 
 /**
@@ -365,6 +368,8 @@ extern "C" {
       F_space_not,
       F_start,
       F_start_not,
+      F_status,
+      F_status_not,
       F_stop,
       F_stop_not,
       F_stream,
index 752f9ea57b804c6be869fa617c012dd0bd409212..c13e30d3e249ee6cc5d460e9e5d35e98f0307659 100644 (file)
@@ -283,6 +283,8 @@ extern "C" {
     const f_string_static_t f_status_space_not_s = macro_f_string_static_t_initialize(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(F_status_start_s, 0, F_status_start_s_length);
     const f_string_static_t f_status_start_not_s = macro_f_string_static_t_initialize(F_status_start_not_s, 0, F_status_start_not_s_length);
+    const f_string_static_t f_status_status_s = macro_f_string_static_t_initialize(F_status_status_s, 0, F_status_status_s_length);
+    const f_string_static_t f_status_status_not_s = macro_f_string_static_t_initialize(F_status_status_not_s, 0, F_status_status_not_s_length);
     const f_string_static_t f_status_stop_s = macro_f_string_static_t_initialize(F_status_stop_s, 0, F_status_stop_s_length);
     const f_string_static_t f_status_stop_not_s = macro_f_string_static_t_initialize(F_status_stop_not_s, 0, F_status_stop_not_s_length);
     const f_string_static_t f_status_stream_s = macro_f_string_static_t_initialize(F_status_stream_s, 0, F_status_stream_s_length);
@@ -1682,6 +1684,14 @@ extern "C" {
           *name = f_status_start_not_s;
           break;
 
+        case F_status:
+          *name = f_status_status_s;
+          break;
+
+        case F_status_not:
+          *name = f_status_status_not_s;
+          break;
+
         case F_stop:
           *name = f_status_stop_s;
           break;
index caaa5bd87b5c235809c6cf1bf36ee9a23051d0f1..b5bb4226f81b8d22397c8120be5b5d03bf5cd6e9 100644 (file)
@@ -436,6 +436,8 @@ extern "C" {
     #define F_status_space_not_s         "F_space_not"
     #define F_status_start_s             "F_start"
     #define F_status_start_not_s         "F_start_not"
+    #define F_status_status_s            "F_status"
+    #define F_status_status_not_s        "F_status_not"
     #define F_status_stop_s              "F_stop"
     #define F_status_stop_not_s          "F_stop_not"
     #define F_status_stream_s            "F_stream"
@@ -684,6 +686,8 @@ extern "C" {
     #define F_status_space_not_s_length         11
     #define F_status_start_s_length             7
     #define F_status_start_not_s_length         11
+    #define F_status_status_s_length            8
+    #define F_status_status_not_s_length        12
     #define F_status_stop_s_length              6
     #define F_status_stop_not_s_length          10
     #define F_status_stream_s_length            8
@@ -932,6 +936,8 @@ extern "C" {
     extern const f_string_static_t f_status_space_not_s;
     extern const f_string_static_t f_status_start_s;
     extern const f_string_static_t f_status_start_not_s;
+    extern const f_string_static_t f_status_status_s;
+    extern const f_string_static_t f_status_status_not_s;
     extern const f_string_static_t f_status_stop_s;
     extern const f_string_static_t f_status_stop_not_s;
     extern const f_string_static_t f_status_stream_s;
index 21c24749142da22ee8d94923cbbf4d8ac265c4b5..bfce30182eae9f72f6584cb6ad06e422c42e7238 100644 (file)
@@ -1656,6 +1656,18 @@ extern "C" {
         return F_none;
       }
 
+      if (fl_string_dynamic_compare(name, f_status_status_s) == F_equal_to) {
+        *code = F_status;
+
+        return F_none;
+      }
+
+      if (fl_string_dynamic_compare(name, f_status_status_not_s) == F_equal_to) {
+        *code = F_status_not;
+
+        return F_none;
+      }
+
       if (fl_string_dynamic_compare(name, f_status_stop_s) == F_equal_to) {
         *code = F_stop;
 
index 8df8ea1e646d53c9b05d01b8c959f7febd37cd00..1000f1692eec38eba2bcf8963f96f6c63c89981c 100644 (file)
@@ -141,7 +141,7 @@ extern "C" {
 
     f_status_t status = fl_conversion_dynamic_to_number_unsigned(value, number);
 
-    if (*number > F_status_size_max_with_signal) {
+    if (*number > F_status_size_max_with_bits_d) {
       fl_print_format("%[out of range%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
 
       return status;
index 0550667b0cdf09c5d780f6a220882d1288b7c8ec..15e12292ccf56894eff58dc3480963df2b6a6d92 100644 (file)
@@ -133,7 +133,7 @@ extern "C" {
 
     f_status_t status = fl_conversion_dynamic_to_number_unsigned(value, number);
 
-    if (*number > F_status_size_max_with_signal) {
+    if (*number > F_status_size_max_with_bits_d) {
       fl_print_format("%[out of range%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
 
       return status;