In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/fe427a6378fe383fb343e07edbe0afaf4c9a18e0?hp=8df928d230eba79fc0097ab1c525ea0aaf62fd01>
- Log ----------------------------------------------------------------- commit fe427a6378fe383fb343e07edbe0afaf4c9a18e0 Author: Karl Williamson <[email protected]> Date: Sun Mar 27 21:39:28 2016 -0600 mktables: Don't destroy a data structure too soon. It can happen that one table depends on another table for its contents. This adds a crude mechanism to prevent the depended-upon table from being destroyed prematurely. So far this has only shown up during debugging, but it could have happened generally. M charclass_invlists.h M lib/unicore/mktables M regcharclass.h commit b82bf1ab2e741cae81b915e189d77e2325bc6b80 Author: Karl Williamson <[email protected]> Date: Mon Jan 4 22:09:55 2016 -0700 mktables: Add info under -annotate option This adds some helpful text when this option is used, which is for examining the Unicode database in great detail M charclass_invlists.h M lib/unicore/mktables M regcharclass.h commit fd2f7781c53de487918ce1b3b454abd025e35748 Author: Karl Williamson <[email protected]> Date: Sun Mar 27 21:36:05 2016 -0600 mktables: Add stack trace facility This can be used for debugging. M charclass_invlists.h M lib/unicore/mktables M regcharclass.h ----------------------------------------------------------------------- Summary of changes: charclass_invlists.h | 2 +- lib/unicore/mktables | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++-- regcharclass.h | 2 +- 3 files changed, 75 insertions(+), 4 deletions(-) diff --git a/charclass_invlists.h b/charclass_invlists.h index 6abd325..50ac8e3 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 - * 285aef7ed2bf69724b1fa9bba177640636f666e1a5dd0ba5e538d4790129bbfe lib/unicore/mktables + * a054c7cdbdc57cf0a8ffb16b0b4944800df23fd6d76fc3c46ba58c5d2b38baf0 lib/unicore/mktables * 462c9aaa608fb2014cd9649af1c5c009485c60b9c8b15b89401fdc10cf6161c6 lib/unicore/version * 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl * 12bd58cb9d5a99f631ca95e269f7f9c90dacaf81020efa5d95a995f3cdc19200 regen/mk_invlists.pl diff --git a/lib/unicore/mktables b/lib/unicore/mktables index 0e70a78..9efc759 100644 --- a/lib/unicore/mktables +++ b/lib/unicore/mktables @@ -352,6 +352,8 @@ my $unicode_reference_url = 'http://www.unicode.org/reports/tr44/'; # # trace ... if main::DEBUG && $to_trace; # +# main::stack_trace() will display what its name implies +# # If there is just one or a few files that you're debugging, you can easily # cause most everything else to be skipped. Change the line # @@ -617,6 +619,22 @@ our $to_trace = 0; } } +sub stack_trace() { + local $to_trace = 1 if main::DEBUG; + my $line = (caller(0))[2]; + my $i = 1; + + # Accumulate the stack trace + while (1) { + my ($pkg, $file, $caller_line, $caller) = caller $i++; + + last unless defined $caller; + + trace "called from $caller() at line $line"; + $line = $caller_line; + } +} + # This is for a rarely used development feature that allows you to compare two # versions of the Unicode standard without having to deal with changes caused # by the code points introduced in the later version. You probably also want @@ -5412,6 +5430,15 @@ sub trace { return main::trace(@_); } # used to override calculations. main::set_access('format', \%format, 'r', 'p_s'); + my %has_dependency; + # A boolean that gives whether some other table in this property is + # defined as the complement of this table. This is a crude, but currently + # sufficient, mechanism to make this table not get destroyed before what + # is dependent on it is. Other dependencies could be added, so the name + # was chosen to reflect a more general situation than actually is + # currently the case. + main::set_access('has_dependency', \%has_dependency, 'r', 's'); + sub new { # All arguments are key => value pairs, which you can see below, most # of which match fields documented above. Otherwise: Re_Pod_Entry, @@ -5467,6 +5494,7 @@ sub trace { return main::trace(@_); } $note{$addr} = [ ]; $file_path{$addr} = [ ]; $locked{$addr} = ""; + $has_dependency{$addr} = 0; push @{$description{$addr}}, $description if $description; push @{$note{$addr}}, $note if $note; @@ -6290,6 +6318,22 @@ END } if ($write_as_invlist) { + if ( $previous_end > 0 + && $output_range_counts{$addr}) + { + my $complement_count = $start - $previous_end - 1; + if ($complement_count > 1) { + $OUT[-1] = merge_single_annotation_line( + $OUT[-1], + "#" + . (" " x 17) + . "[" + . main::clarify_code_point_count( + $complement_count) + . "] in complement\n", + $comment_indent); + } + } # Inversion list format has a single number per line, # the starting code point of a range that matches the @@ -8134,6 +8178,15 @@ sub trace { return main::trace(@_); } } my $addr = do { no overloading; pack 'J', $self; }; $complement{$addr} = $other; + + # Be sure the other property knows we are depending on them; or the + # other table if it is one in the current property. + if ($self->property != $other->property) { + $other->property->set_has_dependency(1); + } + else { + $other->set_has_dependency(1); + } $self->lock; return; } @@ -8720,6 +8773,15 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } main::set_access('pre_declared_maps', \%pre_declared_maps, 'r', 's'); + my %has_dependency; + # A boolean that gives whether some table somewhere is defined as the + # complement of a table in this property. This is a crude, but currently + # sufficient, mechanism to make this property not get destroyed before + # what is dependent on it is. Other dependencies could be added, so the + # name was chosen to reflect a more general situation than actually is + # currently the case. + main::set_access('has_dependency', \%has_dependency, 'r', 's'); + sub new { # The only required parameter is the positionally first, name. All # other parameters are key => value pairs. See the documentation just @@ -8758,6 +8820,7 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } $has_only_code_point_maps{$addr} = 1; $table_ref{$addr} = { }; $unique_maps{$addr} = { }; + $has_dependency{$addr} = 0; $map{$addr} = Map_Table->new($name, Full_Name => $full_name{$addr}, @@ -18524,8 +18587,16 @@ sub make_property_test_script() { # Sort these so get results in same order on different runs of this # program - foreach my $property (sort { $a->name cmp $b->name } property_ref('*')) { - foreach my $table (sort { $a->name cmp $b->name } $property->tables) { + foreach my $property (sort { $a->has_dependency <=> $b->has_dependency + or + lc $a->name cmp lc $b->name + } property_ref('*')) + { + foreach my $table (sort { $a->has_dependency <=> $b->has_dependency + or + lc $a->name cmp lc $b->name + } $property->tables) + { # Find code points that match, and don't match this table. my $valid = $table->get_valid_code_point; diff --git a/regcharclass.h b/regcharclass.h index 36fa1fd..08f3dbf 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 - * 285aef7ed2bf69724b1fa9bba177640636f666e1a5dd0ba5e538d4790129bbfe lib/unicore/mktables + * a054c7cdbdc57cf0a8ffb16b0b4944800df23fd6d76fc3c46ba58c5d2b38baf0 lib/unicore/mktables * 462c9aaa608fb2014cd9649af1c5c009485c60b9c8b15b89401fdc10cf6161c6 lib/unicore/version * 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl * d9c04ac46bdd81bb3e26519f2b8eb6242cb12337205add3f7cf092b0c58dccc4 regen/regcharclass.pl -- Perl5 Master Repository
