ch = '/';
if (PM_GETRE(pm))
Perl_dump_indent(aTHX_ level, file, "PMf_PRE %c%s%c%s\n",
- ch, PM_GETRE(pm)->precomp, ch,
+ ch, RX_PRECOMP(PM_GETRE(pm)), ch,
(pm->op_private & OPpRUNTIME) ? " (RUNTIME)" : "");
else
Perl_dump_indent(aTHX_ level, file, "PMf_PRE (RUNTIME)\n");
level++;
if (PM_GETRE(pm)) {
const regexp *const r = PM_GETRE(pm);
- SV * const tmpsv = newSVpvn(r->precomp,r->prelen);
+ SV * const tmpsv = newSVpvn(RX_PRECOMP(r),r->prelen);
SvUTF8_on(tmpsv);
Perl_xmldump_indent(aTHX_ level, file, "pre=\"%s\"\n",
SvPVX(tmpsv));
ST(0) = sv_newmortal();
rx = PM_GETRE(o);
if (rx)
- sv_setpvn(ST(0), rx->precomp, rx->prelen);
+ sv_setpvn(ST(0), RX_PRECOMP(rx), RX_PRELEN(rx));
#if PERL_VERSION >= 9
CODE:
rx = ((struct xregexp *)SvANY(sv))->xrx_regexp;
/* FIXME - UTF-8? And the equivalent precomp methods? */
- RETVAL = newSVpvn( rx->precomp, rx->prelen );
+ RETVAL = newSVpvn( RX_PRECOMP(rx), RX_PRELEN(rx) );
OUTPUT:
RETVAL
REGEXP* rx = (REGEXP*)mg->mg_obj;
RETVAL = Nullsv;
if( rx )
- RETVAL = newSVpvn( rx->precomp, rx->prelen );
+ RETVAL = newSVpvn( RX_PRECOMP(rx), RX_PRELEN(rx) );
}
else {
croak( "precomp is only meaningful on r-magic" );
match_flags >>= 1;
}
- pattern = sv_2mortal(newSVpvn(re->precomp,re->prelen));
+ pattern = sv_2mortal(newSVpvn(RX_PRECOMP(re),RX_PRELEN(re)));
if (re->extflags & RXf_UTF8) SvUTF8_on(pattern);
/* return the pattern and the modifiers */
if (kid && kid->op_type == OP_MATCH) {
if (ckWARN(WARN_SYNTAX)) {
const REGEXP *re = PM_GETRE(kPMOP);
- const char *pmstr = re ? re->precomp : "STRING";
- const STRLEN len = re ? re->prelen : 6;
+ const char *pmstr = re ? RX_PRECOMP(re) : "STRING";
+ const STRLEN len = re ? RX_PRELEN(re) : 6;
Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
"/%.*s/ should probably be written as \"%.*s\"",
(int)len, pmstr, (int)len, pmstr);
re = PM_GETRE(pm);
/* Check against the last compiled regexp. */
- if (!re || !re->precomp || re->prelen != (I32)len ||
- memNE(re->precomp, t, len))
+ if (!re || !RX_PRECOMP(re) || RX_PRELEN(re) != (I32)len ||
+ memNE(RX_PRECOMP(re), t, len))
{
const regexp_engine *eng = re ? re->engine : NULL;
U32 pm_flags = pm->op_pmflags & PMf_COMPILETIME;
}
#endif
- if (!PM_GETRE(pm)->prelen && PL_curpm)
+ if (!RX_PRELEN(PM_GETRE(pm)) && PL_curpm)
pm = PL_curpm;
/* empty pattern special-cased to use last successful pattern if possible */
- if (!rx->prelen && PL_curpm) {
+ if (!RX_PRELEN(rx) && PL_curpm) {
pm = PL_curpm;
rx = PM_GETRE(pm);
}
position, once with zero-length,
second time with non-zero. */
- if (!rx->prelen && PL_curpm) {
+ if (!RX_PRELEN(rx) && PL_curpm) {
pm = PL_curpm;
rx = PM_GETRE(pm);
}
RXi_SET( r, ri );
r->engine= RE_ENGINE_PTR;
r->refcnt = 1;
- r->prelen = plen;
+ RX_PRELEN(r) = plen;
r->extflags = pm_flags;
{
bool has_p = ((r->extflags & RXf_PMf_KEEPCOPY) == RXf_PMf_KEEPCOPY);
U16 reganch = (U16)((r->extflags & RXf_PMf_STD_PMMOD) >> 12);
const char *fptr = STD_PAT_MODS; /*"msix"*/
char *p;
- r->wraplen = r->prelen + has_minus + has_p + has_runon
+ r->wraplen = RX_PRELEN(r) + has_minus + has_p + has_runon
+ (sizeof(STD_PAT_MODS) - 1)
+ (sizeof("(?:)") - 1);
}
*p++ = ':';
- Copy(RExC_precomp, p, r->prelen, char);
- r->precomp = p;
- p += r->prelen;
+ Copy(RExC_precomp, p, RX_PRELEN(r), char);
+ RX_PRECOMP(r) = p;
+ p += RX_PRELEN(r);
if (has_runon)
*p++ = '\n';
*p++ = ')';
r->paren_names = NULL;
#ifdef STUPID_PATTERN_CHECKS
- if (r->prelen == 0)
+ if (RX_PRELEN(r) == 0)
r->extflags |= RXf_NULL;
- if (r->extflags & RXf_SPLIT && r->prelen == 1 && r->precomp[0] == ' ')
+ if (r->extflags & RXf_SPLIT && RX_PRELEN(r) == 1 && RX_PRECOMP(r)[0] == ' ')
/* XXX: this should happen BEFORE we compile */
r->extflags |= (RXf_SKIPWHITE|RXf_WHITE);
- else if (r->prelen == 3 && memEQ("\\s+", r->precomp, 3))
+ else if (RX_PRELEN(r) == 3 && memEQ("\\s+", RX_PRECOMP(r), 3))
r->extflags |= RXf_WHITE;
- else if (r->prelen == 1 && r->precomp[0] == '^')
+ else if (RX_PRELEN(r) == 1 && RX_PRECOMP(r)[0] == '^')
r->extflags |= RXf_START_ONLY;
#else
- if (r->extflags & RXf_SPLIT && r->prelen == 1 && r->precomp[0] == ' ')
+ if (r->extflags & RXf_SPLIT && RX_PRELEN(r) == 1 && RX_PRECOMP(r)[0] == ' ')
/* XXX: this should happen BEFORE we compile */
r->extflags |= (RXf_SKIPWHITE|RXf_WHITE);
else {
{
SV *dsv= sv_newmortal();
RE_PV_QUOTED_DECL(s, (r->extflags & RXf_UTF8),
- dsv, r->precomp, r->prelen, 60);
+ dsv, RX_PRECOMP(r), RX_PRELEN(r), 60);
PerlIO_printf(Perl_debug_log,"%sFreeing REx:%s %s\n",
PL_colors[4],PL_colors[5],s);
}
}
ret->wrapped = SAVEPVN(ret->wrapped, ret->wraplen+1);
- ret->precomp = ret->wrapped + (ret->precomp - ret->wrapped);
+ RX_PRECOMP(ret) = ret->wrapped + (RX_PRECOMP(ret) - ret->wrapped);
ret->paren_names = hv_dup_inc(ret->paren_names, param);
if (ret->pprivate)
#ifdef QDEBUGGING /* 7/99: reports of failure (with the older version) */
if (end_shift < 0)
Perl_croak(aTHX_ "panic: end_shift: %"IVdf" pattern:\n%s\n ",
- (IV)end_shift, prog->precomp);
+ (IV)end_shift, RX_PRECOMP(prog));
#endif
restart:
reginitcolors();
{
RE_PV_QUOTED_DECL(s0, utf8_pat, PERL_DEBUG_PAD_ZERO(0),
- prog->precomp, prog->prelen, 60);
+ RX_PRECOMP(prog), RX_PRELEN(prog), 60);
RE_PV_QUOTED_DECL(s1, do_utf8, PERL_DEBUG_PAD_ZERO(1),
start, end - start, 60);
? RX_MATCH_COPIED_on(prog) \
: RX_MATCH_COPIED_off(prog))
+/* For source compatibility. We used to store these explicitly. */
+#define RX_PRECOMP(prog) ((prog)->precomp)
+#define RX_PRELEN(prog) ((prog)->prelen)
+
#endif /* PLUGGABLE_RE_EXTENSION */
/* Stuff that needs to be included in the plugable extension goes below here */