Change 18851 by [EMAIL PROTECTED] on 2003/03/08 06:49:35

        regen_headers tiny tidying:
        - regen.pl renamed as regen_lib.pl
        - regen_headers.pl renamed as regen.pl
        - added make target 'regen' (kept target 'regen_headers'
          for porters' brains' backward compatibility)
        - regen.pl fancified a bit to display the names
          of the files that got changed by running the scripts

Affected files ...

... //depot/perl/MANIFEST#990 edit
... //depot/perl/Makefile.SH#259 edit
... //depot/perl/autodoc.pl#6 edit
... //depot/perl/bytecode.pl#44 edit
... //depot/perl/embed.pl#331 edit
... //depot/perl/keywords.pl#23 edit
... //depot/perl/opcode.pl#102 edit
... //depot/perl/regcomp.pl#6 edit
... //depot/perl/regen.pl#2 edit
... //depot/perl/regen_headers.pl#2 delete
... //depot/perl/regen_lib.pl#1 add

Differences ...

==== //depot/perl/MANIFEST#990 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#989~18847~    Fri Mar  7 00:02:50 2003
+++ perl/MANIFEST       Fri Mar  7 22:49:35 2003
@@ -2369,8 +2369,8 @@
 regcomp.h                      Private declarations for above
 regcomp.pl                     Builder of regnodes.h
 regcomp.sym                    Data for regnodes.h
-regen.pl                       Common file routines for generator scripts
-regen_headers.pl               Run all scripts that (re)generate files
+regen.pl                       Run all scripts that (re)generate files
+regen_lib.pl                   Common file routines for generator scripts
 regexec.c                      Regular expression evaluator
 regexp.h                       Public declarations for the above
 regnodes.h                     Description of nodes of RE engine

==== //depot/perl/Makefile.SH#259 (text) ====
Index: perl/Makefile.SH
--- perl/Makefile.SH#258~18160~ Tue Nov 19 04:07:25 2002
+++ perl/Makefile.SH    Fri Mar  7 22:49:35 2003
@@ -812,20 +812,20 @@
 CHMOD_W = chmod +w
 
 # The following files are generated automatically
-#      keywords.pl:    keywords.h
-#      opcode.pl:      opcode.h opnames.h pp_proto.h pp.sym
-# [* embed.pl needs pp.sym generated by opcode.pl! *]
-#      embed.pl:       proto.h embed.h embedvar.h global.sym
-#                      perlapi.h perlapi.c pod/perlintern.pod
-#                      pod/perlapi.pod
+#      autodoc.pl:     pod/perlapi.pod pod/perlintern.pod
 #      bytecode.pl:    ext/ByteLoader/byterun.h ext/ByteLoader/byterun.c
 #                      ext/B/B/Asmdata.pm
+#      embed.pl:       proto.h embed.h embedvar.h global.sym
+#                      perlapi.h perlapi.c 
+# [* embed.pl needs pp.sym generated by opcode.pl! *]
+#      keywords.pl:    keywords.h
+#      opcode.pl:      opcode.h opnames.h pp_proto.h pp.sym
 #      regcomp.pl:     regnodes.h
 #      warnings.pl:    warnings.h lib/warnings.pm
 # The correct versions should be already supplied with the perl kit,
 # in case you don't have perl available.
 # To force them to be regenerated, run
-#       perl regen_headers.pl
+#       perl regen.pl
 # with your existing copy of perl
 # (make regen_headers is kept for backwards compatibility)
 
@@ -838,13 +838,13 @@
 
 .PHONY: regen_headers regen_pods regen_all
 
-regen_headers: FORCE
-       -perl regen_headers.pl
+regen regen_headers:   FORCE
+       -perl regen.pl
 
 regen_pods:    FORCE
        -cd pod; $(LDLIBPTH) $(MAKE) regen_pods
 
-regen_all: $(PERLYVMS) regen_headers regen_pods
+regen_all: $(PERLYVMS) regen regen_pods
 
 # Extensions:
 # Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will

==== //depot/perl/autodoc.pl#6 (text) ====
Index: perl/autodoc.pl
--- perl/autodoc.pl#5~18160~    Tue Nov 19 04:07:25 2002
+++ perl/autodoc.pl     Fri Mar  7 22:49:35 2003
@@ -5,7 +5,7 @@
 
 BEGIN {
   push @INC, 'lib';
-  require 'regen.pl';
+  require 'regen_lib.pl';
 }      # glob() below requires File::Glob
 
 

==== //depot/perl/bytecode.pl#44 (text) ====
Index: perl/bytecode.pl
--- perl/bytecode.pl#43~18160~  Tue Nov 19 04:07:25 2002
+++ perl/bytecode.pl    Fri Mar  7 22:49:35 2003
@@ -1,6 +1,6 @@
 BEGIN {
   push @INC, './lib';
-  require 'regen.pl';
+  require 'regen_lib.pl';
 }
 use strict;
 my %alias_to = (

==== //depot/perl/embed.pl#331 (xtext) ====
Index: perl/embed.pl
--- perl/embed.pl#330~18801~    Sun Mar  2 07:24:22 2003
+++ perl/embed.pl       Fri Mar  7 22:49:35 2003
@@ -5,7 +5,7 @@
 
 BEGIN {
     # Get function prototypes
-    require 'regen.pl';
+    require 'regen_lib.pl';
 }
 
 #

==== //depot/perl/keywords.pl#23 (xtext) ====
Index: perl/keywords.pl
--- perl/keywords.pl#22~18807~  Sun Mar  2 13:22:56 2003
+++ perl/keywords.pl    Fri Mar  7 22:49:35 2003
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-require 'regen.pl';
+require 'regen_lib.pl';
 safer_unlink ("keywords.h");
 open(KW, ">keywords.h") || die "Can't create keywords.h: $!\n";
 select KW;

==== //depot/perl/opcode.pl#102 (xtext) ====
Index: perl/opcode.pl
--- perl/opcode.pl#101~18801~   Sun Mar  2 07:24:22 2003
+++ perl/opcode.pl      Fri Mar  7 22:49:35 2003
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 BEGIN {
     # Get function prototypes
-    require 'regen.pl';
+    require 'regen_lib.pl';
 }
 
 $opcode_new = 'opcode.h-new';

==== //depot/perl/regcomp.pl#6 (text) ====
Index: perl/regcomp.pl
--- perl/regcomp.pl#5~18160~    Tue Nov 19 04:07:25 2002
+++ perl/regcomp.pl     Fri Mar  7 22:49:35 2003
@@ -1,6 +1,6 @@
 BEGIN {
     # Get function prototypes
-    require 'regen.pl';
+    require 'regen_lib.pl';
 }
 #use Fatal qw(open close rename chmod unlink);
 open DESC, 'regcomp.sym';

==== //depot/perl/regen.pl#2 (text) ====
Index: perl/regen.pl
--- perl/regen.pl#1~18160~      Tue Nov 19 04:07:25 2002
+++ perl/regen.pl       Fri Mar  7 22:49:35 2003
@@ -1,45 +1,64 @@
 #!/usr/bin/perl -w
-use strict;
-use vars qw($Is_W32 $Is_OS2 $Is_Cygwin $Is_NetWare $Needs_Write);
-use Config; # Remember, this is running using an existing perl
-
-# Common functions needed by the regen scripts
+require 5.003; # keep this compatible, an old perl is all we may have before
+                # we build the new one
 
-$Is_W32 = $^O eq 'MSWin32';
-$Is_OS2 = $^O eq 'os2';
-$Is_Cygwin = $^O eq 'cygwin';
-$Is_NetWare = $Config{osname} eq 'NetWare';
-if ($Is_NetWare) {
-  $Is_W32 = 0;
-}
+# The idea is to move the regen_headers target out of the Makefile so that
+# it is possible to rebuild the headers before the Makefile is available.
+# (and the Makefile is unavailable until after Configure is run, and we may
+# wish to make a clean source tree but with current headers without running
+# anything else.
 
-$Needs_Write = $Is_OS2 || $Is_W32 || $Is_Cygwin || $Is_NetWare;
-
-sub safer_unlink {
-  my @names = @_;
-  my $cnt = 0;
-
-  my $name;
-  foreach $name (@names) {
-    next unless -e $name;
-    chmod 0777, $name if $Needs_Write;
-    ( CORE::unlink($name) and ++$cnt
-      or warn "Couldn't unlink $name: $!\n" );
-  }
-  return $cnt;
-}
-
-sub safer_rename_silent {
-  my ($from, $to) = @_;
+use strict;
+my $perl = $^X;
 
-  # Some dosish systems can't rename over an existing file:
-  safer_unlink $to;
-  chmod 0600, $from if $Needs_Write;
-  rename $from, $to;
+require 'regen_lib.pl';
+# keep warnings.pl in sync with the CPAN distribution by not requiring core
+# changes
+safer_unlink ("warnings.h", "lib/warnings.pm");
+
+my %gen = (
+          'autodoc.pl'  => [qw[pod/perlapi.pod pod/perlintern.pod]],
+          'bytecode.pl' => [qw[ext/ByteLoader/byterun.h
+                               ext/ByteLoader/byterun.c
+                               ext/B/B/Asmdata.pm]],
+          'embed.pl'    => [qw[proto.h embed.h embedvar.h global.sym
+                               perlapi.h perlapi.c]],
+          'keywords.pl' => [qw[keywords.h]],
+          'opcode.pl'   => [qw[opcode.h opnames.h pp_proto.h pp.sym]],
+          'regcomp.pl'  => [qw[regnodes.h]],
+          'warnings.pl' => [qw[warnings.h lib/warnings.pm]]
+          );
+
+sub do_cksum {
+    my $pl = shift;
+    my %cksum;
+    for my $f (@{ $gen{$pl} }) {
+       local *FH;
+       if (open(FH, $f)) {
+           local $/;
+           $cksum{$f} = unpack("%32C*", <FH>);
+           close FH;
+       } else {
+           warn "$0: $f: $!\n";
+       }
+    }
+    return %cksum;
 }
 
-sub safer_rename {
-  my ($from, $to) = @_;
-  safer_rename_silent($from, $to) or die "renaming $from to $to: $!";
+foreach my $pl (qw (keywords.pl opcode.pl embed.pl bytecode.pl
+                   regcomp.pl warnings.pl autodoc.pl)) {
+  print "$^X $pl\n";
+  my %cksum0;
+  %cksum0 = do_cksum($pl) unless $pl eq 'warnings.pl'; # the files were removed
+  system "$^X $pl";
+  next if $pl eq 'warnings.pl'; # the files were removed
+  my %cksum1 = do_cksum($pl);
+  my @chg;
+  for my $f (@{ $gen{$pl} }) {
+      push(@chg, $f)
+         if !defined($cksum0{$f}) ||
+            !defined($cksum1{$f}) ||
+            $cksum0{$f} ne $cksum1{$f};
+  }
+  print "Changed: @chg\n" if @chg;
 }
-1;

==== //depot/perl/regen_lib.pl#1 (text) ====
Index: perl/regen_lib.pl
--- /dev/null   Tue May  5 13:32:27 1998
+++ perl/regen_lib.pl   Fri Mar  7 22:49:35 2003
@@ -0,0 +1,45 @@
+#!/usr/bin/perl -w
+use strict;
+use vars qw($Is_W32 $Is_OS2 $Is_Cygwin $Is_NetWare $Needs_Write);
+use Config; # Remember, this is running using an existing perl
+
+# Common functions needed by the regen scripts
+
+$Is_W32 = $^O eq 'MSWin32';
+$Is_OS2 = $^O eq 'os2';
+$Is_Cygwin = $^O eq 'cygwin';
+$Is_NetWare = $Config{osname} eq 'NetWare';
+if ($Is_NetWare) {
+  $Is_W32 = 0;
+}
+
+$Needs_Write = $Is_OS2 || $Is_W32 || $Is_Cygwin || $Is_NetWare;
+
+sub safer_unlink {
+  my @names = @_;
+  my $cnt = 0;
+
+  my $name;
+  foreach $name (@names) {
+    next unless -e $name;
+    chmod 0777, $name if $Needs_Write;
+    ( CORE::unlink($name) and ++$cnt
+      or warn "Couldn't unlink $name: $!\n" );
+  }
+  return $cnt;
+}
+
+sub safer_rename_silent {
+  my ($from, $to) = @_;
+
+  # Some dosish systems can't rename over an existing file:
+  safer_unlink $to;
+  chmod 0600, $from if $Needs_Write;
+  rename $from, $to;
+}
+
+sub safer_rename {
+  my ($from, $to) = @_;
+  safer_rename_silent($from, $to) or die "renaming $from to $to: $!";
+}
+1;
End of Patch.

Reply via email to