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 /av.c | |
parent | 1393e20655efb4bcc2062605bfe887dd5e634bc1 (diff) | |
download | perl-a60c0954410db87be540ee8439afcd54350bbb8e.tar.gz |
TIEARRAY updates - almost works ...
p4raw-id: //depot/ansiperl@424
Diffstat (limited to 'av.c')
-rw-r--r-- | av.c | 25 |
1 files changed, 18 insertions, 7 deletions
@@ -56,7 +56,7 @@ av_extend(AV *av, I32 key) PUSHMARK(sp); EXTEND(sp,2); PUSHs(mg->mg_obj); - PUSHs(sv_2mortal(newSViv(key))); + PUSHs(sv_2mortal(newSViv(key+1))); PUTBACK; perl_call_method("EXTEND", G_SCALAR|G_DISCARD); FREETMPS; @@ -321,7 +321,7 @@ av_clear(register AV *av) warn("Attempt to clear deleted array"); } #endif - if (!av || AvMAX(av) < 0) + if (!av) return; /*SUPPRESS 560*/ @@ -329,6 +329,9 @@ av_clear(register AV *av) if (SvRMAGICAL(av)) mg_clear((SV*)av); + if (AvMAX(av) < 0) + return; + if (AvREAL(av)) { ary = AvARRAY(av); key = AvFILLp(av) + 1; @@ -389,8 +392,10 @@ av_push(register AV *av, SV *val) EXTEND(sp,2); PUSHs(mg->mg_obj); PUSHs(val); - PUTBACK; + PUTBACK; + ENTER; perl_call_method("PUSH", G_SCALAR|G_DISCARD); + LEAVE; return; } av_store(av,AvFILLp(av)+1,val); @@ -410,12 +415,14 @@ av_pop(register AV *av) dSP; PUSHMARK(sp); XPUSHs(mg->mg_obj); - PUTBACK; + PUTBACK; + ENTER; if (perl_call_method("POP", G_SCALAR)) { retval = newSVsv(*stack_sp--); } else { retval = &sv_undef; } + LEAVE; return retval; } retval = AvARRAY(av)[AvFILLp(av)]; @@ -446,7 +453,9 @@ av_unshift(register AV *av, register I32 num) PUSHs(&sv_undef); } PUTBACK; + ENTER; perl_call_method("UNSHIFT", G_SCALAR|G_DISCARD); + LEAVE; return; } @@ -495,12 +504,14 @@ av_shift(register AV *av) dSP; PUSHMARK(sp); XPUSHs(mg->mg_obj); - PUTBACK; + PUTBACK; + ENTER; if (perl_call_method("SHIFT", G_SCALAR)) { retval = newSVsv(*stack_sp--); } else { retval = &sv_undef; - } + } + LEAVE; return retval; } retval = *AvARRAY(av); @@ -535,7 +546,7 @@ av_fill(register AV *av, I32 fill) PUSHMARK(sp); EXTEND(sp,2); PUSHs(mg->mg_obj); - PUSHs(sv_2mortal(newSViv(fill))); + PUSHs(sv_2mortal(newSViv(fill+1))); PUTBACK; perl_call_method("STORESIZE", G_SCALAR|G_DISCARD); FREETMPS; |