1 /* generated automatically by mkrunetype.c from UnicodeData-6.3.0.txt */
2
3 static Rune __isspacer[] = {
4 0x0009, 0x000d,
5 0x0020, 0x0020,
6 0x0085, 0x0085,
7 0x00a0, 0x00a0,
8 0x1680, 0x1680,
9 0x2000, 0x200a,
10 0x2028, 0x2029,
11 0x202f, 0x202f,
12 0x205f, 0x205f,
13 0x3000, 0x3000,
14 0xfeff, 0xfeff,
15 };
16
17 int
isspacerune(Rune c)18 isspacerune(Rune c)
19 {
20 Rune *p;
21
22 p = rbsearch(c, __isspacer, nelem(__isspacer)/2, 2);
23 if(p && c >= p[0] && c <= p[1])
24 return 1;
25 return 0;
26 }
27
28 static Rune __isdigitr[] = {
29 0x0030, 0x0039,
30 0x0660, 0x0669,
31 0x06f0, 0x06f9,
32 0x07c0, 0x07c9,
33 0x0966, 0x096f,
34 0x09e6, 0x09ef,
35 0x0a66, 0x0a6f,
36 0x0ae6, 0x0aef,
37 0x0b66, 0x0b6f,
38 0x0be6, 0x0bef,
39 0x0c66, 0x0c6f,
40 0x0ce6, 0x0cef,
41 0x0d66, 0x0d6f,
42 0x0e50, 0x0e59,
43 0x0ed0, 0x0ed9,
44 0x0f20, 0x0f29,
45 0x1040, 0x1049,
46 0x1090, 0x1099,
47 0x17e0, 0x17e9,
48 0x1810, 0x1819,
49 0x1946, 0x194f,
50 0x19d0, 0x19d9,
51 0x1a80, 0x1a89,
52 0x1a90, 0x1a99,
53 0x1b50, 0x1b59,
54 0x1bb0, 0x1bb9,
55 0x1c40, 0x1c49,
56 0x1c50, 0x1c59,
57 0xa620, 0xa629,
58 0xa8d0, 0xa8d9,
59 0xa900, 0xa909,
60 0xa9d0, 0xa9d9,
61 0xaa50, 0xaa59,
62 0xabf0, 0xabf9,
63 0xff10, 0xff19,
64 0x104a0, 0x104a9,
65 0x11066, 0x1106f,
66 0x110f0, 0x110f9,
67 0x11136, 0x1113f,
68 0x111d0, 0x111d9,
69 0x116c0, 0x116c9,
70 0x1d7ce, 0x1d7ff,
71 };
72
73 int
isdigitrune(Rune c)74 isdigitrune(Rune c)
75 {
76 Rune *p;
77
78 p = rbsearch(c, __isdigitr, nelem(__isdigitr)/2, 2);
79 if(p && c >= p[0] && c <= p[1])
80 return 1;
81 return 0;
82 }
83
84 static Rune __isalphar[] = {
85 0x0041, 0x005a,
86 0x0061, 0x007a,
87 0x00c0, 0x00d6,
88 0x00d8, 0x00f6,
89 0x00f8, 0x02c1,
90 0x02c6, 0x02d1,
91 0x02e0, 0x02e4,
92 0x0370, 0x0374,
93 0x0376, 0x0377,
94 0x037a, 0x037d,
95 0x0388, 0x038a,
96 0x038e, 0x03a1,
97 0x03a3, 0x03f5,
98 0x03f7, 0x0481,
99 0x048a, 0x0527,
100 0x0531, 0x0556,
101 0x0561, 0x0587,
102 0x05d0, 0x05ea,
103 0x05f0, 0x05f2,
104 0x0620, 0x064a,
105 0x066e, 0x066f,
106 0x0671, 0x06d3,
107 0x06e5, 0x06e6,
108 0x06ee, 0x06ef,
109 0x06fa, 0x06fc,
110 0x0712, 0x072f,
111 0x074d, 0x07a5,
112 0x07ca, 0x07ea,
113 0x07f4, 0x07f5,
114 0x0800, 0x0815,
115 0x0840, 0x0858,
116 0x08a2, 0x08ac,
117 0x0904, 0x0939,
118 0x0958, 0x0961,
119 0x0971, 0x0977,
120 0x0979, 0x097f,
121 0x0985, 0x098c,
122 0x098f, 0x0990,
123 0x0993, 0x09a8,
124 0x09aa, 0x09b0,
125 0x09b6, 0x09b9,
126 0x09dc, 0x09dd,
127 0x09df, 0x09e1,
128 0x09f0, 0x09f1,
129 0x0a05, 0x0a0a,
130 0x0a0f, 0x0a10,
131 0x0a13, 0x0a28,
132 0x0a2a, 0x0a30,
133 0x0a32, 0x0a33,
134 0x0a35, 0x0a36,
135 0x0a38, 0x0a39,
136 0x0a59, 0x0a5c,
137 0x0a72, 0x0a74,
138 0x0a85, 0x0a8d,
139 0x0a8f, 0x0a91,
140 0x0a93, 0x0aa8,
141 0x0aaa, 0x0ab0,
142 0x0ab2, 0x0ab3,
143 0x0ab5, 0x0ab9,
144 0x0ae0, 0x0ae1,
145 0x0b05, 0x0b0c,
146 0x0b0f, 0x0b10,
147 0x0b13, 0x0b28,
148 0x0b2a, 0x0b30,
149 0x0b32, 0x0b33,
150 0x0b35, 0x0b39,
151 0x0b5c, 0x0b5d,
152 0x0b5f, 0x0b61,
153 0x0b85, 0x0b8a,
154 0x0b8e, 0x0b90,
155 0x0b92, 0x0b95,
156 0x0b99, 0x0b9a,
157 0x0b9e, 0x0b9f,
158 0x0ba3, 0x0ba4,
159 0x0ba8, 0x0baa,
160 0x0bae, 0x0bb9,
161 0x0c05, 0x0c0c,
162 0x0c0e, 0x0c10,
163 0x0c12, 0x0c28,
164 0x0c2a, 0x0c33,
165 0x0c35, 0x0c39,
166 0x0c58, 0x0c59,
167 0x0c60, 0x0c61,
168 0x0c85, 0x0c8c,
169 0x0c8e, 0x0c90,
170 0x0c92, 0x0ca8,
171 0x0caa, 0x0cb3,
172 0x0cb5, 0x0cb9,
173 0x0ce0, 0x0ce1,
174 0x0cf1, 0x0cf2,
175 0x0d05, 0x0d0c,
176 0x0d0e, 0x0d10,
177 0x0d12, 0x0d3a,
178 0x0d60, 0x0d61,
179 0x0d7a, 0x0d7f,
180 0x0d85, 0x0d96,
181 0x0d9a, 0x0db1,
182 0x0db3, 0x0dbb,
183 0x0dc0, 0x0dc6,
184 0x0e01, 0x0e30,
185 0x0e32, 0x0e33,
186 0x0e40, 0x0e46,
187 0x0e81, 0x0e82,
188 0x0e87, 0x0e88,
189 0x0e94, 0x0e97,
190 0x0e99, 0x0e9f,
191 0x0ea1, 0x0ea3,
192 0x0eaa, 0x0eab,
193 0x0ead, 0x0eb0,
194 0x0eb2, 0x0eb3,
195 0x0ec0, 0x0ec4,
196 0x0edc, 0x0edf,
197 0x0f40, 0x0f47,
198 0x0f49, 0x0f6c,
199 0x0f88, 0x0f8c,
200 0x1000, 0x102a,
201 0x1050, 0x1055,
202 0x105a, 0x105d,
203 0x1065, 0x1066,
204 0x106e, 0x1070,
205 0x1075, 0x1081,
206 0x10a0, 0x10c5,
207 0x10d0, 0x10fa,
208 0x10fc, 0x1248,
209 0x124a, 0x124d,
210 0x1250, 0x1256,
211 0x125a, 0x125d,
212 0x1260, 0x1288,
213 0x128a, 0x128d,
214 0x1290, 0x12b0,
215 0x12b2, 0x12b5,
216 0x12b8, 0x12be,
217 0x12c2, 0x12c5,
218 0x12c8, 0x12d6,
219 0x12d8, 0x1310,
220 0x1312, 0x1315,
221 0x1318, 0x135a,
222 0x1380, 0x138f,
223 0x13a0, 0x13f4,
224 0x1401, 0x166c,
225 0x166f, 0x167f,
226 0x1681, 0x169a,
227 0x16a0, 0x16ea,
228 0x1700, 0x170c,
229 0x170e, 0x1711,
230 0x1720, 0x1731,
231 0x1740, 0x1751,
232 0x1760, 0x176c,
233 0x176e, 0x1770,
234 0x1780, 0x17b3,
235 0x1820, 0x1877,
236 0x1880, 0x18a8,
237 0x18b0, 0x18f5,
238 0x1900, 0x191c,
239 0x1950, 0x196d,
240 0x1970, 0x1974,
241 0x1980, 0x19ab,
242 0x19c1, 0x19c7,
243 0x1a00, 0x1a16,
244 0x1a20, 0x1a54,
245 0x1b05, 0x1b33,
246 0x1b45, 0x1b4b,
247 0x1b83, 0x1ba0,
248 0x1bae, 0x1baf,
249 0x1bba, 0x1be5,
250 0x1c00, 0x1c23,
251 0x1c4d, 0x1c4f,
252 0x1c5a, 0x1c7d,
253 0x1ce9, 0x1cec,
254 0x1cee, 0x1cf1,
255 0x1cf5, 0x1cf6,
256 0x1d00, 0x1dbf,
257 0x1e00, 0x1f15,
258 0x1f18, 0x1f1d,
259 0x1f20, 0x1f45,
260 0x1f48, 0x1f4d,
261 0x1f50, 0x1f57,
262 0x1f5f, 0x1f7d,
263 0x1f80, 0x1fb4,
264 0x1fb6, 0x1fbc,
265 0x1fc2, 0x1fc4,
266 0x1fc6, 0x1fcc,
267 0x1fd0, 0x1fd3,
268 0x1fd6, 0x1fdb,
269 0x1fe0, 0x1fec,
270 0x1ff2, 0x1ff4,
271 0x1ff6, 0x1ffc,
272 0x2090, 0x209c,
273 0x210a, 0x2113,
274 0x2119, 0x211d,
275 0x212a, 0x212d,
276 0x212f, 0x2139,
277 0x213c, 0x213f,
278 0x2145, 0x2149,
279 0x2183, 0x2184,
280 0x2c00, 0x2c2e,
281 0x2c30, 0x2c5e,
282 0x2c60, 0x2ce4,
283 0x2ceb, 0x2cee,
284 0x2cf2, 0x2cf3,
285 0x2d00, 0x2d25,
286 0x2d30, 0x2d67,
287 0x2d80, 0x2d96,
288 0x2da0, 0x2da6,
289 0x2da8, 0x2dae,
290 0x2db0, 0x2db6,
291 0x2db8, 0x2dbe,
292 0x2dc0, 0x2dc6,
293 0x2dc8, 0x2dce,
294 0x2dd0, 0x2dd6,
295 0x2dd8, 0x2dde,
296 0x3005, 0x3006,
297 0x3031, 0x3035,
298 0x303b, 0x303c,
299 0x3041, 0x3096,
300 0x309d, 0x309f,
301 0x30a1, 0x30fa,
302 0x30fc, 0x30ff,
303 0x3105, 0x312d,
304 0x3131, 0x318e,
305 0x31a0, 0x31ba,
306 0x31f0, 0x31ff,
307 0x3400, 0x4db5,
308 0x4e00, 0x9fcc,
309 0xa000, 0xa48c,
310 0xa4d0, 0xa4fd,
311 0xa500, 0xa60c,
312 0xa610, 0xa61f,
313 0xa62a, 0xa62b,
314 0xa640, 0xa66e,
315 0xa67f, 0xa697,
316 0xa6a0, 0xa6e5,
317 0xa717, 0xa71f,
318 0xa722, 0xa788,
319 0xa78b, 0xa78e,
320 0xa790, 0xa793,
321 0xa7a0, 0xa7aa,
322 0xa7f8, 0xa801,
323 0xa803, 0xa805,
324 0xa807, 0xa80a,
325 0xa80c, 0xa822,
326 0xa840, 0xa873,
327 0xa882, 0xa8b3,
328 0xa8f2, 0xa8f7,
329 0xa90a, 0xa925,
330 0xa930, 0xa946,
331 0xa960, 0xa97c,
332 0xa984, 0xa9b2,
333 0xaa00, 0xaa28,
334 0xaa40, 0xaa42,
335 0xaa44, 0xaa4b,
336 0xaa60, 0xaa76,
337 0xaa80, 0xaaaf,
338 0xaab5, 0xaab6,
339 0xaab9, 0xaabd,
340 0xaadb, 0xaadd,
341 0xaae0, 0xaaea,
342 0xaaf2, 0xaaf4,
343 0xab01, 0xab06,
344 0xab09, 0xab0e,
345 0xab11, 0xab16,
346 0xab20, 0xab26,
347 0xab28, 0xab2e,
348 0xabc0, 0xabe2,
349 0xac00, 0xd7a3,
350 0xd7b0, 0xd7c6,
351 0xd7cb, 0xd7fb,
352 0xf900, 0xfa6d,
353 0xfa70, 0xfad9,
354 0xfb00, 0xfb06,
355 0xfb13, 0xfb17,
356 0xfb1f, 0xfb28,
357 0xfb2a, 0xfb36,
358 0xfb38, 0xfb3c,
359 0xfb40, 0xfb41,
360 0xfb43, 0xfb44,
361 0xfb46, 0xfbb1,
362 0xfbd3, 0xfd3d,
363 0xfd50, 0xfd8f,
364 0xfd92, 0xfdc7,
365 0xfdf0, 0xfdfb,
366 0xfe70, 0xfe74,
367 0xfe76, 0xfefc,
368 0xff21, 0xff3a,
369 0xff41, 0xff5a,
370 0xff66, 0xffbe,
371 0xffc2, 0xffc7,
372 0xffca, 0xffcf,
373 0xffd2, 0xffd7,
374 0xffda, 0xffdc,
375 0x10000, 0x1000b,
376 0x1000d, 0x10026,
377 0x10028, 0x1003a,
378 0x1003c, 0x1003d,
379 0x1003f, 0x1004d,
380 0x10050, 0x1005d,
381 0x10080, 0x100fa,
382 0x10280, 0x1029c,
383 0x102a0, 0x102d0,
384 0x10300, 0x1031e,
385 0x10330, 0x10340,
386 0x10342, 0x10349,
387 0x10380, 0x1039d,
388 0x103a0, 0x103c3,
389 0x103c8, 0x103cf,
390 0x10400, 0x1049d,
391 0x10800, 0x10805,
392 0x1080a, 0x10835,
393 0x10837, 0x10838,
394 0x1083f, 0x10855,
395 0x10900, 0x10915,
396 0x10920, 0x10939,
397 0x10980, 0x109b7,
398 0x109be, 0x109bf,
399 0x10a10, 0x10a13,
400 0x10a15, 0x10a17,
401 0x10a19, 0x10a33,
402 0x10a60, 0x10a7c,
403 0x10b00, 0x10b35,
404 0x10b40, 0x10b55,
405 0x10b60, 0x10b72,
406 0x10c00, 0x10c48,
407 0x11003, 0x11037,
408 0x11083, 0x110af,
409 0x110d0, 0x110e8,
410 0x11103, 0x11126,
411 0x11183, 0x111b2,
412 0x111c1, 0x111c4,
413 0x11680, 0x116aa,
414 0x12000, 0x1236e,
415 0x13000, 0x1342e,
416 0x16800, 0x16a38,
417 0x16f00, 0x16f44,
418 0x16f93, 0x16f9f,
419 0x1b000, 0x1b001,
420 0x1d400, 0x1d454,
421 0x1d456, 0x1d49c,
422 0x1d49e, 0x1d49f,
423 0x1d4a5, 0x1d4a6,
424 0x1d4a9, 0x1d4ac,
425 0x1d4ae, 0x1d4b9,
426 0x1d4bd, 0x1d4c3,
427 0x1d4c5, 0x1d505,
428 0x1d507, 0x1d50a,
429 0x1d50d, 0x1d514,
430 0x1d516, 0x1d51c,
431 0x1d51e, 0x1d539,
432 0x1d53b, 0x1d53e,
433 0x1d540, 0x1d544,
434 0x1d54a, 0x1d550,
435 0x1d552, 0x1d6a5,
436 0x1d6a8, 0x1d6c0,
437 0x1d6c2, 0x1d6da,
438 0x1d6dc, 0x1d6fa,
439 0x1d6fc, 0x1d714,
440 0x1d716, 0x1d734,
441 0x1d736, 0x1d74e,
442 0x1d750, 0x1d76e,
443 0x1d770, 0x1d788,
444 0x1d78a, 0x1d7a8,
445 0x1d7aa, 0x1d7c2,
446 0x1d7c4, 0x1d7cb,
447 0x1ee00, 0x1ee03,
448 0x1ee05, 0x1ee1f,
449 0x1ee21, 0x1ee22,
450 0x1ee29, 0x1ee32,
451 0x1ee34, 0x1ee37,
452 0x1ee4d, 0x1ee4f,
453 0x1ee51, 0x1ee52,
454 0x1ee61, 0x1ee62,
455 0x1ee67, 0x1ee6a,
456 0x1ee6c, 0x1ee72,
457 0x1ee74, 0x1ee77,
458 0x1ee79, 0x1ee7c,
459 0x1ee80, 0x1ee89,
460 0x1ee8b, 0x1ee9b,
461 0x1eea1, 0x1eea3,
462 0x1eea5, 0x1eea9,
463 0x1eeab, 0x1eebb,
464 0x20000, 0x2a6d6,
465 0x2a700, 0x2b734,
466 0x2b740, 0x2b81d,
467 0x2f800, 0x2fa1d,
468 };
469
470 static Rune __isalphas[] = {
471 0x00aa,
472 0x00b5,
473 0x00ba,
474 0x02ec,
475 0x02ee,
476 0x0386,
477 0x038c,
478 0x0559,
479 0x06d5,
480 0x06ff,
481 0x0710,
482 0x07b1,
483 0x07fa,
484 0x081a,
485 0x0824,
486 0x0828,
487 0x08a0,
488 0x093d,
489 0x0950,
490 0x09b2,
491 0x09bd,
492 0x09ce,
493 0x0a5e,
494 0x0abd,
495 0x0ad0,
496 0x0b3d,
497 0x0b71,
498 0x0b83,
499 0x0b9c,
500 0x0bd0,
501 0x0c3d,
502 0x0cbd,
503 0x0cde,
504 0x0d3d,
505 0x0d4e,
506 0x0dbd,
507 0x0e84,
508 0x0e8a,
509 0x0e8d,
510 0x0ea5,
511 0x0ea7,
512 0x0ebd,
513 0x0ec6,
514 0x0f00,
515 0x103f,
516 0x1061,
517 0x108e,
518 0x10c7,
519 0x10cd,
520 0x1258,
521 0x12c0,
522 0x17d7,
523 0x17dc,
524 0x18aa,
525 0x1aa7,
526 0x1f59,
527 0x1f5b,
528 0x1f5d,
529 0x1fbe,
530 0x2071,
531 0x207f,
532 0x2102,
533 0x2107,
534 0x2115,
535 0x2124,
536 0x2126,
537 0x2128,
538 0x214e,
539 0x2d27,
540 0x2d2d,
541 0x2d6f,
542 0x2e2f,
543 0xa8fb,
544 0xa9cf,
545 0xaa7a,
546 0xaab1,
547 0xaac0,
548 0xaac2,
549 0xfb1d,
550 0xfb3e,
551 0x10808,
552 0x1083c,
553 0x10a00,
554 0x16f50,
555 0x1d4a2,
556 0x1d4bb,
557 0x1d546,
558 0x1ee24,
559 0x1ee27,
560 0x1ee39,
561 0x1ee3b,
562 0x1ee42,
563 0x1ee47,
564 0x1ee49,
565 0x1ee4b,
566 0x1ee54,
567 0x1ee57,
568 0x1ee59,
569 0x1ee5b,
570 0x1ee5d,
571 0x1ee5f,
572 0x1ee64,
573 0x1ee7e,
574 };
575
576 int
isalpharune(Rune c)577 isalpharune(Rune c)
578 {
579 Rune *p;
580
581 p = rbsearch(c, __isalphar, nelem(__isalphar)/2, 2);
582 if(p && c >= p[0] && c <= p[1])
583 return 1;
584 p = rbsearch(c, __isalphas, nelem(__isalphas), 1);
585 if(p && c == p[0])
586 return 1;
587 return 0;
588 }
589
590 static Rune __isupperr[] = {
591 0x0041, 0x005a,
592 0x00c0, 0x00d6,
593 0x00d8, 0x00de,
594 0x0178, 0x0179,
595 0x0181, 0x0182,
596 0x0186, 0x0187,
597 0x0189, 0x018b,
598 0x018e, 0x0191,
599 0x0193, 0x0194,
600 0x0196, 0x0198,
601 0x019c, 0x019d,
602 0x019f, 0x01a0,
603 0x01a6, 0x01a7,
604 0x01ae, 0x01af,
605 0x01b1, 0x01b3,
606 0x01b7, 0x01b8,
607 0x01f6, 0x01f8,
608 0x023a, 0x023b,
609 0x023d, 0x023e,
610 0x0243, 0x0246,
611 0x0388, 0x038a,
612 0x038e, 0x038f,
613 0x0391, 0x03a1,
614 0x03a3, 0x03ab,
615 0x03d2, 0x03d4,
616 0x03f9, 0x03fa,
617 0x03fd, 0x042f,
618 0x04c0, 0x04c1,
619 0x0531, 0x0556,
620 0x10a0, 0x10c5,
621 0x1f08, 0x1f0f,
622 0x1f18, 0x1f1d,
623 0x1f28, 0x1f2f,
624 0x1f38, 0x1f3f,
625 0x1f48, 0x1f4d,
626 0x1f68, 0x1f6f,
627 0x1f88, 0x1f8f,
628 0x1f98, 0x1f9f,
629 0x1fa8, 0x1faf,
630 0x1fb8, 0x1fbc,
631 0x1fc8, 0x1fcc,
632 0x1fd8, 0x1fdb,
633 0x1fe8, 0x1fec,
634 0x1ff8, 0x1ffc,
635 0x210b, 0x210d,
636 0x2110, 0x2112,
637 0x2119, 0x211d,
638 0x212a, 0x212d,
639 0x2130, 0x2133,
640 0x213e, 0x213f,
641 0x2160, 0x216f,
642 0x24b6, 0x24cf,
643 0x2c00, 0x2c2e,
644 0x2c62, 0x2c64,
645 0x2c6d, 0x2c70,
646 0x2c7e, 0x2c80,
647 0xa77d, 0xa77e,
648 0xff21, 0xff3a,
649 0x10400, 0x10427,
650 0x1d400, 0x1d419,
651 0x1d434, 0x1d44d,
652 0x1d468, 0x1d481,
653 0x1d49e, 0x1d49f,
654 0x1d4a5, 0x1d4a6,
655 0x1d4a9, 0x1d4ac,
656 0x1d4ae, 0x1d4b5,
657 0x1d4d0, 0x1d4e9,
658 0x1d504, 0x1d505,
659 0x1d507, 0x1d50a,
660 0x1d50d, 0x1d514,
661 0x1d516, 0x1d51c,
662 0x1d538, 0x1d539,
663 0x1d53b, 0x1d53e,
664 0x1d540, 0x1d544,
665 0x1d54a, 0x1d550,
666 0x1d56c, 0x1d585,
667 0x1d5a0, 0x1d5b9,
668 0x1d5d4, 0x1d5ed,
669 0x1d608, 0x1d621,
670 0x1d63c, 0x1d655,
671 0x1d670, 0x1d689,
672 0x1d6a8, 0x1d6c0,
673 0x1d6e2, 0x1d6fa,
674 0x1d71c, 0x1d734,
675 0x1d756, 0x1d76e,
676 0x1d790, 0x1d7a8,
677 };
678
679 static Rune __isupperp[] = {
680 0x0100, 0x0136,
681 0x0139, 0x0147,
682 0x014a, 0x0176,
683 0x017b, 0x017d,
684 0x01a2, 0x01a4,
685 0x01cd, 0x01db,
686 0x01de, 0x01ee,
687 0x01fa, 0x0232,
688 0x0248, 0x024e,
689 0x0370, 0x0372,
690 0x03d8, 0x03ee,
691 0x0460, 0x0480,
692 0x048a, 0x04be,
693 0x04c3, 0x04cd,
694 0x04d0, 0x0526,
695 0x1e00, 0x1e94,
696 0x1e9e, 0x1efe,
697 0x1f59, 0x1f5f,
698 0x2124, 0x2128,
699 0x2c67, 0x2c6b,
700 0x2c82, 0x2ce2,
701 0x2ceb, 0x2ced,
702 0xa640, 0xa66c,
703 0xa680, 0xa696,
704 0xa722, 0xa72e,
705 0xa732, 0xa76e,
706 0xa779, 0xa77b,
707 0xa780, 0xa786,
708 0xa78b, 0xa78d,
709 0xa790, 0xa792,
710 0xa7a0, 0xa7aa,
711 };
712
713 static Rune __isuppers[] = {
714 0x0184,
715 0x01a9,
716 0x01ac,
717 0x01b5,
718 0x01bc,
719 0x01c4,
720 0x01c7,
721 0x01ca,
722 0x01f1,
723 0x01f4,
724 0x0241,
725 0x0376,
726 0x0386,
727 0x038c,
728 0x03cf,
729 0x03f4,
730 0x03f7,
731 0x10c7,
732 0x10cd,
733 0x2102,
734 0x2107,
735 0x2115,
736 0x2145,
737 0x2183,
738 0x2c60,
739 0x2c72,
740 0x2c75,
741 0x2cf2,
742 0x1d49c,
743 0x1d4a2,
744 0x1d546,
745 0x1d7ca,
746 };
747
748 int
isupperrune(Rune c)749 isupperrune(Rune c)
750 {
751 Rune *p;
752
753 p = rbsearch(c, __isupperr, nelem(__isupperr)/2, 2);
754 if(p && c >= p[0] && c <= p[1])
755 return 1;
756 p = rbsearch(c, __isupperp, nelem(__isupperp)/2, 2);
757 if(p && c >= p[0] && c <= p[1] && !((c - p[0]) & 1))
758 return 1;
759 p = rbsearch(c, __isuppers, nelem(__isuppers), 1);
760 if(p && c == p[0])
761 return 1;
762 return 0;
763 }
764
765 static Rune __islowerr[] = {
766 0x0061, 0x007a,
767 0x00df, 0x00f6,
768 0x00f8, 0x00ff,
769 0x0137, 0x0138,
770 0x0148, 0x0149,
771 0x017e, 0x0180,
772 0x018c, 0x018d,
773 0x0199, 0x019b,
774 0x01aa, 0x01ab,
775 0x01b9, 0x01ba,
776 0x01bd, 0x01bf,
777 0x01dc, 0x01dd,
778 0x01ef, 0x01f0,
779 0x0233, 0x0239,
780 0x023f, 0x0240,
781 0x024f, 0x0293,
782 0x0295, 0x02af,
783 0x037b, 0x037d,
784 0x03ac, 0x03ce,
785 0x03d0, 0x03d1,
786 0x03d5, 0x03d7,
787 0x03ef, 0x03f3,
788 0x03fb, 0x03fc,
789 0x0430, 0x045f,
790 0x04ce, 0x04cf,
791 0x0561, 0x0587,
792 0x1d00, 0x1d2b,
793 0x1d6b, 0x1d77,
794 0x1d79, 0x1d9a,
795 0x1e95, 0x1e9d,
796 0x1eff, 0x1f07,
797 0x1f10, 0x1f15,
798 0x1f20, 0x1f27,
799 0x1f30, 0x1f37,
800 0x1f40, 0x1f45,
801 0x1f50, 0x1f57,
802 0x1f60, 0x1f67,
803 0x1f70, 0x1f7d,
804 0x1f80, 0x1f87,
805 0x1f90, 0x1f97,
806 0x1fa0, 0x1fa7,
807 0x1fb0, 0x1fb4,
808 0x1fb6, 0x1fb7,
809 0x1fc2, 0x1fc4,
810 0x1fc6, 0x1fc7,
811 0x1fd0, 0x1fd3,
812 0x1fd6, 0x1fd7,
813 0x1fe0, 0x1fe7,
814 0x1ff2, 0x1ff4,
815 0x1ff6, 0x1ff7,
816 0x210e, 0x210f,
817 0x213c, 0x213d,
818 0x2146, 0x2149,
819 0x2170, 0x217f,
820 0x24d0, 0x24e9,
821 0x2c30, 0x2c5e,
822 0x2c65, 0x2c66,
823 0x2c73, 0x2c74,
824 0x2c76, 0x2c7b,
825 0x2ce3, 0x2ce4,
826 0x2d00, 0x2d25,
827 0xa72f, 0xa731,
828 0xa771, 0xa778,
829 0xfb00, 0xfb06,
830 0xfb13, 0xfb17,
831 0xff41, 0xff5a,
832 0x10428, 0x1044f,
833 0x1d41a, 0x1d433,
834 0x1d44e, 0x1d454,
835 0x1d456, 0x1d467,
836 0x1d482, 0x1d49b,
837 0x1d4b6, 0x1d4b9,
838 0x1d4bd, 0x1d4c3,
839 0x1d4c5, 0x1d4cf,
840 0x1d4ea, 0x1d503,
841 0x1d51e, 0x1d537,
842 0x1d552, 0x1d56b,
843 0x1d586, 0x1d59f,
844 0x1d5ba, 0x1d5d3,
845 0x1d5ee, 0x1d607,
846 0x1d622, 0x1d63b,
847 0x1d656, 0x1d66f,
848 0x1d68a, 0x1d6a5,
849 0x1d6c2, 0x1d6da,
850 0x1d6dc, 0x1d6e1,
851 0x1d6fc, 0x1d714,
852 0x1d716, 0x1d71b,
853 0x1d736, 0x1d74e,
854 0x1d750, 0x1d755,
855 0x1d770, 0x1d788,
856 0x1d78a, 0x1d78f,
857 0x1d7aa, 0x1d7c2,
858 0x1d7c4, 0x1d7c9,
859 };
860
861 static Rune __islowerp[] = {
862 0x0101, 0x0135,
863 0x013a, 0x0146,
864 0x014b, 0x0177,
865 0x017a, 0x017c,
866 0x0183, 0x0185,
867 0x01a1, 0x01a5,
868 0x01b4, 0x01b6,
869 0x01cc, 0x01da,
870 0x01df, 0x01ed,
871 0x01f3, 0x01f5,
872 0x01f9, 0x0231,
873 0x0247, 0x024d,
874 0x0371, 0x0373,
875 0x03d9, 0x03ed,
876 0x0461, 0x0481,
877 0x048b, 0x04bf,
878 0x04c2, 0x04cc,
879 0x04d1, 0x0527,
880 0x1e01, 0x1e93,
881 0x1e9f, 0x1efd,
882 0x2c68, 0x2c6c,
883 0x2c81, 0x2ce1,
884 0x2cec, 0x2cee,
885 0xa641, 0xa66d,
886 0xa681, 0xa697,
887 0xa723, 0xa72d,
888 0xa733, 0xa76f,
889 0xa77a, 0xa77c,
890 0xa77f, 0xa787,
891 0xa78c, 0xa78e,
892 0xa791, 0xa793,
893 0xa7a1, 0xa7a9,
894 };
895
896 static Rune __islowers[] = {
897 0x00b5,
898 0x0188,
899 0x0192,
900 0x0195,
901 0x019e,
902 0x01a8,
903 0x01ad,
904 0x01b0,
905 0x01c6,
906 0x01c9,
907 0x023c,
908 0x0242,
909 0x0377,
910 0x0390,
911 0x03f5,
912 0x03f8,
913 0x1fbe,
914 0x210a,
915 0x2113,
916 0x212f,
917 0x2134,
918 0x2139,
919 0x214e,
920 0x2184,
921 0x2c61,
922 0x2c71,
923 0x2cf3,
924 0x2d27,
925 0x2d2d,
926 0xa7fa,
927 0x1d4bb,
928 0x1d7cb,
929 };
930
931 int
islowerrune(Rune c)932 islowerrune(Rune c)
933 {
934 Rune *p;
935
936 p = rbsearch(c, __islowerr, nelem(__islowerr)/2, 2);
937 if(p && c >= p[0] && c <= p[1])
938 return 1;
939 p = rbsearch(c, __islowerp, nelem(__islowerp)/2, 2);
940 if(p && c >= p[0] && c <= p[1] && !((c - p[0]) & 1))
941 return 1;
942 p = rbsearch(c, __islowers, nelem(__islowers), 1);
943 if(p && c == p[0])
944 return 1;
945 return 0;
946 }
947
948 static Rune __istitler[] = {
949 0x0041, 0x005a,
950 0x00c0, 0x00d6,
951 0x00d8, 0x00de,
952 0x0178, 0x0179,
953 0x0181, 0x0182,
954 0x0186, 0x0187,
955 0x0189, 0x018b,
956 0x018e, 0x0191,
957 0x0193, 0x0194,
958 0x0196, 0x0198,
959 0x019c, 0x019d,
960 0x019f, 0x01a0,
961 0x01a6, 0x01a7,
962 0x01ae, 0x01af,
963 0x01b1, 0x01b3,
964 0x01b7, 0x01b8,
965 0x01f6, 0x01f8,
966 0x023a, 0x023b,
967 0x023d, 0x023e,
968 0x0243, 0x0246,
969 0x0388, 0x038a,
970 0x038e, 0x038f,
971 0x0391, 0x03a1,
972 0x03a3, 0x03ab,
973 0x03f9, 0x03fa,
974 0x03fd, 0x042f,
975 0x04c0, 0x04c1,
976 0x0531, 0x0556,
977 0x10a0, 0x10c5,
978 0x1f08, 0x1f0f,
979 0x1f18, 0x1f1d,
980 0x1f28, 0x1f2f,
981 0x1f38, 0x1f3f,
982 0x1f48, 0x1f4d,
983 0x1f68, 0x1f6f,
984 0x1f88, 0x1f8f,
985 0x1f98, 0x1f9f,
986 0x1fa8, 0x1faf,
987 0x1fb8, 0x1fbc,
988 0x1fc8, 0x1fcc,
989 0x1fd8, 0x1fdb,
990 0x1fe8, 0x1fec,
991 0x1ff8, 0x1ffc,
992 0x2160, 0x216f,
993 0x24b6, 0x24cf,
994 0x2c00, 0x2c2e,
995 0x2c62, 0x2c64,
996 0x2c6d, 0x2c70,
997 0x2c7e, 0x2c80,
998 0xa77d, 0xa77e,
999 0xff21, 0xff3a,
1000 0x10400, 0x10427,
1001 };
1002
1003 static Rune __istitlep[] = {
1004 0x0100, 0x012e,
1005 0x0132, 0x0136,
1006 0x0139, 0x0147,
1007 0x014a, 0x0176,
1008 0x017b, 0x017d,
1009 0x01a2, 0x01a4,
1010 0x01cb, 0x01db,
1011 0x01de, 0x01ee,
1012 0x01f2, 0x01f4,
1013 0x01fa, 0x0232,
1014 0x0248, 0x024e,
1015 0x0370, 0x0372,
1016 0x03d8, 0x03ee,
1017 0x0460, 0x0480,
1018 0x048a, 0x04be,
1019 0x04c3, 0x04cd,
1020 0x04d0, 0x0526,
1021 0x1e00, 0x1e94,
1022 0x1ea0, 0x1efe,
1023 0x1f59, 0x1f5f,
1024 0x2c67, 0x2c6b,
1025 0x2c82, 0x2ce2,
1026 0x2ceb, 0x2ced,
1027 0xa640, 0xa66c,
1028 0xa680, 0xa696,
1029 0xa722, 0xa72e,
1030 0xa732, 0xa76e,
1031 0xa779, 0xa77b,
1032 0xa780, 0xa786,
1033 0xa78b, 0xa78d,
1034 0xa790, 0xa792,
1035 0xa7a0, 0xa7aa,
1036 };
1037
1038 static Rune __istitles[] = {
1039 0x0184,
1040 0x01a9,
1041 0x01ac,
1042 0x01b5,
1043 0x01bc,
1044 0x01c5,
1045 0x01c8,
1046 0x0241,
1047 0x0376,
1048 0x0386,
1049 0x038c,
1050 0x03cf,
1051 0x03f7,
1052 0x10c7,
1053 0x10cd,
1054 0x2132,
1055 0x2183,
1056 0x2c60,
1057 0x2c72,
1058 0x2c75,
1059 0x2cf2,
1060 };
1061
1062 int
istitlerune(Rune c)1063 istitlerune(Rune c)
1064 {
1065 Rune *p;
1066
1067 p = rbsearch(c, __istitler, nelem(__istitler)/2, 2);
1068 if(p && c >= p[0] && c <= p[1])
1069 return 1;
1070 p = rbsearch(c, __istitlep, nelem(__istitlep)/2, 2);
1071 if(p && c >= p[0] && c <= p[1] && !((c - p[0]) & 1))
1072 return 1;
1073 p = rbsearch(c, __istitles, nelem(__istitles), 1);
1074 if(p && c == p[0])
1075 return 1;
1076 return 0;
1077 }
1078
1079 static Rune __toupperr[] = {
1080 0x0061, 0x007a, 1048544,
1081 0x00e0, 0x00f6, 1048544,
1082 0x00f8, 0x00fe, 1048544,
1083 0x023f, 0x0240, 1059391,
1084 0x0256, 0x0257, 1048371,
1085 0x028a, 0x028b, 1048359,
1086 0x037b, 0x037d, 1048706,
1087 0x03ad, 0x03af, 1048539,
1088 0x03b1, 0x03c1, 1048544,
1089 0x03c3, 0x03cb, 1048544,
1090 0x03cd, 0x03ce, 1048513,
1091 0x0430, 0x044f, 1048544,
1092 0x0450, 0x045f, 1048496,
1093 0x0561, 0x0586, 1048528,
1094 0x1f00, 0x1f07, 1048584,
1095 0x1f10, 0x1f15, 1048584,
1096 0x1f20, 0x1f27, 1048584,
1097 0x1f30, 0x1f37, 1048584,
1098 0x1f40, 0x1f45, 1048584,
1099 0x1f60, 0x1f67, 1048584,
1100 0x1f70, 0x1f71, 1048650,
1101 0x1f72, 0x1f75, 1048662,
1102 0x1f76, 0x1f77, 1048676,
1103 0x1f78, 0x1f79, 1048704,
1104 0x1f7a, 0x1f7b, 1048688,
1105 0x1f7c, 0x1f7d, 1048702,
1106 0x1f80, 0x1f87, 1048584,
1107 0x1f90, 0x1f97, 1048584,
1108 0x1fa0, 0x1fa7, 1048584,
1109 0x1fb0, 0x1fb1, 1048584,
1110 0x1fd0, 0x1fd1, 1048584,
1111 0x1fe0, 0x1fe1, 1048584,
1112 0x2170, 0x217f, 1048560,
1113 0x24d0, 0x24e9, 1048550,
1114 0x2c30, 0x2c5e, 1048528,
1115 0x2d00, 0x2d25, 1041312,
1116 0xff41, 0xff5a, 1048544,
1117 0x10428, 0x1044f, 1048536,
1118 };
1119
1120 static Rune __toupperp[] = {
1121 0x0101, 0x012f, 1048575,
1122 0x0133, 0x0137, 1048575,
1123 0x013a, 0x0148, 1048575,
1124 0x014b, 0x0177, 1048575,
1125 0x017a, 0x017e, 1048575,
1126 0x0183, 0x0185, 1048575,
1127 0x01a1, 0x01a5, 1048575,
1128 0x01b4, 0x01b6, 1048575,
1129 0x01ce, 0x01dc, 1048575,
1130 0x01df, 0x01ef, 1048575,
1131 0x01f9, 0x021f, 1048575,
1132 0x0223, 0x0233, 1048575,
1133 0x0247, 0x024f, 1048575,
1134 0x0371, 0x0373, 1048575,
1135 0x03d9, 0x03ef, 1048575,
1136 0x0461, 0x0481, 1048575,
1137 0x048b, 0x04bf, 1048575,
1138 0x04c2, 0x04ce, 1048575,
1139 0x04d1, 0x0527, 1048575,
1140 0x1e01, 0x1e95, 1048575,
1141 0x1ea1, 0x1eff, 1048575,
1142 0x1f51, 0x1f57, 1048584,
1143 0x2c68, 0x2c6c, 1048575,
1144 0x2c81, 0x2ce3, 1048575,
1145 0x2cec, 0x2cee, 1048575,
1146 0xa641, 0xa66d, 1048575,
1147 0xa681, 0xa697, 1048575,
1148 0xa723, 0xa72f, 1048575,
1149 0xa733, 0xa76f, 1048575,
1150 0xa77a, 0xa77c, 1048575,
1151 0xa77f, 0xa787, 1048575,
1152 0xa791, 0xa793, 1048575,
1153 0xa7a1, 0xa7a9, 1048575,
1154 };
1155
1156 static Rune __touppers[] = {
1157 0x00b5, 1049319,
1158 0x00ff, 1048697,
1159 0x0131, 1048344,
1160 0x017f, 1048276,
1161 0x0180, 1048771,
1162 0x0188, 1048575,
1163 0x018c, 1048575,
1164 0x0192, 1048575,
1165 0x0195, 1048673,
1166 0x0199, 1048575,
1167 0x019a, 1048739,
1168 0x019e, 1048706,
1169 0x01a8, 1048575,
1170 0x01ad, 1048575,
1171 0x01b0, 1048575,
1172 0x01b9, 1048575,
1173 0x01bd, 1048575,
1174 0x01bf, 1048632,
1175 0x01c5, 1048575,
1176 0x01c6, 1048574,
1177 0x01c8, 1048575,
1178 0x01c9, 1048574,
1179 0x01cb, 1048575,
1180 0x01cc, 1048574,
1181 0x01dd, 1048497,
1182 0x01f2, 1048575,
1183 0x01f3, 1048574,
1184 0x01f5, 1048575,
1185 0x023c, 1048575,
1186 0x0242, 1048575,
1187 0x0250, 1059359,
1188 0x0251, 1059356,
1189 0x0252, 1059358,
1190 0x0253, 1048366,
1191 0x0254, 1048370,
1192 0x0259, 1048374,
1193 0x025b, 1048373,
1194 0x0260, 1048371,
1195 0x0263, 1048369,
1196 0x0265, 1090856,
1197 0x0266, 1090884,
1198 0x0268, 1048367,
1199 0x0269, 1048365,
1200 0x026b, 1059319,
1201 0x026f, 1048365,
1202 0x0271, 1059325,
1203 0x0272, 1048363,
1204 0x0275, 1048362,
1205 0x027d, 1059303,
1206 0x0280, 1048358,
1207 0x0283, 1048358,
1208 0x0288, 1048358,
1209 0x0289, 1048507,
1210 0x028c, 1048505,
1211 0x0292, 1048357,
1212 0x0345, 1048660,
1213 0x0377, 1048575,
1214 0x03ac, 1048538,
1215 0x03c2, 1048545,
1216 0x03cc, 1048512,
1217 0x03d0, 1048514,
1218 0x03d1, 1048519,
1219 0x03d5, 1048529,
1220 0x03d6, 1048522,
1221 0x03d7, 1048568,
1222 0x03f0, 1048490,
1223 0x03f1, 1048496,
1224 0x03f2, 1048583,
1225 0x03f5, 1048480,
1226 0x03f8, 1048575,
1227 0x03fb, 1048575,
1228 0x04cf, 1048561,
1229 0x1d79, 1083908,
1230 0x1d7d, 1052390,
1231 0x1e9b, 1048517,
1232 0x1fb3, 1048585,
1233 0x1fbe, 1041371,
1234 0x1fc3, 1048585,
1235 0x1fe5, 1048583,
1236 0x1ff3, 1048585,
1237 0x214e, 1048548,
1238 0x2184, 1048575,
1239 0x2c61, 1048575,
1240 0x2c65, 1037781,
1241 0x2c66, 1037784,
1242 0x2c73, 1048575,
1243 0x2c76, 1048575,
1244 0x2cf3, 1048575,
1245 0x2d27, 1041312,
1246 0x2d2d, 1041312,
1247 0xa78c, 1048575,
1248 };
1249
1250 Rune
toupperrune(Rune c)1251 toupperrune(Rune c)
1252 {
1253 Rune *p;
1254
1255 p = rbsearch(c, __toupperr, nelem(__toupperr)/3, 3);
1256 if(p && c >= p[0] && c <= p[1])
1257 return c + p[2] - 1048576;
1258 p = rbsearch(c, __toupperp, nelem(__toupperp)/3, 3);
1259 if(p && c >= p[0] && c <= p[1] && !((c - p[0]) & 1))
1260 return c + p[2] - 1048576;
1261 p = rbsearch(c, __touppers, nelem(__touppers)/2, 2);
1262 if(p && c == p[0])
1263 return c + p[1] - 1048576;
1264 return c;
1265 }
1266
1267 static Rune __tolowerr[] = {
1268 0x0041, 0x005a, 1048608,
1269 0x00c0, 0x00d6, 1048608,
1270 0x00d8, 0x00de, 1048608,
1271 0x0189, 0x018a, 1048781,
1272 0x01b1, 0x01b2, 1048793,
1273 0x0388, 0x038a, 1048613,
1274 0x038e, 0x038f, 1048639,
1275 0x0391, 0x03a1, 1048608,
1276 0x03a3, 0x03ab, 1048608,
1277 0x03fd, 0x03ff, 1048446,
1278 0x0400, 0x040f, 1048656,
1279 0x0410, 0x042f, 1048608,
1280 0x0531, 0x0556, 1048624,
1281 0x10a0, 0x10c5, 1055840,
1282 0x1f08, 0x1f0f, 1048568,
1283 0x1f18, 0x1f1d, 1048568,
1284 0x1f28, 0x1f2f, 1048568,
1285 0x1f38, 0x1f3f, 1048568,
1286 0x1f48, 0x1f4d, 1048568,
1287 0x1f68, 0x1f6f, 1048568,
1288 0x1f88, 0x1f8f, 1048568,
1289 0x1f98, 0x1f9f, 1048568,
1290 0x1fa8, 0x1faf, 1048568,
1291 0x1fb8, 0x1fb9, 1048568,
1292 0x1fba, 0x1fbb, 1048502,
1293 0x1fc8, 0x1fcb, 1048490,
1294 0x1fd8, 0x1fd9, 1048568,
1295 0x1fda, 0x1fdb, 1048476,
1296 0x1fe8, 0x1fe9, 1048568,
1297 0x1fea, 0x1feb, 1048464,
1298 0x1ff8, 0x1ff9, 1048448,
1299 0x1ffa, 0x1ffb, 1048450,
1300 0x2160, 0x216f, 1048592,
1301 0x24b6, 0x24cf, 1048602,
1302 0x2c00, 0x2c2e, 1048624,
1303 0x2c7e, 0x2c7f, 1037761,
1304 0xff21, 0xff3a, 1048608,
1305 0x10400, 0x10427, 1048616,
1306 };
1307
1308 static Rune __tolowerp[] = {
1309 0x0100, 0x012e, 1048577,
1310 0x0132, 0x0136, 1048577,
1311 0x0139, 0x0147, 1048577,
1312 0x014a, 0x0176, 1048577,
1313 0x017b, 0x017d, 1048577,
1314 0x01a2, 0x01a4, 1048577,
1315 0x01b3, 0x01b5, 1048577,
1316 0x01cd, 0x01db, 1048577,
1317 0x01de, 0x01ee, 1048577,
1318 0x01f8, 0x021e, 1048577,
1319 0x0222, 0x0232, 1048577,
1320 0x0248, 0x024e, 1048577,
1321 0x0370, 0x0372, 1048577,
1322 0x03d8, 0x03ee, 1048577,
1323 0x0460, 0x0480, 1048577,
1324 0x048a, 0x04be, 1048577,
1325 0x04c3, 0x04cd, 1048577,
1326 0x04d0, 0x0526, 1048577,
1327 0x1e00, 0x1e94, 1048577,
1328 0x1ea0, 0x1efe, 1048577,
1329 0x1f59, 0x1f5f, 1048568,
1330 0x2c67, 0x2c6b, 1048577,
1331 0x2c80, 0x2ce2, 1048577,
1332 0x2ceb, 0x2ced, 1048577,
1333 0xa640, 0xa66c, 1048577,
1334 0xa680, 0xa696, 1048577,
1335 0xa722, 0xa72e, 1048577,
1336 0xa732, 0xa76e, 1048577,
1337 0xa779, 0xa77b, 1048577,
1338 0xa780, 0xa786, 1048577,
1339 0xa790, 0xa792, 1048577,
1340 0xa7a0, 0xa7a8, 1048577,
1341 };
1342
1343 static Rune __tolowers[] = {
1344 0x0130, 1048377,
1345 0x0178, 1048455,
1346 0x0179, 1048577,
1347 0x0181, 1048786,
1348 0x0182, 1048577,
1349 0x0184, 1048577,
1350 0x0186, 1048782,
1351 0x0187, 1048577,
1352 0x018b, 1048577,
1353 0x018e, 1048655,
1354 0x018f, 1048778,
1355 0x0190, 1048779,
1356 0x0191, 1048577,
1357 0x0193, 1048781,
1358 0x0194, 1048783,
1359 0x0196, 1048787,
1360 0x0197, 1048785,
1361 0x0198, 1048577,
1362 0x019c, 1048787,
1363 0x019d, 1048789,
1364 0x019f, 1048790,
1365 0x01a0, 1048577,
1366 0x01a6, 1048794,
1367 0x01a7, 1048577,
1368 0x01a9, 1048794,
1369 0x01ac, 1048577,
1370 0x01ae, 1048794,
1371 0x01af, 1048577,
1372 0x01b7, 1048795,
1373 0x01b8, 1048577,
1374 0x01bc, 1048577,
1375 0x01c4, 1048578,
1376 0x01c5, 1048577,
1377 0x01c7, 1048578,
1378 0x01c8, 1048577,
1379 0x01ca, 1048578,
1380 0x01cb, 1048577,
1381 0x01f1, 1048578,
1382 0x01f2, 1048577,
1383 0x01f4, 1048577,
1384 0x01f6, 1048479,
1385 0x01f7, 1048520,
1386 0x0220, 1048446,
1387 0x023a, 1059371,
1388 0x023b, 1048577,
1389 0x023d, 1048413,
1390 0x023e, 1059368,
1391 0x0241, 1048577,
1392 0x0243, 1048381,
1393 0x0244, 1048645,
1394 0x0245, 1048647,
1395 0x0246, 1048577,
1396 0x0376, 1048577,
1397 0x0386, 1048614,
1398 0x038c, 1048640,
1399 0x03cf, 1048584,
1400 0x03f4, 1048516,
1401 0x03f7, 1048577,
1402 0x03f9, 1048569,
1403 0x03fa, 1048577,
1404 0x04c0, 1048591,
1405 0x04c1, 1048577,
1406 0x10c7, 1055840,
1407 0x10cd, 1055840,
1408 0x1e9e, 1040961,
1409 0x1fbc, 1048567,
1410 0x1fcc, 1048567,
1411 0x1fec, 1048569,
1412 0x1ffc, 1048567,
1413 0x2126, 1041059,
1414 0x212a, 1040193,
1415 0x212b, 1040314,
1416 0x2132, 1048604,
1417 0x2183, 1048577,
1418 0x2c60, 1048577,
1419 0x2c62, 1037833,
1420 0x2c63, 1044762,
1421 0x2c64, 1037849,
1422 0x2c6d, 1037796,
1423 0x2c6e, 1037827,
1424 0x2c6f, 1037793,
1425 0x2c70, 1037794,
1426 0x2c72, 1048577,
1427 0x2c75, 1048577,
1428 0x2cf2, 1048577,
1429 0xa77d, 1013244,
1430 0xa77e, 1048577,
1431 0xa78b, 1048577,
1432 0xa78d, 1006296,
1433 0xa7aa, 1006268,
1434 };
1435
1436 Rune
tolowerrune(Rune c)1437 tolowerrune(Rune c)
1438 {
1439 Rune *p;
1440
1441 p = rbsearch(c, __tolowerr, nelem(__tolowerr)/3, 3);
1442 if(p && c >= p[0] && c <= p[1])
1443 return c + p[2] - 1048576;
1444 p = rbsearch(c, __tolowerp, nelem(__tolowerp)/3, 3);
1445 if(p && c >= p[0] && c <= p[1] && !((c - p[0]) & 1))
1446 return c + p[2] - 1048576;
1447 p = rbsearch(c, __tolowers, nelem(__tolowers)/2, 2);
1448 if(p && c == p[0])
1449 return c + p[1] - 1048576;
1450 return c;
1451 }
1452
1453 static Rune __totitler[] = {
1454 0x0061, 0x007a, 1048544,
1455 0x00e0, 0x00f6, 1048544,
1456 0x00f8, 0x00fe, 1048544,
1457 0x023f, 0x0240, 1059391,
1458 0x0256, 0x0257, 1048371,
1459 0x028a, 0x028b, 1048359,
1460 0x037b, 0x037d, 1048706,
1461 0x03ad, 0x03af, 1048539,
1462 0x03b1, 0x03c1, 1048544,
1463 0x03c3, 0x03cb, 1048544,
1464 0x03cd, 0x03ce, 1048513,
1465 0x0430, 0x044f, 1048544,
1466 0x0450, 0x045f, 1048496,
1467 0x0561, 0x0586, 1048528,
1468 0x1f00, 0x1f07, 1048584,
1469 0x1f10, 0x1f15, 1048584,
1470 0x1f20, 0x1f27, 1048584,
1471 0x1f30, 0x1f37, 1048584,
1472 0x1f40, 0x1f45, 1048584,
1473 0x1f60, 0x1f67, 1048584,
1474 0x1f70, 0x1f71, 1048650,
1475 0x1f72, 0x1f75, 1048662,
1476 0x1f76, 0x1f77, 1048676,
1477 0x1f78, 0x1f79, 1048704,
1478 0x1f7a, 0x1f7b, 1048688,
1479 0x1f7c, 0x1f7d, 1048702,
1480 0x1f80, 0x1f87, 1048584,
1481 0x1f90, 0x1f97, 1048584,
1482 0x1fa0, 0x1fa7, 1048584,
1483 0x1fb0, 0x1fb1, 1048584,
1484 0x1fd0, 0x1fd1, 1048584,
1485 0x1fe0, 0x1fe1, 1048584,
1486 0x2170, 0x217f, 1048560,
1487 0x24d0, 0x24e9, 1048550,
1488 0x2c30, 0x2c5e, 1048528,
1489 0x2d00, 0x2d25, 1041312,
1490 0xff41, 0xff5a, 1048544,
1491 0x10428, 0x1044f, 1048536,
1492 };
1493
1494 static Rune __totitlep[] = {
1495 0x0101, 0x012f, 1048575,
1496 0x0133, 0x0137, 1048575,
1497 0x013a, 0x0148, 1048575,
1498 0x014b, 0x0177, 1048575,
1499 0x017a, 0x017e, 1048575,
1500 0x0183, 0x0185, 1048575,
1501 0x01a1, 0x01a5, 1048575,
1502 0x01b4, 0x01b6, 1048575,
1503 0x01cc, 0x01dc, 1048575,
1504 0x01df, 0x01ef, 1048575,
1505 0x01f3, 0x01f5, 1048575,
1506 0x01f9, 0x021f, 1048575,
1507 0x0223, 0x0233, 1048575,
1508 0x0247, 0x024f, 1048575,
1509 0x0371, 0x0373, 1048575,
1510 0x03d9, 0x03ef, 1048575,
1511 0x0461, 0x0481, 1048575,
1512 0x048b, 0x04bf, 1048575,
1513 0x04c2, 0x04ce, 1048575,
1514 0x04d1, 0x0527, 1048575,
1515 0x1e01, 0x1e95, 1048575,
1516 0x1ea1, 0x1eff, 1048575,
1517 0x1f51, 0x1f57, 1048584,
1518 0x2c68, 0x2c6c, 1048575,
1519 0x2c81, 0x2ce3, 1048575,
1520 0x2cec, 0x2cee, 1048575,
1521 0xa641, 0xa66d, 1048575,
1522 0xa681, 0xa697, 1048575,
1523 0xa723, 0xa72f, 1048575,
1524 0xa733, 0xa76f, 1048575,
1525 0xa77a, 0xa77c, 1048575,
1526 0xa77f, 0xa787, 1048575,
1527 0xa791, 0xa793, 1048575,
1528 0xa7a1, 0xa7a9, 1048575,
1529 };
1530
1531 static Rune __totitles[] = {
1532 0x00b5, 1049319,
1533 0x00ff, 1048697,
1534 0x0131, 1048344,
1535 0x017f, 1048276,
1536 0x0180, 1048771,
1537 0x0188, 1048575,
1538 0x018c, 1048575,
1539 0x0192, 1048575,
1540 0x0195, 1048673,
1541 0x0199, 1048575,
1542 0x019a, 1048739,
1543 0x019e, 1048706,
1544 0x01a8, 1048575,
1545 0x01ad, 1048575,
1546 0x01b0, 1048575,
1547 0x01b9, 1048575,
1548 0x01bd, 1048575,
1549 0x01bf, 1048632,
1550 0x01c4, 1048577,
1551 0x01c6, 1048575,
1552 0x01c7, 1048577,
1553 0x01c9, 1048575,
1554 0x01ca, 1048577,
1555 0x01dd, 1048497,
1556 0x01f1, 1048577,
1557 0x023c, 1048575,
1558 0x0242, 1048575,
1559 0x0250, 1059359,
1560 0x0251, 1059356,
1561 0x0252, 1059358,
1562 0x0253, 1048366,
1563 0x0254, 1048370,
1564 0x0259, 1048374,
1565 0x025b, 1048373,
1566 0x0260, 1048371,
1567 0x0263, 1048369,
1568 0x0265, 1090856,
1569 0x0266, 1090884,
1570 0x0268, 1048367,
1571 0x0269, 1048365,
1572 0x026b, 1059319,
1573 0x026f, 1048365,
1574 0x0271, 1059325,
1575 0x0272, 1048363,
1576 0x0275, 1048362,
1577 0x027d, 1059303,
1578 0x0280, 1048358,
1579 0x0283, 1048358,
1580 0x0288, 1048358,
1581 0x0289, 1048507,
1582 0x028c, 1048505,
1583 0x0292, 1048357,
1584 0x0345, 1048660,
1585 0x0377, 1048575,
1586 0x03ac, 1048538,
1587 0x03c2, 1048545,
1588 0x03cc, 1048512,
1589 0x03d0, 1048514,
1590 0x03d1, 1048519,
1591 0x03d5, 1048529,
1592 0x03d6, 1048522,
1593 0x03d7, 1048568,
1594 0x03f0, 1048490,
1595 0x03f1, 1048496,
1596 0x03f2, 1048583,
1597 0x03f5, 1048480,
1598 0x03f8, 1048575,
1599 0x03fb, 1048575,
1600 0x04cf, 1048561,
1601 0x1d79, 1083908,
1602 0x1d7d, 1052390,
1603 0x1e9b, 1048517,
1604 0x1fb3, 1048585,
1605 0x1fbe, 1041371,
1606 0x1fc3, 1048585,
1607 0x1fe5, 1048583,
1608 0x1ff3, 1048585,
1609 0x214e, 1048548,
1610 0x2184, 1048575,
1611 0x2c61, 1048575,
1612 0x2c65, 1037781,
1613 0x2c66, 1037784,
1614 0x2c73, 1048575,
1615 0x2c76, 1048575,
1616 0x2cf3, 1048575,
1617 0x2d27, 1041312,
1618 0x2d2d, 1041312,
1619 0xa78c, 1048575,
1620 };
1621
1622 Rune
totitlerune(Rune c)1623 totitlerune(Rune c)
1624 {
1625 Rune *p;
1626
1627 p = rbsearch(c, __totitler, nelem(__totitler)/3, 3);
1628 if(p && c >= p[0] && c <= p[1])
1629 return c + p[2] - 1048576;
1630 p = rbsearch(c, __totitlep, nelem(__totitlep)/3, 3);
1631 if(p && c >= p[0] && c <= p[1] && !((c - p[0]) & 1))
1632 return c + p[2] - 1048576;
1633 p = rbsearch(c, __totitles, nelem(__totitles)/2, 2);
1634 if(p && c == p[0])
1635 return c + p[1] - 1048576;
1636 return c;
1637 }
1638
1639