diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-12-22 16:34:36 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-12-24 09:25:15 -0800 |
commit | 47222a2dfd12286d515f92f1b5c207f993a2d7df (patch) | |
tree | b9422d0881ddaa4357ed7ea92da63bcf9170380d /regen/feature.pl | |
parent | 03222170f0449b3f2e9185ef2ef65ad58f54c2f5 (diff) | |
download | perl-47222a2dfd12286d515f92f1b5c207f993a2d7df.tar.gz |
feature.pl: Move hint-checking code up
This puts it with the other code that generates ‘global’ variables
used by generation code.
Diffstat (limited to 'regen/feature.pl')
-rwxr-xr-x | regen/feature.pl | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/regen/feature.pl b/regen/feature.pl index 914040ea15..b4ad36a6c1 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -79,6 +79,30 @@ for my $bund ( } } +my $HintShift; + +open "perl.h", "perl.h" or die "$0 cannot open perl.h: $!"; +perlh: { + while (readline "perl.h") { + next unless /#define\s+HINT_FEATURE_MASK/; + /(0x[A-Fa-f0-9]+)/ or die "No hex number in:\n\n$_\n "; + my $hex = $1; + my $bits = sprintf "%b", oct $1; + $bits =~ /^0*1+(0*)\z/ + or die "Non-contiguous bits in $bits (binary for $hex):\n\n$_\n "; + $HintShift = length $1; + my $bits_needed = + length sprintf "%b", scalar keys %UniqueBundles; + $bits =~ /1{$bits_needed}/ + or die "Not enough bits (need $bits_needed)" + . " in $bits (binary for $hex):\n\n$_\n"; + last perlh; + } + die "No HINT_FEATURE_MASK defined in perl.h"; +} +close "perl.h"; + + ########################################################################### @@ -140,29 +164,6 @@ while (<DATA>) { read_only_bottom_close_and_rename($pm); -my $HintShift; - -open "perl.h", "perl.h" or die "$0 cannot open perl.h: $!"; -perlh: { - while (readline "perl.h") { - next unless /#define\s+HINT_FEATURE_MASK/; - /(0x[A-Fa-f0-9]+)/ or die "No hex number in:\n\n$_\n "; - my $hex = $1; - my $bits = sprintf "%b", oct $1; - $bits =~ /^0*1+(0*)\z/ - or die "Non-contiguous bits in $bits (binary for $hex):\n\n$_\n "; - $HintShift = length $1; - my $bits_needed = - length sprintf "%b", scalar keys %UniqueBundles; - $bits =~ /1{$bits_needed}/ - or die "Not enough bits (need $bits_needed)" - . " in $bits (binary for $hex):\n\n$_\n"; - last perlh; - } - die "No HINT_FEATURE_MASK defined in perl.h"; -} -close "perl.h"; - my $first_bit = sprintf "0x%08x", 1 << $HintShift; print $h <<EOH; |