This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
An obsoleted diagnostic.
[perl5.git] / ext / B / defsubs_h.PL
CommitLineData
918c0b2d
CB
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
b874ff32 10 HEf_SVKEY
6aaf4108 11 CVf_METHOD CVf_LOCKED CVf_LVALUE
0ca04487
VB
12 SVf_IOK SVf_IVisUV SVf_NOK SVf_POK
13 SVf_ROK SVp_IOK SVp_POK ))
4c1f658f
NIS
14 {
15 doconst($const);
16 }
17foreach my $file (qw(op.h cop.h))
18 {
19 open(OPH,"../../$file") || die "Cannot open ../../$file:$!";
20 while (<OPH>)
21 {
22 doconst($1) if (/#define\s+(\w+)\s+([\(\)\|\dx]+)\s*(?:$|\/\*)/);
23 }
24 close(OPH);
25 }
26close(OUT);
27
28sub doconst
29{
30 my $sym = shift;
31 my $l = length($sym);
32 print OUT <<"END";
33 newCONSTSUB(stash,"$sym",newSViv($sym));
79cb57f6 34 av_push(export_ok,newSVpvn("$sym",$l));
4c1f658f
NIS
35END
36}