Remove support for assertions and -A
[p5sagit/p5-mst-13.2.git] / ext / B / defsubs_h.PL
CommitLineData
918c0b2d 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)
4c1f658f 4#!perl
32882678 5my ($out) = __FILE__ =~ /(^.*)\.PL/i;
93804878 6$out =~ s/_h$/.h/;
fd40a117 7unlink $out if -l $out;
4c1f658f 8open(OUT,">$out") || die "Cannot open $file:$!";
cc50ac46 9print "Extracting $out...\n";
651aa52e 10print OUT <<"END";
11/*
12 !!! Don't modify this file - it's autogenerated from $0 !!!
13 */
14END
15
059a8bb7 16foreach my $const (qw(
7386c4fb 17 CVf_ANON
7386c4fb 18 CVf_CLONE
19 CVf_CLONED
20 CVf_CONST
21 CVf_LOCKED
22 CVf_LVALUE
23 CVf_METHOD
24 CVf_NODEBUG
7386c4fb 25 CVf_UNIQUE
26 CVf_WEAKOUTSIDE
27 GVf_IMPORTED_AV
28 GVf_IMPORTED_CV
29 GVf_IMPORTED_HV
30 GVf_IMPORTED_SV
b874ff32 31 HEf_SVKEY
7386c4fb 32 SVTYPEMASK
33 SVf_FAKE
34 SVf_IOK
35 SVf_IVisUV
36 SVf_NOK
37 SVf_POK
38 SVf_READONLY
39 SVf_ROK
40 SVp_IOK
41 SVp_NOK
42 SVp_POK
43 SVpad_OUR
44 SVs_RMG
45 SVs_SMG
46 SVt_PVGV
47 SVt_PVHV
077a3fa2 48 PAD_FAKELEX_ANON
49 PAD_FAKELEX_MULTI
059a8bb7 50 ))
4c1f658f 51 {
52 doconst($const);
53 }
e6663653 54
55if ($] < 5.009) {
56 # This is only present in 5.10, but it's useful to B::Deparse to be able
57 # to import a dummy value from B
58 doconst(OPpPAD_STATE);
59}
60
e412117e 61if ($] >= 5.009) {
62 # Constant not present in 5.8.x
63 doconst(CVf_ISXSUB);
f7192a3f 64} else {
65 # Constant not present after 5.8.x
66 doconst(AVf_REAL);
67}
e412117e 68
c737faaf 69foreach my $tuple (['op.h'],['cop.h'],['regexp.h','RXf_'])
4c1f658f 70 {
c737faaf 71 my $file = $tuple->[0];
72 my $pfx = $tuple->[1] || '';
db5fd395 73 my $path = $^O eq 'MacOS' ? ":::$file" : "../../$file";
74 open(OPH,"$path") || die "Cannot open $path:$!";
4c1f658f 75 while (<OPH>)
76 {
c737faaf 77 doconst($1) if (/#define\s+($pfx\w+)\s+([\(\)\|\dx]+)\s*(?:$|\/\*)/);
4c1f658f 78 }
79 close(OPH);
80 }
81close(OUT);
82
83sub doconst
84{
85 my $sym = shift;
86 my $l = length($sym);
87 print OUT <<"END";
88 newCONSTSUB(stash,"$sym",newSViv($sym));
79cb57f6 89 av_push(export_ok,newSVpvn("$sym",$l));
4c1f658f 90END
91}