line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Unicode::Collate::CJK::Korean; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
711
|
use 5.006; |
|
3
|
|
|
|
|
11
|
|
4
|
3
|
|
|
3
|
|
18
|
use strict; |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
69
|
|
5
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1157
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.28'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my %jamo2prim = ( |
10
|
|
|
|
|
|
|
'1100', 0x4011, '1101', 0x4012, '1102', 0x4013, '1103', 0x4014, |
11
|
|
|
|
|
|
|
'1105', 0x4016, '1106', 0x4017, '1107', 0x4018, '1109', 0x401A, |
12
|
|
|
|
|
|
|
'110A', 0x401B, '110B', 0x401C, '110C', 0x401D, '110E', 0x401F, |
13
|
|
|
|
|
|
|
'110F', 0x4020, '1110', 0x4021, '1111', 0x4022, '1112', 0x4023, |
14
|
|
|
|
|
|
|
'1161', 0x408F, '1162', 0x4090, '1163', 0x4091, '1165', 0x4093, |
15
|
|
|
|
|
|
|
'1166', 0x4094, '1167', 0x4095, '1168', 0x4096, '1169', 0x4097, |
16
|
|
|
|
|
|
|
'116A', 0x4098, '116B', 0x4099, '116C', 0x409A, '116D', 0x409B, |
17
|
|
|
|
|
|
|
'116E', 0x409C, '116F', 0x409D, '1170', 0x409E, '1171', 0x409F, |
18
|
|
|
|
|
|
|
'1172', 0x40A0, '1173', 0x40A1, '1174', 0x40A2, '1175', 0x40A3, |
19
|
|
|
|
|
|
|
'11A8', 0x40ED, '11AB', 0x40F0, '11AF', 0x40F4, '11B7', 0x40FC, |
20
|
|
|
|
|
|
|
'11B8', 0x40FD, '11BC', 0x4101, '11BD', 0x4102, |
21
|
|
|
|
|
|
|
); # for DUCET v12.1.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
|
1806
|
my $u = shift; |
42
|
1184
|
100
|
|
|
|
4400
|
return undef if !exists $u2e{$u}; |
43
|
782
|
|
|
|
|
1053
|
my @a = @{ $u2e{$u} }; |
|
782
|
|
|
|
|
2343
|
|
44
|
782
|
|
|
|
|
1201
|
my $s = shift @a; |
45
|
782
|
|
|
|
|
1079
|
my $p = shift @a; |
46
|
782
|
|
|
|
|
3524
|
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__ |