diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-12-22 16:33:01 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-12-24 09:25:15 -0800 |
commit | 03222170f0449b3f2e9185ef2ef65ad58f54c2f5 (patch) | |
tree | 79e0419b59d8ad300af9d0ba78ddec2443aebef2 /regen/feature.pl | |
parent | 40e4d872ac5e7318bdf400a3bdf5a89c482c2003 (diff) | |
download | perl-03222170f0449b3f2e9185ef2ef65ad58f54c2f5.tar.gz |
Add macros for checking individual features
Diffstat (limited to 'regen/feature.pl')
-rwxr-xr-x | regen/feature.pl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/regen/feature.pl b/regen/feature.pl index 18e2ece610..914040ea15 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -68,6 +68,7 @@ for my $bund ( sort { $a eq 'default' ? -1 : $b eq 'default' ? 1 : $a cmp $b } values %UniqueBundles ) { + next if $bund =~ /[^\d.]/ and $bund ne 'default'; for (@{$feature_bundle{$bund}}) { if (@{$BundleRanges{$_} ||= []} == 2) { $BundleRanges{$_}[1] = $bund @@ -186,6 +187,44 @@ print $h <<EOH; (PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints) #define CURRENT_FEATURE_BUNDLE (CURRENT_HINTS >> HINT_FEATURE_SHIFT) +EOH + +for ( + sort { length $a <=> length $b } keys %feature, keys %default_feature +) { + my($first,$last) = + map { (my $__ = uc) =~ y/.//d; $__ } @{$BundleRanges{$_}}; + my $default = ''; + my $name = $feature{$_} # skip "no" + || ($default = '_d', substr $default_feature{$_}, 2); + my $NAME = uc $name; + if ($last) { + print $h <<EOH3; +#define FEATURE_$NAME\_IS_ENABLED \\ + ( \\ + (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_$first && \\ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_$last) \\ + || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\ + FEATURE_IS_ENABLED$default("$name")) \\ + ) + +EOH3 + } + else { + print $h <<EOH4; +#define FEATURE_$NAME\_IS_ENABLED \\ + ( \\ + CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_$first \\ + || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\ + FEATURE_IS_ENABLED$default("$name")) \\ + ) + +EOH4 + } +} + +print $h <<EOH; + #endif /* PERL_CORE or PERL_EXT */ EOH |