diff options
author | Karl Williamson <public@khwilliamson.com> | 2010-07-31 14:01:46 -0600 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-08-11 10:23:34 +0200 |
commit | f4a4cecbe54b6ef3f12e504d1840e450819f026b (patch) | |
tree | ed3afe4741ca4c78e3a8d8189b72eb54a11d6bca | |
parent | 32cdcf9df190bd37343b336e012516dd9e8f9365 (diff) | |
download | perl-f4a4cecbe54b6ef3f12e504d1840e450819f026b.tar.gz |
regexp.h, op.h: decouple mostly from op_reg_common.h
This patch changes the shift bases to new ones local in the files that
are set to the common one. Thus, there is now a single point of
coupling between in each file to the common one.
-rw-r--r-- | op.h | 24 | ||||
-rw-r--r-- | regexp.h | 50 |
2 files changed, 39 insertions, 35 deletions
@@ -360,37 +360,39 @@ struct pmop { #define PM_SETRE(o,r) ((o)->op_pmregexp = (r)) #endif +#define PMf_BASE_SHIFT _RXf_PMf_SHIFT + /* taint $1 etc. if target tainted */ -#define PMf_RETAINT (1<<(_RXf_PMf_SHIFT+1)) +#define PMf_RETAINT (1<<(PMf_BASE_SHIFT+1)) /* match successfully only once per reset, with related flag RXf_USED in * re->extflags holding state. This is used only for ?? matches, and only on * OP_MATCH and OP_QR */ -#define PMf_ONCE (1<<(_RXf_PMf_SHIFT+2)) +#define PMf_ONCE (1<<(PMf_BASE_SHIFT+2)) /* replacement contains variables */ -#define PMf_MAYBE_CONST (1<<(_RXf_PMf_SHIFT+3)) +#define PMf_MAYBE_CONST (1<<(PMf_BASE_SHIFT+3)) /* PMf_ONCE has matched successfully. Not used under threading. */ -#define PMf_USED (1<<(_RXf_PMf_SHIFT+4)) +#define PMf_USED (1<<(PMf_BASE_SHIFT+4)) /* subst replacement is constant */ -#define PMf_CONST (1<<(_RXf_PMf_SHIFT+5)) +#define PMf_CONST (1<<(PMf_BASE_SHIFT+5)) /* keep 1st runtime pattern forever */ -#define PMf_KEEP (1<<(_RXf_PMf_SHIFT+6)) -#define PMf_GLOBAL (1<<(_RXf_PMf_SHIFT+7)) /* pattern had a g modifier */ +#define PMf_KEEP (1<<(PMf_BASE_SHIFT+6)) +#define PMf_GLOBAL (1<<(PMf_BASE_SHIFT+7)) /* pattern had a g modifier */ /* don't reset pos() if //g fails */ -#define PMf_CONTINUE (1<<(_RXf_PMf_SHIFT+8)) +#define PMf_CONTINUE (1<<(PMf_BASE_SHIFT+8)) /* evaluating replacement as expr */ -#define PMf_EVAL (1<<(_RXf_PMf_SHIFT+9)) +#define PMf_EVAL (1<<(PMf_BASE_SHIFT+9)) /* Return substituted string instead of modifying it. */ -#define PMf_NONDESTRUCT (1<<(_RXf_PMf_SHIFT+10)) +#define PMf_NONDESTRUCT (1<<(PMf_BASE_SHIFT+10)) -#if _RXf_PMf_SHIFT+10 > 31 +#if PMf_BASE_SHIFT+10 > 31 # error Too many PMf_ bits used. See above and regnodes.h for any spare in middle #endif @@ -291,55 +291,57 @@ and check for NULL. * */ +#define RXf_BASE_SHIFT _RXf_PMf_SHIFT + /* Anchor and GPOS related stuff */ -#define RXf_ANCH_BOL (1<<(_RXf_PMf_SHIFT+3)) -#define RXf_ANCH_MBOL (1<<(_RXf_PMf_SHIFT+4)) -#define RXf_ANCH_SBOL (1<<(_RXf_PMf_SHIFT+5)) -#define RXf_ANCH_GPOS (1<<(_RXf_PMf_SHIFT+6)) -#define RXf_GPOS_SEEN (1<<(_RXf_PMf_SHIFT+7)) -#define RXf_GPOS_FLOAT (1<<(_RXf_PMf_SHIFT+8)) +#define RXf_ANCH_BOL (1<<(RXf_BASE_SHIFT+3)) +#define RXf_ANCH_MBOL (1<<(RXf_BASE_SHIFT+4)) +#define RXf_ANCH_SBOL (1<<(RXf_BASE_SHIFT+5)) +#define RXf_ANCH_GPOS (1<<(RXf_BASE_SHIFT+6)) +#define RXf_GPOS_SEEN (1<<(RXf_BASE_SHIFT+7)) +#define RXf_GPOS_FLOAT (1<<(RXf_BASE_SHIFT+8)) /* two bits here */ #define RXf_ANCH (RXf_ANCH_BOL|RXf_ANCH_MBOL|RXf_ANCH_GPOS|RXf_ANCH_SBOL) #define RXf_GPOS_CHECK (RXf_GPOS_SEEN|RXf_ANCH_GPOS) #define RXf_ANCH_SINGLE (RXf_ANCH_SBOL|RXf_ANCH_GPOS) /* What we have seen */ -#define RXf_LOOKBEHIND_SEEN (1<<(_RXf_PMf_SHIFT+9)) -#define RXf_EVAL_SEEN (1<<(_RXf_PMf_SHIFT+10)) -#define RXf_CANY_SEEN (1<<(_RXf_PMf_SHIFT+11)) +#define RXf_LOOKBEHIND_SEEN (1<<(RXf_BASE_SHIFT+9)) +#define RXf_EVAL_SEEN (1<<(RXf_BASE_SHIFT+10)) +#define RXf_CANY_SEEN (1<<(RXf_BASE_SHIFT+11)) /* Special */ -#define RXf_NOSCAN (1<<(_RXf_PMf_SHIFT+12)) -#define RXf_CHECK_ALL (1<<(_RXf_PMf_SHIFT+13)) +#define RXf_NOSCAN (1<<(RXf_BASE_SHIFT+12)) +#define RXf_CHECK_ALL (1<<(RXf_BASE_SHIFT+13)) /* UTF8 related */ -#define RXf_MATCH_UTF8 (1<<(_RXf_PMf_SHIFT+15)) +#define RXf_MATCH_UTF8 (1<<(RXf_BASE_SHIFT+15)) /* Intuit related */ -#define RXf_USE_INTUIT_NOML (1<<(_RXf_PMf_SHIFT+16)) -#define RXf_USE_INTUIT_ML (1<<(_RXf_PMf_SHIFT+17)) -#define RXf_INTUIT_TAIL (1<<(_RXf_PMf_SHIFT+18)) +#define RXf_USE_INTUIT_NOML (1<<(RXf_BASE_SHIFT+16)) +#define RXf_USE_INTUIT_ML (1<<(RXf_BASE_SHIFT+17)) +#define RXf_INTUIT_TAIL (1<<(RXf_BASE_SHIFT+18)) /* Set in Perl_pmruntime if op_flags & OPf_SPECIAL, i.e. split. Will be used by regex engines to check whether they should set RXf_SKIPWHITE */ -#define RXf_SPLIT (1<<(_RXf_PMf_SHIFT+19)) +#define RXf_SPLIT (1<<(RXf_BASE_SHIFT+19)) #define RXf_USE_INTUIT (RXf_USE_INTUIT_NOML|RXf_USE_INTUIT_ML) /* Copy and tainted info */ -#define RXf_COPY_DONE (1<<(_RXf_PMf_SHIFT+20)) -#define RXf_TAINTED_SEEN (1<<(_RXf_PMf_SHIFT+21)) -#define RXf_TAINTED (1<<(_RXf_PMf_SHIFT+22)) /* this pattern is tainted */ +#define RXf_COPY_DONE (1<<(RXf_BASE_SHIFT+20)) +#define RXf_TAINTED_SEEN (1<<(RXf_BASE_SHIFT+21)) +#define RXf_TAINTED (1<<(RXf_BASE_SHIFT+22)) /* this pattern is tainted */ /* Flags indicating special patterns */ -#define RXf_START_ONLY (1<<(_RXf_PMf_SHIFT+23)) /* Pattern is /^/ */ -#define RXf_SKIPWHITE (1<<(_RXf_PMf_SHIFT+24)) /* Pattern is for a split / / */ -#define RXf_WHITE (1<<(_RXf_PMf_SHIFT+25)) /* Pattern is /\s+/ */ -#define RXf_NULL (1<<(_RXf_PMf_SHIFT+26)) /* Pattern is // */ -#if _RXf_PMf_SHIFT+26 > 31 +#define RXf_START_ONLY (1<<(RXf_BASE_SHIFT+23)) /* Pattern is /^/ */ +#define RXf_SKIPWHITE (1<<(RXf_BASE_SHIFT+24)) /* Pattern is for a split / / */ +#define RXf_WHITE (1<<(RXf_BASE_SHIFT+25)) /* Pattern is /\s+/ */ +#define RXf_NULL (1<<(RXf_BASE_SHIFT+26)) /* Pattern is // */ +#if RXf_BASE_SHIFT+26 > 31 # error Too many RXf_PMf bits used. See regnodes.h for any spare in middle #endif |