embed.pl doc. (embed.pl reorganization for doc headers)
authorH.Merijn Brand <h.m.brand@xs4all.nl>
Sun, 27 Oct 2002 06:02:21 +0000 (06:02 +0000)
committerH.Merijn Brand <h.m.brand@xs4all.nl>
Sun, 27 Oct 2002 06:02:21 +0000 (06:02 +0000)
Wed, 23 Oct 2002; Jarkko Hietaniemi <jhi@iki.fi>
With some additional modifications

p4raw-id: //depot/perl@18067

embed.pl

index 74abb17..548294a 100755 (executable)
--- a/embed.pl
+++ b/embed.pl
@@ -10,6 +10,40 @@ require 5.003;       # keep this compatible, an old perl is all we may have before
 # implicit interpreter context argument.
 #
 
+sub do_not_edit ($)
+{
+    my $file = shift;
+    my $warning = <<EOW;
+
+   $file
+
+   Copyright (c) 1997-2002, Larry Wall
+
+   You may distribute under the terms of either the GNU General Public
+   License or the Artistic License, as specified in the README file.
+
+!!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
+This file is built by embed.pl from data in embed.fnc, embed.pl,
+pp.sym, intrpvar.h, perlvars.h and thrdvar.h.
+Any changes made here will be lost!
+
+Edit those files and run 'make regen_headers' to effect changes.
+
+EOW
+
+    if ($file =~ m:\.[ch]$:) {
+$warning =~ s:^: * :gm;
+$warning =~ s: +$::gm;
+$warning =~ s: :/:;
+$warning =~ s:$:/:;
+    }
+    else {
+$warning =~ s:^:# :gm;
+$warning =~ s: +$::gm;
+    }
+    $warning;
+} # do_not_edit
+
 open IN, "embed.fnc" or die $!;
 
 # walk table providing an array of components in each line to
@@ -17,7 +51,7 @@ open IN, "embed.fnc" or die $!;
 sub walk_table (&@) {
     my $function = shift;
     my $filename = shift || '-';
-    my $leader = shift;
+    my $leader = shift || do_not_edit ($filename);
     my $trailer = shift;
     my $F;
     local *F;
@@ -166,38 +200,8 @@ sub write_global_sym {
     $ret;
 }
 
-
-walk_table(\&write_protos, 'proto.h', <<'EOT');
-/*
- *    proto.h
- *
- *    Copyright (c) 1997-2002, Larry Wall
- *
- *    You may distribute under the terms of either the GNU General Public
- *    License or the Artistic License, as specified in the README file.
- *
- * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
- * This file is autogenerated from data in embed.pl.  Edit that file
- * and run 'make regen_headers' to effect changes.
- */
-
-EOT
-
-walk_table(\&write_global_sym, 'global.sym', <<'EOT');
-#
-#    global.sym
-#
-#    Copyright (c) 1997-2002, Larry Wall
-#
-#    You may distribute under the terms of either the GNU General Public
-#    License or the Artistic License, as specified in the README file.
-#
-# !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
-# This file is autogenerated from data in embed.pl.  Edit that file
-# and run 'make regen_headers' to effect changes.
-#
-
-EOT
+walk_table(\&write_protos,     "proto.h");
+walk_table(\&write_global_sym, "global.sym");
 
 # XXX others that may need adding
 #       warnhook
@@ -300,19 +304,7 @@ sub multoff ($$) {
 unlink 'embed.h';
 open(EM, '> embed.h') or die "Can't create embed.h: $!\n";
 
-print EM <<'END';
-/*
- *    embed.h
- *
- *    Copyright (c) 1997-2002, Larry Wall
- *
- *    You may distribute under the terms of either the GNU General Public
- *    License or the Artistic License, as specified in the README file.
- *
- *  !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
- *  This file is built by embed.pl from data in embed.pl, pp.sym, intrpvar.h,
- *  perlvars.h and thrdvar.h.  Any changes made here will be lost!
- */
+print EM do_not_edit ("embed.h"), <<'END';
 
 /* (Doing namespace management portably in C is really gross.) */
 
@@ -501,20 +493,7 @@ unlink 'embedvar.h';
 open(EM, '> embedvar.h')
     or die "Can't create embedvar.h: $!\n";
 
-print EM <<'END';
-/*
- *    embedvar.h
- *
- *    Copyright (c) 1997-2002, Larry Wall
- *
- *    You may distribute under the terms of either the GNU General Public
- *    License or the Artistic License, as specified in the README file.
- *
- *
- * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
- *  This file is built by embed.pl from data in embed.pl, pp.sym, intrpvar.h,
- *  perlvars.h and thrdvar.h.  Any changes made here will be lost!
- */
+print EM do_not_edit ("embedvar.h"), <<'END';
 
 /* (Doing namespace management portably in C is really gross.) */
 
@@ -622,20 +601,7 @@ unlink 'perlapi.c';
 open(CAPI, '> perlapi.c') or die "Can't create perlapi.c: $!\n";
 open(CAPIH, '> perlapi.h') or die "Can't create perlapi.h: $!\n";
 
-print CAPIH <<'EOT';
-/*
- *    perlapi.h
- *
- *    Copyright (c) 1997-2002, Larry Wall
- *
- *    You may distribute under the terms of either the GNU General Public
- *    License or the Artistic License, as specified in the README file.
- *
- *
- * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
- *  This file is built by embed.pl from data in embed.pl, pp.sym, intrpvar.h,
- *  perlvars.h and thrdvar.h.  Any changes made here will be lost!
- */
+print CAPIH do_not_edit ("perlapi.h"), <<'EOT';
 
 /* declare accessor functions for Perl variables */
 #ifndef __perlapi_h__
@@ -731,20 +697,7 @@ print CAPIH <<'EOT';
 EOT
 close CAPIH;
 
-print CAPI <<'EOT';
-/*
- *    perlapi.c
- *
- *    Copyright (c) 1997-2002, Larry Wall
- *
- *    You may distribute under the terms of either the GNU General Public
- *    License or the Artistic License, as specified in the README file.
- *
- *
- * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
- *  This file is built by embed.pl from data in embed.pl, pp.sym, intrpvar.h,
- *  perlvars.h and thrdvar.h.  Any changes made here will be lost!
- */
+print CAPI do_not_edit ("perlapi.c"), <<'EOT';
 
 #include "EXTERN.h"
 #include "perl.h"