feature.h: Add macros for current hints
authorFather Chrysostomos <sprout@cpan.org>
Thu, 22 Dec 2011 18:20:01 +0000 (10:20 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 24 Dec 2011 17:25:14 +0000 (09:25 -0800)
CURRENT_HINTS is not specific to features, but for now will be used by
nothing else.  It returns the compile-time or run-time hints, depend-
ing on whether PL_curcop points to &PL_compiling.

CURRENT_FEATURE_BUNDLE extracts the feature bundle number from the
current hints.

feature.h
regen/feature.pl

index 0b5f85c..3ce6e85 100644 (file)
--- a/feature.h
+++ b/feature.h
 #define FEATURE_BUNDLE_515     3
 #define FEATURE_BUNDLE_CUSTOM  (HINT_FEATURE_MASK >> HINT_FEATURE_SHIFT)
 
+#define CURRENT_HINTS \
+    (PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints)
+#define CURRENT_FEATURE_BUNDLE (CURRENT_HINTS >> HINT_FEATURE_SHIFT)
+
 #endif /* PERL_CORE or PERL_EXT */
 
 /* ex: set ro: */
index e63bd50..6cbcd62 100755 (executable)
@@ -163,6 +163,10 @@ for (sort values %UniqueBundles) {
 print $h <<EOH;
 #define FEATURE_BUNDLE_CUSTOM  (HINT_FEATURE_MASK >> HINT_FEATURE_SHIFT)
 
+#define CURRENT_HINTS \\
+    (PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints)
+#define CURRENT_FEATURE_BUNDLE (CURRENT_HINTS >> HINT_FEATURE_SHIFT)
+
 #endif /* PERL_CORE or PERL_EXT */
 EOH