diff options
author | Karl Williamson <khw@cpan.org> | 2021-07-01 08:48:06 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-08-07 04:46:45 -0600 |
commit | d6f90147773df18477f8998a1c0eac389f1269e2 (patch) | |
tree | 83aa229d0d6da1e0d470896236758fa6c1742993 /regen | |
parent | 769444cd0f1c5de5c1dcb9dc4b2b38dd682c85ae (diff) | |
download | perl-d6f90147773df18477f8998a1c0eac389f1269e2.tar.gz |
regcharclass.pl: Make 2 locals into global hashes
This is in preparation for a future commit
Diffstat (limited to 'regen')
-rwxr-xr-x | regen/regcharclass.pl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/regen/regcharclass.pl b/regen/regcharclass.pl index 1fec6f92c6..e555945320 100755 --- a/regen/regcharclass.pl +++ b/regen/regcharclass.pl @@ -362,7 +362,9 @@ sub val_fmt # # Return an object +my %a2n; my %n2a; # Inversion of a2n, for each character set +my %I8_2_utf; my %utf_2_I8; # Inversion of I8_2_utf, for each EBCDIC character set sub new { @@ -380,20 +382,20 @@ sub new { }, $class; my $charset = $opt{charset}; - my $a2n = get_a2n($charset); + $a2n{$charset} = get_a2n($charset); # We need to construct the maps going the other way if not already done unless (defined $n2a{$charset}) { for (my $i = 0; $i < 256; $i++) { - $n2a{$charset}->[$a2n->[$i]] = $i; + $n2a{$charset}->[$a2n{$charset}->[$i]] = $i; } } if ($charset =~ /ebcdic/i) { - my $I8_2_utf = get_I8_2_utf($charset); + $I8_2_utf{$charset} = get_I8_2_utf($charset); unless (defined $utf_2_I8{$charset}) { for (my $i = 0; $i < 256; $i++) { - $utf_2_I8{$charset}->[$I8_2_utf->[$i]] = $i; + $utf_2_I8{$charset}->[$I8_2_utf{$charset}->[$i]] = $i; } } } @@ -460,11 +462,11 @@ sub new { die "Unparsable line: $txt\n"; } my ( $cp, $cp_high, $low, $latin1, $utf8 ) - = __uni_latin1($charset, $a2n, $str ); + = __uni_latin1($charset, $a2n{$charset}, $str ); my $from; if (defined $hash_return{"\"$str\""}) { $from = $hash_return{"\"$str\""}; - $from = $a2n->[$from] if $from < 256; + $from = $a2n{$charset}->[$from] if $from < 256; } my $UTF8= $low || $utf8; my $LATIN1= $low || $latin1; |