From: Perl 5 Porters Date: Sat, 3 Feb 1996 17:45:32 +0000 (-0500) Subject: perl 5.002gamma: pp.c X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=464e2e8a8adc53c0c10661a188bbf62d0c83deeb;p=p5sagit%2Fp5-mst-13.2.git perl 5.002gamma: pp.c >From salzench@dun.nielsen.comSat Feb 3 15:18:05 1996 >Date: Sat, 3 Feb 1996 12:45:32 -0500 (EST) >From: Chip Salzenberg >Reply to: chip@atlantic.net >To: Perl 5 Porters >Subject: Beta3: Combine code: provide_refs >From lwall@sems.comWed Feb 7 09:10:55 1996 >Date: Tue, 06 Feb 96 14:52:41 -0800 >From: Larry Wall >To: perl5-porters@africa.nicoh.com >Subject: study still busted --- diff --git a/pp.c b/pp.c index 159091f..7da420b 100644 --- a/pp.c +++ b/pp.c @@ -188,19 +188,8 @@ PP(pp_rv2sv) if (op->op_flags & OPf_MOD) { if (op->op_private & OPpLVAL_INTRO) sv = save_scalar((GV*)TOPs); - else if (op->op_private & (OPpDEREF_HV|OPpDEREF_AV)) { - if (SvGMAGICAL(sv)) - mg_get(sv); - if (!SvOK(sv)) { - if (SvREADONLY(sv)) - croak(no_modify); - (void)SvUPGRADE(sv, SVt_RV); - SvRV(sv) = (op->op_private & OPpDEREF_HV ? - (SV*)newHV() : (SV*)newAV()); - SvROK_on(sv); - SvSETMAGIC(sv); - } - } + else if (op->op_private & (OPpDEREF_HV|OPpDEREF_AV)) + provide_ref(op, sv); } SETs(sv); RETURN; @@ -433,6 +422,7 @@ PP(pp_study) } SvSCREAM_on(sv); + sv_magic(sv, Nullsv, 'g', Nullch, 0); /* piggyback on m//g magic */ retval = 1; ret: XPUSHs(sv_2mortal(newSViv((I32)retval))); @@ -1330,28 +1320,38 @@ PP(pp_hex) { dSP; dTARGET; char *tmps; + unsigned long value; I32 argtype; tmps = POPp; - XPUSHi( scan_hex(tmps, 99, &argtype) ); + value = scan_hex(tmps, 99, &argtype); + if ((IV)value >= 0) + XPUSHi(value); + else + XPUSHn(U_V(value)); RETURN; } PP(pp_oct) { dSP; dTARGET; - I32 value; + unsigned long value; I32 argtype; char *tmps; tmps = POPp; - while (*tmps && (isSPACE(*tmps) || *tmps == '0')) + while (*tmps && isSPACE(*tmps)) + tmps++; + if (*tmps == '0') tmps++; if (*tmps == 'x') - value = (I32)scan_hex(++tmps, 99, &argtype); + value = scan_hex(++tmps, 99, &argtype); else - value = (I32)scan_oct(tmps, 99, &argtype); - XPUSHi(value); + value = scan_oct(tmps, 99, &argtype); + if ((IV)value >= 0) + XPUSHi(value); + else + XPUSHn(U_V(value)); RETURN; }