This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document the undefinedness of bitshifting out of range.
[perl5.git] / ext / B / defsubs_h.PL
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)
4 #!perl
5 my ($out) = __FILE__ =~ /(^.*)\.PL/i;
6 $out =~ s/_h$/.h/;
7 open(OUT,">$out") || die "Cannot open $file:$!";
8 print "Extracting $out...\n";
9 foreach my $const (qw(
10                       AVf_REAL 
11                       HEf_SVKEY
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
16                       SVf_IOK SVf_IVisUV SVf_NOK SVf_POK 
17                       SVf_ROK SVp_IOK SVp_POK SVp_NOK
18                       ))
19  {
20   doconst($const);
21  }
22 foreach my $file (qw(op.h cop.h))
23  {
24   my $path = $^O eq 'MacOS' ? ":::$file" : "../../$file";
25   open(OPH,"$path") || die "Cannot open $path:$!";
26   while (<OPH>)
27    {  
28     doconst($1) if (/#define\s+(\w+)\s+([\(\)\|\dx]+)\s*(?:$|\/\*)/);
29    }  
30   close(OPH);
31  }
32 close(OUT);
33                
34 sub doconst
35 {
36  my $sym = shift;
37  my $l = length($sym);
38  print OUT <<"END";
39  newCONSTSUB(stash,"$sym",newSViv($sym)); 
40  av_push(export_ok,newSVpvn("$sym",$l));
41 END
42 }