Skip to content

Commit

Permalink
regcharclass.pl: Get UTF EBCDIC translations
Browse files Browse the repository at this point in the history
These will be used in a future commit
  • Loading branch information
khwilliamson committed Aug 7, 2021
1 parent 0dc7c81 commit 66af77d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion regcharclass.h
Expand Up @@ -3765,6 +3765,6 @@
* 696e706fddd3ce8cd48c7ea91caf4c9edf5c296432d320aa7b78631f69aa9eac lib/unicore/mktables
* 50b85a67451145545a65cea370dab8d3444fbfe07e9c34cef560c5b7da9d3eef lib/unicore/version
* 0a6b5ab33bb1026531f816efe81aea1a8ffcd34a27cbea37dd6a70a63d73c844 regen/charset_translations.pl
* b4f1b6922eae1fbac74236d06906225702f8f42b315809b1d9e2c613ab4ceb24 regen/regcharclass.pl
* e91b9cdc5fda1b4e9220e5bf992184ded05252bbf9fba9f187e40be041944a46 regen/regcharclass.pl
* b2f896452d2b30da3e04800f478c60c1fd0b03d6b668689b020f1e3cf1f1cdd9 regen/regcharclass_multi_char_folds.pl
* ex: set ro: */
14 changes: 12 additions & 2 deletions regen/regcharclass.pl
Expand Up @@ -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;
Expand All @@ -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 =~ /^[""]/ ) {
Expand Down

0 comments on commit 66af77d

Please sign in to comment.