]> Kevux Git Server - fll/commitdiff
Update: byte_dump should utilize color2 functions and handle zero-width characters
authorKevin Day <thekevinday@gmail.com>
Fri, 24 Apr 2020 02:50:44 +0000 (21:50 -0500)
committerKevin Day <thekevinday@gmail.com>
Fri, 24 Apr 2020 02:50:44 +0000 (21:50 -0500)
level_3/byte_dump/c/private-byte_dump.c

index 59910ace80c27df57c043cb8a5e85676babe79fe..526430144f23e95b4e2a6529b1bab32aa458ffd1 100644 (file)
@@ -500,106 +500,106 @@ extern "C" {
       else if (output >= 0 && output <= 32 || output == 127) {
         if (data.presentation == byte_dump_presentation_normal) {
           if (output == 0) {
-            printf("%s", byte_dump_sequence_null);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_null);
           }
           else if (output == 1) {
-            printf("%s", byte_dump_sequence_start_of_header);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_start_of_header);
           }
           else if (output == 2) {
-            printf("%s", byte_dump_sequence_start_of_text);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_start_of_text);
           }
           else if (output == 3) {
-            printf("%s", byte_dump_sequence_end_of_text);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_end_of_text);
           }
           else if (output == 4) {
-            printf("%s", byte_dump_sequence_end_of_transmission);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_end_of_transmission);
           }
           else if (output == 5) {
-            printf("%s", byte_dump_sequence_end_of_enquiry);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_end_of_enquiry);
           }
           else if (output == 6) {
-            printf("%s", byte_dump_sequence_acknowledge);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_acknowledge);
           }
           else if (output == 7) {
-            printf("%s", byte_dump_sequence_bell);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_bell);
           }
           else if (output == 8) {
-            printf("%s", byte_dump_sequence_backspace);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_backspace);
           }
           else if (output == 9) {
-            printf("%s", byte_dump_sequence_tab);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_tab);
           }
           else if (output == 10) {
-            printf("%s", byte_dump_sequence_new_line);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_new_line);
           }
           else if (output == 11) {
-            printf("%s", byte_dump_sequence_tab_vertical);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_tab_vertical);
           }
           else if (output == 12) {
-            printf("%s", byte_dump_sequence_form_feed);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_form_feed);
           }
           else if (output == 13) {
-            printf("%s", byte_dump_sequence_carriage_return);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_carriage_return);
           }
           else if (output == 14) {
-            printf("%s", byte_dump_sequence_shift_out);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_shift_out);
           }
           else if (output == 15) {
-            printf("%s", byte_dump_sequence_shift_in);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_shift_in);
           }
           else if (output == 16) {
-            printf("%s", byte_dump_sequence_data_link_escape);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_data_link_escape);
           }
           else if (output == 17) {
-            printf("%s", byte_dump_sequence_device_control_1);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_device_control_1);
           }
           else if (output == 18) {
-            printf("%s", byte_dump_sequence_device_control_2);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_device_control_2);
           }
           else if (output == 19) {
-            printf("%s", byte_dump_sequence_device_control_3);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_device_control_3);
           }
           else if (output == 20) {
-            printf("%s", byte_dump_sequence_device_control_4);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_device_control_4);
           }
           else if (output == 21) {
-            printf("%s", byte_dump_sequence_negative_acknowledge);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_negative_acknowledge);
           }
           else if (output == 22) {
-            printf("%s", byte_dump_sequence_synchronous_idle);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_synchronous_idle);
           }
           else if (output == 23) {
-            printf("%s", byte_dump_sequence_end_of_transmission_block);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_end_of_transmission_block);
           }
           else if (output == 24) {
-            printf("%s", byte_dump_sequence_cancel);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_cancel);
           }
           else if (output == 25) {
-            printf("%s", byte_dump_sequence_end_of_medium);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_end_of_medium);
           }
           else if (output == 26) {
-            printf("%s", byte_dump_sequence_substitute);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_substitute);
           }
           else if (output == 27) {
-            printf("%s", byte_dump_sequence_escape);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_escape);
           }
           else if (output == 28) {
-            printf("%s", byte_dump_sequence_file_separator);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_file_separator);
           }
           else if (output == 29) {
-            printf("%s", byte_dump_sequence_group_separator);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_group_separator);
           }
           else if (output == 30) {
-            printf("%s", byte_dump_sequence_record_separator);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_record_separator);
           }
           else if (output == 31) {
-            printf("%s", byte_dump_sequence_unit_separator);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_unit_separator);
           }
           else if (output == 32) {
-            printf("%s", byte_dump_sequence_space);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_space);
           }
           else if (output == 127) {
-            printf("%s", byte_dump_sequence_delete);
+            fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_delete);
           }
         }
         else if (data.presentation == byte_dump_presentation_simple) {
@@ -610,12 +610,23 @@ extern "C" {
         }
       }
       else if (f_utf_character_is_whitespace(characters.string[i]) == f_true) {
-        printf("%s", byte_dump_sequence_space);
+        fl_color_print2(f_standard_output, data.context.notable, data.context.warning, data.context.reset, "%s", byte_dump_sequence_space);
+      }
+      else if (f_utf_character_is_zero_width(characters.string[i]) == f_true) {
+        if (data.presentation == byte_dump_presentation_classic) {
+          printf(".");
+        }
+        else if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) {
+          fl_color_print(f_standard_output, data.context.warning, data.context.reset, "%s", byte_dump_character_placeholder);
+        }
+        else {
+          printf(" ");
+        }
       }
       else if (f_utf_character_is_control(characters.string[i]) == f_true) {
         // print a space (or '.') for control characters.
         if (data.presentation == byte_dump_presentation_classic) {
-          printf(".");
+          fl_color_print(f_standard_output, data.context.warning, data.context.reset, ".");
         }
         else {
           printf(" ");