# Regenerate (overwriting only if changed):
#
# mg_vtable.h
+# pod/perlguts.pod
#
-# from information stored in this file.
+# from information stored in this file. pod/perlguts.pod is not completely
+# regenerated. Only the magic table is replaced; the other parts remain
+# untouched.
#
# Accepts the standard regen_lib -q and -v args.
#
require 'regen/regen_lib.pl';
}
-# This generates the relevant section to paste into perlguts.pod to STDOUT
-my $output_guts = grep { $_ eq '-g' } @ARGV;
-
my %mg =
(
sv => { char => '\0', vtable => 'sv', readonly_acceptable => 1,
desc => '%ENV hash element' },
fm => { char => 'f', vtable => 'regdata', value_magic => 1,
readonly_acceptable => 1, desc => "Formline ('compiled' format)" },
+ study => { char => 'G', vtable => 'regexp', value_magic => 1,
+ readonly_acceptable => 1, desc => 'study()ed string' },
regex_global => { char => 'g', vtable => 'mglob', value_magic => 1,
- readonly_acceptable => 1,
- desc => 'm//g target / study()ed string' },
+ readonly_acceptable => 1, desc => 'm//g target' },
hints => { char => 'H', vtable => 'hints', desc => '%^H hash' },
hintselem => { char => 'h', vtable => 'hintselem',
desc => '%^H hash element' },
unknown_to_sv_magic => 1 },
vec => { char => 'v', vtable => 'vec', value_magic => 1,
desc => 'vec() lvalue' },
- vstring => { char => 'V', value_magic => 1,
+ vstring => { char => 'V', value_magic => 1, vtable => 'vstring',
desc => 'SV was vstring literal' },
utf8 => { char => 'w', vtable => 'utf8', value_magic => 1,
desc => 'Cached UTF-8 information' },
cond => '#ifdef USE_LOCALE_COLLATE'},
'hintselem' => {set => 'sethint', clear => 'clearhint'},
'hints' => {clear => 'clearhints'},
+ 'vstring' => {set => 'setvstring'},
);
my ($vt, $raw, $names) = map {
open_new($_, '>',
{ by => 'regen/mg_vtable.pl', file => $_, style => '*' });
} 'mg_vtable.h', 'mg_raw.h', 'mg_names.c';
+my $guts = open_new("pod/perlguts.pod", ">");
print $vt <<'EOH';
/* These constants should be used in preference to raw characters
$data->{vtable} ? "vtbl_$data->{vtable}" : '(none)',
$data->{desc}];
}
- if ($output_guts) {
+ select +(select($guts), do {
my @header = ('(old-style char and macro)', 'MGVTBL', 'Type of magic');
my @widths = (0, 0);
foreach my $row (@rows) {
if length $row->[$_] > $widths[$_];
}
}
- my $indent = ' ';
+ my $indent = ' ';
my $format
= sprintf "$indent%%-%ds%%-%ds%%s\n", $widths[0] + 1, $widths[1] + 1;
- my $desc_wrap = 80 - (length $indent) - $widths[0] - $widths[1] - 2;
+ my $desc_wrap =
+ 79 - 7 - (length $indent) - $widths[0] - $widths[1] - 2;
+
+ open my $oldguts, "<", "pod/perlguts.pod"
+ or die "$0 cannot open pod/perlguts.pod for reading: $!";
+ while (<$oldguts>) {
+ print;
+ last if /^=for mg_vtable.pl begin/
+ }
- print $indent . "mg_type\n";
+ print "\n", $indent . "mg_type\n";
printf $format, @header;
printf $format, map {'-' x length $_} @header;
foreach (@rows) {
printf $format, $type, $vtbl, $desc;
printf $format, '', '', $_ foreach @cont;
}
- }
+ print "\n";
+
+ while (<$oldguts>) {
+ last if /^=for mg_vtable.pl end/;
+ }
+ do { print } while <$oldguts>;
+ })[0];
}
my @names = sort keys %sig;
die "Too many vtable names" if @vtable_names > 63;
read_only_bottom_close_and_rename($_) foreach $vt, $raw, $names;
+ close_and_rename($guts);