ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/staticperl/perl/pp.h
Revision: 1.1
Committed: Thu Jun 30 14:26:42 2005 UTC (21 years, 3 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: PERL-5-8-7, HEAD
Branch point for: PERL
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 /* pp.h
2     *
3     * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
4     * 2000, 2001, 2002, 2003, 2004, 2005 by Larry Wall and others
5     *
6     * You may distribute under the terms of either the GNU General Public
7     * License or the Artistic License, as specified in the README file.
8     *
9     */
10    
11     #ifdef USE_5005THREADS
12     #define ARGS thr
13     #define dARGS struct perl_thread *thr;
14     #else
15     #define ARGS
16     #define dARGS
17     #endif /* USE_5005THREADS */
18    
19     #define PP(s) OP * Perl_##s(pTHX)
20    
21     /*
22     =head1 Stack Manipulation Macros
23    
24     =for apidoc AmU||SP
25     Stack pointer. This is usually handled by C<xsubpp>. See C<dSP> and
26     C<SPAGAIN>.
27    
28     =for apidoc AmU||MARK
29     Stack marker variable for the XSUB. See C<dMARK>.
30    
31     =for apidoc Am|void|PUSHMARK|SP
32     Opening bracket for arguments on a callback. See C<PUTBACK> and
33     L<perlcall>.
34    
35     =for apidoc Ams||dSP
36     Declares a local copy of perl's stack pointer for the XSUB, available via
37     the C<SP> macro. See C<SP>.
38    
39     =for apidoc ms||djSP
40    
41     Declare Just C<SP>. This is actually identical to C<dSP>, and declares
42     a local copy of perl's stack pointer, available via the C<SP> macro.
43     See C<SP>. (Available for backward source code compatibility with the
44     old (Perl 5.005) thread model.)
45    
46     =for apidoc Ams||dMARK
47     Declare a stack marker variable, C<mark>, for the XSUB. See C<MARK> and
48     C<dORIGMARK>.
49    
50     =for apidoc Ams||dORIGMARK
51     Saves the original stack mark for the XSUB. See C<ORIGMARK>.
52    
53     =for apidoc AmU||ORIGMARK
54     The original stack mark for the XSUB. See C<dORIGMARK>.
55    
56     =for apidoc Ams||SPAGAIN
57     Refetch the stack pointer. Used after a callback. See L<perlcall>.
58    
59     =cut */
60    
61     #undef SP /* Solaris 2.7 i386 has this in /usr/include/sys/reg.h */
62     #define SP sp
63     #define MARK mark
64     #define TARG targ
65    
66     #define PUSHMARK(p) \
67     STMT_START { \
68     if (++PL_markstack_ptr == PL_markstack_max) \
69     markstack_grow(); \
70     *PL_markstack_ptr = (p) - PL_stack_base; \
71     } STMT_END
72    
73     #define TOPMARK (*PL_markstack_ptr)
74     #define POPMARK (*PL_markstack_ptr--)
75    
76     #define dSP register SV **sp = PL_stack_sp
77     #define djSP dSP
78     #define dMARK register SV **mark = PL_stack_base + POPMARK
79     #define dORIGMARK I32 origmark = mark - PL_stack_base
80     #define SETORIGMARK origmark = mark - PL_stack_base
81     #define ORIGMARK (PL_stack_base + origmark)
82    
83     #define SPAGAIN sp = PL_stack_sp
84     #define MSPAGAIN STMT_START { sp = PL_stack_sp; mark = ORIGMARK; } STMT_END
85    
86     #define GETTARGETSTACKED targ = (PL_op->op_flags & OPf_STACKED ? POPs : PAD_SV(PL_op->op_targ))
87     #define dTARGETSTACKED SV * GETTARGETSTACKED
88    
89     #define GETTARGET targ = PAD_SV(PL_op->op_targ)
90     #define dTARGET SV * GETTARGET
91    
92     #define GETATARGET targ = (PL_op->op_flags & OPf_STACKED ? sp[-1] : PAD_SV(PL_op->op_targ))
93     #define dATARGET SV * GETATARGET
94    
95     #define dTARG SV *targ
96    
97     #define NORMAL PL_op->op_next
98     #define DIE return Perl_die
99     #define DIE_NULL return DieNull
100    
101     /*
102     =for apidoc Ams||PUTBACK
103     Closing bracket for XSUB arguments. This is usually handled by C<xsubpp>.
104     See C<PUSHMARK> and L<perlcall> for other uses.
105    
106     =for apidoc Amn|SV*|POPs
107     Pops an SV off the stack.
108    
109     =for apidoc Amn|char*|POPp
110     Pops a string off the stack. Deprecated. New code should provide
111     a STRLEN n_a and use POPpx.
112    
113     =for apidoc Amn|char*|POPpx
114     Pops a string off the stack.
115     Requires a variable STRLEN n_a in scope.
116    
117     =for apidoc Amn|char*|POPpbytex
118     Pops a string off the stack which must consist of bytes i.e. characters < 256.
119     Requires a variable STRLEN n_a in scope.
120    
121     =for apidoc Amn|NV|POPn
122     Pops a double off the stack.
123    
124     =for apidoc Amn|IV|POPi
125     Pops an integer off the stack.
126    
127     =for apidoc Amn|long|POPl
128     Pops a long off the stack.
129    
130     =cut
131     */
132    
133     #define PUTBACK PL_stack_sp = sp
134     #define RETURN return PUTBACK, NORMAL
135     #define RETURNOP(o) return PUTBACK, o
136     #define RETURNX(x) return x, PUTBACK, NORMAL
137    
138     #define POPs (*sp--)
139     #define POPp (SvPVx(POPs, PL_na)) /* deprecated */
140     #define POPpx (SvPVx(POPs, n_a))
141     #define POPpbytex (SvPVbytex(POPs, n_a))
142     #define POPn (SvNVx(POPs))
143     #define POPi ((IV)SvIVx(POPs))
144     #define POPu ((UV)SvUVx(POPs))
145     #define POPl ((long)SvIVx(POPs))
146     #define POPul ((unsigned long)SvIVx(POPs))
147     #ifdef HAS_QUAD
148     #define POPq ((Quad_t)SvIVx(POPs))
149     #define POPuq ((Uquad_t)SvUVx(POPs))
150     #endif
151    
152     #define TOPs (*sp)
153     #define TOPm1s (*(sp-1))
154     #define TOPp1s (*(sp+1))
155     #define TOPp (SvPV(TOPs, PL_na)) /* deprecated */
156     #define TOPpx (SvPV(TOPs, n_a))
157     #define TOPn (SvNV(TOPs))
158     #define TOPi ((IV)SvIV(TOPs))
159     #define TOPu ((UV)SvUV(TOPs))
160     #define TOPl ((long)SvIV(TOPs))
161     #define TOPul ((unsigned long)SvUV(TOPs))
162     #ifdef HAS_QUAD
163     #define TOPq ((Quad_t)SvIV(TOPs))
164     #define TOPuq ((Uquad_t)SvUV(TOPs))
165     #endif
166    
167     /* Go to some pains in the rare event that we must extend the stack. */
168    
169     /*
170     =for apidoc Am|void|EXTEND|SP|int nitems
171     Used to extend the argument stack for an XSUB's return values. Once
172     used, guarantees that there is room for at least C<nitems> to be pushed
173     onto the stack.
174    
175     =for apidoc Am|void|PUSHs|SV* sv
176     Push an SV onto the stack. The stack must have room for this element.
177     Does not handle 'set' magic. Does not use C<TARG>. See also C<PUSHmortal>,
178     C<XPUSHs> and C<XPUSHmortal>.
179    
180     =for apidoc Am|void|PUSHp|char* str|STRLEN len
181     Push a string onto the stack. The stack must have room for this element.
182     The C<len> indicates the length of the string. Handles 'set' magic. Uses
183     C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to declare it. Do not
184     call multiple C<TARG>-oriented macros to return lists from XSUB's - see
185     C<mPUSHp> instead. See also C<XPUSHp> and C<mXPUSHp>.
186    
187     =for apidoc Am|void|PUSHn|NV nv
188     Push a double onto the stack. The stack must have room for this element.
189     Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
190     called to declare it. Do not call multiple C<TARG>-oriented macros to
191     return lists from XSUB's - see C<mPUSHn> instead. See also C<XPUSHn> and
192     C<mXPUSHn>.
193    
194     =for apidoc Am|void|PUSHi|IV iv
195     Push an integer onto the stack. The stack must have room for this element.
196     Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
197     called to declare it. Do not call multiple C<TARG>-oriented macros to
198     return lists from XSUB's - see C<mPUSHi> instead. See also C<XPUSHi> and
199     C<mXPUSHi>.
200    
201     =for apidoc Am|void|PUSHu|UV uv
202     Push an unsigned integer onto the stack. The stack must have room for this
203     element. Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG>
204     should be called to declare it. Do not call multiple C<TARG>-oriented
205     macros to return lists from XSUB's - see C<mPUSHu> instead. See also
206     C<XPUSHu> and C<mXPUSHu>.
207    
208     =for apidoc Am|void|XPUSHs|SV* sv
209     Push an SV onto the stack, extending the stack if necessary. Does not
210     handle 'set' magic. Does not use C<TARG>. See also C<XPUSHmortal>,
211     C<PUSHs> and C<PUSHmortal>.
212    
213     =for apidoc Am|void|XPUSHp|char* str|STRLEN len
214     Push a string onto the stack, extending the stack if necessary. The C<len>
215     indicates the length of the string. Handles 'set' magic. Uses C<TARG>, so
216     C<dTARGET> or C<dXSTARG> should be called to declare it. Do not call
217     multiple C<TARG>-oriented macros to return lists from XSUB's - see
218     C<mXPUSHp> instead. See also C<PUSHp> and C<mPUSHp>.
219    
220     =for apidoc Am|void|XPUSHn|NV nv
221     Push a double onto the stack, extending the stack if necessary. Handles
222     'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to
223     declare it. Do not call multiple C<TARG>-oriented macros to return lists
224     from XSUB's - see C<mXPUSHn> instead. See also C<PUSHn> and C<mPUSHn>.
225    
226     =for apidoc Am|void|XPUSHi|IV iv
227     Push an integer onto the stack, extending the stack if necessary. Handles
228     'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to
229     declare it. Do not call multiple C<TARG>-oriented macros to return lists
230     from XSUB's - see C<mXPUSHi> instead. See also C<PUSHi> and C<mPUSHi>.
231    
232     =for apidoc Am|void|XPUSHu|UV uv
233     Push an unsigned integer onto the stack, extending the stack if necessary.
234     Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
235     called to declare it. Do not call multiple C<TARG>-oriented macros to
236     return lists from XSUB's - see C<mXPUSHu> instead. See also C<PUSHu> and
237     C<mPUSHu>.
238    
239     =for apidoc Am|void|PUSHmortal
240     Push a new mortal SV onto the stack. The stack must have room for this
241     element. Does not handle 'set' magic. Does not use C<TARG>. See also
242     C<PUSHs>, C<XPUSHmortal> and C<XPUSHs>.
243    
244     =for apidoc Am|void|mPUSHp|char* str|STRLEN len
245     Push a string onto the stack. The stack must have room for this element.
246     The C<len> indicates the length of the string. Handles 'set' magic. Does
247     not use C<TARG>. See also C<PUSHp>, C<mXPUSHp> and C<XPUSHp>.
248    
249     =for apidoc Am|void|mPUSHn|NV nv
250     Push a double onto the stack. The stack must have room for this element.
251     Handles 'set' magic. Does not use C<TARG>. See also C<PUSHn>, C<mXPUSHn>
252     and C<XPUSHn>.
253    
254     =for apidoc Am|void|mPUSHi|IV iv
255     Push an integer onto the stack. The stack must have room for this element.
256     Handles 'set' magic. Does not use C<TARG>. See also C<PUSHi>, C<mXPUSHi>
257     and C<XPUSHi>.
258    
259     =for apidoc Am|void|mPUSHu|UV uv
260     Push an unsigned integer onto the stack. The stack must have room for this
261     element. Handles 'set' magic. Does not use C<TARG>. See also C<PUSHu>,
262     C<mXPUSHu> and C<XPUSHu>.
263    
264     =for apidoc Am|void|XPUSHmortal
265     Push a new mortal SV onto the stack, extending the stack if necessary. Does
266     not handle 'set' magic. Does not use C<TARG>. See also C<XPUSHs>,
267     C<PUSHmortal> and C<PUSHs>.
268    
269     =for apidoc Am|void|mXPUSHp|char* str|STRLEN len
270     Push a string onto the stack, extending the stack if necessary. The C<len>
271     indicates the length of the string. Handles 'set' magic. Does not use
272     C<TARG>. See also C<XPUSHp>, C<mPUSHp> and C<PUSHp>.
273    
274     =for apidoc Am|void|mXPUSHn|NV nv
275     Push a double onto the stack, extending the stack if necessary. Handles
276     'set' magic. Does not use C<TARG>. See also C<XPUSHn>, C<mPUSHn> and
277     C<PUSHn>.
278    
279     =for apidoc Am|void|mXPUSHi|IV iv
280     Push an integer onto the stack, extending the stack if necessary. Handles
281     'set' magic. Does not use C<TARG>. See also C<XPUSHi>, C<mPUSHi> and
282     C<PUSHi>.
283    
284     =for apidoc Am|void|mXPUSHu|UV uv
285     Push an unsigned integer onto the stack, extending the stack if necessary.
286     Handles 'set' magic. Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu>
287     and C<PUSHu>.
288    
289     =cut
290     */
291    
292     #define EXTEND(p,n) STMT_START { if (PL_stack_max - p < (int)(n)) { \
293     sp = stack_grow(sp,p, (int) (n)); \
294     } } STMT_END
295    
296     /* Same thing, but update mark register too. */
297     #define MEXTEND(p,n) STMT_START {if (PL_stack_max - p < (int)(n)) { \
298     int markoff = mark - PL_stack_base; \
299     sp = stack_grow(sp,p,(int) (n)); \
300     mark = PL_stack_base + markoff; \
301     } } STMT_END
302    
303     #define PUSHs(s) (*++sp = (s))
304     #define PUSHTARG STMT_START { SvSETMAGIC(TARG); PUSHs(TARG); } STMT_END
305     #define PUSHp(p,l) STMT_START { sv_setpvn(TARG, (p), (l)); PUSHTARG; } STMT_END
306     #define PUSHn(n) STMT_START { sv_setnv(TARG, (NV)(n)); PUSHTARG; } STMT_END
307     #define PUSHi(i) STMT_START { sv_setiv(TARG, (IV)(i)); PUSHTARG; } STMT_END
308     #define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END
309    
310     #define XPUSHs(s) STMT_START { EXTEND(sp,1); (*++sp = (s)); } STMT_END
311     #define XPUSHTARG STMT_START { SvSETMAGIC(TARG); XPUSHs(TARG); } STMT_END
312     #define XPUSHp(p,l) STMT_START { sv_setpvn(TARG, (p), (l)); XPUSHTARG; } STMT_END
313     #define XPUSHn(n) STMT_START { sv_setnv(TARG, (NV)(n)); XPUSHTARG; } STMT_END
314     #define XPUSHi(i) STMT_START { sv_setiv(TARG, (IV)(i)); XPUSHTARG; } STMT_END
315     #define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
316     #define XPUSHundef STMT_START { SvOK_off(TARG); XPUSHs(TARG); } STMT_END
317    
318     #define PUSHmortal PUSHs(sv_newmortal())
319     #define mPUSHp(p,l) sv_setpvn_mg(PUSHmortal, (p), (l))
320     #define mPUSHn(n) sv_setnv_mg(PUSHmortal, (NV)(n))
321     #define mPUSHi(i) sv_setiv_mg(PUSHmortal, (IV)(i))
322     #define mPUSHu(u) sv_setuv_mg(PUSHmortal, (UV)(u))
323    
324     #define XPUSHmortal XPUSHs(sv_newmortal())
325     #define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn_mg(PUSHmortal, (p), (l)); } STMT_END
326     #define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv_mg(PUSHmortal, (NV)(n)); } STMT_END
327     #define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv_mg(PUSHmortal, (IV)(i)); } STMT_END
328     #define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv_mg(PUSHmortal, (UV)(u)); } STMT_END
329    
330     #define SETs(s) (*sp = s)
331     #define SETTARG STMT_START { SvSETMAGIC(TARG); SETs(TARG); } STMT_END
332     #define SETp(p,l) STMT_START { sv_setpvn(TARG, (p), (l)); SETTARG; } STMT_END
333     #define SETn(n) STMT_START { sv_setnv(TARG, (NV)(n)); SETTARG; } STMT_END
334     #define SETi(i) STMT_START { sv_setiv(TARG, (IV)(i)); SETTARG; } STMT_END
335     #define SETu(u) STMT_START { sv_setuv(TARG, (UV)(u)); SETTARG; } STMT_END
336    
337     #define dTOPss SV *sv = TOPs
338     #define dPOPss SV *sv = POPs
339     #define dTOPnv NV value = TOPn
340     #define dPOPnv NV value = POPn
341     #define dTOPiv IV value = TOPi
342     #define dPOPiv IV value = POPi
343     #define dTOPuv UV value = TOPu
344     #define dPOPuv UV value = POPu
345     #ifdef HAS_QUAD
346     #define dTOPqv Quad_t value = TOPu
347     #define dPOPqv Quad_t value = POPu
348     #define dTOPuqv Uquad_t value = TOPuq
349     #define dPOPuqv Uquad_t value = POPuq
350     #endif
351    
352     #define dPOPXssrl(X) SV *right = POPs; SV *left = CAT2(X,s)
353     #define dPOPXnnrl(X) NV right = POPn; NV left = CAT2(X,n)
354     #define dPOPXiirl(X) IV right = POPi; IV left = CAT2(X,i)
355    
356     #define USE_LEFT(sv) \
357     (SvOK(sv) || SvGMAGICAL(sv) || !(PL_op->op_flags & OPf_STACKED))
358     #define dPOPXnnrl_ul(X) \
359     NV right = POPn; \
360     SV *leftsv = CAT2(X,s); \
361     NV left = USE_LEFT(leftsv) ? SvNV(leftsv) : 0.0
362     #define dPOPXiirl_ul(X) \
363     IV right = POPi; \
364     SV *leftsv = CAT2(X,s); \
365     IV left = USE_LEFT(leftsv) ? SvIV(leftsv) : 0
366    
367     #define dPOPPOPssrl dPOPXssrl(POP)
368     #define dPOPPOPnnrl dPOPXnnrl(POP)
369     #define dPOPPOPnnrl_ul dPOPXnnrl_ul(POP)
370     #define dPOPPOPiirl dPOPXiirl(POP)
371     #define dPOPPOPiirl_ul dPOPXiirl_ul(POP)
372    
373     #define dPOPTOPssrl dPOPXssrl(TOP)
374     #define dPOPTOPnnrl dPOPXnnrl(TOP)
375     #define dPOPTOPnnrl_ul dPOPXnnrl_ul(TOP)
376     #define dPOPTOPiirl dPOPXiirl(TOP)
377     #define dPOPTOPiirl_ul dPOPXiirl_ul(TOP)
378    
379     #define RETPUSHYES RETURNX(PUSHs(&PL_sv_yes))
380     #define RETPUSHNO RETURNX(PUSHs(&PL_sv_no))
381     #define RETPUSHUNDEF RETURNX(PUSHs(&PL_sv_undef))
382    
383     #define RETSETYES RETURNX(SETs(&PL_sv_yes))
384     #define RETSETNO RETURNX(SETs(&PL_sv_no))
385     #define RETSETUNDEF RETURNX(SETs(&PL_sv_undef))
386    
387     #define ARGTARG PL_op->op_targ
388    
389     /* See OPpTARGET_MY: */
390     #define MAXARG (PL_op->op_private & 15)
391    
392     #define SWITCHSTACK(f,t) \
393     STMT_START { \
394     AvFILLp(f) = sp - PL_stack_base; \
395     PL_stack_base = AvARRAY(t); \
396     PL_stack_max = PL_stack_base + AvMAX(t); \
397     sp = PL_stack_sp = PL_stack_base + AvFILLp(t); \
398     PL_curstack = t; \
399     } STMT_END
400    
401     #define EXTEND_MORTAL(n) \
402     STMT_START { \
403     if (PL_tmps_ix + (n) >= PL_tmps_max) \
404     tmps_grow(n); \
405     } STMT_END
406    
407     #define AMGf_noright 1
408     #define AMGf_noleft 2
409     #define AMGf_assign 4
410     #define AMGf_unary 8
411    
412     #define tryAMAGICbinW(meth,assign,set) STMT_START { \
413     if (PL_amagic_generation) { \
414     SV* tmpsv; \
415     SV* right= *(sp); SV* left= *(sp-1);\
416     if ((SvAMAGIC(left)||SvAMAGIC(right))&&\
417     (tmpsv=amagic_call(left, \
418     right, \
419     CAT2(meth,_amg), \
420     (assign)? AMGf_assign: 0))) {\
421     SPAGAIN; \
422     (void)POPs; set(tmpsv); RETURN; } \
423     } \
424     } STMT_END
425    
426     #define tryAMAGICbin(meth,assign) tryAMAGICbinW(meth,assign,SETsv)
427     #define tryAMAGICbinSET(meth,assign) tryAMAGICbinW(meth,assign,SETs)
428    
429     #define AMG_CALLun(sv,meth) amagic_call(sv,&PL_sv_undef, \
430     CAT2(meth,_amg),AMGf_noright | AMGf_unary)
431     #define AMG_CALLbinL(left,right,meth) \
432     amagic_call(left,right,CAT2(meth,_amg),AMGf_noright)
433    
434     #define tryAMAGICunW(meth,set,shift,ret) STMT_START { \
435     if (PL_amagic_generation) { \
436     SV* tmpsv; \
437     SV* arg= sp[shift]; \
438     if(0) goto am_again; /* shut up unused warning */ \
439     am_again: \
440     if ((SvAMAGIC(arg))&&\
441     (tmpsv=AMG_CALLun(arg,meth))) {\
442     SPAGAIN; if (shift) sp += shift; \
443     set(tmpsv); ret; } \
444     } \
445     } STMT_END
446    
447     #define FORCE_SETs(sv) STMT_START { sv_setsv(TARG, (sv)); SETTARG; } STMT_END
448    
449     #define tryAMAGICun(meth) tryAMAGICunW(meth,SETsvUN,0,RETURN)
450     #define tryAMAGICunSET(meth) tryAMAGICunW(meth,SETs,0,RETURN)
451     #define tryAMAGICunTARGET(meth, shift) \
452     STMT_START { dSP; sp--; /* get TARGET from below PL_stack_sp */ \
453     { dTARGETSTACKED; \
454     { dSP; tryAMAGICunW(meth,FORCE_SETs,shift,RETURN);}}} STMT_END
455    
456     #define setAGAIN(ref) \
457     STMT_START { \
458     sv = ref; \
459     if (!SvROK(ref)) \
460     Perl_croak(aTHX_ "Overloaded dereference did not return a reference"); \
461     if (ref != arg && SvRV(ref) != SvRV(arg)) { \
462     arg = ref; \
463     goto am_again; \
464     } \
465     } STMT_END
466    
467     #define tryAMAGICunDEREF(meth) tryAMAGICunW(meth,setAGAIN,0,(void)0)
468    
469     #define opASSIGN (PL_op->op_flags & OPf_STACKED)
470     #define SETsv(sv) STMT_START { \
471     if (opASSIGN || (SvFLAGS(TARG) & SVs_PADMY)) \
472     { sv_setsv(TARG, (sv)); SETTARG; } \
473     else SETs(sv); } STMT_END
474    
475     #define SETsvUN(sv) STMT_START { \
476     if (SvFLAGS(TARG) & SVs_PADMY) \
477     { sv_setsv(TARG, (sv)); SETTARG; } \
478     else SETs(sv); } STMT_END
479    
480     /* newSVsv does not behave as advertised, so we copy missing
481     * information by hand */
482    
483     /* SV* ref causes confusion with the member variable
484     changed SV* ref to SV* tmpRef */
485     #define RvDEEPCP(rv) STMT_START { SV* tmpRef=SvRV(rv); \
486     if (SvREFCNT(tmpRef)>1) { \
487     SvRV(rv)=AMG_CALLun(rv,copy); \
488     SvREFCNT_dec(tmpRef); \
489     } } STMT_END
490    
491     /*
492     =for apidoc mU||LVRET
493     True if this op will be the return value of an lvalue subroutine
494    
495     =cut */
496     #define LVRET ((PL_op->op_private & OPpMAYBE_LVSUB) && is_lvalue_sub())