This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Adjust where .pl suffix gets added to output filenames
[perl5.git] / lib / unicore / mktables
index 31ab73d..2e12632 100644 (file)
@@ -4973,6 +4973,23 @@ sub trace { return main::trace(@_); }
             # does.
             push @OUT, "!utf8::Any\n";
         }
+        elsif ($self->name eq 'N'
+
+               # To save disk space and table cache space, avoid putting out
+               # binary N tables, but instead create a file which just inverts
+               # the Y table.  Since the file will still exist and occupy a
+               # certain number of blocks, might as well output the whole
+               # thing if it all will fit in one block.   The number of
+               # ranges below is an approximate number for that.
+               && $self->property->type == $BINARY
+               # && $self->property->tables == 2  Can't do this because the
+               #        non-binary properties, like NFDQC aren't specifiable
+               #        by the notation
+               && $range_list{$addr}->ranges > 15
+               && ! $annotate)  # Under --annotate, want to see everything
+        {
+            push @OUT, "!utf8::" . $self->property->name . "\n";
+        }
         else {
             my $range_size_1 = $range_size_1{$addr};
             my $format;            # Used only in $annotate option
@@ -5214,10 +5231,11 @@ sub trace { return main::trace(@_); }
         my $pre_body = $self->pre_body;
         push @HEADER, $pre_body, "\n" if $pre_body;
 
-        # All these files have a .pl suffix
-        $file_path{$addr}->[-1] .= '.pl';
+        # All these files should have a .pl suffix added to them.
+        my @file_with_pl = @{$file_path{$addr}};
+        $file_with_pl[-1] .= '.pl';
 
-        main::write($file_path{$addr},
+        main::write(\@file_with_pl,
                     $annotate,      # utf8 iff annotating
                     \@HEADER,
                     \@OUT);
@@ -12238,7 +12256,7 @@ sub register_file_for_name($$$) {
 
     my $table = shift;
     my $directory_ref = shift;   # Array of the directory path for the file
-    my $file = shift;            # The file name in the final directory, [-1].
+    my $file = shift;            # The file name in the final directory.
     Carp::carp_extra_args(\@_) if main::DEBUG && @_;
 
     trace "table=$table, file=$file, directory=@$directory_ref" if main::DEBUG && $to_trace;
@@ -13439,7 +13457,6 @@ END
     foreach my $cased (keys %caseless_equivalent_to) {
         my @path = $caseless_equivalent_to{$cased}->file_path;
         my $path = join '/', @path[1, -1];
-        $path =~ s/\.pl//;
         $utf8::caseless_equivalent_to{$cased} = $path;
     }
     push @heavy, simple_dumper (\%utf8::caseless_equivalent_to, ' ' x 4);