diff options
author | Alexander Barkov <bar@mariadb.com> | 2021-11-24 15:11:49 +0400 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-10 15:03:47 +0200 |
commit | 0736c03d56f3ebcbac1f9fe2702bf2dcb0775c6d (patch) | |
tree | 6206e1518fa96d3470c5c74591aeae1f424c66db /strings/ctype-uca.h | |
parent | bb84f61a2608588cb0182cb48ecd80540cb0c2c3 (diff) | |
download | mariadb-git-0736c03d56f3ebcbac1f9fe2702bf2dcb0775c6d.tar.gz |
MDEV-27009 Add UCA-14.0.0 collations - Adding implicit weight handling for Unicode-14.0.0
1. Adding separate functions for different Unicode versions
- my_uca_520_implicit_weight_primary()
It calculates implicit weights according to the old algorithm
that we used to dump Unicode-5.2.0 weights.
- my_uca_1400_implicit_weight_primary()
It calculates implicit weights according to
https://unicode.org/reports/tr10/#Values_For_Base_Table
as of November 2021, Unicode version 14.0.0.
2. Adding the "@version" line recognition when dumping allkeys.txt.
Implicit weights are dumped according to @version.
3. Dumping the scanned version as a "#define"
4. Removing dumping MY_UCA_NPAGES, MY_UCA_NCHARS, MY_UCA_CMASK, MY_UCA_PSHIFT,
as they are defined in ctype-uca.c. Removing dumping of "main()", it's not
needed. The intent is to generate an *.h file which can be put directly
to the MariaDB source tree.
5. Adding a structure MY_DUCET. It now contains weights for single
characters and version related members. Later we'll add contractions
and logical positions in here.
Diffstat (limited to 'strings/ctype-uca.h')
-rw-r--r-- | strings/ctype-uca.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/strings/ctype-uca.h b/strings/ctype-uca.h index 01f655b06cb..d439b8c578c 100644 --- a/strings/ctype-uca.h +++ b/strings/ctype-uca.h @@ -17,6 +17,7 @@ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ +#define MY_UCA_VERSION_ID(x,y,z) ((uint) ((x) * 100 + (y) * 10 + (z))) /* Implicit weight handling is done according to @@ -105,6 +106,18 @@ my_uca_520_implicit_weight_primary(my_wc_t code) } +#include "ctype-uca1400.h" + + +static inline MY_UCA_IMPLICIT_WEIGHT +my_uca_implicit_weight_primary(uint version, my_wc_t code) +{ + return version >= 1400 ? + my_uca_1400_implicit_weight_primary(code) : + my_uca_520_implicit_weight_primary(code); +} + + static inline MY_UCA_IMPLICIT_WEIGHT my_uca_implicit_weight_secondary() { @@ -136,11 +149,11 @@ my_uca_implicit_weight_quaternary() static inline MY_UCA_IMPLICIT_WEIGHT -my_uca_520_implicit_weight_on_level(my_wc_t code, uint level) +my_uca_implicit_weight_on_level(uint version, my_wc_t code, uint level) { switch (level) { case 0: - return my_uca_520_implicit_weight_primary(code); + return my_uca_implicit_weight_primary(version, code); case 1: return my_uca_implicit_weight_secondary(); case 2: |