#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy is of the CDDL is also available via the Internet
#
#
# Copyright 2010 Nexenta Systems, Inc. All rights reserved.
#
# This converts MAPPING files to localedef character maps
# suitable for use with the UTF-8 derived localedef data.
sub ucs_to_utf8
{
my $ucs = shift;
my $utf8;
if ($ucs <= 0x7f) {
} elsif ($ucs <= 0x7ff) {
$ucs >>= 6;
} elsif ($ucs <= 0xffff) {
$ucs >>= 6;
$ucs >>= 6;
} elsif ($ucs <= 0x1fffff) {
$ucs >>= 6;
$ucs >>= 6;
$ucs >>= 6;
} elsif ($ucs <= 0x03ffffff) {
$ucs >>= 6;
$ucs >>= 6;
$ucs >>= 6;
$ucs >>= 6;
} else {
$ucs >>= 6;
$ucs >>= 6;
$ucs >>= 6;
$ucs >>= 6;
$ucs >>= 6;
}
return ($utf8);
}
my %unames;
my %uvalues;
#
# This is not a general purpose Character Map parser, but its good enough
# for the stock one supplied with CLDR.
#
sub load_utf8_cm
{
my $file = shift;
while (<UTF8>) {
next if (/^#/);
next if (/^\s*$/);
next if (/^\s*CHARMAP\s*$/);
next if (/^\s*END\s*CHARMAP\s*$/);
chomp;
@words = split /\s+/;
} else {
}
}
close(UTF8);
}
my %map;
sub load_map
{
my $file = shift;
while (<MAP>) {
next if (/^#/);
next if (/^\s*$/);
chomp;
@words = split /\s+/;
$utf8 =~ s/^\\x[0]*//;
} else {
}
}
}
sub mb_str
{
my $val = shift;
my $str = "";
if ($val == 0) {
return ("\\x00");
}
while ($val) {
$val >>= 8;
}
return ($str);
}
load_utf8_cm("UTF-8.cm");
print("CHARMAP\n");
#$utf8 = $map{$val};
print "$name";
while ($nt) {
print "\t";
$nt--;
}
}
}
}
print "END CHARMAP\n";