Continuing mopup for #6204.
[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/;
4c1f658f 7open(OUT,">$out") || die "Cannot open $file:$!";
cc50ac46 8print "Extracting $out...\n";
4c1f658f 9foreach my $const (qw(AVf_REAL
fe0658f9 10 HEf_SVKEY SVphv_SHAREKEYS
11 SVf_READONLY
12 GVf_IMPORTED_AV GVf_IMPORTED_HV
13 GVf_IMPORTED_SV GVf_IMPORTED_CV
14 SVf_IOK SVf_IVisUV SVf_NOK SVf_POK
15 SVf_ROK SVp_IOK SVp_POK SVp_NOK))
4c1f658f 16 {
17 doconst($const);
18 }
19foreach my $file (qw(op.h cop.h))
20 {
21 open(OPH,"../../$file") || die "Cannot open ../../$file:$!";
22 while (<OPH>)
23 {
24 doconst($1) if (/#define\s+(\w+)\s+([\(\)\|\dx]+)\s*(?:$|\/\*)/);
25 }
26 close(OPH);
27 }
28close(OUT);
29
30sub doconst
31{
32 my $sym = shift;
33 my $l = length($sym);
34 print OUT <<"END";
35 newCONSTSUB(stash,"$sym",newSViv($sym));
79cb57f6 36 av_push(export_ok,newSVpvn("$sym",$l));
4c1f658f 37END
38}