| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Encoding of Korean: North Korean Romanization 1992 |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id: NKR_1992.pm,v 1.7 2007/11/29 14:25:31 you Exp $ |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Encode::Korean::NKR_1992; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = do { q$Revision: 1.7 $ =~ /\d+\.(\d+)/; sprintf "%.2f", $1 / 100 }; |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
21610
|
use 5.008008; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
36
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
36
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
762
|
use Encode::Encoding; |
|
|
1
|
|
|
|
|
11492
|
|
|
|
1
|
|
|
|
|
40
|
|
|
15
|
1
|
|
|
1
|
|
8
|
use base qw(Encode::Encoding); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
133
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
__PACKAGE__->Define(qw/nkr-1992 nkr1992 nkr/); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub import { |
|
20
|
1
|
|
|
1
|
|
13
|
require Encode; |
|
21
|
1
|
|
|
|
|
38
|
Encode->export_to_level(1,@_); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# = Encoding = |
|
25
|
1
|
|
|
1
|
|
699
|
use Encode::Korean::TransliteratorGenerator; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
295
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# == RULES == |
|
28
|
|
|
|
|
|
|
my $nkr = Encode::Korean::TransliteratorGenerator->new(); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$nkr->consonants(qw(k kk n t tt r m p pp s ss ng ts tss tsh kh th ph h)); |
|
31
|
|
|
|
|
|
|
$nkr->vowels( |
|
32
|
|
|
|
|
|
|
"a", |
|
33
|
|
|
|
|
|
|
"ae", |
|
34
|
|
|
|
|
|
|
"ya", |
|
35
|
|
|
|
|
|
|
"yae", |
|
36
|
|
|
|
|
|
|
"\x{014F}", # latin small letter with breve (ŏ) |
|
37
|
|
|
|
|
|
|
"e", |
|
38
|
|
|
|
|
|
|
"y\x{014F}", |
|
39
|
|
|
|
|
|
|
"ye", |
|
40
|
|
|
|
|
|
|
"o", |
|
41
|
|
|
|
|
|
|
"wa", |
|
42
|
|
|
|
|
|
|
"wae", |
|
43
|
|
|
|
|
|
|
"oe", |
|
44
|
|
|
|
|
|
|
"yo", |
|
45
|
|
|
|
|
|
|
"u", |
|
46
|
|
|
|
|
|
|
"w\x{014F}", |
|
47
|
|
|
|
|
|
|
"we", |
|
48
|
|
|
|
|
|
|
"wi", |
|
49
|
|
|
|
|
|
|
"yu", |
|
50
|
|
|
|
|
|
|
"\x{016D}", # latin small letter u with breve (ŭ) |
|
51
|
|
|
|
|
|
|
"\x{016D}y", |
|
52
|
|
|
|
|
|
|
"i" |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
$nkr->el('l'); |
|
55
|
|
|
|
|
|
|
$nkr->ell('ll'); |
|
56
|
|
|
|
|
|
|
$nkr->naught('.'); |
|
57
|
|
|
|
|
|
|
$nkr->sep('.'); |
|
58
|
|
|
|
|
|
|
$nkr->make(); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# == MODES == |
|
61
|
|
|
|
|
|
|
$nkr->enmode('greedy'); |
|
62
|
|
|
|
|
|
|
$nkr->demode('greedy'); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub enmode { |
|
65
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
66
|
0
|
|
|
|
|
|
my($mode) = @_; |
|
67
|
0
|
|
|
|
|
|
$nkr->enmode($mode); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub demode { |
|
71
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
72
|
0
|
|
|
|
|
|
my($mode) = @_; |
|
73
|
0
|
|
|
|
|
|
$nkr->demode($mode); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# == METHODS == |
|
77
|
|
|
|
|
|
|
# === encode === |
|
78
|
|
|
|
|
|
|
# * encode($string [,$check]) |
|
79
|
|
|
|
|
|
|
# * Encodes |
|
80
|
|
|
|
|
|
|
# unicode hangul syllables (Perl internal string) |
|
81
|
|
|
|
|
|
|
# into NKR transliteration (octets) |
|
82
|
|
|
|
|
|
|
sub encode ($$;$) { |
|
83
|
0
|
|
|
0
|
1
|
|
my ($obj, $str, $chk) = @_; |
|
84
|
0
|
|
|
|
|
|
my $tr = $nkr->encode($str, $chk); |
|
85
|
0
|
0
|
|
|
|
|
$_[1] = '' if $chk; |
|
86
|
0
|
|
|
|
|
|
return $tr; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# === decode === |
|
90
|
|
|
|
|
|
|
# * decode($octets [,$check]) |
|
91
|
|
|
|
|
|
|
# * Decodes |
|
92
|
|
|
|
|
|
|
# NKR transliteration (octets) |
|
93
|
|
|
|
|
|
|
# into unicode hangul syllables (Perl internal string) |
|
94
|
|
|
|
|
|
|
sub decode ($$;$) { |
|
95
|
0
|
|
|
0
|
1
|
|
my ($obj, $str, $chk) = @_; |
|
96
|
0
|
|
|
|
|
|
my $han = $nkr->decode($str, $chk); |
|
97
|
0
|
0
|
|
|
|
|
$_[1] = '' if $chk; |
|
98
|
0
|
|
|
|
|
|
return $han; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# === cat_decode === |
|
102
|
|
|
|
|
|
|
# * Needs to work with encoding pragma |
|
103
|
|
|
|
|
|
|
# * cat_decode($destination, $octets, $offset, $terminator [,$check]) |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
|
107
|
|
|
|
|
|
|
__END__ |