summaryrefslogtreecommitdiff
path: root/regen/overload.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-01-23 00:09:24 +0000
committerNicholas Clark <nick@ccl4.org>2011-01-23 00:13:20 +0000
commit78102347e0341b1cd4795accd0ca5ff1f2621bb2 (patch)
treea8f150f8f20133aff3a38c5b8963326398a9879f /regen/overload.pl
parent03f96b769ecd6ff2f839c64bd87c8d185f8ce3f5 (diff)
downloadperl-78102347e0341b1cd4795accd0ca5ff1f2621bb2.tar.gz
Move all the generated file header printing into read_only_top()
Previously all the scripts in regen/ had code to generate header comments (buffer-read-only, "do not edit this file", and optionally regeneration script, regeneration data, copyright years and filename). This change results in some minor reformatting of header blocks, and standardises the copyright line as "Larry Wall and others".
Diffstat (limited to 'regen/overload.pl')
-rw-r--r--regen/overload.pl50
1 files changed, 10 insertions, 40 deletions
diff --git a/regen/overload.pl b/regen/overload.pl
index 1cd07dd954..343629f81c 100644
--- a/regen/overload.pl
+++ b/regen/overload.pl
@@ -39,22 +39,12 @@ my $p = safer_open('lib/overload/numbers.pm');
select $p;
+print read_only_top(lang => 'Perl', by => 'regen/overload.pl',
+ file => 'lib/overload/numbers.pm', copyright => [2008]);
+
{
local $" = "\n ";
print <<"EOF";
-# -*- buffer-read-only: t -*-
-#
-# lib/overload/numbers.pm
-#
-# Copyright (C) 2008 by Larry Wall and others
-#
-# 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 regen/overload.pl
-#
-
package overload::numbers;
our \@names = qw#
@@ -72,35 +62,16 @@ our \@enums = qw#
EOF
}
-
-sub print_header {
- my $file = shift;
- print <<"EOF";
-/* -*- buffer-read-only: t -*-
- *
- * $file
- *
- * Copyright (C) 1997, 1998, 2000, 2001, 2005, 2006, 2007, 2011
- * by Larry Wall and others
- *
- * 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 regen/overload.pl
- */
-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 $c;
-print_header('overload.c');
-
select $h;
-print_header('overload.h');
-print <<'EOF';
-
-enum {
-EOF
+print "enum {\n";
for (0..$#enums) {
my $op = $names[$_];
@@ -123,7 +94,6 @@ print <<'EOF';
EOF
print $c <<'EOF';
-
#define AMG_id2name(id) (PL_AMG_names[id]+1)
#define AMG_id2namelen(id) (PL_AMG_namelens[id]-1)