Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,759 changes: 2,116 additions & 1,643 deletions libunicode-table.h

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions libunicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ enum {
RUN_TYPE_LF,
RUN_TYPE_UL,
RUN_TYPE_LSU,
RUN_TYPE_U2_399_EXT2,
RUN_TYPE_U2L_399_EXT2,
RUN_TYPE_UF_D20,
RUN_TYPE_UF_D1_EXT,
RUN_TYPE_U_EXT,
RUN_TYPE_U_EXT2,
RUN_TYPE_U_EXT3,
RUN_TYPE_L_EXT,
RUN_TYPE_LF_EXT,
RUN_TYPE_UF_EXT2,
RUN_TYPE_LF_EXT2,
Expand Down Expand Up @@ -87,6 +91,7 @@ static int lre_case_conv_entry(uint32_t *res, uint32_t c, int conv_type, uint32_
c += (2 * is_lower - 1) * 2;
}
break;
case RUN_TYPE_U2_399_EXT2:
case RUN_TYPE_U2L_399_EXT2:
if (!is_lower) {
res[0] = c - code + case_conv_ext[data >> 6];
Expand All @@ -107,11 +112,16 @@ static int lre_case_conv_entry(uint32_t *res, uint32_t c, int conv_type, uint32_
c = case_conv_ext[data] + (conv_type == 2);
break;
case RUN_TYPE_U_EXT:
case RUN_TYPE_L_EXT:
case RUN_TYPE_LF_EXT:
if (is_lower != (type - RUN_TYPE_U_EXT))
break;
c = case_conv_ext[data];
break;
case RUN_TYPE_U_EXT2:
case RUN_TYPE_U_EXT3:
// TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone needs to tell me how to implement these, my brain is not capable of writing this kind of obfuscated C code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caveat emptor, I'm not 100% sure but I suspect you can merge the RUN_TYPE_U_EXT2 case with RUN_TYPE_LF_EXT2 and update the guard to:

if (is_lower != (type - RUN_TYPE_U_EXT2))
    break;

RUN_TYPE_U_EXT2 should immediately precede RUN_TYPE_LF_EXT2 in the enum declaration for that to work (not the case right now.)

For RUN_TYPE_U_EXT3, the code should probably look like this:

case RUN_TYPE_U_EXT3:
    res[0] = c - code + case_conv_ext[data >> 8];
    res[1] = case_conv_ext[(data >> 4) & 0x0f];
    res[2] = case_conv_ext[data & 0x0f];
    return 3;

break;
case RUN_TYPE_LF_EXT2:
if (!is_lower)
break;
Expand Down
Loading