1 # Do not remove the following line; MakeMaker relies on it to identify
2 # this file as a template for defsubs.h
3 # Extracting defsubs.h (with variable substitutions)
6 my (undef, $headerpath) = @ARGV;
7 my ($out) = __FILE__ =~ /(^.*)\.PL/i;
9 unlink $out if -l $out;
10 open(OUT,">$out") || die "Cannot open $out:$!";
11 print "Extracting $out...\n";
14 !!! Don't modify this file - it's autogenerated from $0 !!!
18 foreach my $const (qw(
57 # This is only present in 5.10, but it's useful to B::Deparse to be able
58 # to import a dummy value from B
59 doconst(OPpPAD_STATE);
63 # Constant not present in 5.8.x
66 # Constant not present after 5.8.x
71 # Constant not present after 5.10.x
75 # First element in each tuple is the file; second is a regex snippet
76 # giving the prefix to limit the names of symbols to define that come
77 # from that file. If none, all symbols will be defined whose values
78 # match the pattern below.
79 foreach my $tuple (['op_reg_common.h','(?:(?:RXf_)?PMf_)'],['op.h'],['cop.h'],['regexp.h','RXf_'])
81 my $file = $tuple->[0];
82 my $pfx = $tuple->[1] || '';
83 my $path = File::Spec->catfile($headerpath, $file);
84 open(OPH,"$path") || die "Cannot open $path:$!";
87 doconst($1) if (/ \#define \s+ ( $pfx \w+ ) \s+
88 ( [()|\dx]+ # Parens, '|', digits, 'x'
89 | \(? \d+ \s* << .*? # digits left shifted by anything
90 ) \s* (?: $| \/ \* ) # ending at comment or $
100 my $l = length($sym);
102 newCONSTSUB(stash,"$sym",newSViv($sym));
103 av_push(export_ok,newSVpvn("$sym",$l));