## Base names already used in lib/gc_sc (for avoiding 8.3 conflicts)
my %BaseNames;
-
##
## Process any args.
##
{
##
## Most of the work with aliases doesn't occur here,
- ## but rather in utf8_heavy.pl, which uses utf8_pva.pl,
- ## which contains just this function. However, this one
- ##
- ## -- japhy (2004/04/13)
+ ## but rather in utf8_heavy.pl, which uses PVA.pl,
+
+ # Placate the warnings about used only once. (They are used again, but
+ # via a typeglob lookup)
+ %utf8::PropertyAlias = ();
+ %utf8::PA_reverse = ();
+ %utf8::PropValueAlias = ();
+ %utf8::PVA_reverse = ();
+ %utf8::PVA_abbr_map = ();
open PA, "< PropertyAliases.txt"
or confess "Can't open PropertyAliases.txt: $!";
next if $abbrev eq "n/a";
$PropertyAlias{$abbrev} = $name;
$PA_reverse{$name} = $abbrev;
+
+ # The %utf8::... versions use japhy's code originally from utf8_pva.pl
+ # However, it's moved here so that we build the tables at runtime.
+ tr/ _-//d for $abbrev, $name;
+ $utf8::PropertyAlias{lc $abbrev} = $name;
+ $utf8::PA_reverse{lc $name} = $abbrev;
}
close PA;
$PropValueAlias{$prop}{$data[0]} = $data[1];
$PVA_reverse{$prop}{$data[1]} = $data[0];
}
+
+ shift @data if $prop eq 'ccc';
+ next if $data[0] eq "n/a";
+
+ $data[1] =~ tr/ _-//d;
+ $utf8::PropValueAlias{$prop}{lc $data[0]} = $data[1];
+ $utf8::PVA_reverse{$prop}{lc $data[1]} = $data[0];
+
+ my $abbr_class = ($prop eq 'gc' or $prop eq 'sc') ? 'gc_sc' : $prop;
+ $utf8::PVA_abbr_map{$abbr_class}{lc $data[0]} = $data[0];
}
close PVA;
+
+ # backwards compatibility for L& -> LC
+ $utf8::PropValueAlias{gc}{'l&'} = $utf8::PropValueAlias{gc}{lc};
+ $utf8::PVA_abbr_map{gc_sc}{'l&'} = $utf8::PVA_abbr_map{gc_sc}{lc};
+
}
my %General;
my %Cat;
+## Simple Data::Dumper alike. Good enough for our needs. We can't use the real
+## thing as we have to run under miniperl
+sub simple_dumper {
+ my @lines;
+ my $item;
+ foreach $item (@_) {
+ if (ref $item) {
+ if (ref $item eq 'ARRAY') {
+ push @lines, "[\n", simple_dumper (@$item), "],\n";
+ } elsif (ref $item eq 'HASH') {
+ push @lines, "{\n", simple_dumper (%$item), "},\n";
+ } else {
+ die "Can't cope with $item";
+ }
+ } else {
+ if (defined $item) {
+ my $copy = $item;
+ $copy =~ s/([\'\\])/\\$1/gs;
+ push @lines, "'$copy',\n";
+ } else {
+ push @lines, "undef,\n";
+ }
+ }
+ }
+ @lines;
+}
+
##
## Process UnicodeData.txt (Categories, etc.)
##
##
$Name->Write("Name.pl");
+ {
+ my @PVA = $HEADER;
+ foreach my $name (qw (PropertyAlias PA_reverse PropValueAlias
+ PVA_reverse PVA_abbr_map)) {
+ # Should I really jump through typeglob hoops just to avoid a
+ # symbolic reference? (%{"utf8::$name})
+ push @PVA, "\n", "\%utf8::$name = (\n",
+ simple_dumper (%{$utf8::{$name}}), ");\n";
+ }
+ WriteIfChanged("PVA.pl", @PVA);
+ }
+
# $Bidi->Write("Bidirectional.pl");
for (keys %Bidi) {
$Bidi{$_}->Write(
+++ /dev/null
-package utf8;
-
-##
-## Store the alias definitions for later use.
-##
-
-my $dir;
-for (@INC) {
- $dir = $_, last if -e "$_/unicore/PropertyAliases.txt";
-}
-
-use Carp 'confess';
-
-local *_;
-local $.; # localizes Pl_last_in_gv
-
-open PA, "< $dir/unicore/PropertyAliases.txt"
- or confess "Can't open PropertyAliases.txt: $!";
-while (<PA>) {
- s/#.*//;
- s/\s+$//;
- next if /^$/;
-
- my ($abbrev, $name) = split /\s*;\s*/;
- next if $abbrev eq "n/a";
- tr/ _-//d for $abbrev, $name;
- $PropertyAlias{lc $abbrev} = $name;
- $PA_reverse{lc $name} = $abbrev;
-}
-close PA;
-
-open PVA, "< $dir/unicore/PropValueAliases.txt"
- or confess "Can't open PropValueAliases.txt: $!";
-while (<PVA>) {
- s/#.*//;
- s/\s+$//;
- next if /^$/;
-
- my ($prop, @data) = split /\s*;\s*/;
- shift @data if $prop eq 'ccc';
- next if $data[0] eq "n/a";
-
- $data[1] =~ tr/ _-//d;
- $PropValueAlias{$prop}{lc $data[0]} = $data[1];
- $PVA_reverse{$prop}{lc $data[1]} = $data[0];
-
- my $abbr_class = ($prop eq 'gc' or $prop eq 'sc') ? 'gc_sc' : $prop;
- $PVA_abbr_map{$abbr_class}{lc $data[0]} = $data[0];
-}
-close PVA;
-
-# backwards compatibility for L& -> LC
-$PropValueAlias{gc}{'l&'} = $PropValueAlias{gc}{lc};
-$PVA_abbr_map{gc_sc}{'l&'} = $PVA_abbr_map{gc_sc}{lc};
-
-1;