applied non-conflicting parts of suggested patch
[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
f675dbe5 5my ($out) = __FILE__ =~ /(^.*)\.PL/;
6if ($^O eq 'VMS') { ($out) = __FILE__ =~ /^(.+)_PL$/i; }
4c1f658f 7open(OUT,">$out") || die "Cannot open $file:$!";
918c0b2d 8print "Extracting $out . . .\n";
4c1f658f 9foreach my $const (qw(AVf_REAL
b874ff32 10 HEf_SVKEY
4c1f658f 11 SVf_IOK SVf_NOK SVf_POK SVf_ROK SVp_IOK SVp_POK ))
12 {
13 doconst($const);
14 }
15foreach my $file (qw(op.h cop.h))
16 {
17 open(OPH,"../../$file") || die "Cannot open ../../$file:$!";
18 while (<OPH>)
19 {
20 doconst($1) if (/#define\s+(\w+)\s+([\(\)\|\dx]+)\s*(?:$|\/\*)/);
21 }
22 close(OPH);
23 }
24close(OUT);
25
26sub doconst
27{
28 my $sym = shift;
29 my $l = length($sym);
30 print OUT <<"END";
31 newCONSTSUB(stash,"$sym",newSViv($sym));
79cb57f6 32 av_push(export_ok,newSVpvn("$sym",$l));
4c1f658f 33END
34}