| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Encode::JP::Mobile::Vodafone; |
|
2
|
24
|
|
|
24
|
|
137
|
use strict; |
|
|
24
|
|
|
|
|
44
|
|
|
|
24
|
|
|
|
|
1007
|
|
|
3
|
24
|
|
|
24
|
|
131
|
use base qw(Encode::Encoding); |
|
|
24
|
|
|
|
|
42
|
|
|
|
24
|
|
|
|
|
2443
|
|
|
4
|
|
|
|
|
|
|
__PACKAGE__->Define(qw(x-sjis-vodafone-raw)); |
|
5
|
|
|
|
|
|
|
|
|
6
|
24
|
|
|
24
|
|
131
|
use Encode::Alias; |
|
|
24
|
|
|
|
|
44
|
|
|
|
24
|
|
|
|
|
48599
|
|
|
7
|
|
|
|
|
|
|
define_alias('x-sjis-softbank-raw' => 'x-sjis-vodafone-raw'); |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# G! => E001, G" => E002, G# => E003 ... |
|
10
|
|
|
|
|
|
|
# E! => E101, F! => E201, O! => E301, P! => E401, Q! => E501 |
|
11
|
|
|
|
|
|
|
my %HighCharToBit = (G => 0xE000, E => 0xE100, F => 0xE200, |
|
12
|
|
|
|
|
|
|
O => 0xE300, P => 0xE400, Q => 0xE500); |
|
13
|
|
|
|
|
|
|
my %HighBitToChar = reverse %HighCharToBit; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $range = '\x{E001}-\x{E05A}\x{E101}-\x{E15A}\x{E201}-\x{E25A}\x{E301}-\x{E34D}\x{E401}-\x{E44C}\x{E501}-\x{E539}'; |
|
16
|
|
|
|
|
|
|
my $InRange = "[$range]"; |
|
17
|
|
|
|
|
|
|
my $OutRange = "[^$range]"; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub decode($$;$) { |
|
20
|
515
|
|
|
515
|
1
|
406382
|
my($self, $char, $check) = @_; |
|
21
|
515
|
|
|
|
|
3355
|
my $str = Encode::decode("cp932", $char, Encode::FB_PERLQQ); |
|
22
|
515
|
|
|
|
|
48198
|
$str =~ s{\x1b\x24([GEFOPQ])([\x20-\x7F]+)\x0f}{ |
|
23
|
515
|
|
|
|
|
6198
|
join '', map chr($HighCharToBit{$1} | ord($_) - 32), split //, $2; |
|
24
|
|
|
|
|
|
|
}ge; |
|
25
|
515
|
50
|
|
|
|
7805
|
$_[1] = $str if $check; |
|
26
|
515
|
|
|
|
|
2068
|
$str; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub encode($$;$) { |
|
30
|
522
|
|
|
522
|
1
|
630448
|
my($self, $str, $check) = @_; |
|
31
|
522
|
|
|
|
|
917
|
my $res = ''; |
|
32
|
23
|
|
|
23
|
|
24374
|
$str =~ tr/\x{301C}/\x{FF5E}/; # ad-hoc solution for FULLWIDTH TILDE Problem |
|
|
23
|
|
|
|
|
323
|
|
|
|
23
|
|
|
|
|
501
|
|
|
|
522
|
|
|
|
|
1960
|
|
|
33
|
522
|
|
|
|
|
9759
|
$str =~ s{($InRange+)|($OutRange+)}{ |
|
34
|
548
|
|
|
|
|
1996
|
my $in = defined $1; |
|
35
|
548
|
100
|
|
|
|
1932
|
my $m = $in ? $1 : $2; |
|
36
|
548
|
100
|
|
|
|
2312
|
$res .= $in ? _encode_vodafone($m) |
|
37
|
|
|
|
|
|
|
: Encode::encode("cp932", $m, $check); |
|
38
|
548
|
|
|
|
|
38520
|
'' |
|
39
|
|
|
|
|
|
|
}egs; |
|
40
|
522
|
100
|
|
|
|
1878
|
$_[1] = $res if $check; |
|
41
|
522
|
|
|
|
|
2025
|
$res; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _encode_vodafone { |
|
45
|
518
|
|
|
518
|
|
747
|
my $str = shift; |
|
46
|
518
|
|
|
|
|
2133
|
my @str = split //, $str; |
|
47
|
518
|
|
|
|
|
857
|
my $res = "\x1b\x24"; |
|
48
|
518
|
|
|
|
|
723
|
my $buf = ''; |
|
49
|
518
|
|
|
|
|
1196
|
for my $str (@str) { |
|
50
|
546
|
|
|
|
|
1374
|
my $high = ord($str) & 0xEF00; |
|
51
|
546
|
|
|
|
|
765
|
my $low = ord($str) & 0x00FF; |
|
52
|
546
|
100
|
|
|
|
2233
|
if ($buf ne $high) { |
|
53
|
520
|
100
|
|
|
|
1271
|
$res .= "\x0f\x1b\x24" unless $buf eq ''; |
|
54
|
520
|
|
|
|
|
1134
|
$res .= $HighBitToChar{$high}; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
546
|
|
|
|
|
918
|
$res .= chr($low+32); |
|
57
|
546
|
|
|
|
|
1406
|
$buf = $high; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
518
|
|
|
|
|
1646
|
$res . "\x0f"; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |