summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-06-30 12:20:56 -0600
committerKarl Williamson <khw@cpan.org>2021-08-07 04:46:45 -0600
commit66af77d6a34e55b1fe5818d4274aaf43f7d7f653 (patch)
tree113ae696bb824bc50027a3cc046f49788235f539 /regen
parent0dc7c8106f0701205185b7e0ec7632a6b4d98025 (diff)
downloadperl-66af77d6a34e55b1fe5818d4274aaf43f7d7f653.tar.gz
regcharclass.pl: Get UTF EBCDIC translations
These will be used in a future commit
Diffstat (limited to 'regen')
-rwxr-xr-xregen/regcharclass.pl14
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 =~ /^[""]/ ) {