summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-03-17 14:27:34 -0600
committerKarl Williamson <khw@cpan.org>2016-03-17 16:13:49 -0600
commit4ed2b786f0a44b01cfc49ae1a48bd9745aac2d6f (patch)
tree2e9ef371bc4f9deb62c3e7e6a5ec0d5f6bb2b4f7
parent933afa2c456ccd7f9ecc3376f645028e485c874f (diff)
downloadperl-4ed2b786f0a44b01cfc49ae1a48bd9745aac2d6f.tar.gz
mktables: Fix bug with early Unicode versions
An array had 2 optional elements at the end. I got confused about handling them. This change first deals with the final one, pops it and saves it separately if found. Then only one optional element needs to be dealt with in the course of the code. This only gets executed for very early Unicode versions
-rw-r--r--charclass_invlists.h2
-rw-r--r--lib/unicore/mktables34
-rw-r--r--regcharclass.h2
3 files changed, 22 insertions, 16 deletions
diff --git a/charclass_invlists.h b/charclass_invlists.h
index c82d986835..40ab3510e3 100644
--- a/charclass_invlists.h
+++ b/charclass_invlists.h
@@ -87887,7 +87887,7 @@ static const U8 WB_table[19][19] = {
* 1a0687fb9c6c4567e853913549df0944fe40821279a3e9cdaa6ab8679bc286fd lib/unicore/extracted/DLineBreak.txt
* 40bcfed3ca727c19e1331f6c33806231d5f7eeeabd2e6a9e06a3740c85d0c250 lib/unicore/extracted/DNumType.txt
* a18d502bad39d527ac5586d7bc93e29f565859e3bcc24ada627eff606d6f5fed lib/unicore/extracted/DNumValues.txt
- * a72f8475755d75dd9ae8d8955051d61499542f157f1c65bc43c25a3537d69e62 lib/unicore/mktables
+ * 5dbee5ba64f6ba6da74242e1d45c9dff38c232cb813e5a38543508203182cf7a lib/unicore/mktables
* 462c9aaa608fb2014cd9649af1c5c009485c60b9c8b15b89401fdc10cf6161c6 lib/unicore/version
* 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl
* 5774f77d07a81945b6a679ecce07ad90cdb334f3fb402ff63bdbecd2ec67da05 regen/mk_invlists.pl
diff --git a/lib/unicore/mktables b/lib/unicore/mktables
index 4ab9eb7ac0..6b6851f337 100644
--- a/lib/unicore/mktables
+++ b/lib/unicore/mktables
@@ -2289,10 +2289,10 @@ sub trace { return main::trace(@_); }
# points not given in the input. If not present, the default from the
# normal property is used
#
- # [4] if present must be the string 'ONLY_EARLY'. Normally, when
- # compiling Unicode versions that don't invoke the early handling, the
- # name in [1] is added as an alias to the property name used for these.
- # This parameter says to not do this.
+ # [-1] If there is an extra final element that is the string 'ONLY_EARLY'.
+ # it means to not add the name in [1] as an alias to the property name
+ # used for these. Normally, when compiling Unicode versions that don't
+ # invoke the early handling, the name is added as a synonym.
#
# Not all files can be handled in the above way, and so the code ref
# alternative is available. It can do whatever it needs to. The other
@@ -2304,6 +2304,9 @@ sub trace { return main::trace(@_); }
# makes for easier testing later on.
main::set_access('early', \%early, 'c');
+ my %only_early;
+ main::set_access('only_early', \%only_early, 'c');
+
my %required_even_in_debug_skip;
# debug_skip is used to speed up compilation during debugging by skipping
# processing files that are not needed for the task at hand. However,
@@ -2414,9 +2417,9 @@ sub trace { return main::trace(@_); }
my $progress;
my $function_instead_of_file = 0;
- if ($early{$addr}->@* > 4 && $early{$addr}[4] ne 'ONLY_EARLY') {
- Carp::my_carp_bug("If present, element [4] in 'Early => [ ... ]'"
- . " must be the string 'ONLY_EARLY'");
+ if ($early{$addr}->@* && $early{$addr}[-1] eq 'ONLY_EARLY') {
+ $only_early{$addr} = 1;
+ pop $early{$addr}->@*;
}
# If we are compiling a Unicode release earlier than the file became
@@ -2427,6 +2430,8 @@ sub trace { return main::trace(@_); }
unshift $early{$addr}->@*, 1;
# See the definition of %early for what the array elements mean.
+ # Note that we have just unshifted onto the array, so the numbers
+ # below are +1 of those in the %early description.
# If we have a property this defines, create a table and default
# map for it now (at essentially compile time), so that it will be
# available for the whole of run time. (We will want to add this
@@ -2445,8 +2450,8 @@ sub trace { return main::trace(@_); }
# If not specified by the constructor, use the default mapping
# for the regular property for this substitute one.
- if ($early{$addr}[3]) {
- $prop_object->set_default_map($early{$addr}[3]);
+ if ($early{$addr}[4]) {
+ $prop_object->set_default_map($early{$addr}[4]);
}
elsif ( defined $property{$addr}
&& defined $default_mapping{$property{$addr}})
@@ -2497,7 +2502,7 @@ END
push $each_line_handler{$addr}->@*, \&_exclude_unassigned;
if ( $v_version lt v2.0 # Hanguls in this release ...
- && defined $early{$addr}[4]) # ... need special treatment
+ && defined $early{$addr}[3]) # ... need special treatment
{
push $eof_handler{$addr}->@*, \&_fixup_obsolete_hanguls;
}
@@ -2717,11 +2722,12 @@ END
# official property, we still have to allow the publicly
# inaccessible early name so that the core code which uses it
# will work regardless.
- if (! $early{$addr}[0] && $early{$addr}->@* > 2) {
+ if ( ! $only_early{$addr}
+ && ! $early{$addr}[0]
+ && $early{$addr}->@* > 2)
+ {
my $early_property_name = $early{$addr}[2];
- if ( $property{$addr} ne $early_property_name
- && $early{$addr}->@* < 5)
- {
+ if ($property{$addr} ne $early_property_name) {
main::property_ref($property{$addr})
->add_alias($early_property_name);
}
diff --git a/regcharclass.h b/regcharclass.h
index 215325ee6f..d04fce4897 100644
--- a/regcharclass.h
+++ b/regcharclass.h
@@ -1895,7 +1895,7 @@
* 1a0687fb9c6c4567e853913549df0944fe40821279a3e9cdaa6ab8679bc286fd lib/unicore/extracted/DLineBreak.txt
* 40bcfed3ca727c19e1331f6c33806231d5f7eeeabd2e6a9e06a3740c85d0c250 lib/unicore/extracted/DNumType.txt
* a18d502bad39d527ac5586d7bc93e29f565859e3bcc24ada627eff606d6f5fed lib/unicore/extracted/DNumValues.txt
- * a72f8475755d75dd9ae8d8955051d61499542f157f1c65bc43c25a3537d69e62 lib/unicore/mktables
+ * 5dbee5ba64f6ba6da74242e1d45c9dff38c232cb813e5a38543508203182cf7a lib/unicore/mktables
* 462c9aaa608fb2014cd9649af1c5c009485c60b9c8b15b89401fdc10cf6161c6 lib/unicore/version
* 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl
* d9c04ac46bdd81bb3e26519f2b8eb6242cb12337205add3f7cf092b0c58dccc4 regen/regcharclass.pl