Changeset View
Changeset View
Standalone View
Standalone View
head/tools/tools/locale/tools/convert_map.pl
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
# | # | ||||
# This is not a general purpose Character Map parser, but its good enough | # This is not a general purpose Character Map parser, but its good enough | ||||
# for the stock one supplied with CLDR. | # for the stock one supplied with CLDR. | ||||
# | # | ||||
sub load_utf8_cm | sub load_utf8_cm | ||||
{ | { | ||||
my $file = shift; | my $file = shift; | ||||
open(UTF8, "$file") || die "open"; | open(UTF8, "$file") || die "$!: open: $file"; | ||||
while (<UTF8>) { | while (<UTF8>) { | ||||
next if (/^#/); | next if (/^#/); | ||||
next if (/^\s*$/); | next if (/^\s*$/); | ||||
next if (/^\s*CHARMAP\s*$/); | next if (/^\s*CHARMAP\s*$/); | ||||
next if (/^\s*END\s*CHARMAP\s*$/); | next if (/^\s*END\s*CHARMAP\s*$/); | ||||
chomp; | chomp; | ||||
@words = split /\s+/; | @words = split /\s+/; | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | $val >>= 8; | ||||
} | } | ||||
return ($str); | return ($str); | ||||
} | } | ||||
$mf = shift(@ARGV); | $mf = shift(@ARGV); | ||||
$codeset = shift(@ARGV); | $codeset = shift(@ARGV); | ||||
my $max_mb; | my $max_mb; | ||||
load_utf8_cm("etc/final-maps/map.UTF-8"); | my $etcdir = (exists $ENV{'ETCDIR'}) ? $ENV{'ETCDIR'} : "etc"; | ||||
load_utf8_cm("${etcdir}/final-maps/map.UTF-8"); | |||||
load_map($mf); | load_map($mf); | ||||
if ($codeset eq "SJIS") { $max_mb = 2 } | if ($codeset eq "SJIS") { $max_mb = 2 } | ||||
elsif ($codeset eq "eucCN") { $max_mb = 2 } | elsif ($codeset eq "eucCN") { $max_mb = 2 } | ||||
elsif ($codeset eq "eucJP") { $max_mb = 3 } | elsif ($codeset eq "eucJP") { $max_mb = 3 } | ||||
elsif ($codeset eq "eucKR") { $max_mb = 2 } | elsif ($codeset eq "eucKR") { $max_mb = 2 } | ||||
elsif ($codeset eq "GBK") { $max_mb = 2 } | elsif ($codeset eq "GBK") { $max_mb = 2 } | ||||
Show All 24 Lines |