Skip to content

Commit

Permalink
module: unicode: rephrase u8_textprep_data.h tables in terms of U8_UN…
Browse files Browse the repository at this point in the history
…ICODE_LATEST+1 instead of fixed 2

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
  • Loading branch information
nabijaczleweli committed Oct 30, 2024
1 parent 6187b19 commit d799996
Showing 1 changed file with 34 additions and 22 deletions.
56 changes: 34 additions & 22 deletions include/sys/u8_textprep_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ typedef struct {
* The common b1_tbl for combining class, decompositions, tolower, and
* toupper case conversion mappings.
*/
static const uchar_t u8_common_b1_tbl[2][256] = {
static const uchar_t u8_common_b1_tbl[U8_UNICODE_LATEST + 1][256] = {
{
0, N_, N_, N_, N_, N_, N_, N_,
N_, N_, N_, N_, N_, N_, N_, N_,
Expand Down Expand Up @@ -217,7 +217,8 @@ static const uchar_t u8_common_b1_tbl[2][256] = {
},
};

static const uchar_t u8_combining_class_b2_tbl[2][2][256] = {
static const uchar_t u8_combining_class_b2_tbl[U8_UNICODE_LATEST + 1][2][256] =
{
{
{
0, N_, N_, N_, N_, N_, N_, N_,
Expand Down Expand Up @@ -363,7 +364,8 @@ static const uchar_t u8_combining_class_b2_tbl[2][2][256] = {

};

static const uchar_t u8_combining_class_b3_tbl[2][9][256] = {
static const uchar_t u8_combining_class_b3_tbl[U8_UNICODE_LATEST + 1][9][256] =
{
{
{ /* Third byte table 0. */
N_, N_, N_, N_, N_, N_, N_, N_,
Expand Down Expand Up @@ -986,7 +988,8 @@ static const uchar_t u8_combining_class_b3_tbl[2][9][256] = {
* Unlike other b4_tbl, the b4_tbl for combining class data has
* the combining class values not indices to the final tables.
*/
static const uchar_t u8_combining_class_b4_tbl[2][55][256] = {
static const uchar_t u8_combining_class_b4_tbl[U8_UNICODE_LATEST + 1][55][256] =
{
{
{ /* Fourth byte table 0. */
0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -4733,7 +4736,7 @@ static const uchar_t u8_combining_class_b4_tbl[2][55][256] = {
},
};

static const uchar_t u8_composition_b1_tbl[2][256] = {
static const uchar_t u8_composition_b1_tbl[U8_UNICODE_LATEST + 1][256] = {
{
0, N_, N_, N_, N_, N_, N_, N_,
N_, N_, N_, N_, N_, N_, N_, N_,
Expand Down Expand Up @@ -4804,7 +4807,7 @@ static const uchar_t u8_composition_b1_tbl[2][256] = {
},
};

static const uchar_t u8_composition_b2_tbl[2][1][256] = {
static const uchar_t u8_composition_b2_tbl[U8_UNICODE_LATEST + 1][1][256] = {
{
{
0, N_, N_, N_, N_, N_, N_, N_,
Expand Down Expand Up @@ -4882,7 +4885,9 @@ static const uchar_t u8_composition_b2_tbl[2][1][256] = {

};

static const u8_displacement_t u8_composition_b3_tbl[2][5][256] = {
static const u8_displacement_t u8_composition_b3_tbl[
U8_UNICODE_LATEST + 1][5][256] =
{
{
{ /* Third byte table 0. */
{ 0x8000, 0 }, { N_, 0 }, { N_, 0 },
Expand Down Expand Up @@ -5769,7 +5774,7 @@ static const u8_displacement_t u8_composition_b3_tbl[2][5][256] = {
},
};

static const uchar_t u8_composition_b4_tbl[2][41][257] = {
static const uchar_t u8_composition_b4_tbl[U8_UNICODE_LATEST + 1][41][257] = {
{
{ /* Fourth byte table 0. */
0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -8646,7 +8651,9 @@ static const uchar_t u8_composition_b4_tbl[2][41][257] = {
},
};

static const uint16_t u8_composition_b4_16bit_tbl[2][5][257] = {
static const uint16_t u8_composition_b4_16bit_tbl[
U8_UNICODE_LATEST + 1][5][257] =
{
{
{ /* Fourth byte 16-bit table 0. */
0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -9003,7 +9010,7 @@ static const uint16_t u8_composition_b4_16bit_tbl[2][5][257] = {
},
};

static const uchar_t u8_composition_final_tbl[2][6623] = {
static const uchar_t u8_composition_final_tbl[U8_UNICODE_LATEST + 1][6623] = {
{
0x01, 0xCC, 0xB8, FIL_, 0xE2, 0x89, 0xAE, FIL_,
0x01, 0xCC, 0xB8, FIL_, 0xE2, 0x89, 0xA0, FIL_,
Expand Down Expand Up @@ -10666,7 +10673,7 @@ static const uchar_t u8_composition_final_tbl[2][6623] = {
},
};

static const uchar_t u8_decomp_b2_tbl[2][2][256] = {
static const uchar_t u8_decomp_b2_tbl[U8_UNICODE_LATEST + 1][2][256] = {
{
{
0, N_, N_, N_, N_, N_, N_, N_,
Expand Down Expand Up @@ -10812,7 +10819,8 @@ static const uchar_t u8_decomp_b2_tbl[2][2][256] = {

};

static const u8_displacement_t u8_decomp_b3_tbl[2][8][256] = {
static const u8_displacement_t u8_decomp_b3_tbl[U8_UNICODE_LATEST + 1][8][256] =
{
{
{ /* Third byte table 0. */
{ N_, 0 }, { N_, 0 }, { N_, 0 },
Expand Down Expand Up @@ -12227,7 +12235,7 @@ static const u8_displacement_t u8_decomp_b3_tbl[2][8][256] = {
},
};

static const uchar_t u8_decomp_b4_tbl[2][118][257] = {
static const uchar_t u8_decomp_b4_tbl[U8_UNICODE_LATEST + 1][118][257] = {
{
{ /* Fourth byte table 0. */
0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -20494,7 +20502,7 @@ static const uchar_t u8_decomp_b4_tbl[2][118][257] = {
},
};

static const uint16_t u8_decomp_b4_16bit_tbl[2][30][257] = {
static const uint16_t u8_decomp_b4_16bit_tbl[U8_UNICODE_LATEST + 1][30][257] = {
{
{ /* Fourth byte 16-bit table 0. */
0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -22601,7 +22609,7 @@ static const uint16_t u8_decomp_b4_16bit_tbl[2][30][257] = {
},
};

static const uchar_t u8_decomp_final_tbl[2][19370] = {
static const uchar_t u8_decomp_final_tbl[U8_UNICODE_LATEST + 1][19370] = {
{
0x20, 0x20, 0xCC, 0x88, 0x61, 0x20, 0xCC, 0x84,
0x32, 0x33, 0x20, 0xCC, 0x81, 0xCE, 0xBC, 0x20,
Expand Down Expand Up @@ -27452,7 +27460,7 @@ static const uchar_t u8_decomp_final_tbl[2][19370] = {
},
};

static const uchar_t u8_case_common_b2_tbl[2][2][256] = {
static const uchar_t u8_case_common_b2_tbl[U8_UNICODE_LATEST + 1][2][256] = {
{
{
0, N_, N_, N_, N_, N_, N_, N_,
Expand Down Expand Up @@ -27598,7 +27606,9 @@ static const uchar_t u8_case_common_b2_tbl[2][2][256] = {

};

static const u8_displacement_t u8_tolower_b3_tbl[2][5][256] = {
static const u8_displacement_t u8_tolower_b3_tbl[
U8_UNICODE_LATEST + 1][5][256] =
{
{
{ /* Third byte table 0. */
{ N_, 0 }, { N_, 0 }, { N_, 0 }, { N_, 0 },
Expand Down Expand Up @@ -28265,7 +28275,7 @@ static const u8_displacement_t u8_tolower_b3_tbl[2][5][256] = {
},
};

static const uchar_t u8_tolower_b4_tbl[2][36][257] = {
static const uchar_t u8_tolower_b4_tbl[U8_UNICODE_LATEST + 1][36][257] = {
{
{ /* Fourth byte table 0. */
0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -30792,7 +30802,7 @@ static const uchar_t u8_tolower_b4_tbl[2][36][257] = {
},
};

static const uchar_t u8_tolower_final_tbl[2][2299] = {
static const uchar_t u8_tolower_final_tbl[U8_UNICODE_LATEST + 1][2299] = {
{
0xC3, 0xA0, 0xC3, 0xA1, 0xC3, 0xA2, 0xC3, 0xA3,
0xC3, 0xA4, 0xC3, 0xA5, 0xC3, 0xA6, 0xC3, 0xA7,
Expand Down Expand Up @@ -31375,7 +31385,9 @@ static const uchar_t u8_tolower_final_tbl[2][2299] = {
},
};

static const u8_displacement_t u8_toupper_b3_tbl[2][5][256] = {
static const u8_displacement_t u8_toupper_b3_tbl[
U8_UNICODE_LATEST + 1][5][256] =
{
{
{ /* Third byte table 0. */
{ N_, 0 }, { N_, 0 }, { N_, 0 }, { N_, 0 },
Expand Down Expand Up @@ -32042,7 +32054,7 @@ static const u8_displacement_t u8_toupper_b3_tbl[2][5][256] = {
},
};

static const uchar_t u8_toupper_b4_tbl[2][39][257] = {
static const uchar_t u8_toupper_b4_tbl[U8_UNICODE_LATEST + 1][39][257] = {
{
{ /* Fourth byte table 0. */
0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -34779,7 +34791,7 @@ static const uchar_t u8_toupper_b4_tbl[2][39][257] = {
},
};

static const uchar_t u8_toupper_final_tbl[2][2318] = {
static const uchar_t u8_toupper_final_tbl[U8_UNICODE_LATEST + 1][2318] = {
{
0xCE, 0x9C, 0xC3, 0x80, 0xC3, 0x81, 0xC3, 0x82,
0xC3, 0x83, 0xC3, 0x84, 0xC3, 0x85, 0xC3, 0x86,
Expand Down

0 comments on commit d799996

Please sign in to comment.