diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 1998-01-14 18:49:25 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 1998-01-14 18:49:25 +0000 |
commit | a60c0954410db87be540ee8439afcd54350bbb8e (patch) | |
tree | 1a39a6e0941f3c706efe727a664534cce93143ee /pp.c | |
parent | 1393e20655efb4bcc2062605bfe887dd5e634bc1 (diff) | |
download | perl-a60c0954410db87be540ee8439afcd54350bbb8e.tar.gz |
TIEARRAY updates - almost works ...
p4raw-id: //depot/ansiperl@424
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 47 |
1 files changed, 27 insertions, 20 deletions
@@ -2460,8 +2460,10 @@ PP(pp_splice) if (SvRMAGICAL(ary) && (mg = mg_find((SV*)ary,'P'))) { *MARK-- = mg->mg_obj; PUSHMARK(MARK); - PUTBACK; + PUTBACK; + ENTER; perl_call_method("SPLICE",GIMME_V); + LEAVE; SPAGAIN; RETURN; } @@ -2658,17 +2660,19 @@ PP(pp_push) *MARK-- = mg->mg_obj; PUSHMARK(MARK); PUTBACK; - perl_call_method("PUSH",GIMME_V); + ENTER; + perl_call_method("PUSH",G_SCALAR|G_DISCARD); + LEAVE; SPAGAIN; - RETURN; } - - /* Why no pre-extend of ary here ? */ - for (++MARK; MARK <= SP; MARK++) { - sv = NEWSV(51, 0); - if (*MARK) - sv_setsv(sv, *MARK); - av_push(ary, sv); + else { + /* Why no pre-extend of ary here ? */ + for (++MARK; MARK <= SP; MARK++) { + sv = NEWSV(51, 0); + if (*MARK) + sv_setsv(sv, *MARK); + av_push(ary, sv); + } } SP = ORIGMARK; PUSHi( AvFILL(ary) + 1 ); @@ -2708,20 +2712,23 @@ PP(pp_unshift) register I32 i = 0; MAGIC *mg; - if (SvRMAGICAL(ary) && (mg = mg_find((SV*)ary,'P'))) { + if (SvRMAGICAL(ary) && (mg = mg_find((SV*)ary,'P'))) { + + *MARK-- = mg->mg_obj; - PUSHMARK(MARK); PUTBACK; - perl_call_method("UNSHIFT",GIMME_V); + ENTER; + perl_call_method("UNSHIFT",G_SCALAR|G_DISCARD); + LEAVE; SPAGAIN; - RETURN; } - - av_unshift(ary, SP - MARK); - while (MARK < SP) { - sv = NEWSV(27, 0); - sv_setsv(sv, *++MARK); - (void)av_store(ary, i++, sv); + else { + av_unshift(ary, SP - MARK); + while (MARK < SP) { + sv = NEWSV(27, 0); + sv_setsv(sv, *++MARK); + (void)av_store(ary, i++, sv); + } } SP = ORIGMARK; PUSHi( AvFILL(ary) + 1 ); |