X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=op.c;h=7459ae6d4f6ecd09bdb36c12b7e4ccf27e5cb587;hb=e336de0d01f30cc4061b6d6a00d11df30fc67cd3;hp=11c17d7b9a45b941c1471d6c1e5faf0b31361a26;hpb=888da360572857d466db3c37a59308523ea41a9a;p=p5sagit%2Fp5-mst-13.2.git diff --git a/op.c b/op.c index 11c17d7..7459ae6 100644 --- a/op.c +++ b/op.c @@ -1573,7 +1573,7 @@ newPROG(OP *o) CV *cv = perl_get_cv("DB::postponed", FALSE); if (cv) { dSP; - PUSHMARK(sp); + PUSHMARK(SP); XPUSHs((SV*)compiling.cop_filegv); PUTBACK; perl_call_sv((SV*)cv, G_DISCARD); @@ -3330,7 +3330,7 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block) goto done; } /* ahem, death to those who redefine active sort subs */ - if (curstack == sortstack && sortcop == CvSTART(cv)) + if (curstackinfo->si_type == SI_SORT && sortcop == CvSTART(cv)) croak("Can't redefine active sort subroutine %s", name); const_sv = cv_const_sv(cv); if (const_sv || dowarn && !(CvGV(cv) && GvSTASH(CvGV(cv)) @@ -3466,7 +3466,7 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block) if (HvFILL(hv) > 0 && hv_exists(hv, SvPVX(tmpstr), SvCUR(tmpstr)) && (cv = GvCV(db_postponed))) { dSP; - PUSHMARK(sp); + PUSHMARK(SP); XPUSHs(tmpstr); PUTBACK; perl_call_sv((SV*)cv, G_DISCARD); @@ -3516,6 +3516,33 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block) return cv; } +void +newCONSTSUB(HV *stash, char *name, SV *sv) +{ + dTHR; + U32 oldhints = hints; + HV *old_cop_stash = curcop->cop_stash; + HV *old_curstash = curstash; + line_t oldline = curcop->cop_line; + curcop->cop_line = copline; + + hints &= ~HINT_BLOCK_SCOPE; + if(stash) + curstash = curcop->cop_stash = stash; + + newSUB( + start_subparse(FALSE, 0), + newSVOP(OP_CONST, 0, newSVpv(name,0)), + newSVOP(OP_CONST, 0, &sv_no), /* SvPV(&sv_no) == "" -- GMB */ + newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) + ); + + hints = oldhints; + curcop->cop_stash = old_cop_stash; + curstash = old_curstash; + curcop->cop_line = oldline; +} + CV * newXS(char *name, void (*subaddr) (CV *), char *filename) {