This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
inline.h: Move some fcn '{' to column 1
[perl5.git] / regen / overload.pl
index 7ff3f12..38dac32 100644 (file)
@@ -3,7 +3,7 @@
 # Regenerate (overwriting only if changed):
 #
 #    overload.h
-#    overload.c
+#    overload.inc
 #    lib/overload/numbers.pm
 #
 # from information stored in the DATA section of this file.
@@ -16,7 +16,7 @@
 
 BEGIN {
     # Get function prototypes
-    require 'regen/regen_lib.pl';
+    require './regen/regen_lib.pl';
 }
 
 use strict;
@@ -30,20 +30,20 @@ while (<DATA>) {
   push @names, $name;
 }
 
-my $c = safer_open('overload.c-new', 'overload.c');
-my $h = safer_open('overload.h-new', 'overload.h');
-mkdir("lib/overload", 0777) unless -d 'lib/overload';
-my $p = safer_open('lib/overload/numbers.pm-new', 'lib/overload/numbers.pm');
-
-
-select $p;
+my ($c, $h) = map {
+    open_new($_, '>',
+            { by => 'regen/overload.pl', file => $_, style => '*',
+              copyright => [1997, 1998, 2000, 2001, 2005 .. 2007, 2011] });
+} 'overload.inc', 'overload.h';
 
-print read_only_top(lang => 'Perl', by => 'regen/overload.pl',
-                   file => 'lib/overload/numbers.pm', copyright => [2008]);
+mkdir("lib/overload", 0777) unless -d 'lib/overload';
+my $p = open_new('lib/overload/numbers.pm', '>',
+                { by => 'regen/overload.pl',
+                  file => 'lib/overload/numbers.pm', copyright => [2008] });
 
 {
 local $" = "\n    ";
-print <<"EOF";
+print $p <<"EOF";
 package overload::numbers;
 
 our \@names = qw#
@@ -57,20 +57,10 @@ our \@enums = qw#
 { my \$i = 0; our %names = map { \$_ => \$i++ } \@names }
 
 { my \$i = 0; our %enums = map { \$_ => \$i++ } \@enums }
-
 EOF
 }
 
-for ([$c, 'overload.c'], [$h, 'overload.h']) {
-    my ($handle, $file) = @$_;
-    print $handle read_only_top(lang => 'C', by => 'regen/overload.pl',
-                               file => $file, style => '*',
-                               copyright => [1997, 1998, 2000, 2001,
-                                            2005 .. 2007, 2011]);
-}
-
-select $h;
-print "enum {\n";
+print $h "enum {\n";
 
 for (0..$#enums) {
     my $op = $names[$_];
@@ -79,17 +69,16 @@ for (0..$#enums) {
     die if $op =~ m{\*/};
     my $l =   3 - int((length($enums[$_]) + 9) / 8);
     $l = 1 if $l < 1;
-    printf "    %s_amg,%s/* 0x%02x %-8s */\n", $enums[$_],
+    printf $h "    %s_amg,%s/* 0x%02x %-8s */\n", $enums[$_],
        ("\t" x $l), $_, $op;
 }
 
-print <<'EOF';
+print $h <<'EOF';
     max_amg_code
     /* Do not leave a trailing comma here.  C9X allows it, C89 doesn't. */
 };
 
 #define NofAMmeth max_amg_code
-
 EOF
 
 print $c <<'EOF';
@@ -129,10 +118,9 @@ print $c <<"EOT";
 };
 EOT
 
-close_and_rename($h);
-close_and_rename($c);
-close_and_rename($p);
-
+foreach ($h, $c, $p) {
+    read_only_bottom_close_and_rename($_);
+}
 __DATA__
 # Fallback should be the first
 fallback       ()
@@ -190,13 +178,20 @@ rshift            (>>
 rshift_ass     (>>=
 band           (&
 band_ass       (&=
+sband          (&.
+sband_ass      (&.=
 bor            (|
 bor_ass                (|=
+sbor           (|.
+sbor_ass       (|.=
 bxor           (^
 bxor_ass       (^=
+sbxor          (^.
+sbxor_ass      (^.=
 ncmp           (<=>
 scmp           (cmp
 compl          (~
+scompl         (~.
 atan2          (atan2
 cos            (cos
 sin            (sin
@@ -210,5 +205,3 @@ concat_ass  (.=
 smart          (~~
 ftest           (-X
 regexp          (qr
-# Note: Perl_Gv_AMupdate() assumes that DESTROY is the last entry
-DESTROY                DESTROY