This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regen/mk_invlists.pl: Allow multiple files to access
authorKarl Williamson <khw@cpan.org>
Sat, 6 Jan 2018 23:09:57 +0000 (16:09 -0700)
committerKarl Williamson <khw@cpan.org>
Wed, 31 Jan 2018 05:12:46 +0000 (22:12 -0700)
This changes the code so that the symbols defined by this program
can be #define'd in more than one file.

charclass_invlists.h
regen/mk_invlists.pl

index bbff009..20cbad4 100644 (file)
@@ -109537,5 +109537,5 @@ static const U8 WB_table[24][24] = {
  * 5671c3de473b25e7ea47097e4906260624dfabe3e9b1739f490aecbc3d858459 lib/unicore/mktables
  * 21653d2744fdd071f9ef138c805393901bb9547cf3e777ebf50215a191f986ea lib/unicore/version
  * 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl
- * 46df154c4b2265cab87816c85428df795cd652e193330c00a0463257b2cee92f regen/mk_invlists.pl
+ * 0a86f0efd62d395cce983ca78be05b7d67224d9a21570d32764f74b574049313 regen/mk_invlists.pl
  * ex: set ro: */
index 73632f3..32d14c9 100644 (file)
@@ -99,17 +99,21 @@ sub end_file_pound_if {
 sub switch_pound_if ($$) {
     my $name = shift;
     my $new_pound_if = shift;
+    my @new_pound_if = ref ($new_pound_if)
+                       ? @$new_pound_if
+                       : $new_pound_if;
 
     # Switch to new #if given by the 2nd argument.  If there is an override
     # for this, it instead switches to that.  The 1st argument is the
     # static's name, used to look up the overrides
 
     if (exists $exceptions_to_where_to_define{$name}) {
-        $new_pound_if = $exceptions_to_where_to_define{$name};
+        @new_pound_if = $exceptions_to_where_to_define{$name};
     }
+    $new_pound_if = join "", @new_pound_if;
 
     # Exit current #if if the new one is different from the old
-    if ($in_file_pound_if
+    if (   $in_file_pound_if
         && $in_file_pound_if !~ /$new_pound_if/)
     {
         end_file_pound_if;
@@ -117,7 +121,10 @@ sub switch_pound_if ($$) {
 
     # Enter new #if, if not already in it.
     if (! $in_file_pound_if) {
-        $in_file_pound_if = "defined($new_pound_if)";
+        foreach my $element (@new_pound_if) {
+            $element = "defined($element)";
+        }
+        $in_file_pound_if = join " || ", @new_pound_if;
         print $out_fh "\n#if $in_file_pound_if\n";
     }
 }