Changeset View
Changeset View
Standalone View
Standalone View
tools/tools/locale/tools/unicode2src.pl
#!/usr/bin/perl -wC | #!/usr/bin/perl -wC | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
use strict; | use strict; | ||||
use XML::Parser; | use XML::Parser; | ||||
use Tie::IxHash; | use Tie::IxHash; | ||||
use Data::Dumper; | use Data::Dumper; | ||||
use Getopt::Long; | use Getopt::Long; | ||||
use Digest::SHA qw(sha1_hex); | use Digest::SHA qw(sha1_hex); | ||||
if ($#ARGV < 2) { | if ($#ARGV < 2) { | ||||
print "Usage: $0 --cldr=<cldrdir> --unidata=<unidatadir> --etc=<etcdir> --input=<inputfile> --output=<outputfile>\n"; | print "Usage: $0 --unidir=<unidir> --etc=<etcdir> --input=<inputfile> --output=<outputfile>\n"; | ||||
exit(1); | exit(1); | ||||
} | } | ||||
my @filter = (); | my @filter = (); | ||||
my $CLDRDIR = undef; | my $UNIDIR = undef; | ||||
my $UNIDATADIR = undef; | |||||
my $ETCDIR = undef; | my $ETCDIR = undef; | ||||
my $TYPE = undef; | my $TYPE = undef; | ||||
my $INPUT = undef; | my $INPUT = undef; | ||||
my $OUTPUT = undef; | my $OUTPUT = undef; | ||||
my $result = GetOptions ( | my $result = GetOptions ( | ||||
"cldr=s" => \$CLDRDIR, | "unidir=s" => \$UNIDIR, | ||||
"unidata=s" => \$UNIDATADIR, | |||||
"etc=s" => \$ETCDIR, | "etc=s" => \$ETCDIR, | ||||
"type=s" => \$TYPE, | "type=s" => \$TYPE, | ||||
"input=s" => \$INPUT, | "input=s" => \$INPUT, | ||||
"output=s" => \$OUTPUT, | "output=s" => \$OUTPUT, | ||||
); | ); | ||||
my %ucd = (); | my %ucd = (); | ||||
my %utf8map = (); | my %utf8map = (); | ||||
my %utf8aliases = (); | my %utf8aliases = (); | ||||
get_unidata($UNIDATADIR); | get_unidata($UNIDIR); | ||||
get_utf8map("$CLDRDIR/posix/UTF-8.cm"); | get_utf8map("$UNIDIR/posix/UTF-8.cm"); | ||||
convert($INPUT, $OUTPUT); | convert($INPUT, $OUTPUT); | ||||
############################ | ############################ | ||||
sub get_unidata { | sub get_unidata { | ||||
my $directory = shift; | my $directory = shift; | ||||
open(FIN, "$directory/UnicodeData.txt") | open(FIN, "$directory/UnicodeData.txt") | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |