This source file includes following definitions.
- uc_composition
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <config.h>
19
20
21 #include "uninorm.h"
22
23 #include <string.h>
24
25 struct composition_rule { char codes[6]; unsigned int combined; };
26
27 #include "composition-table.h"
28
29 ucs4_t
30 uc_composition (ucs4_t uc1, ucs4_t uc2)
31 {
32 if (uc1 < 0x12000 && uc2 < 0x12000)
33 {
34 if (uc2 >= 0x1161 && uc2 < 0x1161 + 21
35 && uc1 >= 0x1100 && uc1 < 0x1100 + 19)
36 {
37
38
39 return 0xAC00 + ((uc1 - 0x1100) * 21 + (uc2 - 0x1161)) * 28;
40 }
41 else if (uc2 > 0x11A7 && uc2 < 0x11A7 + 28
42 && uc1 >= 0xAC00 && uc1 < 0xD7A4 && ((uc1 - 0xAC00) % 28) == 0)
43 {
44
45
46 return uc1 + (uc2 - 0x11A7);
47 }
48 else
49 {
50 #if 0
51 unsigned int uc = MUL1 * uc1 * MUL2 * uc2;
52 unsigned int index1 = uc >> composition_header_0;
53 if (index1 < composition_header_1)
54 {
55 int lookup1 = u_composition.level1[index1];
56 if (lookup1 >= 0)
57 {
58 unsigned int index2 = (uc >> composition_header_2) & composition_header_3;
59 int lookup2 = u_composition.level2[lookup1 + index2];
60 if (lookup2 >= 0)
61 {
62 unsigned int index3 = (uc & composition_header_4);
63 unsigned int lookup3 = u_composition.level3[lookup2 + index3];
64 if ((lookup3 >> 16) == uc2)
65 return lookup3 & ((1U << 16) - 1);
66 }
67 }
68 }
69 #else
70 char codes[6];
71 const struct composition_rule *rule;
72
73 codes[0] = (uc1 >> 16) & 0xff;
74 codes[1] = (uc1 >> 8) & 0xff;
75 codes[2] = uc1 & 0xff;
76 codes[3] = (uc2 >> 16) & 0xff;
77 codes[4] = (uc2 >> 8) & 0xff;
78 codes[5] = uc2 & 0xff;
79
80 rule = gl_uninorm_compose_lookup (codes, 6);
81 if (rule != NULL)
82 return rule->combined;
83 #endif
84 }
85 }
86 return 0;
87 }