It would seem that in Linux 2.2 there is no way
[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
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";
651aa52e 9print OUT <<"END";
10/*
11 !!! Don't modify this file - it's autogenerated from $0 !!!
12 */
13END
14
059a8bb7 15foreach my $const (qw(
16 AVf_REAL
b874ff32 17 HEf_SVKEY
059a8bb7 18 SVf_READONLY SVTYPEMASK
19 GVf_IMPORTED_AV GVf_IMPORTED_HV
20 GVf_IMPORTED_SV GVf_IMPORTED_CV
06492da6 21 CVf_METHOD CVf_LOCKED CVf_LVALUE CVf_CONST CVf_ASSERTION
7dafbf52 22 SVpad_OUR SVf_FAKE SVf_IOK SVf_IVisUV SVf_NOK SVf_POK
651aa52e 23 SVf_ROK SVp_IOK SVp_POK SVp_NOK SVt_PVGV SVt_PVHV
059a8bb7 24 ))
4c1f658f 25 {
26 doconst($const);
27 }
28foreach my $file (qw(op.h cop.h))
29 {
db5fd395 30 my $path = $^O eq 'MacOS' ? ":::$file" : "../../$file";
31 open(OPH,"$path") || die "Cannot open $path:$!";
4c1f658f 32 while (<OPH>)
33 {
34 doconst($1) if (/#define\s+(\w+)\s+([\(\)\|\dx]+)\s*(?:$|\/\*)/);
35 }
36 close(OPH);
37 }
38close(OUT);
39
40sub doconst
41{
42 my $sym = shift;
43 my $l = length($sym);
44 print OUT <<"END";
45 newCONSTSUB(stash,"$sym",newSViv($sym));
79cb57f6 46 av_push(export_ok,newSVpvn("$sym",$l));
4c1f658f 47END
48}