From 64870e056a120beee73d9952c055e61d91973578 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 14 May 2011 10:10:21 -0600 Subject: [PATCH] utf8_heavy: Return pointer to special treatment hash. Many of the mapping tables that utf8_heavy.pl deals with have maps that don't fit into the general scheme of things, and a hash is generated for those. This patch causes utf8_heavy to add an entry to the object it generates containing a reference to this hash. Prior to this, the name of the hash had to be known to the users of the table. --- lib/utf8_heavy.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/utf8_heavy.pl b/lib/utf8_heavy.pl index b744b3b..13caa39 100644 --- a/lib/utf8_heavy.pl +++ b/lib/utf8_heavy.pl @@ -74,6 +74,8 @@ sub croak { require Carp; Carp::croak(@_) } # Upon success, a new (or cached) blessed object is returned with # keys TYPE, BITS, EXTRAS, LIST, and NONE with values having the # same meanings as the input parameters. + # And if there is a special-treatment hash in the file, a reference + # to it is returned in the entry with key SPECIALS my $file; ## file to load data from, and also part of the %Cache key. my $ListSorted = 0; @@ -540,6 +542,15 @@ sub croak { require Carp; Carp::croak(@_) } if ($file) { $Cache{$class, $file} = $SWASH; + if ($type + && exists $utf8::SwashInfo{$type} + && exists $utf8::SwashInfo{$type}{'specials_name'}) + { + my $specials_name = $utf8::SwashInfo{$type}{'specials_name'}; + no strict "refs"; + print STDERR "\nspecials_name => $SWASH->{'SPECIALS'}\n" if DEBUG; + $SWASH->{'SPECIALS'} = \%$specials_name; + } } pop @recursed if @recursed && $type; -- 2.7.4