X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp.h;h=ec701f3054f3cfa53ebfdc9cc2aae4c2bb4b92fe;hb=0a9fdc5d26a453a78e950d4bdaa9da4ed9ede5af;hp=7aeee707bb07e32746e3cd40ab4d748ed6a59219;hpb=4eb8286e4c6ac94fdae21a64c54a936bc836983e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp.h b/pp.h index 7aeee70..ec701f3 100644 --- a/pp.h +++ b/pp.h @@ -15,7 +15,7 @@ #define dARGS #endif /* USE_THREADS */ -#define PP(s) OP * s(ARGSproto) +#define PP(s) OP * Perl_##s(pTHX) #define SP sp #define MARK mark @@ -50,7 +50,7 @@ #define dTARG SV *targ #define NORMAL PL_op->op_next -#define DIE return die +#define DIE return Perl_die #define PUTBACK PL_stack_sp = sp #define RETURN return PUTBACK, NORMAL @@ -64,6 +64,11 @@ #define POPi ((IV)SvIVx(POPs)) #define POPu ((UV)SvUVx(POPs)) #define POPl ((long)SvIVx(POPs)) +#define POPul ((unsigned long)SvIVx(POPs)) +#ifdef HAS_QUAD +#define POPq ((Quad_t)SvIVx(POPs)) +#define POPuq ((Uquad_t)SvUVx(POPs)) +#endif #define TOPs (*sp) #define TOPp (SvPV(TOPs, PL_na)) /* deprecated */ @@ -72,6 +77,11 @@ #define TOPi ((IV)SvIV(TOPs)) #define TOPu ((UV)SvUV(TOPs)) #define TOPl ((long)SvIV(TOPs)) +#define TOPul ((unsigned long)SvUV(TOPs)) +#ifdef HAS_QUAD +#define TOPq ((Quad_t)SvIV(TOPs)) +#define TOPuq ((Uquad_t)SvUV(TOPs)) +#endif /* Go to some pains in the rare event that we must extend the stack. */ #define EXTEND(p,n) STMT_START { if (PL_stack_max - p < (n)) { \ @@ -88,43 +98,50 @@ #define PUSHs(s) (*++sp = (s)) #define PUSHTARG STMT_START { SvSETMAGIC(TARG); PUSHs(TARG); } STMT_END #define PUSHp(p,l) STMT_START { sv_setpvn(TARG, (p), (l)); PUSHTARG; } STMT_END -#define PUSHn(n) STMT_START { sv_setnv(TARG, (double)(n)); PUSHTARG; } STMT_END +#define PUSHn(n) STMT_START { sv_setnv(TARG, (NV)(n)); PUSHTARG; } STMT_END #define PUSHi(i) STMT_START { sv_setiv(TARG, (IV)(i)); PUSHTARG; } STMT_END #define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END #define XPUSHs(s) STMT_START { EXTEND(sp,1); (*++sp = (s)); } STMT_END #define XPUSHTARG STMT_START { SvSETMAGIC(TARG); XPUSHs(TARG); } STMT_END #define XPUSHp(p,l) STMT_START { sv_setpvn(TARG, (p), (l)); XPUSHTARG; } STMT_END -#define XPUSHn(n) STMT_START { sv_setnv(TARG, (double)(n)); XPUSHTARG; } STMT_END +#define XPUSHn(n) STMT_START { sv_setnv(TARG, (NV)(n)); XPUSHTARG; } STMT_END #define XPUSHi(i) STMT_START { sv_setiv(TARG, (IV)(i)); XPUSHTARG; } STMT_END #define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END +#define XPUSHundef STMT_START { SvOK_off(TARG); XPUSHs(TARG); } STMT_END #define SETs(s) (*sp = s) #define SETTARG STMT_START { SvSETMAGIC(TARG); SETs(TARG); } STMT_END #define SETp(p,l) STMT_START { sv_setpvn(TARG, (p), (l)); SETTARG; } STMT_END -#define SETn(n) STMT_START { sv_setnv(TARG, (double)(n)); SETTARG; } STMT_END +#define SETn(n) STMT_START { sv_setnv(TARG, (NV)(n)); SETTARG; } STMT_END #define SETi(i) STMT_START { sv_setiv(TARG, (IV)(i)); SETTARG; } STMT_END #define SETu(u) STMT_START { sv_setuv(TARG, (UV)(u)); SETTARG; } STMT_END #define dTOPss SV *sv = TOPs #define dPOPss SV *sv = POPs -#define dTOPnv double value = TOPn -#define dPOPnv double value = POPn +#define dTOPnv NV value = TOPn +#define dPOPnv NV value = POPn #define dTOPiv IV value = TOPi #define dPOPiv IV value = POPi #define dTOPuv UV value = TOPu #define dPOPuv UV value = POPu +#ifdef HAS_QUAD +#define dTOPqv Quad_t value = TOPu +#define dPOPqv Quad_t value = POPu +#define dTOPuqv Uquad_t value = TOPuq +#define dPOPuqv Uquad_t value = POPuq +#endif #define dPOPXssrl(X) SV *right = POPs; SV *left = CAT2(X,s) -#define dPOPXnnrl(X) double right = POPn; double left = CAT2(X,n) +#define dPOPXnnrl(X) NV right = POPn; NV left = CAT2(X,n) #define dPOPXiirl(X) IV right = POPi; IV left = CAT2(X,i) #define USE_LEFT(sv) \ (SvOK(sv) || SvGMAGICAL(sv) || !(PL_op->op_flags & OPf_STACKED)) #define dPOPXnnrl_ul(X) \ - double right = POPn; \ + NV right = POPn; \ SV *leftsv = CAT2(X,s); \ - double left = USE_LEFT(leftsv) ? SvNV(leftsv) : 0.0 + NV left = USE_LEFT(leftsv) ? SvNV(leftsv) : 0.0 #define dPOPXiirl_ul(X) \ IV right = POPi; \ SV *leftsv = CAT2(X,s); \ @@ -151,22 +168,24 @@ #define RETSETUNDEF RETURNX(SETs(&PL_sv_undef)) #define ARGTARG PL_op->op_targ -#define MAXARG PL_op->op_private + + /* See OPpTARGET_MY: */ +#define MAXARG (PL_op->op_private & 15) #define SWITCHSTACK(f,t) \ STMT_START { \ - AvFILLp(f) = sp - PL_stack_base; \ + AvFILLp(f) = sp - PL_stack_base; \ PL_stack_base = AvARRAY(t); \ - PL_stack_max = PL_stack_base + AvMAX(t); \ + PL_stack_max = PL_stack_base + AvMAX(t); \ sp = PL_stack_sp = PL_stack_base + AvFILLp(t); \ - PL_curstack = t; \ + PL_curstack = t; \ } STMT_END #define EXTEND_MORTAL(n) \ - STMT_START { \ - if (PL_tmps_ix + (n) >= PL_tmps_max) \ - Renew(PL_tmps_stack, PL_tmps_max = PL_tmps_ix + (n) + 1, SV*); \ - } STMT_END + STMT_START { \ + if (PL_tmps_ix + (n) >= PL_tmps_max) \ + tmps_grow(n); \ + } STMT_END #define AMGf_noright 1 #define AMGf_noleft 2 @@ -209,8 +228,8 @@ #define FORCE_SETs(sv) STMT_START { sv_setsv(TARG, (sv)); SETTARG; } STMT_END -#define tryAMAGICun tryAMAGICunSET -#define tryAMAGICunSET(meth) tryAMAGICunW(meth,SETs,0,RETURN) +#define tryAMAGICun(meth) tryAMAGICunW(meth,SETsvUN,0,RETURN) +#define tryAMAGICunSET(meth) tryAMAGICunW(meth,SETs,0,RETURN) #define tryAMAGICunTARGET(meth, shift) \ { dSP; sp--; /* get TARGET from below PL_stack_sp */ \ { dTARGETSTACKED; \ @@ -218,14 +237,20 @@ #define setAGAIN(ref) sv = arg = ref; \ if (!SvROK(ref)) \ - croak("Overloaded dereference did not return a reference"); \ + Perl_croak(aTHX_ "Overloaded dereference did not return a reference"); \ goto am_again; #define tryAMAGICunDEREF(meth) tryAMAGICunW(meth,setAGAIN,0,(void)0) #define opASSIGN (PL_op->op_flags & OPf_STACKED) #define SETsv(sv) STMT_START { \ - if (opASSIGN) { sv_setsv(TARG, (sv)); SETTARG; } \ + if (opASSIGN || (SvFLAGS(TARG) & SVs_PADMY)) \ + { sv_setsv(TARG, (sv)); SETTARG; } \ + else SETs(sv); } STMT_END + +#define SETsvUN(sv) STMT_START { \ + if (SvFLAGS(TARG) & SVs_PADMY) \ + { sv_setsv(TARG, (sv)); SETTARG; } \ else SETs(sv); } STMT_END /* newSVsv does not behave as advertised, so we copy missing