1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
#include "__bsearch.h"
#include "macros.h"
#include "rune.h"
#include "unicode/prop.h"
#define M(...) ((struct rview)_(__VA_ARGS__))
#define _(...) \
{(const rune []){__VA_ARGS__}, lengthof(((const rune []){__VA_ARGS__}))}
static const struct {
rune k;
struct rview v;
} lookup[] = {
{0x0149, _(0x02BC, 0x004E)},
{0x01F0, _(0x004A, 0x030C)},
{0x0390, _(0x0399, 0x0308, 0x0301)},
{0x03B0, _(0x03A5, 0x0308, 0x0301)},
{0x0587, _(0x0535, 0x0552)},
{0x1E96, _(0x0048, 0x0331)},
{0x1E97, _(0x0054, 0x0308)},
{0x1E98, _(0x0057, 0x030A)},
{0x1E99, _(0x0059, 0x030A)},
{0x1E9A, _(0x0041, 0x02BE)},
{0x1F50, _(0x03A5, 0x0313)},
{0x1F52, _(0x03A5, 0x0313, 0x0300)},
{0x1F54, _(0x03A5, 0x0313, 0x0301)},
{0x1F56, _(0x03A5, 0x0313, 0x0342)},
{0x1F80, _(0x1F08, 0x0399)},
{0x1F81, _(0x1F09, 0x0399)},
{0x1F82, _(0x1F0A, 0x0399)},
{0x1F83, _(0x1F0B, 0x0399)},
{0x1F84, _(0x1F0C, 0x0399)},
{0x1F85, _(0x1F0D, 0x0399)},
{0x1F86, _(0x1F0E, 0x0399)},
{0x1F87, _(0x1F0F, 0x0399)},
{0x1F88, _(0x1F08, 0x0399)},
{0x1F89, _(0x1F09, 0x0399)},
{0x1F8A, _(0x1F0A, 0x0399)},
{0x1F8B, _(0x1F0B, 0x0399)},
{0x1F8C, _(0x1F0C, 0x0399)},
{0x1F8D, _(0x1F0D, 0x0399)},
{0x1F8E, _(0x1F0E, 0x0399)},
{0x1F8F, _(0x1F0F, 0x0399)},
{0x1F90, _(0x1F28, 0x0399)},
{0x1F91, _(0x1F29, 0x0399)},
{0x1F92, _(0x1F2A, 0x0399)},
{0x1F93, _(0x1F2B, 0x0399)},
{0x1F94, _(0x1F2C, 0x0399)},
{0x1F95, _(0x1F2D, 0x0399)},
{0x1F96, _(0x1F2E, 0x0399)},
{0x1F97, _(0x1F2F, 0x0399)},
{0x1F98, _(0x1F28, 0x0399)},
{0x1F99, _(0x1F29, 0x0399)},
{0x1F9A, _(0x1F2A, 0x0399)},
{0x1F9B, _(0x1F2B, 0x0399)},
{0x1F9C, _(0x1F2C, 0x0399)},
{0x1F9D, _(0x1F2D, 0x0399)},
{0x1F9E, _(0x1F2E, 0x0399)},
{0x1F9F, _(0x1F2F, 0x0399)},
{0x1FA0, _(0x1F68, 0x0399)},
{0x1FA1, _(0x1F69, 0x0399)},
{0x1FA2, _(0x1F6A, 0x0399)},
{0x1FA3, _(0x1F6B, 0x0399)},
{0x1FA4, _(0x1F6C, 0x0399)},
{0x1FA5, _(0x1F6D, 0x0399)},
{0x1FA6, _(0x1F6E, 0x0399)},
{0x1FA7, _(0x1F6F, 0x0399)},
{0x1FA8, _(0x1F68, 0x0399)},
{0x1FA9, _(0x1F69, 0x0399)},
{0x1FAA, _(0x1F6A, 0x0399)},
{0x1FAB, _(0x1F6B, 0x0399)},
{0x1FAC, _(0x1F6C, 0x0399)},
{0x1FAD, _(0x1F6D, 0x0399)},
{0x1FAE, _(0x1F6E, 0x0399)},
{0x1FAF, _(0x1F6F, 0x0399)},
{0x1FB2, _(0x1FBA, 0x0399)},
{0x1FB3, _(0x0391, 0x0399)},
{0x1FB4, _(0x0386, 0x0399)},
{0x1FB6, _(0x0391, 0x0342)},
{0x1FB7, _(0x0391, 0x0342, 0x0399)},
{0x1FBC, _(0x0391, 0x0399)},
{0x1FC2, _(0x1FCA, 0x0399)},
{0x1FC3, _(0x0397, 0x0399)},
{0x1FC4, _(0x0389, 0x0399)},
{0x1FC6, _(0x0397, 0x0342)},
{0x1FC7, _(0x0397, 0x0342, 0x0399)},
{0x1FCC, _(0x0397, 0x0399)},
{0x1FD2, _(0x0399, 0x0308, 0x0300)},
{0x1FD3, _(0x0399, 0x0308, 0x0301)},
{0x1FD6, _(0x0399, 0x0342)},
{0x1FD7, _(0x0399, 0x0308, 0x0342)},
{0x1FE2, _(0x03A5, 0x0308, 0x0300)},
{0x1FE3, _(0x03A5, 0x0308, 0x0301)},
{0x1FE4, _(0x03A1, 0x0313)},
{0x1FE6, _(0x03A5, 0x0342)},
{0x1FE7, _(0x03A5, 0x0308, 0x0342)},
{0x1FF2, _(0x1FFA, 0x0399)},
{0x1FF3, _(0x03A9, 0x0399)},
{0x1FF4, _(0x038F, 0x0399)},
{0x1FF6, _(0x03A9, 0x0342)},
{0x1FF7, _(0x03A9, 0x0342, 0x0399)},
{0x1FFC, _(0x03A9, 0x0399)},
{0xFB00, _(0x0046, 0x0046)},
{0xFB01, _(0x0046, 0x0049)},
{0xFB02, _(0x0046, 0x004C)},
{0xFB03, _(0x0046, 0x0046, 0x0049)},
{0xFB04, _(0x0046, 0x0046, 0x004C)},
{0xFB05, _(0x0053, 0x0054)},
{0xFB06, _(0x0053, 0x0054)},
{0xFB13, _(0x0544, 0x0546)},
{0xFB14, _(0x0544, 0x0535)},
{0xFB15, _(0x0544, 0x053B)},
{0xFB16, _(0x054E, 0x0546)},
{0xFB17, _(0x0544, 0x053D)},
};
__MLIB_DEFINE_BSEARCH_KV(struct rview, lookup, M(ch))
struct rview
uprop_get_uc(rune ch, struct ucctx ctx)
{
if (ch == U'ß')
return ctx.cap_eszett ? M(U'ẞ') : M('S', 'S');
if (ch == 'i' && ctx.az_or_tr)
return M(U'İ');
if (ch == 0x307 && ctx.lt_after_i)
return M();
rune CH = uprop_get_suc(ch);
if (ch != CH)
return M(CH);
return mlib_lookup_kv(ch);
}
|