Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 486 lines (394 sloc) 17.373 kb
a0d0e21 perl 5.000
Larry Wall authored
1 /* pp.h
7907280 perl 5.0 alpha 2
Larry Wall authored
2 *
4bb101f @jhi Fix up Larry's copyright statements to my best knowledge.
jhi authored
3 * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
1d32597 @rgs Update copyrights.
rgs authored
4 * 2000, 2001, 2002, 2003, 2004, 2005 by Larry Wall and others
7907280 perl 5.0 alpha 2
Larry Wall authored
5 *
a0d0e21 perl 5.000
Larry Wall authored
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.
7907280 perl 5.0 alpha 2
Larry Wall authored
8 *
a0d0e21 perl 5.000
Larry Wall authored
9 */
7907280 perl 5.0 alpha 2
Larry Wall authored
10
cea2e8a more complete support for implicit thread/interpreter pointer,
Gurusamy Sarathy authored
11 #define PP(s) OP * Perl_##s(pTHX)
7907280 perl 5.0 alpha 2
Larry Wall authored
12
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
13 /*
ccfc67b @jhi Missed the =head1 additions.
jhi authored
14 =head1 Stack Manipulation Macros
15
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
16 =for apidoc AmU||SP
17 Stack pointer. This is usually handled by C<xsubpp>. See C<dSP> and
18 C<SPAGAIN>.
19
20 =for apidoc AmU||MARK
21 Stack marker variable for the XSUB. See C<dMARK>.
22
c578083 Fix apidoc entries for PUSHMARK and newXSproto.
Marcus Holland-Moritz authored
23 =for apidoc Am|void|PUSHMARK|SP
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
24 Opening bracket for arguments on a callback. See C<PUTBACK> and
25 L<perlcall>.
26
27 =for apidoc Ams||dSP
28 Declares a local copy of perl's stack pointer for the XSUB, available via
29 the C<SP> macro. See C<SP>.
30
fac3506 @mstevens djSP
mstevens authored
31 =for apidoc ms||djSP
32
33 Declare Just C<SP>. This is actually identical to C<dSP>, and declares
34 a local copy of perl's stack pointer, available via the C<SP> macro.
35 See C<SP>. (Available for backward source code compatibility with the
36 old (Perl 5.005) thread model.)
37
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
38 =for apidoc Ams||dMARK
39 Declare a stack marker variable, C<mark>, for the XSUB. See C<MARK> and
40 C<dORIGMARK>.
41
42 =for apidoc Ams||dORIGMARK
43 Saves the original stack mark for the XSUB. See C<ORIGMARK>.
44
45 =for apidoc AmU||ORIGMARK
46 The original stack mark for the XSUB. See C<dORIGMARK>.
47
48 =for apidoc Ams||SPAGAIN
49 Refetch the stack pointer. Used after a callback. See L<perlcall>.
50
fac3506 @mstevens djSP
mstevens authored
51 =cut */
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
52
ac634a9 @jhi Integrate changes #8641,8644,8649,8654,8662,8663,8664,8665,8667,8669
jhi authored
53 #undef SP /* Solaris 2.7 i386 has this in /usr/include/sys/reg.h */
7907280 perl 5.0 alpha 2
Larry Wall authored
54 #define SP sp
55 #define MARK mark
56 #define TARG targ
57
16e7e11 Missign STATEMENT brackets in PUSHMARK
Ton Hospel authored
58 #define PUSHMARK(p) \
59 STMT_START { \
60 if (++PL_markstack_ptr == PL_markstack_max) \
61 markstack_grow(); \
62 *PL_markstack_ptr = (p) - PL_stack_base; \
63 } STMT_END
a0d0e21 perl 5.000
Larry Wall authored
64
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
65 #define TOPMARK (*PL_markstack_ptr)
66 #define POPMARK (*PL_markstack_ptr--)
a0d0e21 perl 5.000
Larry Wall authored
67
39644a2 @timj Re: sync sync sync: have I missed any patches?
timj authored
68 #define dSP register SV **sp = PL_stack_sp
69 #define djSP dSP
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
70 #define dMARK register SV **mark = PL_stack_base + POPMARK
a3b680e @petdance consting-eleventy.patch: More consts, plus actual bug fix
petdance authored
71 #define dORIGMARK const I32 origmark = mark - PL_stack_base
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
72 #define ORIGMARK (PL_stack_base + origmark)
7907280 perl 5.0 alpha 2
Larry Wall authored
73
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
74 #define SPAGAIN sp = PL_stack_sp
16e7e11 Missign STATEMENT brackets in PUSHMARK
Ton Hospel authored
75 #define MSPAGAIN STMT_START { sp = PL_stack_sp; mark = ORIGMARK; } STMT_END
7907280 perl 5.0 alpha 2
Larry Wall authored
76
533c011 PL_ stuff for threads
Nick Ing-Simmons authored
77 #define GETTARGETSTACKED targ = (PL_op->op_flags & OPf_STACKED ? POPs : PAD_SV(PL_op->op_targ))
7907280 perl 5.0 alpha 2
Larry Wall authored
78 #define dTARGETSTACKED SV * GETTARGETSTACKED
79
533c011 PL_ stuff for threads
Nick Ing-Simmons authored
80 #define GETTARGET targ = PAD_SV(PL_op->op_targ)
7907280 perl 5.0 alpha 2
Larry Wall authored
81 #define dTARGET SV * GETTARGET
82
533c011 PL_ stuff for threads
Nick Ing-Simmons authored
83 #define GETATARGET targ = (PL_op->op_flags & OPf_STACKED ? sp[-1] : PAD_SV(PL_op->op_targ))
7907280 perl 5.0 alpha 2
Larry Wall authored
84 #define dATARGET SV * GETATARGET
85
86 #define dTARG SV *targ
87
533c011 PL_ stuff for threads
Nick Ing-Simmons authored
88 #define NORMAL PL_op->op_next
cea2e8a more complete support for implicit thread/interpreter pointer,
Gurusamy Sarathy authored
89 #define DIE return Perl_die
5df617b to improve -DCHECK_FORMAT
Robin Barker authored
90 #define DIE_NULL return DieNull
7907280 perl 5.0 alpha 2
Larry Wall authored
91
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
92 /*
93 =for apidoc Ams||PUTBACK
94 Closing bracket for XSUB arguments. This is usually handled by C<xsubpp>.
95 See C<PUSHMARK> and L<perlcall> for other uses.
96
97 =for apidoc Amn|SV*|POPs
98 Pops an SV off the stack.
99
100 =for apidoc Amn|char*|POPp
8c074e2 Convert POPpx POPpconstx and POPpbytex to use nolen macros.
Nicholas Clark authored
101 Pops a string off the stack. Deprecated. New code should use POPpx.
595ae48 Some tests for Camel 3rd edition features.
Nick Ing-Simmons authored
102
103 =for apidoc Amn|char*|POPpx
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
104 Pops a string off the stack.
595ae48 Some tests for Camel 3rd edition features.
Nick Ing-Simmons authored
105
106 =for apidoc Amn|char*|POPpbytex
107 Pops a string off the stack which must consist of bytes i.e. characters < 256.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
108
109 =for apidoc Amn|NV|POPn
110 Pops a double off the stack.
111
112 =for apidoc Amn|IV|POPi
113 Pops an integer off the stack.
114
115 =for apidoc Amn|long|POPl
116 Pops a long off the stack.
117
118 =cut
119 */
120
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
121 #define PUTBACK PL_stack_sp = sp
7907280 perl 5.0 alpha 2
Larry Wall authored
122 #define RETURN return PUTBACK, NORMAL
123 #define RETURNOP(o) return PUTBACK, o
124 #define RETURNX(x) return x, PUTBACK, NORMAL
125
126 #define POPs (*sp--)
2d8e6c8 another threads reliability fix: serialize writes to thr->threadsv
Gurusamy Sarathy authored
127 #define POPp (SvPVx(POPs, PL_na)) /* deprecated */
8c074e2 Convert POPpx POPpconstx and POPpbytex to use nolen macros.
Nicholas Clark authored
128 #define POPpx (SvPVx_nolen(POPs))
129 #define POPpconstx (SvPVx_nolen_const(POPs))
130 #define POPpbytex (SvPVbytex_nolen(POPs))
463ee0b perl 5.0 alpha 4
Larry Wall authored
131 #define POPn (SvNVx(POPs))
a0d0e21 perl 5.000
Larry Wall authored
132 #define POPi ((IV)SvIVx(POPs))
ff68c71 [inseparable changes from patch from perl5.003_09 to perl5.003_10]
Perl 5 Porters authored
133 #define POPu ((UV)SvUVx(POPs))
463ee0b perl 5.0 alpha 4
Larry Wall authored
134 #define POPl ((long)SvIVx(POPs))
d9b3e12 @jhi Jumbo Configure and large file support update.
jhi authored
135 #define POPul ((unsigned long)SvIVx(POPs))
1b8cd67 @jhi Regen Configure.
jhi authored
136 #ifdef HAS_QUAD
d9b3e12 @jhi Jumbo Configure and large file support update.
jhi authored
137 #define POPq ((Quad_t)SvIVx(POPs))
c5a0f51 @jhi Implement 64-bit vec().
jhi authored
138 #define POPuq ((Uquad_t)SvUVx(POPs))
d9b3e12 @jhi Jumbo Configure and large file support update.
jhi authored
139 #endif
7907280 perl 5.0 alpha 2
Larry Wall authored
140
141 #define TOPs (*sp)
56370e9 @jhi Add TOPm1s to peek at the second topmost stack item.
jhi authored
142 #define TOPm1s (*(sp-1))
7dca457 Re: [PATCH] Re: [ID 20010105.023] numeric problems in IRIX
Nicholas Clark authored
143 #define TOPp1s (*(sp+1))
2d8e6c8 another threads reliability fix: serialize writes to thr->threadsv
Gurusamy Sarathy authored
144 #define TOPp (SvPV(TOPs, PL_na)) /* deprecated */
145 #define TOPpx (SvPV(TOPs, n_a))
463ee0b perl 5.0 alpha 4
Larry Wall authored
146 #define TOPn (SvNV(TOPs))
a0d0e21 perl 5.000
Larry Wall authored
147 #define TOPi ((IV)SvIV(TOPs))
ff68c71 [inseparable changes from patch from perl5.003_09 to perl5.003_10]
Perl 5 Porters authored
148 #define TOPu ((UV)SvUV(TOPs))
463ee0b perl 5.0 alpha 4
Larry Wall authored
149 #define TOPl ((long)SvIV(TOPs))
c5a0f51 @jhi Implement 64-bit vec().
jhi authored
150 #define TOPul ((unsigned long)SvUV(TOPs))
1b8cd67 @jhi Regen Configure.
jhi authored
151 #ifdef HAS_QUAD
d9b3e12 @jhi Jumbo Configure and large file support update.
jhi authored
152 #define TOPq ((Quad_t)SvIV(TOPs))
c5a0f51 @jhi Implement 64-bit vec().
jhi authored
153 #define TOPuq ((Uquad_t)SvUV(TOPs))
d9b3e12 @jhi Jumbo Configure and large file support update.
jhi authored
154 #endif
7907280 perl 5.0 alpha 2
Larry Wall authored
155
156 /* Go to some pains in the rare event that we must extend the stack. */
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
157
158 /*
159 =for apidoc Am|void|EXTEND|SP|int nitems
160 Used to extend the argument stack for an XSUB's return values. Once
4375e83 various pod nits (from Larry Virden and others)
Gurusamy Sarathy authored
161 used, guarantees that there is room for at least C<nitems> to be pushed
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
162 onto the stack.
163
164 =for apidoc Am|void|PUSHs|SV* sv
aacdac4 If overloaded %{} etc. return the object do not loop.
Nick Ing-Simmons authored
165 Push an SV onto the stack. The stack must have room for this element.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
166 Does not handle 'set' magic. Does not use C<TARG>. See also C<PUSHmortal>,
167 C<XPUSHs> and C<XPUSHmortal>.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
168
169 =for apidoc Am|void|PUSHp|char* str|STRLEN len
170 Push a string onto the stack. The stack must have room for this element.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
171 The C<len> indicates the length of the string. Handles 'set' magic. Uses
172 C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to declare it. Do not
173 call multiple C<TARG>-oriented macros to return lists from XSUB's - see
174 C<mPUSHp> instead. See also C<XPUSHp> and C<mXPUSHp>.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
175
176 =for apidoc Am|void|PUSHn|NV nv
177 Push a double onto the stack. The stack must have room for this element.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
178 Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
179 called to declare it. Do not call multiple C<TARG>-oriented macros to
180 return lists from XSUB's - see C<mPUSHn> instead. See also C<XPUSHn> and
181 C<mXPUSHn>.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
182
183 =for apidoc Am|void|PUSHi|IV iv
184 Push an integer onto the stack. The stack must have room for this element.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
185 Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
186 called to declare it. Do not call multiple C<TARG>-oriented macros to
187 return lists from XSUB's - see C<mPUSHi> instead. See also C<XPUSHi> and
188 C<mXPUSHi>.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
189
190 =for apidoc Am|void|PUSHu|UV uv
191 Push an unsigned integer onto the stack. The stack must have room for this
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
192 element. Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG>
193 should be called to declare it. Do not call multiple C<TARG>-oriented
194 macros to return lists from XSUB's - see C<mPUSHu> instead. See also
195 C<XPUSHu> and C<mXPUSHu>.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
196
197 =for apidoc Am|void|XPUSHs|SV* sv
198 Push an SV onto the stack, extending the stack if necessary. Does not
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
199 handle 'set' magic. Does not use C<TARG>. See also C<XPUSHmortal>,
200 C<PUSHs> and C<PUSHmortal>.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
201
202 =for apidoc Am|void|XPUSHp|char* str|STRLEN len
203 Push a string onto the stack, extending the stack if necessary. The C<len>
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
204 indicates the length of the string. Handles 'set' magic. Uses C<TARG>, so
205 C<dTARGET> or C<dXSTARG> should be called to declare it. Do not call
206 multiple C<TARG>-oriented macros to return lists from XSUB's - see
207 C<mXPUSHp> instead. See also C<PUSHp> and C<mPUSHp>.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
208
209 =for apidoc Am|void|XPUSHn|NV nv
210 Push a double onto the stack, extending the stack if necessary. Handles
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
211 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to
212 declare it. Do not call multiple C<TARG>-oriented macros to return lists
213 from XSUB's - see C<mXPUSHn> instead. See also C<PUSHn> and C<mPUSHn>.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
214
215 =for apidoc Am|void|XPUSHi|IV iv
216 Push an integer onto the stack, extending the stack if necessary. Handles
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
217 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to
218 declare it. Do not call multiple C<TARG>-oriented macros to return lists
219 from XSUB's - see C<mXPUSHi> instead. See also C<PUSHi> and C<mPUSHi>.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
220
221 =for apidoc Am|void|XPUSHu|UV uv
aacdac4 If overloaded %{} etc. return the object do not loop.
Nick Ing-Simmons authored
222 Push an unsigned integer onto the stack, extending the stack if necessary.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
223 Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
224 called to declare it. Do not call multiple C<TARG>-oriented macros to
225 return lists from XSUB's - see C<mXPUSHu> instead. See also C<PUSHu> and
226 C<mPUSHu>.
227
228 =for apidoc Am|void|PUSHmortal
229 Push a new mortal SV onto the stack. The stack must have room for this
230 element. Does not handle 'set' magic. Does not use C<TARG>. See also
231 C<PUSHs>, C<XPUSHmortal> and C<XPUSHs>.
232
233 =for apidoc Am|void|mPUSHp|char* str|STRLEN len
234 Push a string onto the stack. The stack must have room for this element.
de4f220 @rgs Follow-up to previous patch: the mX?PUSH[inup] macros
rgs authored
235 The C<len> indicates the length of the string. Handles 'set' magic. Does
236 not use C<TARG>. See also C<PUSHp>, C<mXPUSHp> and C<XPUSHp>.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
237
238 =for apidoc Am|void|mPUSHn|NV nv
239 Push a double onto the stack. The stack must have room for this element.
de4f220 @rgs Follow-up to previous patch: the mX?PUSH[inup] macros
rgs authored
240 Handles 'set' magic. Does not use C<TARG>. See also C<PUSHn>, C<mXPUSHn>
241 and C<XPUSHn>.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
242
243 =for apidoc Am|void|mPUSHi|IV iv
244 Push an integer onto the stack. The stack must have room for this element.
de4f220 @rgs Follow-up to previous patch: the mX?PUSH[inup] macros
rgs authored
245 Handles 'set' magic. Does not use C<TARG>. See also C<PUSHi>, C<mXPUSHi>
246 and C<XPUSHi>.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
247
248 =for apidoc Am|void|mPUSHu|UV uv
249 Push an unsigned integer onto the stack. The stack must have room for this
de4f220 @rgs Follow-up to previous patch: the mX?PUSH[inup] macros
rgs authored
250 element. Handles 'set' magic. Does not use C<TARG>. See also C<PUSHu>,
251 C<mXPUSHu> and C<XPUSHu>.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
252
253 =for apidoc Am|void|XPUSHmortal
254 Push a new mortal SV onto the stack, extending the stack if necessary. Does
255 not handle 'set' magic. Does not use C<TARG>. See also C<XPUSHs>,
256 C<PUSHmortal> and C<PUSHs>.
257
258 =for apidoc Am|void|mXPUSHp|char* str|STRLEN len
259 Push a string onto the stack, extending the stack if necessary. The C<len>
de4f220 @rgs Follow-up to previous patch: the mX?PUSH[inup] macros
rgs authored
260 indicates the length of the string. Handles 'set' magic. Does not use
261 C<TARG>. See also C<XPUSHp>, C<mPUSHp> and C<PUSHp>.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
262
263 =for apidoc Am|void|mXPUSHn|NV nv
de4f220 @rgs Follow-up to previous patch: the mX?PUSH[inup] macros
rgs authored
264 Push a double onto the stack, extending the stack if necessary. Handles
265 'set' magic. Does not use C<TARG>. See also C<XPUSHn>, C<mPUSHn> and
266 C<PUSHn>.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
267
268 =for apidoc Am|void|mXPUSHi|IV iv
de4f220 @rgs Follow-up to previous patch: the mX?PUSH[inup] macros
rgs authored
269 Push an integer onto the stack, extending the stack if necessary. Handles
270 'set' magic. Does not use C<TARG>. See also C<XPUSHi>, C<mPUSHi> and
271 C<PUSHi>.
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
272
273 =for apidoc Am|void|mXPUSHu|UV uv
274 Push an unsigned integer onto the stack, extending the stack if necessary.
de4f220 @rgs Follow-up to previous patch: the mX?PUSH[inup] macros
rgs authored
275 Handles 'set' magic. Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu>
276 and C<PUSHu>.
954c199 autogenerate API listing from comments in the source (from Benjamin
Gurusamy Sarathy authored
277
278 =cut
279 */
280
c5661c8 Integrate from maint:
Marcus Holland-Moritz authored
281 #define EXTEND(p,n) STMT_START { if (PL_stack_max - p < (int)(n)) { \
bbce6d6 [inseparable changes from patch from perl5.003_08 to perl5.003_09]
Perl 5 Porters authored
282 sp = stack_grow(sp,p, (int) (n)); \
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
283 } } STMT_END
a0d0e21 perl 5.000
Larry Wall authored
284
7907280 perl 5.0 alpha 2
Larry Wall authored
285 /* Same thing, but update mark register too. */
c5661c8 Integrate from maint:
Marcus Holland-Moritz authored
286 #define MEXTEND(p,n) STMT_START {if (PL_stack_max - p < (int)(n)) { \
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
287 int markoff = mark - PL_stack_base; \
bbce6d6 [inseparable changes from patch from perl5.003_08 to perl5.003_09]
Perl 5 Porters authored
288 sp = stack_grow(sp,p,(int) (n)); \
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
289 mark = PL_stack_base + markoff; \
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
290 } } STMT_END
7907280 perl 5.0 alpha 2
Larry Wall authored
291
292 #define PUSHs(s) (*++sp = (s))
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
293 #define PUSHTARG STMT_START { SvSETMAGIC(TARG); PUSHs(TARG); } STMT_END
294 #define PUSHp(p,l) STMT_START { sv_setpvn(TARG, (p), (l)); PUSHTARG; } STMT_END
6520202 slightly tweaked version of suggested patch
Dan Sugalski authored
295 #define PUSHn(n) STMT_START { sv_setnv(TARG, (NV)(n)); PUSHTARG; } STMT_END
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
296 #define PUSHi(i) STMT_START { sv_setiv(TARG, (IV)(i)); PUSHTARG; } STMT_END
55497cf [inseparable changes from patch from perl5.003_07 to perl5.003_08]
Perl 5 Porters authored
297 #define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END
7907280 perl 5.0 alpha 2
Larry Wall authored
298
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
299 #define XPUSHs(s) STMT_START { EXTEND(sp,1); (*++sp = (s)); } STMT_END
300 #define XPUSHTARG STMT_START { SvSETMAGIC(TARG); XPUSHs(TARG); } STMT_END
301 #define XPUSHp(p,l) STMT_START { sv_setpvn(TARG, (p), (l)); XPUSHTARG; } STMT_END
6520202 slightly tweaked version of suggested patch
Dan Sugalski authored
302 #define XPUSHn(n) STMT_START { sv_setnv(TARG, (NV)(n)); XPUSHTARG; } STMT_END
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
303 #define XPUSHi(i) STMT_START { sv_setiv(TARG, (IV)(i)); XPUSHTARG; } STMT_END
55497cf [inseparable changes from patch from perl5.003_07 to perl5.003_08]
Perl 5 Porters authored
304 #define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
b162f9e Optimize away OP_SASSIGN
Ilya Zakharevich authored
305 #define XPUSHundef STMT_START { SvOK_off(TARG); XPUSHs(TARG); } STMT_END
7907280 perl 5.0 alpha 2
Larry Wall authored
306
2cc7004 Fix mX?PUSH[inup] macros. (Follow-up to #22756 and #22757)
Marcus Holland-Moritz authored
307 #define PUSHmortal PUSHs(sv_newmortal())
308 #define mPUSHp(p,l) sv_setpvn_mg(PUSHmortal, (p), (l))
309 #define mPUSHn(n) sv_setnv_mg(PUSHmortal, (NV)(n))
310 #define mPUSHi(i) sv_setiv_mg(PUSHmortal, (IV)(i))
311 #define mPUSHu(u) sv_setuv_mg(PUSHmortal, (UV)(u))
312
313 #define XPUSHmortal XPUSHs(sv_newmortal())
314 #define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn_mg(PUSHmortal, (p), (l)); } STMT_END
315 #define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv_mg(PUSHmortal, (NV)(n)); } STMT_END
316 #define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv_mg(PUSHmortal, (IV)(i)); } STMT_END
317 #define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv_mg(PUSHmortal, (UV)(u)); } STMT_END
d82b684 Document limitations in PUSHi et al macros and add new mPUSHi et al macr...
Steve Hay authored
318
7907280 perl 5.0 alpha 2
Larry Wall authored
319 #define SETs(s) (*sp = s)
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
320 #define SETTARG STMT_START { SvSETMAGIC(TARG); SETs(TARG); } STMT_END
321 #define SETp(p,l) STMT_START { sv_setpvn(TARG, (p), (l)); SETTARG; } STMT_END
6520202 slightly tweaked version of suggested patch
Dan Sugalski authored
322 #define SETn(n) STMT_START { sv_setnv(TARG, (NV)(n)); SETTARG; } STMT_END
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
323 #define SETi(i) STMT_START { sv_setiv(TARG, (IV)(i)); SETTARG; } STMT_END
55497cf [inseparable changes from patch from perl5.003_07 to perl5.003_08]
Perl 5 Porters authored
324 #define SETu(u) STMT_START { sv_setuv(TARG, (UV)(u)); SETTARG; } STMT_END
a0d0e21 perl 5.000
Larry Wall authored
325
7907280 perl 5.0 alpha 2
Larry Wall authored
326 #define dTOPss SV *sv = TOPs
327 #define dPOPss SV *sv = POPs
6520202 slightly tweaked version of suggested patch
Dan Sugalski authored
328 #define dTOPnv NV value = TOPn
329 #define dPOPnv NV value = POPn
a0d0e21 perl 5.000
Larry Wall authored
330 #define dTOPiv IV value = TOPi
331 #define dPOPiv IV value = POPi
55497cf [inseparable changes from patch from perl5.003_07 to perl5.003_08]
Perl 5 Porters authored
332 #define dTOPuv UV value = TOPu
333 #define dPOPuv UV value = POPu
1b8cd67 @jhi Regen Configure.
jhi authored
334 #ifdef HAS_QUAD
2d4389e @jhi Batch of small 64-bit/long double/large file support tweaks:
jhi authored
335 #define dTOPqv Quad_t value = TOPu
336 #define dPOPqv Quad_t value = POPu
337 #define dTOPuqv Uquad_t value = TOPuq
338 #define dPOPuqv Uquad_t value = POPuq
339 #endif
7907280 perl 5.0 alpha 2
Larry Wall authored
340
7a4c00b [inseparable changes from patch from perl5.003_15 to perl5.003_16]
Perl 5 Porters authored
341 #define dPOPXssrl(X) SV *right = POPs; SV *left = CAT2(X,s)
6520202 slightly tweaked version of suggested patch
Dan Sugalski authored
342 #define dPOPXnnrl(X) NV right = POPn; NV left = CAT2(X,n)
7a4c00b [inseparable changes from patch from perl5.003_15 to perl5.003_16]
Perl 5 Porters authored
343 #define dPOPXiirl(X) IV right = POPi; IV left = CAT2(X,i)
344
345 #define USE_LEFT(sv) \
533c011 PL_ stuff for threads
Nick Ing-Simmons authored
346 (SvOK(sv) || SvGMAGICAL(sv) || !(PL_op->op_flags & OPf_STACKED))
7a4c00b [inseparable changes from patch from perl5.003_15 to perl5.003_16]
Perl 5 Porters authored
347 #define dPOPXnnrl_ul(X) \
6520202 slightly tweaked version of suggested patch
Dan Sugalski authored
348 NV right = POPn; \
7a4c00b [inseparable changes from patch from perl5.003_15 to perl5.003_16]
Perl 5 Porters authored
349 SV *leftsv = CAT2(X,s); \
6520202 slightly tweaked version of suggested patch
Dan Sugalski authored
350 NV left = USE_LEFT(leftsv) ? SvNV(leftsv) : 0.0
7a4c00b [inseparable changes from patch from perl5.003_15 to perl5.003_16]
Perl 5 Porters authored
351 #define dPOPXiirl_ul(X) \
352 IV right = POPi; \
353 SV *leftsv = CAT2(X,s); \
354 IV left = USE_LEFT(leftsv) ? SvIV(leftsv) : 0
355
356 #define dPOPPOPssrl dPOPXssrl(POP)
357 #define dPOPPOPnnrl dPOPXnnrl(POP)
358 #define dPOPPOPnnrl_ul dPOPXnnrl_ul(POP)
359 #define dPOPPOPiirl dPOPXiirl(POP)
360 #define dPOPPOPiirl_ul dPOPXiirl_ul(POP)
361
362 #define dPOPTOPssrl dPOPXssrl(TOP)
363 #define dPOPTOPnnrl dPOPXnnrl(TOP)
364 #define dPOPTOPnnrl_ul dPOPXnnrl_ul(TOP)
365 #define dPOPTOPiirl dPOPXiirl(TOP)
366 #define dPOPTOPiirl_ul dPOPXiirl_ul(TOP)
7907280 perl 5.0 alpha 2
Larry Wall authored
367
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
368 #define RETPUSHYES RETURNX(PUSHs(&PL_sv_yes))
369 #define RETPUSHNO RETURNX(PUSHs(&PL_sv_no))
370 #define RETPUSHUNDEF RETURNX(PUSHs(&PL_sv_undef))
7907280 perl 5.0 alpha 2
Larry Wall authored
371
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
372 #define RETSETYES RETURNX(SETs(&PL_sv_yes))
373 #define RETSETNO RETURNX(SETs(&PL_sv_no))
374 #define RETSETUNDEF RETURNX(SETs(&PL_sv_undef))
7907280 perl 5.0 alpha 2
Larry Wall authored
375
533c011 PL_ stuff for threads
Nick Ing-Simmons authored
376 #define ARGTARG PL_op->op_targ
b162f9e Optimize away OP_SASSIGN
Ilya Zakharevich authored
377
378 /* See OPpTARGET_MY: */
379 #define MAXARG (PL_op->op_private & 15)
7907280 perl 5.0 alpha 2
Larry Wall authored
380
e336de0 [win32] implement stack-of-stacks so that magic invocations don't
Gurusamy Sarathy authored
381 #define SWITCHSTACK(f,t) \
382 STMT_START { \
677b06e grow PL_tmps_stack more efficiently; make it more amenable to
Gurusamy Sarathy authored
383 AvFILLp(f) = sp - PL_stack_base; \
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
384 PL_stack_base = AvARRAY(t); \
677b06e grow PL_tmps_stack more efficiently; make it more amenable to
Gurusamy Sarathy authored
385 PL_stack_max = PL_stack_base + AvMAX(t); \
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
386 sp = PL_stack_sp = PL_stack_base + AvFILLp(t); \
677b06e grow PL_tmps_stack more efficiently; make it more amenable to
Gurusamy Sarathy authored
387 PL_curstack = t; \
e336de0 [win32] implement stack-of-stacks so that magic invocations don't
Gurusamy Sarathy authored
388 } STMT_END
7907280 perl 5.0 alpha 2
Larry Wall authored
389
bbce6d6 [inseparable changes from patch from perl5.003_08 to perl5.003_09]
Perl 5 Porters authored
390 #define EXTEND_MORTAL(n) \
677b06e grow PL_tmps_stack more efficiently; make it more amenable to
Gurusamy Sarathy authored
391 STMT_START { \
392 if (PL_tmps_ix + (n) >= PL_tmps_max) \
393 tmps_grow(n); \
394 } STMT_END
bbce6d6 [inseparable changes from patch from perl5.003_08 to perl5.003_09]
Perl 5 Porters authored
395
a0d0e21 perl 5.000
Larry Wall authored
396 #define AMGf_noright 1
397 #define AMGf_noleft 2
398 #define AMGf_assign 4
399 #define AMGf_unary 8
400
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
401 #define tryAMAGICbinW(meth,assign,set) STMT_START { \
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
402 if (PL_amagic_generation) { \
a0d0e21 perl 5.000
Larry Wall authored
403 SV* tmpsv; \
404 SV* right= *(sp); SV* left= *(sp-1);\
405 if ((SvAMAGIC(left)||SvAMAGIC(right))&&\
406 (tmpsv=amagic_call(left, \
407 right, \
408 CAT2(meth,_amg), \
409 (assign)? AMGf_assign: 0))) {\
410 SPAGAIN; \
411 (void)POPs; set(tmpsv); RETURN; } \
412 } \
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
413 } STMT_END
a0d0e21 perl 5.000
Larry Wall authored
414
415 #define tryAMAGICbin(meth,assign) tryAMAGICbinW(meth,assign,SETsv)
416 #define tryAMAGICbinSET(meth,assign) tryAMAGICbinW(meth,assign,SETs)
417
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
418 #define AMG_CALLun(sv,meth) amagic_call(sv,&PL_sv_undef, \
a0d0e21 perl 5.000
Larry Wall authored
419 CAT2(meth,_amg),AMGf_noright | AMGf_unary)
420 #define AMG_CALLbinL(left,right,meth) \
421 amagic_call(left,right,CAT2(meth,_amg),AMGf_noright)
422
e8c2096 Re: [PATCH 5.00552] Overloaded <> and deref again
Ilya Zakharevich authored
423 #define tryAMAGICunW(meth,set,shift,ret) STMT_START { \
3280af2 PL_ prefix to all perlvars, part1
Nick Ing-Simmons authored
424 if (PL_amagic_generation) { \
a0d0e21 perl 5.000
Larry Wall authored
425 SV* tmpsv; \
f5284f6 Overloaded <> and deref again
Ilya Zakharevich authored
426 SV* arg= sp[shift]; \
c4459e0 @schwern Re: Would -Wno-unused -Wall be better?
schwern authored
427 if(0) goto am_again; /* shut up unused warning */ \
f5284f6 Overloaded <> and deref again
Ilya Zakharevich authored
428 am_again: \
a0d0e21 perl 5.000
Larry Wall authored
429 if ((SvAMAGIC(arg))&&\
430 (tmpsv=AMG_CALLun(arg,meth))) {\
f5284f6 Overloaded <> and deref again
Ilya Zakharevich authored
431 SPAGAIN; if (shift) sp += shift; \
e8c2096 Re: [PATCH 5.00552] Overloaded <> and deref again
Ilya Zakharevich authored
432 set(tmpsv); ret; } \
a0d0e21 perl 5.000
Larry Wall authored
433 } \
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
434 } STMT_END
a0d0e21 perl 5.000
Larry Wall authored
435
f5284f6 Overloaded <> and deref again
Ilya Zakharevich authored
436 #define FORCE_SETs(sv) STMT_START { sv_setsv(TARG, (sv)); SETTARG; } STMT_END
437
b162f9e Optimize away OP_SASSIGN
Ilya Zakharevich authored
438 #define tryAMAGICun(meth) tryAMAGICunW(meth,SETsvUN,0,RETURN)
439 #define tryAMAGICunSET(meth) tryAMAGICunW(meth,SETs,0,RETURN)
f5284f6 Overloaded <> and deref again
Ilya Zakharevich authored
440 #define tryAMAGICunTARGET(meth, shift) \
16e7e11 Missign STATEMENT brackets in PUSHMARK
Ton Hospel authored
441 STMT_START { dSP; sp--; /* get TARGET from below PL_stack_sp */ \
f5284f6 Overloaded <> and deref again
Ilya Zakharevich authored
442 { dTARGETSTACKED; \
16e7e11 Missign STATEMENT brackets in PUSHMARK
Ton Hospel authored
443 { dSP; tryAMAGICunW(meth,FORCE_SETs,shift,RETURN);}}} STMT_END
444
445 #define setAGAIN(ref) \
446 STMT_START { \
447 sv = ref; \
448 if (!SvROK(ref)) \
449 Perl_croak(aTHX_ "Overloaded dereference did not return a reference"); \
450 if (ref != arg && SvRV(ref) != SvRV(arg)) { \
451 arg = ref; \
452 goto am_again; \
453 } \
454 } STMT_END
e8c2096 Re: [PATCH 5.00552] Overloaded <> and deref again
Ilya Zakharevich authored
455
0f4592e bump patchlevel; other minor fixes for clean build and test on
Gurusamy Sarathy authored
456 #define tryAMAGICunDEREF(meth) tryAMAGICunW(meth,setAGAIN,0,(void)0)
a0d0e21 perl 5.000
Larry Wall authored
457
533c011 PL_ stuff for threads
Nick Ing-Simmons authored
458 #define opASSIGN (PL_op->op_flags & OPf_STACKED)
e990555 perl 5.003_01: pp.h
Perl 5 Porters authored
459 #define SETsv(sv) STMT_START { \
b162f9e Optimize away OP_SASSIGN
Ilya Zakharevich authored
460 if (opASSIGN || (SvFLAGS(TARG) & SVs_PADMY)) \
461 { sv_setsv(TARG, (sv)); SETTARG; } \
462 else SETs(sv); } STMT_END
463
464 #define SETsvUN(sv) STMT_START { \
465 if (SvFLAGS(TARG) & SVs_PADMY) \
466 { sv_setsv(TARG, (sv)); SETTARG; } \
e990555 perl 5.003_01: pp.h
Perl 5 Porters authored
467 else SETs(sv); } STMT_END
a0d0e21 perl 5.000
Larry Wall authored
468
469 /* newSVsv does not behave as advertised, so we copy missing
470 * information by hand */
471
76e3520 [asperl] added AS patch#2
Gurusamy Sarathy authored
472 /* SV* ref causes confusion with the member variable
473 changed SV* ref to SV* tmpRef */
474 #define RvDEEPCP(rv) STMT_START { SV* tmpRef=SvRV(rv); \
475 if (SvREFCNT(tmpRef)>1) { \
b162af0 @smpeters Refactoring to Sv*_set() macros - patch #5
smpeters authored
476 SvRV_set(rv, AMG_CALLun(rv,copy)); \
76e3520 [asperl] added AS patch#2
Gurusamy Sarathy authored
477 SvREFCNT_dec(tmpRef); \
8654792 Incorporate new single-statement macros
Perl 5 Porters authored
478 } } STMT_END
78f9721 Consolidated lvalue sub changes
Stephen McCamant authored
479
480 /*
481 =for apidoc mU||LVRET
482 True if this op will be the return value of an lvalue subroutine
483
484 =cut */
9d96b2e @jhi Use the /^Perl_/-less form of is_lvalue_sub().
jhi authored
485 #define LVRET ((PL_op->op_private & OPpMAYBE_LVSUB) && is_lvalue_sub())
Something went wrong with that request. Please try again.