This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Export constant subs from B.xs for op.h, cop.h and a few others.
[perl5.git] / ext / B / defsubs.h.PL
CommitLineData
4c1f658f
NIS
1#!perl
2my ($out) = __FILE__ =~ /(^.*)\.PL/;
3open(OUT,">$out") || die "Cannot open $file:$!";
4foreach my $const (qw(AVf_REAL
5 SVf_IOK SVf_NOK SVf_POK SVf_ROK SVp_IOK SVp_POK ))
6 {
7 doconst($const);
8 }
9foreach my $file (qw(op.h cop.h))
10 {
11 open(OPH,"../../$file") || die "Cannot open ../../$file:$!";
12 while (<OPH>)
13 {
14 doconst($1) if (/#define\s+(\w+)\s+([\(\)\|\dx]+)\s*(?:$|\/\*)/);
15 }
16 close(OPH);
17 }
18close(OUT);
19
20sub doconst
21{
22 my $sym = shift;
23 my $l = length($sym);
24 print OUT <<"END";
25 newCONSTSUB(stash,"$sym",newSViv($sym));
26 av_push(export_ok,newSVpv("$sym",$l));
27END
28}