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 5my ($out) = __FILE__ =~ /(^.*)\.PL/i; 6$out =~ s/_h$/.h/; 7open(OUT,">$out") || die "Cannot open $file:$!"; 8print "Extracting $out...\n"; 9print OUT <<"END"; 10/* 11 !!! Don't modify this file - it's autogenerated from $0 !!! 12 */ 13END 14 15foreach my $const (qw( 16 AVf_REAL 17 CVf_ANON 18 CVf_CLONE 19 CVf_CLONED 20 CVf_CONST 21 CVf_LOCKED 22 CVf_LVALUE 23 CVf_METHOD 24 CVf_NODEBUG 25 CVf_OLDSTYLE 26 CVf_UNIQUE 27 CVf_WEAKOUTSIDE 28 GVf_IMPORTED_AV 29 GVf_IMPORTED_CV 30 GVf_IMPORTED_HV 31 GVf_IMPORTED_SV 32 HEf_SVKEY 33 SVTYPEMASK 34 SVf_FAKE 35 SVf_IOK 36 SVf_IVisUV 37 SVf_NOK 38 SVf_POK 39 SVf_READONLY 40 SVf_ROK 41 SVp_IOK 42 SVp_NOK 43 SVp_POK 44 SVpad_OUR 45 SVs_RMG 46 SVs_SMG 47 SVt_PVGV 48 SVt_PVHV 49 )) 50 { 51 doconst($const); 52 } 53foreach my $file (qw(op.h cop.h)) 54 { 55 my $path = $^O eq 'MacOS' ? ":::$file" : "../../$file"; 56 open(OPH,"$path") || die "Cannot open $path:$!"; 57 while (<OPH>) 58 { 59 doconst($1) if (/#define\s+(\w+)\s+([\(\)\|\dx]+)\s*(?:$|\/\*)/); 60 } 61 close(OPH); 62 } 63close(OUT); 64 65sub doconst 66{ 67 my $sym = shift; 68 my $l = length($sym); 69 print OUT <<"END"; 70 newCONSTSUB(stash,"$sym",newSViv($sym)); 71 av_push(export_ok,newSVpvn("$sym",$l)); 72END 73} 74