Artistic fine-tuning.
[p5sagit/p5-mst-13.2.git] / pp.h
diff --git a/pp.h b/pp.h
index 9fd3365..ec701f3 100644 (file)
--- a/pp.h
+++ b/pp.h
 #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 */
 #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)) {              \
 #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 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)   NV right = POPn; NV left = CAT2(X,n)
 #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 {                                                       \
 
 #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;                                           \
 
 #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