4 # Regenerate (overwriting only if changed):
8 # from information contained in this file in the
9 # __DATA_ section below.
11 # To add a new type simply add its name to the list
12 # below in the correct section (marked by C comments)
13 # and then regenerate with 'make regen'.
15 # Accepts the standard regen_lib -q and -v args.
17 # This script is normally invoked from regen.pl.
19 # The style of this file is determined by:
21 # perltidy -w -ple -bbb -bbc -bbs -nolq -l=80 -noll -nola -nwls='=' \
22 # -isbc -nolc -otr -kis -ci=4 -se -sot -sct -nsbl -pt=2 -fs \
23 # -fsb='##!' -fse='##.'
26 # Get function prototypes
27 require './regen/regen_lib.pl';
45 foreach my $line (<DATA>) {
47 if ($line =~ /(\w+) arg/) {
48 $nargs= $args{$1} // die "panic: Bad arg number '$1'";
50 if ($line =~ /^SAVEt/) {
52 $tlen= length($line) if $tlen < length($line);
54 push @arg_num, [ $nargs, $line ];
55 push @lines, [ $line, $id ];
63 foreach my $num (0 .. $#lines) {
64 my $line= $lines[$num];
66 my ($type, $id)= @$line;
67 $line= sprintf "#define %*s %*d",
68 -$tlen, $type, length(0 + @types), $id;
70 $c_code .= $line . "\n";
75 static const U8 leave_scope_arg_counts[] = {
78 foreach my $tuple (@arg_num) {
79 my ($nargs, $type)= @$tuple;
80 $c_code .= sprintf " %d%s /* %*s */\n",
81 $nargs, $tuple == $arg_num[-1] ? " " : ",",
84 my $max_savet= $#arg_num;
89 #define MAX_SAVEt $max_savet
92 my $final= <<'EOF_FINAL';
93 The defines and contents of the leave_scope_arg_counts[] array
94 must match. To add a new type modify the __DATA__ section in
95 regen/scope_types.pl and run `make regen` to rebuild the file.
101 by => 'regen/scope_types.pl',
106 read_only_bottom_close_and_rename($out);
120 SAVEt_COMPILE_WARNINGS
121 SAVEt_CURCOP_WARNINGS
158 SAVEt_SAVESWITCHSTACK
172 SAVEt_PADSV_AND_MORTALIZE