]> git.kaiwu.me - quickjs.git/commitdiff
libunicode: added lre_is_soft_dotted() and exported unicode_get_cc()
authorFabrice Bellard <fabrice@bellard.org>
Sat, 10 Oct 2026 14:13:11 +0000 (16:13 +0200)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 10 Oct 2026 14:13:11 +0000 (16:13 +0200)
libunicode-table.h
libunicode.c
libunicode.h
unicode_gen.c

index 85956edc14de1a2192f79e5223875d323142c8db..bda11f5f6f7268efe7cbff8322cc59ec12ae65de 100644 (file)
@@ -632,6 +632,25 @@ static const uint8_t unicode_prop_ID_Continue1_index[66] = {
     0xf0, 0x01, 0x0e,  //  E01F0 at 704 (upper bound)
 };
 
+static const uint8_t unicode_prop_Soft_Dotted_table[79] = {
+    0xe8, 0x81, 0x40, 0xc3, 0x80, 0x41, 0x18, 0x80,
+    0x9d, 0x80, 0xb3, 0x80, 0x93, 0x80, 0x41, 0x3f,
+    0x80, 0xe1, 0x00, 0x80, 0x59, 0x08, 0x80, 0xb2,
+    0x80, 0x8c, 0x02, 0x80, 0x40, 0x83, 0x80, 0x40,
+    0x9c, 0x80, 0x41, 0xa4, 0x80, 0x40, 0xd5, 0x81,
+    0x4b, 0x31, 0x80, 0x61, 0xa7, 0xa4, 0x81, 0xb1,
+    0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1,
+    0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1,
+    0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0x48,
+    0x85, 0x80, 0x41, 0x30, 0x81, 0x99, 0x80,
+};
+
+static const uint8_t unicode_prop_Soft_Dotted_index[9] = {
+    0xcc, 0x1e, 0x40,  //  01ECC at 34
+    0xf8, 0xd5, 0x21,  //  1D5F8 at 65
+    0x69, 0xe0, 0x01,  //  1E069 at 96 (upper bound)
+};
+
 #ifdef CONFIG_ALL_UNICODE
 
 static const uint8_t unicode_cc_table[937] = {
@@ -4391,19 +4410,6 @@ static const uint8_t unicode_prop_Sentence_Terminal_table[213] = {
     0x05, 0x80, 0x5d, 0xe7, 0x80,
 };
 
-static const uint8_t unicode_prop_Soft_Dotted_table[79] = {
-    0xe8, 0x81, 0x40, 0xc3, 0x80, 0x41, 0x18, 0x80,
-    0x9d, 0x80, 0xb3, 0x80, 0x93, 0x80, 0x41, 0x3f,
-    0x80, 0xe1, 0x00, 0x80, 0x59, 0x08, 0x80, 0xb2,
-    0x80, 0x8c, 0x02, 0x80, 0x40, 0x83, 0x80, 0x40,
-    0x9c, 0x80, 0x41, 0xa4, 0x80, 0x40, 0xd5, 0x81,
-    0x4b, 0x31, 0x80, 0x61, 0xa7, 0xa4, 0x81, 0xb1,
-    0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1,
-    0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1,
-    0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0x48,
-    0x85, 0x80, 0x41, 0x30, 0x81, 0x99, 0x80,
-};
-
 static const uint8_t unicode_prop_Terminal_Punctuation_table[264] = {
     0xa0, 0x80, 0x89, 0x00, 0x80, 0x8a, 0x0a, 0x80,
     0x43, 0x3d, 0x07, 0x80, 0x42, 0x00, 0x80, 0xb8,
@@ -5203,4 +5209,4 @@ static const uint8_t unicode_rgi_emoji_zwj_sequence[2392] = {
 };
 
 #endif /* CONFIG_ALL_UNICODE */
-/* 71 tables / 36659 bytes, 5 index / 357 bytes */
+/* 71 tables / 36659 bytes, 6 index / 366 bytes */
index 0b7b6d0b1f09a84f17d7fe18c3492c2d5318afb1..f3f75cc769fadf72901047d0acffc54446a16b27 100644 (file)
@@ -376,6 +376,13 @@ BOOL lre_is_case_ignorable(uint32_t c)
                            sizeof(unicode_prop_Case_Ignorable_index) / 3);
 }
 
+BOOL lre_is_soft_dotted(uint32_t c)
+{
+    return lre_is_in_table(c, unicode_prop_Soft_Dotted_table,
+                           unicode_prop_Soft_Dotted_index,
+                           sizeof(unicode_prop_Soft_Dotted_index) / 3);
+}
+
 /* character range */
 
 static __maybe_unused void cr_dump(CharRange *cr)
@@ -1030,7 +1037,7 @@ static int unicode_compose_pair(uint32_t c0, uint32_t c1)
 }
 
 /* return the combining class of character c (between 0 and 255) */
-static int unicode_get_cc(uint32_t c)
+int unicode_get_cc(uint32_t c)
 {
     uint32_t code, n, type, cc, c1, b;
     int pos;
index c2fdeac89e6b222aec2a4eaf8e62133b7b57e6b3..be2f3cc2f03cb48fc1e942f5094266f5a4d54cdd 100644 (file)
@@ -134,6 +134,8 @@ extern uint8_t const lre_ctype_bits[256];
 /* zero or non-zero return value */
 int lre_is_cased(uint32_t c);
 int lre_is_case_ignorable(uint32_t c);
+int lre_is_soft_dotted(uint32_t c);
+int unicode_get_cc(uint32_t c);
 int lre_is_id_start(uint32_t c);
 int lre_is_id_continue(uint32_t c);
 
index c793ba1e6935837fe9c282491eb4b1ad22a4bfda..f33cd056b4d1c8ef9674476d14c101c5eb9213ab 100644 (file)
@@ -1957,6 +1957,7 @@ void build_flags_tables(FILE *f)
     build_prop_table(f, "Case_Ignorable", PROP_Case_Ignorable, TRUE);
     build_prop_table(f, "ID_Start", PROP_ID_Start, TRUE);
     build_prop_table(f, "ID_Continue1", PROP_ID_Continue1, TRUE);
+    build_prop_table(f, "Soft_Dotted", PROP_Soft_Dotted, TRUE);
 }
 
 void dump_name_table(FILE *f, const char *cname, const char **tab_name, int len,
@@ -2211,7 +2212,8 @@ void build_prop_list_table(FILE *f)
     for(i = 0; i < PROP_TABLE_COUNT; i++) {
         if (i == PROP_ID_Start ||
             i == PROP_Case_Ignorable ||
-            i == PROP_ID_Continue1) {
+            i == PROP_ID_Continue1 ||
+            i == PROP_Soft_Dotted) {
             /* already generated */
         } else {
             build_prop_table(f, unicode_prop_name[i], i, FALSE);