/* pp_ctl.c
*
- * Copyright (c) 1991-1999, Larry Wall
+ * Copyright (c) 1991-2000, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
PL_reginterp_cnt = I32_MAX; /* Mark as safe. */
pm->op_pmflags = pm->op_pmpermflags; /* reset case sensitivity */
+ if (DO_UTF8(tmpstr))
+ pm->op_pmdynflags |= PMdf_UTF8;
pm->op_pmregexp = CALLREGCOMP(aTHX_ t, t + len, pm);
PL_reginterp_cnt = 0; /* XXXX Be extra paranoid - needed
inside tie/overload accessors. */
NV value;
bool gotsome;
STRLEN len;
- STRLEN fudge = SvCUR(tmpForm) * (IN_UTF8 ? 3 : 1) + 1;
+ STRLEN fudge = SvCUR(tmpForm) * (IN_BYTE ? 1 : 3) + 1;
+ bool item_is_utf = FALSE;
if (!SvMAGICAL(tmpForm) || !SvCOMPILED(tmpForm)) {
- SvREADONLY_off(tmpForm);
- doparseform(tmpForm);
+ if (SvREADONLY(tmpForm)) {
+ SvREADONLY_off(tmpForm);
+ doparseform(tmpForm);
+ SvREADONLY_on(tmpForm);
+ }
+ else
+ doparseform(tmpForm);
}
SvPV_force(PL_formtarget, len);
case FF_CHECKNL:
item = s = SvPV(sv, len);
itemsize = len;
- if (IN_UTF8) {
+ if (DO_UTF8(sv)) {
itemsize = sv_len_utf8(sv);
if (itemsize != len) {
I32 itembytes;
break;
s++;
}
+ item_is_utf = TRUE;
itemsize = s - item;
sv_pos_b2u(sv, &itemsize);
break;
}
}
+ item_is_utf = FALSE;
if (itemsize > fieldsize)
itemsize = fieldsize;
send = chophere = s + itemsize;
case FF_CHECKCHOP:
item = s = SvPV(sv, len);
itemsize = len;
- if (IN_UTF8) {
+ if (DO_UTF8(sv)) {
itemsize = sv_len_utf8(sv);
if (itemsize != len) {
I32 itembytes;
itemsize = chophere - item;
sv_pos_b2u(sv, &itemsize);
}
+ item_is_utf = TRUE;
break;
}
}
+ item_is_utf = FALSE;
if (itemsize <= fieldsize) {
send = chophere = s + itemsize;
while (s < send) {
case FF_ITEM:
arg = itemsize;
s = item;
- if (IN_UTF8) {
+ if (item_is_utf) {
while (arg--) {
if (*s & 0x80) {
switch (UTF8SKIP(s)) {
case FF_LINEGLOB:
item = s = SvPV(sv, len);
itemsize = len;
+ item_is_utf = FALSE; /* XXX is this correct? */
if (itemsize) {
gotsome = TRUE;
send = s + itemsize;
mg_get(right);
if (SvNIOKp(left) || !SvPOKp(left) ||
- (looks_like_number(left) && *SvPVX(left) != '0') )
+ SvNIOKp(right) || !SvPOKp(right) ||
+ (looks_like_number(left) && *SvPVX(left) != '0' &&
+ looks_like_number(right) && *SvPVX(right) != '0'))
{
if (SvNV(left) < IV_MIN || SvNV(right) > IV_MAX)
DIE(aTHX_ "Range iterator outside integer range");
else if (PL_errors)
sv_catsv(PL_errors, err);
else
- Perl_warn(aTHX_ "%_", err);
+ Perl_warn(aTHX_ "%"SVf, err);
++PL_error_count;
}
if (SvTYPE(cx->blk_loop.iterary) != SVt_PVAV) {
dPOPss;
if (SvNIOKp(sv) || !SvPOKp(sv) ||
- (looks_like_number(sv) && *SvPVX(sv) != '0')) {
+ SvNIOKp(cx->blk_loop.iterary) || !SvPOKp(cx->blk_loop.iterary) ||
+ (looks_like_number(sv) && *SvPVX(sv) != '0' &&
+ looks_like_number((SV*)cx->blk_loop.iterary) &&
+ *SvPVX(cx->blk_loop.iterary) != '0'))
+ {
if (SvNV(sv) < IV_MIN ||
SvNV((SV*)cx->blk_loop.iterary) >= IV_MAX)
DIE(aTHX_ "Range iterator outside integer range");
if (cxix < cxstack_ix)
dounwind(cxix);
- TOPBLOCK(cx);
- oldsave = PL_scopestack[PL_scopestack_ix - 1];
- LEAVE_SCOPE(oldsave);
- return cx->blk_loop.next_op;
+ cx = &cxstack[cxstack_ix];
+ {
+ OP *nextop = cx->blk_loop.next_op;
+ /* clean scope, but only if there's no continue block */
+ if (nextop == cUNOPx(cx->blk_loop.last_op)->op_first->op_next) {
+ TOPBLOCK(cx);
+ oldsave = PL_scopestack[PL_scopestack_ix - 1];
+ LEAVE_SCOPE(oldsave);
+ }
+ return nextop;
+ }
}
PP(pp_redo)
/* Eventually we may want to stack the needed arguments
* for each op. For now, we punt on the hard ones. */
if (PL_op->op_type == OP_ENTERITER)
- DIE(aTHX_ "Can't \"goto\" into the middle of a foreach loop",
- label);
+ DIE(aTHX_ "Can't \"goto\" into the middle of a foreach loop");
CALL_FPTR(PL_op->op_ppaddr)(aTHX);
}
PL_op = oldop;
I32 optype;
OP dummy;
OP *oop = PL_op, *rop;
- char tmpbuf[TYPE_DIGITS(long) + 12 + 10];
+ char tbuf[TYPE_DIGITS(long) + 12 + 10];
+ char *tmpbuf = tbuf;
char *safestr;
ENTER;
}
SAVECOPFILE(&PL_compiling);
SAVECOPLINE(&PL_compiling);
- sprintf(tmpbuf, "_<(%.10s_eval %lu)", code, (unsigned long)++PL_evalseq);
+ if (PERLDB_NAMEEVAL && CopLINE(PL_curcop)) {
+ SV *sv = sv_newmortal();
+ Perl_sv_setpvf(aTHX_ sv, "_<(%.10seval %lu)[%s:%"IVdf"]",
+ code, (unsigned long)++PL_evalseq,
+ CopFILE(PL_curcop), (IV)CopLINE(PL_curcop));
+ tmpbuf = SvPVX(sv);
+ }
+ else
+ sprintf(tmpbuf, "_<(%.10s_eval %lu)", code, (unsigned long)++PL_evalseq);
CopFILE_set(&PL_compiling, tmpbuf+2);
CopLINE_set(&PL_compiling, 1);
/* XXX For C<eval "...">s within BEGIN {} blocks, this ends up
sv = POPs;
if (SvNIOKp(sv)) {
UV rev, ver, sver;
- if (SvPOKp(sv) && SvUTF8(sv)) { /* require v5.6.1 */
+ if (SvPOKp(sv)) { /* require v5.6.1 */
I32 len;
U8 *s = (U8*)SvPVX(sv);
U8 *end = (U8*)SvPVX(sv) + SvCUR(sv);
&& PERL_SUBVERSION < sver))))
{
DIE(aTHX_ "Perl v%"UVuf".%"UVuf".%"UVuf" required--this is only version "
- "v%"UVuf".%"UVuf".%"UVuf", stopped", rev, ver, sver, PERL_REVISION,
+ "v%d.%d.%d, stopped", rev, ver, sver, PERL_REVISION,
PERL_VERSION, PERL_SUBVERSION);
}
}
+ 0.00000099 < SvNV(sv))
{
DIE(aTHX_ "Perl v%"UVuf".%"UVuf".%"UVuf" required--this is only version "
- "v%"UVuf".%"UVuf".%"UVuf", stopped", rev, ver, sver, PERL_REVISION,
+ "v%d.%d.%d, stopped", rev, ver, sver, PERL_REVISION,
PERL_VERSION, PERL_SUBVERSION);
}
}
register PERL_CONTEXT *cx;
dPOPss;
I32 gimme = GIMME_V, was = PL_sub_generation;
- char tmpbuf[TYPE_DIGITS(long) + 12];
+ char tbuf[TYPE_DIGITS(long) + 12];
+ char *tmpbuf = tbuf;
char *safestr;
STRLEN len;
OP *ret;
/* switch to eval mode */
SAVECOPFILE(&PL_compiling);
- sprintf(tmpbuf, "_<(eval %lu)", (unsigned long)++PL_evalseq);
+ if (PERLDB_NAMEEVAL && CopLINE(PL_curcop)) {
+ SV *sv = sv_newmortal();
+ Perl_sv_setpvf(aTHX_ sv, "_<(eval %lu)[%s:%"IVdf"]",
+ (unsigned long)++PL_evalseq,
+ CopFILE(PL_curcop), (IV)CopLINE(PL_curcop));
+ tmpbuf = SvPVX(sv);
+ }
+ else
+ sprintf(tmpbuf, "_<(eval %lu)", (unsigned long)++PL_evalseq);
CopFILE_set(&PL_compiling, tmpbuf+2);
CopLINE_set(&PL_compiling, 1);
/* XXX For C<eval "...">s within BEGIN {} blocks, this ends up