summaryrefslogtreecommitdiff
path: root/regen/opcode.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-01-23 10:38:58 +0000
committerNicholas Clark <nick@ccl4.org>2011-01-23 10:41:25 +0000
commitce716c52d393ac84495b7b8f262c39ecc5447cc9 (patch)
tree8053d9bd192b318367aa7c50b3910bc88b706422 /regen/opcode.pl
parentf038801aea0ff24cf86511fa6679d7dcb859cd8d (diff)
downloadperl-ce716c52d393ac84495b7b8f262c39ecc5447cc9.tar.gz
Change close_and_rename() to read_only_bottom_close_and_rename()
All users of close_and_rename() were printing out the appropriate "ex: set ro:" string to the file handle immediately before closing it. So move that into the common function and rename it to reflect what it now does. [Except overload.pl, which should have been, given that it calls read_only_top()] Print a newline above the "ex: set ro:" line. This removes many newlines from the regen scripts, but does add newlines to a couple of generated files.
Diffstat (limited to 'regen/opcode.pl')
-rwxr-xr-xregen/opcode.pl19
1 files changed, 6 insertions, 13 deletions
diff --git a/regen/opcode.pl b/regen/opcode.pl
index 676583d0e3..afb25e9bac 100755
--- a/regen/opcode.pl
+++ b/regen/opcode.pl
@@ -408,7 +408,6 @@ print <<END;
#endif /* !PERL_GLOBAL_STRUCT_INIT */
END_EXTERN_C
-
END
# Emit OP_IS_* macros
@@ -418,7 +417,6 @@ print $on <<EO_OP_IS_COMMENT;
/* the OP_IS_(SOCKET|FILETEST) macros are optimized to a simple range
check because all the member OPs are contiguous in opcode.pl
<OPS> table. opcode.pl verifies the range contiguity. */
-
EO_OP_IS_COMMENT
gen_op_is_macro( \%OP_IS_SOCKET, 'OP_IS_SOCKET');
@@ -437,7 +435,7 @@ sub gen_op_is_macro {
my $last = pop @rest; # @rest slurped, get its last
die "Invalid range of ops: $first .. $last\n" unless $last;
- print $on "#define $macname(op) \\\n\t(";
+ print $on "\n#define $macname(op) \\\n\t(";
# verify that op-ct matches 1st..last range (and fencepost)
# (we know there are no dups)
@@ -445,21 +443,16 @@ sub gen_op_is_macro {
# contiguous ops -> optimized version
print $on "(op) >= OP_" . uc($first) . " && (op) <= OP_" . uc($last);
- print $on ")\n\n";
+ print $on ")\n";
}
else {
print $on join(" || \\\n\t ",
map { "(op) == OP_" . uc() } sort keys %$op_is);
- print $on ")\n\n";
+ print $on ")\n";
}
}
}
-foreach ($oc, $on) {
- print $_ "/* ex: set ro: */\n";
- close_and_rename($_);
-}
-
my $pp = safer_open('pp_proto.h-new', 'pp_proto.h');
print $pp read_only_top(lang => 'C', by => 'opcode.pl', from => 'its data');
@@ -472,9 +465,9 @@ print $pp read_only_top(lang => 'C', by => 'opcode.pl', from => 'its data');
}
print $pp "PERL_CALLCONV OP *$_(pTHX);\n" foreach sort keys %funcs;
}
-print $pp "\n/* ex: set ro: */\n";
-
-close_and_rename($pp);
+foreach ($oc, $on, $pp) {
+ read_only_bottom_close_and_rename($_);
+}
###########################################################################
sub tab {