From 22c7467e111ce45b0cf3997c7864582cfeb7a117 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Thu, 14 Apr 2022 03:17:40 +0200 Subject: regen/mk_invlists.pl - add a way to dump the keywords hash for review This adds a way to tell mk_invlists.pl to dump the keywords hash so it can be reviewed, or used for testing or whatnot. A user can define the env var DUMP_KEYWORDS_FILE to be a file name which will be used to save the keywords hash to. If the env var is not set the file won't get written to disk. Includes regenerated output from running regen/mk_invlists.pl to keep porting/regen.t happy. --- regen/mk_invlists.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'regen') diff --git a/regen/mk_invlists.pl b/regen/mk_invlists.pl index 815a28b4e5..e5259aa118 100644 --- a/regen/mk_invlists.pl +++ b/regen/mk_invlists.pl @@ -3350,7 +3350,16 @@ my $uni_pl = open_new('lib/unicore/uni_keywords.pl', '>', read_only_bottom_close_and_rename($uni_pl, \@sources); - +if (my $file= $ENV{DUMP_KEYWORDS_FILE}) { + require Data::Dumper; + + open my $ofh, ">", $file + or die "Failed to open DUMP_KEYWORDS_FILE '$file' for write: $!"; + print $ofh Data::Dumper->new([\%keywords],['*keywords']) + ->Sortkeys(1)->Useqq(1)->Dump(); + close $ofh; + print "Wrote keywords to '$file'.\n"; +} my $keywords_fh = open_new('uni_keywords.h', '>', {style => '*', by => 'regen/mk_invlists.pl', -- cgit v1.2.1