summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-03-17 01:10:54 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-03-17 01:10:54 +0000
commitd9f975991d53b93e15d703c5e48ae9aea5162637 (patch)
treedd1d9b7620f3ee9a37e547299d2cc978c5114674
parentac4c12e7aee90d31d5da776601addbfd9d738a5a (diff)
downloadperl-d9f975991d53b93e15d703c5e48ae9aea5162637.tar.gz
[asperl] add a part of AS patch#14, backout incomplete variable
name changes for gcc. Builds and tests under VC/BC once again. p4raw-id: //depot/asperl@830
-rw-r--r--bytecode.h8
-rw-r--r--mg.c54
-rw-r--r--pp.c44
-rw-r--r--pp_ctl.c60
-rw-r--r--pp_hot.c222
-rw-r--r--toke.c16
6 files changed, 202 insertions, 202 deletions
diff --git a/bytecode.h b/bytecode.h
index 92c124dc06..0239866d0a 100644
--- a/bytecode.h
+++ b/bytecode.h
@@ -28,11 +28,11 @@ EXT I32 obj_list_fill INIT(-1);
#endif /* INDIRECT_BGET_MACROS */
#define BGET_U32(arg) \
- BGET_FREAD(&arg, sizeof(U32), 1); arg = ntohl((U32)arg)
+ BGET_FREAD(&arg, sizeof(U32), 1); arg = PerlSock_ntohl((U32)arg)
#define BGET_I32(arg) \
- BGET_FREAD(&arg, sizeof(I32), 1); arg = (I32)ntohl((U32)arg)
+ BGET_FREAD(&arg, sizeof(I32), 1); arg = (I32)PerlSock_ntohl((U32)arg)
#define BGET_U16(arg) \
- BGET_FREAD(&arg, sizeof(U16), 1); arg = ntohs((U16)arg)
+ BGET_FREAD(&arg, sizeof(U16), 1); arg = PerlSock_ntohs((U16)arg)
#define BGET_U8(arg) arg = BGET_FGETC()
#if INDIRECT_BGET_MACROS
@@ -92,7 +92,7 @@ EXT I32 obj_list_fill INIT(-1);
New(666, ary, 256, unsigned short); \
BGET_FREAD(ary, 256, 2); \
for (i = 0; i < 256; i++) \
- ary[i] = ntohs(ary[i]); \
+ ary[i] = PerlSock_ntohs(ary[i]); \
arg = (char *) ary; \
} while (0)
diff --git a/mg.c b/mg.c
index 6466b314db..29fe0a403a 100644
--- a/mg.c
+++ b/mg.c
@@ -289,18 +289,18 @@ magic_len(SV *sv, MAGIC *mg)
register I32 paren;
register char *s;
register I32 i;
- register REGEXP *prx;
+ register REGEXP *rx;
char *t;
switch (*mg->mg_ptr) {
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '&':
- if (curpm && (prx = curpm->op_pmregexp)) {
+ if (curpm && (rx = curpm->op_pmregexp)) {
paren = atoi(mg->mg_ptr);
getparen:
- if (paren <= prx->nparens &&
- (s = prx->startp[paren]) &&
- (t = prx->endp[paren]))
+ if (paren <= rx->nparens &&
+ (s = rx->startp[paren]) &&
+ (t = rx->endp[paren]))
{
i = t - s;
if (i >= 0)
@@ -309,25 +309,25 @@ magic_len(SV *sv, MAGIC *mg)
}
return 0;
case '+':
- if (curpm && (prx = curpm->op_pmregexp)) {
- paren = prx->lastparen;
+ if (curpm && (rx = curpm->op_pmregexp)) {
+ paren = rx->lastparen;
if (paren)
goto getparen;
}
return 0;
case '`':
- if (curpm && (prx = curpm->op_pmregexp)) {
- if ((s = prx->subbeg) && prx->startp[0]) {
- i = prx->startp[0] - s;
+ if (curpm && (rx = curpm->op_pmregexp)) {
+ if ((s = rx->subbeg) && rx->startp[0]) {
+ i = rx->startp[0] - s;
if (i >= 0)
return i;
}
}
return 0;
case '\'':
- if (curpm && (prx = curpm->op_pmregexp)) {
- if (prx->subend && (s = prx->endp[0])) {
- i = prx->subend - s;
+ if (curpm && (rx = curpm->op_pmregexp)) {
+ if (rx->subend && (s = rx->endp[0])) {
+ i = rx->subend - s;
if (i >= 0)
return i;
}
@@ -353,7 +353,7 @@ magic_get(SV *sv, MAGIC *mg)
register I32 paren;
register char *s;
register I32 i;
- register REGEXP *prx;
+ register REGEXP *rx;
char *t;
switch (*mg->mg_ptr) {
@@ -457,16 +457,16 @@ magic_get(SV *sv, MAGIC *mg)
break;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '&':
- if (curpm && (prx = curpm->op_pmregexp)) {
+ if (curpm && (rx = curpm->op_pmregexp)) {
/*
* Pre-threads, this was paren = atoi(GvENAME((GV*)mg->mg_obj));
* XXX Does the new way break anything?
*/
paren = atoi(mg->mg_ptr);
getparen:
- if (paren <= prx->nparens &&
- (s = prx->startp[paren]) &&
- (t = prx->endp[paren]))
+ if (paren <= rx->nparens &&
+ (s = rx->startp[paren]) &&
+ (t = rx->endp[paren]))
{
i = t - s;
getrx:
@@ -478,7 +478,7 @@ magic_get(SV *sv, MAGIC *mg)
}
sv_setpvn(sv,s,i);
if (tainting)
- tainted = was_tainted || RX_MATCH_TAINTED(prx);
+ tainted = was_tainted || RX_MATCH_TAINTED(rx);
break;
}
}
@@ -486,26 +486,26 @@ magic_get(SV *sv, MAGIC *mg)
sv_setsv(sv,&sv_undef);
break;
case '+':
- if (curpm && (prx = curpm->op_pmregexp)) {
- paren = prx->lastparen;
+ if (curpm && (rx = curpm->op_pmregexp)) {
+ paren = rx->lastparen;
if (paren)
goto getparen;
}
sv_setsv(sv,&sv_undef);
break;
case '`':
- if (curpm && (prx = curpm->op_pmregexp)) {
- if ((s = prx->subbeg) && prx->startp[0]) {
- i = prx->startp[0] - s;
+ if (curpm && (rx = curpm->op_pmregexp)) {
+ if ((s = rx->subbeg) && rx->startp[0]) {
+ i = rx->startp[0] - s;
goto getrx;
}
}
sv_setsv(sv,&sv_undef);
break;
case '\'':
- if (curpm && (prx = curpm->op_pmregexp)) {
- if (prx->subend && (s = prx->endp[0])) {
- i = prx->subend - s;
+ if (curpm && (rx = curpm->op_pmregexp)) {
+ if (rx->subend && (s = rx->endp[0])) {
+ i = rx->subend - s;
goto getrx;
}
}
diff --git a/pp.c b/pp.c
index 390c501bd2..affea1788c 100644
--- a/pp.c
+++ b/pp.c
@@ -4127,7 +4127,7 @@ PP(pp_split)
register char *s = SvPV(sv, len);
char *strend = s + len;
register PMOP *pm;
- register REGEXP *prx;
+ register REGEXP *rx;
register SV *dstr;
register char *m;
I32 iters = 0;
@@ -4150,7 +4150,7 @@ PP(pp_split)
#endif
if (!pm || !s)
DIE("panic: do_split");
- prx = pm->op_pmregexp;
+ rx = pm->op_pmregexp;
TAINT_IF((pm->op_pmflags & PMf_LOCALE) &&
(pm->op_pmflags & (PMf_WHITE | PMf_SKIPWHITE)));
@@ -4228,7 +4228,7 @@ PP(pp_split)
++s;
}
}
- else if (strEQ("^", prx->precomp)) {
+ else if (strEQ("^", rx->precomp)) {
while (--limit) {
/*SUPPRESS 530*/
for (m = s; m < strend && *m != '\n'; m++) ;
@@ -4243,12 +4243,12 @@ PP(pp_split)
s = m;
}
}
- else if (prx->check_substr && !prx->nparens
- && (prx->reganch & ROPT_CHECK_ALL)
- && !(prx->reganch & ROPT_ANCH)) {
- i = SvCUR(prx->check_substr);
- if (i == 1 && !SvTAIL(prx->check_substr)) {
- i = *SvPVX(prx->check_substr);
+ else if (rx->check_substr && !rx->nparens
+ && (rx->reganch & ROPT_CHECK_ALL)
+ && !(rx->reganch & ROPT_ANCH)) {
+ i = SvCUR(rx->check_substr);
+ if (i == 1 && !SvTAIL(rx->check_substr)) {
+ i = *SvPVX(rx->check_substr);
while (--limit) {
/*SUPPRESS 530*/
for (m = s; m < strend && *m != i; m++) ;
@@ -4266,7 +4266,7 @@ PP(pp_split)
#ifndef lint
while (s < strend && --limit &&
(m=fbm_instr((unsigned char*)s, (unsigned char*)strend,
- prx->check_substr)) )
+ rx->check_substr)) )
#endif
{
dstr = NEWSV(31, m-s);
@@ -4279,29 +4279,29 @@ PP(pp_split)
}
}
else {
- maxiters += (strend - s) * prx->nparens;
+ maxiters += (strend - s) * rx->nparens;
while (s < strend && --limit &&
- regexec_flags(prx, s, strend, orig, 1, Nullsv, NULL, 0))
+ regexec_flags(rx, s, strend, orig, 1, Nullsv, NULL, 0))
{
- TAINT_IF(RX_MATCH_TAINTED(prx));
- if (prx->subbase
- && prx->subbase != orig) {
+ TAINT_IF(RX_MATCH_TAINTED(rx));
+ if (rx->subbase
+ && rx->subbase != orig) {
m = s;
s = orig;
- orig = prx->subbase;
+ orig = rx->subbase;
s = orig + (m - s);
strend = s + (strend - m);
}
- m = prx->startp[0];
+ m = rx->startp[0];
dstr = NEWSV(32, m-s);
sv_setpvn(dstr, s, m-s);
if (make_mortal)
sv_2mortal(dstr);
XPUSHs(dstr);
- if (prx->nparens) {
- for (i = 1; i <= prx->nparens; i++) {
- s = prx->startp[i];
- m = prx->endp[i];
+ if (rx->nparens) {
+ for (i = 1; i <= rx->nparens; i++) {
+ s = rx->startp[i];
+ m = rx->endp[i];
if (m && s) {
dstr = NEWSV(33, m-s);
sv_setpvn(dstr, s, m-s);
@@ -4313,7 +4313,7 @@ PP(pp_split)
XPUSHs(dstr);
}
}
- s = prx->endp[0];
+ s = rx->endp[0];
}
}
diff --git a/pp_ctl.c b/pp_ctl.c
index 437ca07645..2d8ea72350 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -126,9 +126,9 @@ PP(pp_substcont)
register char *s = cx->sb_s;
register char *m = cx->sb_m;
char *orig = cx->sb_orig;
- register REGEXP *prx = cx->sb_rx;
+ register REGEXP *rx = cx->sb_rx;
- rxres_restore(&cx->sb_rxres, prx);
+ rxres_restore(&cx->sb_rxres, rx);
if (cx->sb_iters++) {
if (cx->sb_iters > cx->sb_maxiters)
@@ -139,14 +139,14 @@ PP(pp_substcont)
sv_catsv(dstr, POPs);
/* Are we done */
- if (cx->sb_once || !regexec_flags(prx, s, cx->sb_strend, orig,
+ if (cx->sb_once || !regexec_flags(rx, s, cx->sb_strend, orig,
s == m, Nullsv, NULL,
cx->sb_safebase ? 0 : REXEC_COPY_STR))
{
SV *targ = cx->sb_targ;
sv_catpvn(dstr, s, cx->sb_strend - s);
- TAINT_IF(cx->sb_rxtainted || RX_MATCH_TAINTED(prx));
+ TAINT_IF(cx->sb_rxtainted || RX_MATCH_TAINTED(rx));
(void)SvOOK_off(targ);
Safefree(SvPVX(targ));
@@ -165,29 +165,29 @@ PP(pp_substcont)
RETURNOP(pm->op_next);
}
}
- if (prx->subbase && prx->subbase != orig) {
+ if (rx->subbase && rx->subbase != orig) {
m = s;
s = orig;
- cx->sb_orig = orig = prx->subbase;
+ cx->sb_orig = orig = rx->subbase;
s = orig + (m - s);
cx->sb_strend = s + (cx->sb_strend - m);
}
- cx->sb_m = m = prx->startp[0];
+ cx->sb_m = m = rx->startp[0];
sv_catpvn(dstr, s, m-s);
- cx->sb_s = prx->endp[0];
- cx->sb_rxtainted |= RX_MATCH_TAINTED(prx);
- rxres_save(&cx->sb_rxres, prx);
+ cx->sb_s = rx->endp[0];
+ cx->sb_rxtainted |= RX_MATCH_TAINTED(rx);
+ rxres_save(&cx->sb_rxres, rx);
RETURNOP(pm->op_pmreplstart);
}
void
-rxres_save(void **rsp, REGEXP *prx)
+rxres_save(void **rsp, REGEXP *rx)
{
UV *p = (UV*)*rsp;
U32 i;
- if (!p || p[1] < prx->nparens) {
- i = 6 + prx->nparens * 2;
+ if (!p || p[1] < rx->nparens) {
+ i = 6 + rx->nparens * 2;
if (!p)
New(501, p, i, UV);
else
@@ -195,36 +195,36 @@ rxres_save(void **rsp, REGEXP *prx)
*rsp = (void*)p;
}
- *p++ = (UV)prx->subbase;
- prx->subbase = Nullch;
+ *p++ = (UV)rx->subbase;
+ rx->subbase = Nullch;
- *p++ = prx->nparens;
+ *p++ = rx->nparens;
- *p++ = (UV)prx->subbeg;
- *p++ = (UV)prx->subend;
- for (i = 0; i <= prx->nparens; ++i) {
- *p++ = (UV)prx->startp[i];
- *p++ = (UV)prx->endp[i];
+ *p++ = (UV)rx->subbeg;
+ *p++ = (UV)rx->subend;
+ for (i = 0; i <= rx->nparens; ++i) {
+ *p++ = (UV)rx->startp[i];
+ *p++ = (UV)rx->endp[i];
}
}
void
-rxres_restore(void **rsp, REGEXP *prx)
+rxres_restore(void **rsp, REGEXP *rx)
{
UV *p = (UV*)*rsp;
U32 i;
- Safefree(prx->subbase);
- prx->subbase = (char*)(*p);
+ Safefree(rx->subbase);
+ rx->subbase = (char*)(*p);
*p++ = 0;
- prx->nparens = *p++;
+ rx->nparens = *p++;
- prx->subbeg = (char*)(*p++);
- prx->subend = (char*)(*p++);
- for (i = 0; i <= prx->nparens; ++i) {
- prx->startp[i] = (char*)(*p++);
- prx->endp[i] = (char*)(*p++);
+ rx->subbeg = (char*)(*p++);
+ rx->subend = (char*)(*p++);
+ for (i = 0; i <= rx->nparens; ++i) {
+ rx->startp[i] = (char*)(*p++);
+ rx->endp[i] = (char*)(*p++);
}
}
diff --git a/pp_hot.c b/pp_hot.c
index 702e4473e3..32f378a59f 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -763,7 +763,7 @@ PP(pp_match)
I32 global;
I32 safebase;
char *truebase;
- register REGEXP *prx = pm->op_pmregexp;
+ register REGEXP *rx = pm->op_pmregexp;
I32 gimme = GIMME;
STRLEN len;
I32 minmatch = 0;
@@ -791,31 +791,31 @@ PP(pp_match)
RETPUSHNO;
}
- if (!prx->prelen && curpm) {
+ if (!rx->prelen && curpm) {
pm = curpm;
- prx = pm->op_pmregexp;
+ rx = pm->op_pmregexp;
}
- if (prx->minlen > len) goto failure;
+ if (rx->minlen > len) goto failure;
- screamer = ( (SvSCREAM(TARG) && prx->check_substr
- && SvTYPE(prx->check_substr) == SVt_PVBM
- && SvVALID(prx->check_substr))
+ screamer = ( (SvSCREAM(TARG) && rx->check_substr
+ && SvTYPE(rx->check_substr) == SVt_PVBM
+ && SvVALID(rx->check_substr))
? TARG : Nullsv);
truebase = t = s;
if (global = pm->op_pmflags & PMf_GLOBAL) {
- prx->startp[0] = 0;
+ rx->startp[0] = 0;
if (SvTYPE(TARG) >= SVt_PVMG && SvMAGIC(TARG)) {
MAGIC* mg = mg_find(TARG, 'g');
if (mg && mg->mg_len >= 0) {
- prx->endp[0] = prx->startp[0] = s + mg->mg_len;
+ rx->endp[0] = rx->startp[0] = s + mg->mg_len;
minmatch = (mg->mg_flags & MGf_MINMATCH);
update_minmatch = 0;
}
}
}
- if (!prx->nparens && !global)
+ if (!rx->nparens && !global)
gimme = G_SCALAR; /* accidental array context? */
- safebase = (((gimme == G_ARRAY) || global || !prx->nparens)
+ safebase = (((gimme == G_ARRAY) || global || !rx->nparens)
&& !sawampersand);
safebase = safebase ? 0 : REXEC_COPY_STR ;
if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) {
@@ -824,36 +824,36 @@ PP(pp_match)
}
play_it_again:
- if (global && prx->startp[0]) {
- t = s = prx->endp[0];
- if ((s + prx->minlen) > strend)
+ if (global && rx->startp[0]) {
+ t = s = rx->endp[0];
+ if ((s + rx->minlen) > strend)
goto nope;
if (update_minmatch++)
- minmatch = (s == prx->startp[0]);
+ minmatch = (s == rx->startp[0]);
}
- if (prx->check_substr) {
- if (!(prx->reganch & ROPT_NOSCAN)) { /* Floating checkstring. */
+ if (rx->check_substr) {
+ if (!(rx->reganch & ROPT_NOSCAN)) { /* Floating checkstring. */
if ( screamer ) {
I32 p = -1;
- if (screamfirst[BmRARE(prx->check_substr)] < 0)
+ if (screamfirst[BmRARE(rx->check_substr)] < 0)
goto nope;
- else if (!(s = screaminstr(TARG, prx->check_substr,
- prx->check_offset_min, 0, &p, 0)))
+ else if (!(s = screaminstr(TARG, rx->check_substr,
+ rx->check_offset_min, 0, &p, 0)))
goto nope;
- else if ((prx->reganch & ROPT_CHECK_ALL)
- && !sawampersand && !SvTAIL(prx->check_substr))
+ else if ((rx->reganch & ROPT_CHECK_ALL)
+ && !sawampersand && !SvTAIL(rx->check_substr))
goto yup;
}
- else if (!(s = fbm_instr((unsigned char*)s + prx->check_offset_min,
+ else if (!(s = fbm_instr((unsigned char*)s + rx->check_offset_min,
(unsigned char*)strend,
- prx->check_substr)))
+ rx->check_substr)))
goto nope;
- else if ((prx->reganch & ROPT_CHECK_ALL) && !sawampersand)
+ else if ((rx->reganch & ROPT_CHECK_ALL) && !sawampersand)
goto yup;
- if (s && prx->check_offset_max < t - s) {
- ++BmUSEFUL(prx->check_substr);
- s -= prx->check_offset_max;
+ if (s && rx->check_offset_max < t - s) {
+ ++BmUSEFUL(rx->check_substr);
+ s -= rx->check_offset_max;
}
else
s = t;
@@ -862,20 +862,20 @@ play_it_again:
beginning of match, and the match is anchored at s. */
else if (!multiline) { /* Anchored near beginning of string. */
I32 slen;
- if (*SvPVX(prx->check_substr) != s[prx->check_offset_min]
- || ((slen = SvCUR(prx->check_substr)) > 1
- && memNE(SvPVX(prx->check_substr),
- s + prx->check_offset_min, slen)))
+ if (*SvPVX(rx->check_substr) != s[rx->check_offset_min]
+ || ((slen = SvCUR(rx->check_substr)) > 1
+ && memNE(SvPVX(rx->check_substr),
+ s + rx->check_offset_min, slen)))
goto nope;
}
- if (!prx->naughty && --BmUSEFUL(prx->check_substr) < 0
- && prx->check_substr == prx->float_substr) {
- SvREFCNT_dec(prx->check_substr);
- prx->check_substr = Nullsv; /* opt is being useless */
- prx->float_substr = Nullsv;
+ if (!rx->naughty && --BmUSEFUL(rx->check_substr) < 0
+ && rx->check_substr == rx->float_substr) {
+ SvREFCNT_dec(rx->check_substr);
+ rx->check_substr = Nullsv; /* opt is being useless */
+ rx->float_substr = Nullsv;
}
}
- if (regexec_flags(prx, s, strend, truebase, minmatch,
+ if (regexec_flags(rx, s, strend, truebase, minmatch,
screamer, NULL, safebase))
{
curpm = pm;
@@ -888,11 +888,11 @@ play_it_again:
/*NOTREACHED*/
gotcha:
- TAINT_IF(RX_MATCH_TAINTED(prx));
+ TAINT_IF(RX_MATCH_TAINTED(rx));
if (gimme == G_ARRAY) {
I32 iters, i, len;
- iters = prx->nparens;
+ iters = rx->nparens;
if (global && !iters)
i = 1;
else
@@ -903,16 +903,16 @@ play_it_again:
for (i = !i; i <= iters; i++) {
PUSHs(sv_newmortal());
/*SUPPRESS 560*/
- if ((s = prx->startp[i]) && prx->endp[i] ) {
- len = prx->endp[i] - s;
+ if ((s = rx->startp[i]) && rx->endp[i] ) {
+ len = rx->endp[i] - s;
sv_setpvn(*SP, s, len);
}
}
if (global) {
- truebase = prx->subbeg;
- strend = prx->subend;
- if (prx->startp[0] && prx->startp[0] == prx->endp[0])
- ++prx->endp[0];
+ truebase = rx->subbeg;
+ strend = rx->subend;
+ if (rx->startp[0] && rx->startp[0] == rx->endp[0])
+ ++rx->endp[0];
PUTBACK; /* EVAL blocks may use stack */
goto play_it_again;
}
@@ -928,9 +928,9 @@ play_it_again:
sv_magic(TARG, (SV*)0, 'g', Nullch, 0);
mg = mg_find(TARG, 'g');
}
- if (prx->startp[0]) {
- mg->mg_len = prx->endp[0] - prx->subbeg;
- if (prx->startp[0] == prx->endp[0])
+ if (rx->startp[0]) {
+ mg->mg_len = rx->endp[0] - rx->subbeg;
+ if (rx->startp[0] == rx->endp[0])
mg->mg_flags |= MGf_MINMATCH;
else
mg->mg_flags &= ~MGf_MINMATCH;
@@ -941,35 +941,35 @@ play_it_again:
}
yup: /* Confirmed by check_substr */
- TAINT_IF(RX_MATCH_TAINTED(prx));
- ++BmUSEFUL(prx->check_substr);
+ TAINT_IF(RX_MATCH_TAINTED(rx));
+ ++BmUSEFUL(rx->check_substr);
curpm = pm;
if (pm->op_pmflags & PMf_ONCE)
pm->op_pmflags |= PMf_USED;
- Safefree(prx->subbase);
- prx->subbase = Nullch;
+ Safefree(rx->subbase);
+ rx->subbase = Nullch;
if (global) {
- prx->subbeg = truebase;
- prx->subend = strend;
- prx->startp[0] = s;
- prx->endp[0] = s + SvCUR(prx->check_substr);
+ rx->subbeg = truebase;
+ rx->subend = strend;
+ rx->startp[0] = s;
+ rx->endp[0] = s + SvCUR(rx->check_substr);
goto gotcha;
}
if (sawampersand) {
char *tmps;
- tmps = prx->subbase = savepvn(t, strend-t);
- prx->subbeg = tmps;
- prx->subend = tmps + (strend-t);
- tmps = prx->startp[0] = tmps + (s - t);
- prx->endp[0] = tmps + SvCUR(prx->check_substr);
+ tmps = rx->subbase = savepvn(t, strend-t);
+ rx->subbeg = tmps;
+ rx->subend = tmps + (strend-t);
+ tmps = rx->startp[0] = tmps + (s - t);
+ rx->endp[0] = tmps + SvCUR(rx->check_substr);
}
LEAVE_SCOPE(oldsave);
RETPUSHYES;
nope:
- if (prx->check_substr)
- ++BmUSEFUL(prx->check_substr);
+ if (rx->check_substr)
+ ++BmUSEFUL(rx->check_substr);
ret_no:
if (global && !(pm->op_pmflags & PMf_CONTINUE)) {
@@ -1442,7 +1442,7 @@ PP(pp_subst)
bool rxtainted;
char *orig;
I32 safebase;
- register REGEXP *prx = pm->op_pmregexp;
+ register REGEXP *rx = pm->op_pmregexp;
STRLEN len;
int force_on_match = 0;
I32 oldsave = savestack_ix;
@@ -1475,37 +1475,37 @@ PP(pp_subst)
strend = s + len;
maxiters = (strend - s) + 10;
- if (!prx->prelen && curpm) {
+ if (!rx->prelen && curpm) {
pm = curpm;
- prx = pm->op_pmregexp;
+ rx = pm->op_pmregexp;
}
- screamer = ( (SvSCREAM(TARG) && prx->check_substr
- && SvTYPE(prx->check_substr) == SVt_PVBM
- && SvVALID(prx->check_substr))
+ screamer = ( (SvSCREAM(TARG) && rx->check_substr
+ && SvTYPE(rx->check_substr) == SVt_PVBM
+ && SvVALID(rx->check_substr))
? TARG : Nullsv);
- safebase = (!prx->nparens && !sawampersand) ? 0 : REXEC_COPY_STR;
+ safebase = (!rx->nparens && !sawampersand) ? 0 : REXEC_COPY_STR;
if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) {
SAVEINT(multiline);
multiline = pm->op_pmflags & PMf_MULTILINE;
}
orig = m = s;
- if (prx->check_substr) {
- if (!(prx->reganch & ROPT_NOSCAN)) { /* It floats. */
+ if (rx->check_substr) {
+ if (!(rx->reganch & ROPT_NOSCAN)) { /* It floats. */
if (screamer) {
I32 p = -1;
- if (screamfirst[BmRARE(prx->check_substr)] < 0)
+ if (screamfirst[BmRARE(rx->check_substr)] < 0)
goto nope;
- else if (!(s = screaminstr(TARG, prx->check_substr, prx->check_offset_min, 0, &p, 0)))
+ else if (!(s = screaminstr(TARG, rx->check_substr, rx->check_offset_min, 0, &p, 0)))
goto nope;
}
- else if (!(s = fbm_instr((unsigned char*)s + prx->check_offset_min,
+ else if (!(s = fbm_instr((unsigned char*)s + rx->check_offset_min,
(unsigned char*)strend,
- prx->check_substr)))
+ rx->check_substr)))
goto nope;
- if (s && prx->check_offset_max < s - m) {
- ++BmUSEFUL(prx->check_substr);
- s -= prx->check_offset_max;
+ if (s && rx->check_offset_max < s - m) {
+ ++BmUSEFUL(rx->check_substr);
+ s -= rx->check_offset_max;
}
else
s = m;
@@ -1514,17 +1514,17 @@ PP(pp_subst)
beginning of match, and the match is anchored at s. */
else if (!multiline) { /* Anchored at beginning of string. */
I32 slen;
- if (*SvPVX(prx->check_substr) != s[prx->check_offset_min]
- || ((slen = SvCUR(prx->check_substr)) > 1
- && memNE(SvPVX(prx->check_substr),
- s + prx->check_offset_min, slen)))
+ if (*SvPVX(rx->check_substr) != s[rx->check_offset_min]
+ || ((slen = SvCUR(rx->check_substr)) > 1
+ && memNE(SvPVX(rx->check_substr),
+ s + rx->check_offset_min, slen)))
goto nope;
}
- if (!prx->naughty && --BmUSEFUL(prx->check_substr) < 0
- && prx->check_substr == prx->float_substr) {
- SvREFCNT_dec(prx->check_substr);
- prx->check_substr = Nullsv; /* opt is being useless */
- prx->float_substr = Nullsv;
+ if (!rx->naughty && --BmUSEFUL(rx->check_substr) < 0
+ && rx->check_substr == rx->float_substr) {
+ SvREFCNT_dec(rx->check_substr);
+ rx->check_substr = Nullsv; /* opt is being useless */
+ rx->float_substr = Nullsv;
}
}
@@ -1535,9 +1535,9 @@ PP(pp_subst)
c = dstr ? SvPV(dstr, clen) : Nullch;
/* can do inplace substitution? */
- if (c && clen <= prx->minlen && (once || !(safebase & REXEC_COPY_STR))
- && !(prx->reganch & ROPT_LOOKBEHIND_SEEN)) {
- if (!regexec_flags(prx, s, strend, orig, 0, screamer, NULL, safebase)) {
+ if (c && clen <= rx->minlen && (once || !(safebase & REXEC_COPY_STR))
+ && !(rx->reganch & ROPT_LOOKBEHIND_SEEN)) {
+ if (!regexec_flags(rx, s, strend, orig, 0, screamer, NULL, safebase)) {
SPAGAIN;
PUSHs(&sv_no);
LEAVE_SCOPE(oldsave);
@@ -1552,13 +1552,13 @@ PP(pp_subst)
curpm = pm;
SvSCREAM_off(TARG); /* disable possible screamer */
if (once) {
- rxtainted = RX_MATCH_TAINTED(prx);
- if (prx->subbase) {
- m = orig + (prx->startp[0] - prx->subbase);
- d = orig + (prx->endp[0] - prx->subbase);
+ rxtainted = RX_MATCH_TAINTED(rx);
+ if (rx->subbase) {
+ m = orig + (rx->startp[0] - rx->subbase);
+ d = orig + (rx->endp[0] - rx->subbase);
} else {
- m = prx->startp[0];
- d = prx->endp[0];
+ m = rx->startp[0];
+ d = rx->endp[0];
}
s = orig;
if (m - s > strend - d) { /* faster to shorten from end */
@@ -1602,8 +1602,8 @@ PP(pp_subst)
do {
if (iters++ > maxiters)
DIE("Substitution loop");
- rxtainted |= RX_MATCH_TAINTED(prx);
- m = prx->startp[0];
+ rxtainted |= RX_MATCH_TAINTED(rx);
+ m = rx->startp[0];
/*SUPPRESS 560*/
if (i = m - s) {
if (s != d)
@@ -1614,8 +1614,8 @@ PP(pp_subst)
Copy(c, d, clen, char);
d += clen;
}
- s = prx->endp[0];
- } while (regexec_flags(prx, s, strend, orig, s == m,
+ s = rx->endp[0];
+ } while (regexec_flags(rx, s, strend, orig, s == m,
Nullsv, NULL, 0)); /* don't match same null twice */
if (s != d) {
i = strend - s;
@@ -1637,13 +1637,13 @@ PP(pp_subst)
RETURN;
}
- if (regexec_flags(prx, s, strend, orig, 0, screamer, NULL, safebase)) {
+ if (regexec_flags(rx, s, strend, orig, 0, screamer, NULL, safebase)) {
if (force_on_match) {
force_on_match = 0;
s = SvPV_force(TARG, len);
goto force_it;
}
- rxtainted = RX_MATCH_TAINTED(prx);
+ rxtainted = RX_MATCH_TAINTED(rx);
dstr = NEWSV(25, len);
sv_setpvn(dstr, m, s-m);
curpm = pm;
@@ -1656,22 +1656,22 @@ PP(pp_subst)
do {
if (iters++ > maxiters)
DIE("Substitution loop");
- rxtainted |= RX_MATCH_TAINTED(prx);
- if (prx->subbase && prx->subbase != orig) {
+ rxtainted |= RX_MATCH_TAINTED(rx);
+ if (rx->subbase && rx->subbase != orig) {
m = s;
s = orig;
- orig = prx->subbase;
+ orig = rx->subbase;
s = orig + (m - s);
strend = s + (strend - m);
}
- m = prx->startp[0];
+ m = rx->startp[0];
sv_catpvn(dstr, s, m-s);
- s = prx->endp[0];
+ s = rx->endp[0];
if (clen)
sv_catpvn(dstr, c, clen);
if (once)
break;
- } while (regexec_flags(prx, s, strend, orig, s == m, Nullsv, NULL, safebase));
+ } while (regexec_flags(rx, s, strend, orig, s == m, Nullsv, NULL, safebase));
sv_catpvn(dstr, s, strend - s);
TAINT_IF(rxtainted);
@@ -1695,7 +1695,7 @@ PP(pp_subst)
goto ret_no;
nope:
- ++BmUSEFUL(prx->check_substr);
+ ++BmUSEFUL(rx->check_substr);
ret_no:
SPAGAIN;
diff --git a/toke.c b/toke.c
index c24f87868f..00dbf7fc47 100644
--- a/toke.c
+++ b/toke.c
@@ -876,23 +876,23 @@ scan_const(char *start)
*d++ = *s++;
} else if (s[2] == '{') { /* This should march regcomp.c */
I32 count = 1;
- char *pregparse = s + 3;
+ char *regparse = s + 3;
char c;
- while (count && (c = *pregparse)) {
- if (c == '\\' && pregparse[1])
- pregparse++;
+ while (count && (c = *regparse)) {
+ if (c == '\\' && regparse[1])
+ regparse++;
else if (c == '{')
count++;
else if (c == '}')
count--;
- pregparse++;
+ regparse++;
}
- if (*pregparse == ')')
- pregparse++;
+ if (*regparse == ')')
+ regparse++;
else
yyerror("Sequence (?{...}) not terminated or not {}-balanced");
- while (s < pregparse && *s != ')')
+ while (s < regparse && *s != ')')
*d++ = *s++;
}
}