line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Unicode::Collate::CJK::Korean; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
740
|
use 5.006; |
|
3
|
|
|
|
|
12
|
|
4
|
3
|
|
|
3
|
|
25
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
80
|
|
5
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1265
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.30'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my %jamo2prim = ( |
10
|
|
|
|
|
|
|
'1100', 0x4175, '1101', 0x4176, '1102', 0x4177, '1103', 0x4178, |
11
|
|
|
|
|
|
|
'1105', 0x417A, '1106', 0x417B, '1107', 0x417C, '1109', 0x417E, |
12
|
|
|
|
|
|
|
'110A', 0x417F, '110B', 0x4180, '110C', 0x4181, '110E', 0x4183, |
13
|
|
|
|
|
|
|
'110F', 0x4184, '1110', 0x4185, '1111', 0x4186, '1112', 0x4187, |
14
|
|
|
|
|
|
|
'1161', 0x41F3, '1162', 0x41F4, '1163', 0x41F5, '1165', 0x41F7, |
15
|
|
|
|
|
|
|
'1166', 0x41F8, '1167', 0x41F9, '1168', 0x41FA, '1169', 0x41FB, |
16
|
|
|
|
|
|
|
'116A', 0x41FC, '116B', 0x41FD, '116C', 0x41FE, '116D', 0x41FF, |
17
|
|
|
|
|
|
|
'116E', 0x4200, '116F', 0x4201, '1170', 0x4202, '1171', 0x4203, |
18
|
|
|
|
|
|
|
'1172', 0x4204, '1173', 0x4205, '1174', 0x4206, '1175', 0x4207, |
19
|
|
|
|
|
|
|
'11A8', 0x4251, '11AB', 0x4254, '11AF', 0x4258, '11B7', 0x4260, |
20
|
|
|
|
|
|
|
'11B8', 0x4261, '11BC', 0x4265, '11BD', 0x4266, |
21
|
|
|
|
|
|
|
); # for DUCET v13.0.0 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my(%u2e, $prim, $wt); |
24
|
|
|
|
|
|
|
while () { |
25
|
|
|
|
|
|
|
last if /^__END__/; |
26
|
|
|
|
|
|
|
my @c = split; |
27
|
|
|
|
|
|
|
if (@c == 1 && $c[0] =~ /^[A-D]/) { # hangul |
28
|
|
|
|
|
|
|
$c[0] =~ s/^.*://; |
29
|
|
|
|
|
|
|
$prim = [ map $jamo2prim{$_}, split /-/, $c[0] ]; |
30
|
|
|
|
|
|
|
$wt = 0x20; |
31
|
|
|
|
|
|
|
} else { # ideographs |
32
|
|
|
|
|
|
|
for my $c (@c) { |
33
|
|
|
|
|
|
|
next if !$c; |
34
|
|
|
|
|
|
|
$wt++; |
35
|
|
|
|
|
|
|
$u2e{hex($c)} = [ $wt, @$prim ]; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub weightKorean { |
41
|
1184
|
|
|
1184
|
0
|
1856
|
my $u = shift; |
42
|
1184
|
100
|
|
|
|
4553
|
return undef if !exists $u2e{$u}; |
43
|
782
|
|
|
|
|
1065
|
my @a = @{ $u2e{$u} }; |
|
782
|
|
|
|
|
2596
|
|
44
|
782
|
|
|
|
|
1287
|
my $s = shift @a; |
45
|
782
|
|
|
|
|
1057
|
my $p = shift @a; |
46
|
782
|
|
|
|
|
3164
|
return([ $p, $s, 0x2, $u ], @a); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# DATA format |
52
|
|
|
|
|
|
|
# hangul syllable:jamo-jamo(-jamo) |
53
|
|
|
|
|
|
|
# equiv. ideographs |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__DATA__ |