diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-05-14 22:28:08 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-05-19 10:18:16 +0100 |
commit | 5f8dc0737d315bf7d9ba977258a20d8512927c0d (patch) | |
tree | 631ad8cd114e448c70b0d62931c5aa3a7013e909 /regen | |
parent | 56fd1190657e040f5b17c8a00628205a045093e3 (diff) | |
download | perl-5f8dc0737d315bf7d9ba977258a20d8512927c0d.tar.gz |
Rename do_not_edit() to open_print_header(), and move open_new() into it.
This removes duplication of open_new() calls.
Diffstat (limited to 'regen')
-rwxr-xr-x | regen/embed.pl | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/regen/embed.pl b/regen/embed.pl index 0cb40ed144..a72a0f7651 100755 --- a/regen/embed.pl +++ b/regen/embed.pl @@ -40,17 +40,16 @@ my $unflagged_pointers; # implicit interpreter context argument. # -sub do_not_edit -{ +sub open_print_header { my ($file, $quote) = @_; - return read_only_top(lang => ($file =~ /\.[ch]$/ ? 'C' : 'Perl'), - file => $file, style => '*', by => 'regen/embed.pl', - from => ['data in embed.fnc', 'regen/embed.pl', - 'regen/opcodes', 'intrpvar.h', 'perlvars.h'], - final => "\nEdit those files and run 'make regen_headers' to effect changes.\n", - copyright => [1993 .. 2009], quote => $quote); -} # do_not_edit + return open_new($file, '>', + { file => $file, style => '*', by => 'regen/embed.pl', + from => ['data in embed.fnc', 'regen/embed.pl', + 'regen/opcodes', 'intrpvar.h', 'perlvars.h'], + final => "\nEdit those files and run 'make regen_headers' to effect changes.\n", + copyright => [1993 .. 2009], quote => $quote }); +} open IN, "embed.fnc" or die $!; @@ -187,8 +186,7 @@ sub walk_table (&@) { $F = $filename; } else { - $F = open_new($filename); - print $F do_not_edit ($filename); + $F = open_print_header($filename); } foreach (@embed) { my @outs = &{$function}(@$_); @@ -202,8 +200,8 @@ sub walk_table (&@) { # generate proto.h { - my $pr = open_new('proto.h'); - print $pr do_not_edit ("proto.h"), "START_EXTERN_C\n"; + my $pr = open_print_header("proto.h"); + print $pr "START_EXTERN_C\n"; my $ret; foreach (@embed) { @@ -416,9 +414,9 @@ sub multoff ($$) { return hide("PL_$pre$sym", "PL_$sym"); } -my $em = open_new('embed.h'); +my $em = open_print_header('embed.h'); -print $em do_not_edit ("embed.h"), <<'END'; +print $em <<'END'; /* (Doing namespace management portably in C is really gross.) */ /* By defining PERL_NO_SHORT_NAMES (not done by default) the short forms @@ -575,9 +573,9 @@ END read_only_bottom_close_and_rename($em); -$em = open_new('embedvar.h'); +$em = open_print_header('embedvar.h'); -print $em do_not_edit ("embedvar.h"), <<'END'; +print $em <<'END'; /* (Doing namespace management portably in C is really gross.) */ /* @@ -654,10 +652,9 @@ END read_only_bottom_close_and_rename($em); -my $capi = open_new('perlapi.c'); -my $capih = open_new('perlapi.h'); +my $capih = open_print_header('perlapi.h'); -print $capih do_not_edit ("perlapi.h"), <<'EOT'; +print $capih <<'EOT'; /* declare accessor functions for Perl variables */ #ifndef __perlapi_h__ #define __perlapi_h__ @@ -763,7 +760,7 @@ EOT read_only_bottom_close_and_rename($capih); -my $warning = do_not_edit ("perlapi.c", <<'EOQ'); +my $capi = open_print_header('perlapi.c', <<'EOQ'); * * * Up to the threshold of the door there mounted a flight of twenty-seven @@ -775,7 +772,7 @@ my $warning = do_not_edit ("perlapi.c", <<'EOQ'); */ EOQ -print $capi $warning, <<'EOT'; +print $capi <<'EOT'; #include "EXTERN.h" #include "perl.h" #include "perlapi.h" |