diff options
author | Karl Williamson <khw@cpan.org> | 2021-06-30 12:20:56 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-08-07 04:46:45 -0600 |
commit | 66af77d6a34e55b1fe5818d4274aaf43f7d7f653 (patch) | |
tree | 113ae696bb824bc50027a3cc046f49788235f539 /regen | |
parent | 0dc7c8106f0701205185b7e0ec7632a6b4d98025 (diff) | |
download | perl-66af77d6a34e55b1fe5818d4274aaf43f7d7f653.tar.gz |
regcharclass.pl: Get UTF EBCDIC translations
These will be used in a future commit
Diffstat (limited to 'regen')
-rwxr-xr-x | regen/regcharclass.pl | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/regen/regcharclass.pl b/regen/regcharclass.pl index f5155aab1a..d6385e12cf 100755 --- a/regen/regcharclass.pl +++ b/regen/regcharclass.pl @@ -362,7 +362,8 @@ sub val_fmt # # Return an object -my %n2a; # Inversion of a2n, for each character set +my %n2a; # Inversion of a2n, for each character set +my %utf_2_I8; # Inversion of I8_2_utf, for each EBCDIC character set sub new { my $class= shift; @@ -381,13 +382,22 @@ sub new { my $charset = $opt{charset}; my $a2n = get_a2n($charset); - # We need to construct the map going the other way if not already done + # 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; } } + if ($charset =~ /ebcdic/i) { + my $I8_2_utf = 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; + } + } + } + foreach my $txt ( @{ $opt{txt} } ) { my $str= $txt; if ( $str =~ /^[""]/ ) { |