From d1fd0100b99385b1e0c84be811cacef81d01c17a Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 22 Dec 2011 10:20:01 -0800 Subject: [PATCH] feature.h: Add macros for current hints 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 | 4 ++++ regen/feature.pl | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/feature.h b/feature.h index 0b5f85c..3ce6e85 100644 --- a/feature.h +++ b/feature.h @@ -15,6 +15,10 @@ #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: */ diff --git a/regen/feature.pl b/regen/feature.pl index e63bd50..6cbcd62 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -163,6 +163,10 @@ for (sort values %UniqueBundles) { print $h <> 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 -- 2.7.4