diff options
author | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-03-28 13:32:21 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-03-28 13:32:21 +0000 |
commit | c750a3ec3b866067ab46dbcc9083205d823047c3 (patch) | |
tree | df8ac921c8928fe673a259a2f22aa1f53156cb92 /doop.c | |
parent | cfe4554026dfe078c2d7c706ace0e327f16b2c05 (diff) | |
download | perl-c750a3ec3b866067ab46dbcc9083205d823047c3.tar.gz |
Initial devel changes.
Pseudo-hashes. Optional strong typing. RESTART {}.
p4raw-id: //depot/perl@2
Diffstat (limited to 'doop.c')
-rw-r--r-- | doop.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -628,15 +628,19 @@ dARGS SV *tmpstr; I32 dokeys = (op->op_type == OP_KEYS); I32 dovalues = (op->op_type == OP_VALUES); - + I32 realhv = (SvTYPE(hv) == SVt_PVHV); + if (op->op_type == OP_RV2HV || op->op_type == OP_PADHV) dokeys = dovalues = TRUE; if (!hv) RETURN; - (void)hv_iterinit(hv); /* always reset iterator regardless */ - + if (realhv) + (void)hv_iterinit(hv); /* always reset iterator regardless */ + else + (void)avhv_iterinit((AV*)hv); + if (GIMME != G_ARRAY) { dTARGET; @@ -645,7 +649,7 @@ dARGS else { i = 0; /*SUPPRESS 560*/ - while (entry = hv_iternext(hv)) { + while (entry = realhv ? hv_iternext(hv) : avhv_iternext((AV*)hv)) { i++; } } @@ -657,7 +661,7 @@ dARGS EXTEND(sp, HvMAX(hv) * (dokeys + dovalues)); PUTBACK; /* hv_iternext and hv_iterval might clobber stack_sp */ - while (entry = hv_iternext(hv)) { + while (entry = realhv ? hv_iternext(hv) : avhv_iternext((AV*)hv)) { SPAGAIN; if (dokeys) { tmps = hv_iterkey(entry,&i); /* won't clobber stack_sp */ @@ -668,7 +672,8 @@ dARGS if (dovalues) { tmpstr = NEWSV(45,0); PUTBACK; - sv_setsv(tmpstr,hv_iterval(hv,entry)); + sv_setsv(tmpstr,realhv ? + hv_iterval(hv,entry) : avhv_iterval((AV*)hv,entry)); SPAGAIN; DEBUG_H( { sprintf(buf,"%d%%%d=%d\n",entry->hent_hash, @@ -681,4 +686,3 @@ dARGS } return NORMAL; } - |