line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Encoding of Korean: South Korean Romanization 2000 |
2
|
|
|
|
|
|
|
# (aka. Revised Romanization of Korean) |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# $Id: SKR_2000.pm,v 1.5 2007/11/29 14:25:31 you Exp $ |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Encode::Korean::SKR_2000; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = do { q$Revision: 1.5 $ =~ /\d+\.(\d+)/; sprintf "%.2f", $1 / 100 }; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
22587
|
use 5.008008; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
49
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
13
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
932
|
use Encode::Encoding; |
|
1
|
|
|
|
|
13076
|
|
|
1
|
|
|
|
|
41
|
|
16
|
1
|
|
|
1
|
|
11
|
use base qw(Encode::Encoding); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
151
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__PACKAGE__->Define(qw/skr-2000 skr2000 skr/); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub import { |
21
|
1
|
|
|
1
|
|
21
|
require Encode; |
22
|
1
|
|
|
|
|
48
|
Encode->export_to_level(1,@_); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# == RULES == |
27
|
1
|
|
|
1
|
|
780
|
use Encode::Korean::TransliteratorGenerator; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
337
|
|
28
|
|
|
|
|
|
|
my $coder = Encode::Korean::TransliteratorGenerator->new(); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$coder->consonants(qw(g kk n d tt r m b pp s ss ng j jj ch k t p h)); |
31
|
|
|
|
|
|
|
$coder->vowels(qw(a ae ya yae eo e yeo ye o wa wae oe yo u wo we wi yu eu ui i)); |
32
|
|
|
|
|
|
|
$coder->el('l'); |
33
|
|
|
|
|
|
|
$coder->ell('ll'); |
34
|
|
|
|
|
|
|
$coder->naught('-'); |
35
|
|
|
|
|
|
|
$coder->sep('-'); |
36
|
|
|
|
|
|
|
$coder->make(); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# == MODES == |
40
|
|
|
|
|
|
|
$coder->enmode('greedy'); |
41
|
|
|
|
|
|
|
$coder->demode('greedy'); |
42
|
|
|
|
|
|
|
sub enmode { |
43
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
44
|
0
|
|
|
|
|
|
my($mode) = @_; |
45
|
0
|
|
|
|
|
|
$coder->enmode($mode); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub demode { |
49
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
50
|
0
|
|
|
|
|
|
my($mode) = @_; |
51
|
0
|
|
|
|
|
|
$coder->demode($mode); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# == METHODS == |
56
|
|
|
|
|
|
|
# === encode === |
57
|
|
|
|
|
|
|
# * encode($string [,$check]) |
58
|
|
|
|
|
|
|
# * Encodes unicode hangul syllables (Perl internal string) |
59
|
|
|
|
|
|
|
# into transliterated (romanized) string |
60
|
|
|
|
|
|
|
sub encode ($$;$) { |
61
|
0
|
|
|
0
|
1
|
|
my ($obj, $str, $chk) = @_; |
62
|
0
|
|
|
|
|
|
my $tr = $coder->encode($str, $chk); |
63
|
0
|
0
|
|
|
|
|
$_[1] = '' if $chk; |
64
|
0
|
|
|
|
|
|
return $tr; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# |
68
|
|
|
|
|
|
|
# === decode === |
69
|
|
|
|
|
|
|
# * decode($octets [,$check]) |
70
|
|
|
|
|
|
|
# * Decodes transliteration into unicode hangul syllables (Perl internal string) |
71
|
|
|
|
|
|
|
sub decode ($$;$) { |
72
|
0
|
|
|
0
|
1
|
|
my ($obj, $str, $chk) = @_; |
73
|
0
|
|
|
|
|
|
my $han = $coder->decode($str, $chk); |
74
|
0
|
0
|
|
|
|
|
$_[1] = '' if $chk; |
75
|
0
|
|
|
|
|
|
return $han; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# === cat_decode === |
79
|
|
|
|
|
|
|
# * Needs to work with encoding pragma |
80
|
|
|
|
|
|
|
# * cat_decode($destination, $octets, $offset, $terminator [,$check]) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
__END__ |