SYN SYN
[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
146174a9 5my ($out) = __FILE__ =~ /(^.*)\.PL/i;
c529f79d 6$out =~ s/_h$/.h/;
4c1f658f 7open(OUT,">$out") || die "Cannot open $file:$!";
146174a9 8print "Extracting $out...\n";
22d4bb9c 9foreach my $const (qw(
10 AVf_REAL
b874ff32 11 HEf_SVKEY
22d4bb9c 12 SVf_READONLY SVTYPEMASK
13 GVf_IMPORTED_AV GVf_IMPORTED_HV
14 GVf_IMPORTED_SV GVf_IMPORTED_CV
15 CVf_METHOD CVf_LOCKED CVf_LVALUE
0ca04487 16 SVf_IOK SVf_IVisUV SVf_NOK SVf_POK
22d4bb9c 17 SVf_ROK SVp_IOK SVp_POK SVp_NOK
18 ))
4c1f658f 19 {
20 doconst($const);
21 }
22foreach my $file (qw(op.h cop.h))
23 {
24 open(OPH,"../../$file") || die "Cannot open ../../$file:$!";
25 while (<OPH>)
26 {
27 doconst($1) if (/#define\s+(\w+)\s+([\(\)\|\dx]+)\s*(?:$|\/\*)/);
28 }
29 close(OPH);
30 }
31close(OUT);
32
33sub doconst
34{
35 my $sym = shift;
36 my $l = length($sym);
37 print OUT <<"END";
38 newCONSTSUB(stash,"$sym",newSViv($sym));
79cb57f6 39 av_push(export_ok,newSVpvn("$sym",$l));
4c1f658f 40END
41}