]> Kevux Git Server - fll/commitdiff
Cleanup: Converted type is actually uint32_t rather than f_utf_char_t.
authorKevin Day <thekevinday@gmail.com>
Sun, 10 Jul 2022 22:26:42 +0000 (17:26 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 10 Jul 2022 22:29:02 +0000 (17:29 -0500)
The f_utf_char_t is supposed to be an uint32_t so this is not a problem.

The intent and design of this, however, is that f_utf_char_t is a special case representing the character as a string rather than as a digit.
The f_utf_char_t is stored as a 4-byte integer to store each byte representing a character.

The uint32_t is simply a straight up 4-byte integer.

This is the numeric value of the code point rather than the representation as a string.
This is an important semantic difference.

level_0/f_utf/c/utf/convert.c
level_0/f_utf/c/utf/convert.h
level_3/fake/c/private-make-operate_process.c
level_3/utf8/c/private-print.c
level_3/utf8/c/private-print.h
level_3/utf8/c/private-utf8_bytesequence.c
level_3/utf8/c/private-utf8_codepoint.c

index 6dff6c8..5940e7d 100644 (file)
@@ -304,7 +304,7 @@ extern "C" {
 #endif // _di_f_utf_unicode_to_
 
 #ifndef _di_f_utf_unicode_string_to_f_
-  f_status_t f_utf_unicode_string_to(const f_string_t string, const f_array_length_t length, f_utf_char_t *unicode) {
+  f_status_t f_utf_unicode_string_to(const f_string_t string, const f_array_length_t length, uint32_t *unicode) {
     #ifndef _di_level_0_parameter_checking_
       if (!unicode) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
@@ -337,7 +337,7 @@ extern "C" {
       return F_status_set_error(F_valid_not);
     }
 
-    f_utf_char_t value = 0;
+    uint32_t value = 0;
 
     for (; i < length; ++i) {
 
index db92062..ce51052 100644 (file)
@@ -222,7 +222,7 @@ extern "C" {
  *   F_valid_not (with error bit) if string is not a valid Unicode string.
  */
 #ifndef _di_f_utf_unicode_string_to_
-  extern f_status_t f_utf_unicode_string_to(const f_string_t string, const f_array_length_t length, f_utf_char_t *unicode);
+  extern f_status_t f_utf_unicode_string_to(const f_string_t string, const f_array_length_t length, uint32_t *unicode);
 #endif // _di_f_utf_unicode_string_to_
 
 #ifdef __cplusplus
index 13029ea..91cf46a 100644 (file)
@@ -549,7 +549,7 @@ extern "C" {
             } // for
 
             if (buffer.used > 2) {
-              f_utf_char_t codepoint = 0;
+              uint32_t codepoint = 0;
 
               status = f_utf_unicode_string_to(buffer.string, buffer.used, &codepoint);
 
index c816a07..395116d 100644 (file)
@@ -43,7 +43,7 @@ extern "C" {
 #endif // _di_utf8_print_character_invalid_
 
 #ifndef _di_utf8_print_codepoint_
-  void utf8_print_codepoint(utf8_data_t * const data, const f_utf_char_t codepoint) {
+  void utf8_print_codepoint(utf8_data_t * const data, const uint32_t codepoint) {
 
     if (codepoint < 0x10000) {
       fl_print_format("%rU+%04_U%r", data->file.stream, data->prepend, codepoint, data->append);
@@ -138,7 +138,7 @@ extern "C" {
 #endif // _di_utf8_print_error_decode_
 
 #ifndef _di_utf8_print_error_encode_
-  void utf8_print_error_encode(utf8_data_t * const data, const f_status_t status, const f_utf_char_t codepoint) {
+  void utf8_print_error_encode(utf8_data_t * const data, const f_status_t status, const uint32_t codepoint) {
 
     if (data->main->error.verbosity == f_console_verbosity_quiet_e) return;
 
index 34c5a9c..cb0247b 100644 (file)
@@ -50,7 +50,7 @@ extern "C" {
  *   This is the code that represents a single character.
  */
 #ifndef _di_utf8_print_codepoint_
-  extern void utf8_print_codepoint(utf8_data_t * const data, const f_utf_char_t codepoint) F_attribute_visibility_internal_d;
+  extern void utf8_print_codepoint(utf8_data_t * const data, const uint32_t codepoint) F_attribute_visibility_internal_d;
 #endif // _di_utf8_print_codepoint_
 
 /**
@@ -98,7 +98,7 @@ extern "C" {
  *   The codepoint that is invalid.
  */
 #ifndef _di_utf8_print_error_encode_
-  extern void utf8_print_error_encode(utf8_data_t * const data, const f_status_t status, const f_utf_char_t codepoint) F_attribute_visibility_internal_d;
+  extern void utf8_print_error_encode(utf8_data_t * const data, const f_status_t status, const uint32_t codepoint) F_attribute_visibility_internal_d;
 #endif // _di_utf8_print_error_encode_
 
 /**
index 0266d14..45c133d 100644 (file)
@@ -15,7 +15,7 @@ extern "C" {
     f_status_t status = F_none;
     bool valid_not = F_false;
 
-    f_utf_char_t codepoint = 0;
+    uint32_t codepoint = 0;
 
     if (sequence.used) {
       status = f_utf_unicode_to(sequence.string, sequence.used, &codepoint);
index 48adae3..f46d031 100644 (file)
@@ -27,7 +27,7 @@ extern "C" {
     }
 
     if (*mode == utf8_codepoint_mode_end_e) {
-      f_utf_char_t codepoint = 0;
+      uint32_t codepoint = 0;
 
       status = f_utf_unicode_string_to(data->text.string, data->text.used, &codepoint);