/* pp.h
*
- * Copyright (c) 1991-2000, Larry Wall
+ * Copyright (c) 1991-2001, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
Declares a local copy of perl's stack pointer for the XSUB, available via
the C<SP> macro. See C<SP>.
+=for apidoc ms||djSP
+
+Declare Just C<SP>. This is actually identical to C<dSP>, and declares
+a local copy of perl's stack pointer, available via the C<SP> macro.
+See C<SP>. (Available for backward source code compatibility with the
+old (Perl 5.005) thread model.)
+
=for apidoc Ams||dMARK
Declare a stack marker variable, C<mark>, for the XSUB. See C<MARK> and
C<dORIGMARK>.
=for apidoc Ams||SPAGAIN
Refetch the stack pointer. Used after a callback. See L<perlcall>.
-=cut
-*/
+=cut */
+#undef SP /* Solaris 2.7 i386 has this in /usr/include/sys/reg.h */
#define SP sp
#define MARK mark
#define TARG targ
#define TOPMARK (*PL_markstack_ptr)
#define POPMARK (*PL_markstack_ptr--)
-#define djSP register SV **sp = PL_stack_sp
-#define dSP dTHR; djSP
+#define dSP register SV **sp = PL_stack_sp
+#define djSP dSP
#define dMARK register SV **mark = PL_stack_base + POPMARK
#define dORIGMARK I32 origmark = mark - PL_stack_base
#define SETORIGMARK origmark = mark - PL_stack_base
Pops an SV off the stack.
=for apidoc Amn|char*|POPp
+Pops a string off the stack. Deprecated. New code should provide
+a STRLEN n_a and use POPpx.
+
+=for apidoc Amn|char*|POPpx
Pops a string off the stack.
+Requires a variable STRLEN n_a in scope.
+
+=for apidoc Amn|char*|POPpbytex
+Pops a string off the stack which must consist of bytes i.e. characters < 256.
+Requires a variable STRLEN n_a in scope.
=for apidoc Amn|NV|POPn
Pops a double off the stack.
#define POPs (*sp--)
#define POPp (SvPVx(POPs, PL_na)) /* deprecated */
#define POPpx (SvPVx(POPs, n_a))
+#define POPpbytex (SvPVbytex(POPs, n_a))
#define POPn (SvNVx(POPs))
#define POPi ((IV)SvIVx(POPs))
#define POPu ((UV)SvUVx(POPs))
#endif
#define TOPs (*sp)
+#define TOPm1s (*(sp-1))
+#define TOPp1s (*(sp+1))
#define TOPp (SvPV(TOPs, PL_na)) /* deprecated */
#define TOPpx (SvPV(TOPs, n_a))
#define TOPn (SvNV(TOPs))
onto the stack.
=for apidoc Am|void|PUSHs|SV* sv
-Push an SV onto the stack. The stack must have room for this element.
+Push an SV onto the stack. The stack must have room for this element.
Does not handle 'set' magic. See C<XPUSHs>.
=for apidoc Am|void|PUSHp|char* str|STRLEN len
'set' magic. See C<PUSHi>.
=for apidoc Am|void|XPUSHu|UV uv
-Push an unsigned integer onto the stack, extending the stack if necessary.
+Push an unsigned integer onto the stack, extending the stack if necessary.
See C<PUSHu>.
=cut
if (PL_amagic_generation) { \
SV* tmpsv; \
SV* arg= sp[shift]; \
+ if(0) goto am_again; /* shut up unused warning */ \
am_again: \
if ((SvAMAGIC(arg))&&\
(tmpsv=AMG_CALLun(arg,meth))) {\
{ dTARGETSTACKED; \
{ dSP; tryAMAGICunW(meth,FORCE_SETs,shift,RETURN);}}}
-#define setAGAIN(ref) sv = arg = ref; \
- if (!SvROK(ref)) \
+#define setAGAIN(ref) sv = ref; \
+ if (!SvROK(ref)) \
Perl_croak(aTHX_ "Overloaded dereference did not return a reference"); \
- goto am_again;
+ if (ref != arg && SvRV(ref) != SvRV(arg)) { \
+ arg = ref; \
+ goto am_again; \
+ }
#define tryAMAGICunDEREF(meth) tryAMAGICunW(meth,setAGAIN,0,(void)0)
SvREFCNT_dec(tmpRef); \
SvRV(rv)=AMG_CALLun(rv,copy); \
} } STMT_END
+
+/*
+=for apidoc mU||LVRET
+True if this op will be the return value of an lvalue subroutine
+
+=cut */
+#define LVRET ((PL_op->op_private & OPpMAYBE_LVSUB) && is_lvalue_sub())