| 22 |
my %T; |
my %T; |
| 23 |
my %option; |
my %option; |
| 24 |
while (<>) { |
while (<>) { |
| 25 |
if (/^0x([0-9A-F]+)\tU\+([0-9A-F]+)\t/) { |
if (/^((?:0x|[0-9A-Za-z]+[+-])[0-9A-F]+)\tU\+([0-9A-F]+)\t/) { |
| 26 |
$T{ hex $1 } = hex $2; |
$T{ $1 } = hex $2; |
| 27 |
} elsif (/^#\?o ([A-Za-z0-9-]+)="([^"]+)"/) { |
} elsif (/^#\?o ([A-Za-z0-9-]+)="((?:[^"\\]|\\.)+)"/) { |
| 28 |
my $n = $1; $n =~ tr/-/_/; $option{$n} = $2; |
my ($n,$v) = ($1,$2); $n =~ tr/-/_/; $v =~ s/\\(.)/$1/g; $option{$n} = $v; |
| 29 |
} |
} |
| 30 |
} |
} |
| 31 |
|
|
| 32 |
require 'internal.pl'; |
require 'internal.pl'; |
| 33 |
$option{offset} ||= &internal::cp_start (%option) || $internal::cp_start{ $option{charset_name} || $option{table_name} }; |
$option{offset} ||= &internal::cp_start (%option) || $internal::cp_start{ $option{charset_name} || $option{table_name} }; |
| 34 |
|
if ($option{map_internal}) { |
| 35 |
|
eval qq{\$option{map_internal} = sub { $option{map_internal} }} or die $@; |
| 36 |
|
} else { |
| 37 |
|
$option{map_internal} = sub { |
| 38 |
|
my $c = shift; $c =~ s/0x//; $c = hex $c; |
| 39 |
|
($option{charset_dimension} > 1 ? |
| 40 |
|
(int ($c / 0x100) - $option{_start}) * $option{charset_chars} : 0) |
| 41 |
|
+ (($c % 0x100) - $option{_start}) + $option{offset}; |
| 42 |
|
}; |
| 43 |
|
} |
| 44 |
|
|
| 45 |
my (@T, @U); |
my (@T, @U); |
| 46 |
$option{_start} = $option{charset_chars} == 94 ? 0x21 : 0x20; |
$option{_start} = $option{charset_chars} == 94 ? 0x21 : 0x20; |
| 47 |
@U = sort { $a->[0] <=> $b->[0] } |
@U = sort { $a->[0] <=> $b->[0] } |
| 48 |
map { |
map { [ &{$option{map_internal}} ($_), $T{ $_ } ] } keys %T; |
|
[ ($option{charset_dimension} > 1 ? |
|
|
(int ($_ / 0x100) - $option{_start}) * $option{charset_chars} : 0) |
|
|
+ (($_ % 0x100) - $option{_start}) + $option{offset}, |
|
|
$T{ $_ } ] |
|
|
} keys %T; |
|
| 49 |
|
|
| 50 |
my $tbl = ''; |
my $tbl = ''; |
| 51 |
my $pack = ''; |
my $pack = ''; |