150
153
<a class="l_k" href="functions/my.html">my</a> <span class="i">$a</span> = <span class="i">tmp</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span>
151
154
<a class="l_k" href="functions/undef.html">undef</a> <span class="i">&tmp</span><span class="sc">;</span>
152
155
<a class="l_k" href="functions/print.html">print</a> <span class="i">$a</span>-><span class="s">(</span><span class="s">)</span><span class="sc">;</span></pre>
153
<pre class="verbatim"> bool <span class="i">CvWEAKOUTSIDE</span><span class="s">(</span>CV *cv<span class="s">)</span></pre>
156
<pre class="verbatim"> <span class="w">bool</span> <span class="i">CvWEAKOUTSIDE</span><span class="s">(</span><span class="w">CV</span> *<span class="w">cv</span><span class="s">)</span></pre>
156
159
<a name="Functions-in-file-pad.h"></a><h1>Functions in file pad.h</h1>
158
<li><a name="CX_CURPAD_SAVE-CX_CURPAD_SAVE"></a><b>CX_CURPAD_SAVE
161
<li><a name="CX_CURPAD_SAVE"></a><b>CX_CURPAD_SAVE
160
163
<p>Save the current pad in the given context block structure.</p>
161
<pre class="verbatim"> void <span class="i">CX_CURPAD_SAVE</span><span class="s">(</span>struct context<span class="s">)</span></pre>
164
<pre class="verbatim"> <span class="w">void</span> <span class="i">CX_CURPAD_SAVE</span><span class="s">(</span><span class="w">struct</span> <span class="w">context</span><span class="s">)</span></pre>
163
<li><a name="CX_CURPAD_SV-CX_CURPAD_SV"></a><b>CX_CURPAD_SV
166
<li><a name="CX_CURPAD_SV"></a><b>CX_CURPAD_SV
165
168
<p>Access the SV at offset po in the saved current pad in the given
166
169
context block structure (can be used as an lvalue).</p>
167
<pre class="verbatim"> SV * <span class="i">CX_CURPAD_SV</span><span class="s">(</span>struct context<span class="cm">,</span> PADOFFSET po<span class="s">)</span></pre>
170
<pre class="verbatim"> <span class="w">SV</span> * <span class="i">CX_CURPAD_SV</span><span class="s">(</span><span class="w">struct</span> <span class="w">context</span><span class="cm">,</span> <span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></pre>
169
<li><a name="PAD_BASE_SV-PAD_BASE_SV"></a><b>PAD_BASE_SV
172
<li><a name="PAD_BASE_SV"></a><b>PAD_BASE_SV
171
<p>Get the value from slot <code class="inline">po</code>
174
<p>Get the value from slot <code class="inline"><span class="w">po</span></code>
172
175
in the base (DEPTH=1) pad of a padlist</p>
173
<pre class="verbatim"> SV * <span class="i">PAD_BASE_SV</span><span class="s">(</span>PADLIST padlist<span class="cm">,</span> PADOFFSET po<span class="s">)</span></pre>
176
<pre class="verbatim"> <span class="w">SV</span> * <span class="i">PAD_BASE_SV</span><span class="s">(</span><span class="w">PADLIST</span> <span class="w">padlist</span><span class="cm">,</span> <span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></pre>
175
<li><a name="PAD_CLONE_VARS-PAD_CLONE_VARS"></a><b>PAD_CLONE_VARS
178
<li><a name="PAD_CLONE_VARS"></a><b>PAD_CLONE_VARS
177
180
<p>|CLONE_PARAMS* param
178
181
Clone the state variables associated with running and compiling pads.</p>
179
<pre class="verbatim"> void <span class="i">PAD_CLONE_VARS</span><span class="s">(</span>PerlInterpreter *proto_perl \<span class="s">)</span></pre>
182
<pre class="verbatim"> <span class="w">void</span> <span class="i">PAD_CLONE_VARS</span><span class="s">(</span><span class="w">PerlInterpreter</span> *<span class="w">proto_perl</span> \<span class="s">)</span></pre>
181
<li><a name="PAD_COMPNAME_FLAGS-PAD_COMPNAME_FLAGS"></a><b>PAD_COMPNAME_FLAGS
184
<li><a name="PAD_COMPNAME_FLAGS"></a><b>PAD_COMPNAME_FLAGS
183
186
<p>Return the flags for the current compiling pad name
184
at offset <code class="inline">po</code>
187
at offset <code class="inline"><span class="w">po</span></code>
185
188
. Assumes a valid slot entry.</p>
186
<pre class="verbatim"> U32 <span class="i">PAD_COMPNAME_FLAGS</span><span class="s">(</span>PADOFFSET po<span class="s">)</span></pre>
188
<li><a name="PAD_COMPNAME_GEN-PAD_COMPNAME_GEN"></a><b>PAD_COMPNAME_GEN
190
<p>The generation number of the name at offset <code class="inline">po</code>
192
compiling pad (lvalue). Note that <code class="inline">SvCUR</code>
193
is hijacked for this purpose.</p>
194
<pre class="verbatim"> STRLEN <span class="i">PAD_COMPNAME_GEN</span><span class="s">(</span>PADOFFSET po<span class="s">)</span></pre>
196
<li><a name="PAD_COMPNAME_GEN_set-PAD_COMPNAME_GEN_set"></a><b>PAD_COMPNAME_GEN_set
198
<p>Sets the generation number of the name at offset <code class="inline">po</code>
200
ling pad (lvalue) to <code class="inline">gen</code>
201
. Note that <code class="inline">SvCUR_set</code>
202
is hijacked for this purpose.</p>
203
<pre class="verbatim"> STRLEN <span class="i">PAD_COMPNAME_GEN_set</span><span class="s">(</span>PADOFFSET po<span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> gen<span class="s">)</span></pre>
205
<li><a name="PAD_COMPNAME_OURSTASH-PAD_COMPNAME_OURSTASH"></a><b>PAD_COMPNAME_OURSTASH
189
<pre class="verbatim"> <span class="w">U32</span> <span class="i">PAD_COMPNAME_FLAGS</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></pre>
191
<li><a name="PAD_COMPNAME_GEN"></a><b>PAD_COMPNAME_GEN
193
<p>The generation number of the name at offset <code class="inline"><span class="w">po</span></code>
195
compiling pad (lvalue). Note that <code class="inline"><span class="w">SvUVX</span></code>
196
is hijacked for this purpose.</p>
197
<pre class="verbatim"> <span class="w">STRLEN</span> <span class="i">PAD_COMPNAME_GEN</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></pre>
199
<li><a name="PAD_COMPNAME_GEN_set"></a><b>PAD_COMPNAME_GEN_set
201
<p>Sets the generation number of the name at offset <code class="inline"><span class="w">po</span></code>
203
ling pad (lvalue) to <code class="inline"><span class="w">gen</span></code>
204
. Note that <code class="inline"><span class="w">SvUV_set</span></code>
205
is hijacked for this purpose.</p>
206
<pre class="verbatim"> <span class="w">STRLEN</span> <span class="i">PAD_COMPNAME_GEN_set</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">gen</span><span class="s">)</span></pre>
208
<li><a name="PAD_COMPNAME_OURSTASH"></a><b>PAD_COMPNAME_OURSTASH
207
210
<p>Return the stash associated with an <code class="inline"><a class="l_k" href="functions/our.html">our</a></code> variable.
208
211
Assumes the slot entry is a valid <code class="inline"><a class="l_k" href="functions/our.html">our</a></code> lexical.</p>
209
<pre class="verbatim"> HV * <span class="i">PAD_COMPNAME_OURSTASH</span><span class="s">(</span>PADOFFSET po<span class="s">)</span></pre>
212
<pre class="verbatim"> <span class="w">HV</span> * <span class="i">PAD_COMPNAME_OURSTASH</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></pre>
211
<li><a name="PAD_COMPNAME_PV-PAD_COMPNAME_PV"></a><b>PAD_COMPNAME_PV
214
<li><a name="PAD_COMPNAME_PV"></a><b>PAD_COMPNAME_PV
213
216
<p>Return the name of the current compiling pad name
214
at offset <code class="inline">po</code>
217
at offset <code class="inline"><span class="w">po</span></code>
215
218
. Assumes a valid slot entry.</p>
216
<pre class="verbatim"> char * <span class="i">PAD_COMPNAME_PV</span><span class="s">(</span>PADOFFSET po<span class="s">)</span></pre>
219
<pre class="verbatim"> <span class="w">char</span> * <span class="i">PAD_COMPNAME_PV</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></pre>
218
<li><a name="PAD_COMPNAME_TYPE-PAD_COMPNAME_TYPE"></a><b>PAD_COMPNAME_TYPE
221
<li><a name="PAD_COMPNAME_TYPE"></a><b>PAD_COMPNAME_TYPE
220
223
<p>Return the type (stash) of the current compiling pad name at offset
221
<code class="inline">po</code>
224
<code class="inline"><span class="w">po</span></code>
222
225
. Must be a valid name. Returns null if not typed.</p>
223
<pre class="verbatim"> HV * <span class="i">PAD_COMPNAME_TYPE</span><span class="s">(</span>PADOFFSET po<span class="s">)</span></pre>
226
<pre class="verbatim"> <span class="w">HV</span> * <span class="i">PAD_COMPNAME_TYPE</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></pre>
225
<li><a name="PAD_DUP-PAD_DUP"></a><b>PAD_DUP
228
<li><a name="PAD_DUP"></a><b>PAD_DUP
227
230
<p>Clone a padlist.</p>
228
<pre class="verbatim"> void <span class="i">PAD_DUP</span><span class="s">(</span>PADLIST dstpad<span class="cm">,</span> PADLIST srcpad<span class="cm">,</span> CLONE_PARAMS* param<span class="s">)</span></pre>
231
<pre class="verbatim"> <span class="w">void</span> <span class="i">PAD_DUP</span><span class="s">(</span><span class="w">PADLIST</span> <span class="w">dstpad</span><span class="cm">,</span> <span class="w">PADLIST</span> <span class="w">srcpad</span><span class="cm">,</span> <span class="w">CLONE_PARAMS</span>* <span class="w">param</span><span class="s">)</span></pre>
230
<li><a name="PAD_RESTORE_LOCAL-PAD_RESTORE_LOCAL"></a><b>PAD_RESTORE_LOCAL
233
<li><a name="PAD_RESTORE_LOCAL"></a><b>PAD_RESTORE_LOCAL
232
235
<p>Restore the old pad saved into the local variable opad by PAD_SAVE_LOCAL()</p>
233
<pre class="verbatim"> void <span class="i">PAD_RESTORE_LOCAL</span><span class="s">(</span>PAD *opad<span class="s">)</span></pre>
236
<pre class="verbatim"> <span class="w">void</span> <span class="i">PAD_RESTORE_LOCAL</span><span class="s">(</span><span class="w">PAD</span> *<span class="w">opad</span><span class="s">)</span></pre>
235
<li><a name="PAD_SAVE_LOCAL-PAD_SAVE_LOCAL"></a><b>PAD_SAVE_LOCAL
238
<li><a name="PAD_SAVE_LOCAL"></a><b>PAD_SAVE_LOCAL
237
240
<p>Save the current pad to the local variable opad, then make the
238
241
current pad equal to npad</p>
239
<pre class="verbatim"> void <span class="i">PAD_SAVE_LOCAL</span><span class="s">(</span>PAD *opad<span class="cm">,</span> PAD *npad<span class="s">)</span></pre>
242
<pre class="verbatim"> <span class="w">void</span> <span class="i">PAD_SAVE_LOCAL</span><span class="s">(</span><span class="w">PAD</span> *<span class="w">opad</span><span class="cm">,</span> <span class="w">PAD</span> *<span class="w">npad</span><span class="s">)</span></pre>
241
<li><a name="PAD_SAVE_SETNULLPAD-PAD_SAVE_SETNULLPAD"></a><b>PAD_SAVE_SETNULLPAD
244
<li><a name="PAD_SAVE_SETNULLPAD"></a><b>PAD_SAVE_SETNULLPAD
243
246
<p>Save the current pad then set it to null.</p>
244
<pre class="verbatim"> void <span class="i">PAD_SAVE_SETNULLPAD</span><span class="s">(</span><span class="s">)</span></pre>
247
<pre class="verbatim"> <span class="w">void</span> <span class="i">PAD_SAVE_SETNULLPAD</span><span class="s">(</span><span class="s">)</span></pre>
246
<li><a name="PAD_SETSV-PAD_SETSV"></a><b>PAD_SETSV
249
<li><a name="PAD_SETSV"></a><b>PAD_SETSV
248
<p>Set the slot at offset <code class="inline">po</code>
249
in the current pad to <code class="inline">sv</code>
251
<p>Set the slot at offset <code class="inline"><span class="w">po</span></code>
252
in the current pad to <code class="inline"><span class="w">sv</span></code>
251
<pre class="verbatim"> SV * <span class="i">PAD_SETSV</span><span class="s">(</span>PADOFFSET po<span class="cm">,</span> SV* sv<span class="s">)</span></pre>
254
<pre class="verbatim"> <span class="w">SV</span> * <span class="i">PAD_SETSV</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></pre>
253
<li><a name="PAD_SET_CUR-PAD_SET_CUR"></a><b>PAD_SET_CUR
256
<li><a name="PAD_SET_CUR"></a><b>PAD_SET_CUR
255
<p>Set the current pad to be pad <code class="inline">n</code>
258
<p>Set the current pad to be pad <code class="inline"><span class="w">n</span></code>
256
259
in the padlist, saving
257
260
the previous current pad. NB currently this macro expands to a string too
258
261
long for some compilers, so it's best to replace it with</p>
259
262
<pre class="verbatim"> <span class="i">SAVECOMPPAD</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span>
260
<span class="i">PAD_SET_CUR_NOSAVE</span><span class="s">(</span>padlist<span class="cm">,</span>n<span class="s">)</span><span class="sc">;</span></pre>
261
<pre class="verbatim"> void <span class="i">PAD_SET_CUR</span><span class="s">(</span>PADLIST padlist<span class="cm">,</span> I32 n<span class="s">)</span></pre>
263
<span class="i">PAD_SET_CUR_NOSAVE</span><span class="s">(</span><span class="w">padlist</span><span class="cm">,</span><span class="w">n</span><span class="s">)</span><span class="sc">;</span></pre>
264
<pre class="verbatim"> <span class="w">void</span> <span class="i">PAD_SET_CUR</span><span class="s">(</span><span class="w">PADLIST</span> <span class="w">padlist</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">n</span><span class="s">)</span></pre>
263
<li><a name="PAD_SET_CUR_NOSAVE-PAD_SET_CUR_NOSAVE"></a><b>PAD_SET_CUR_NOSAVE
266
<li><a name="PAD_SET_CUR_NOSAVE"></a><b>PAD_SET_CUR_NOSAVE
265
268
<p>like PAD_SET_CUR, but without the save</p>
266
<pre class="verbatim"> void <span class="i">PAD_SET_CUR_NOSAVE</span><span class="s">(</span>PADLIST padlist<span class="cm">,</span> I32 n<span class="s">)</span></pre>
269
<pre class="verbatim"> <span class="w">void</span> <span class="i">PAD_SET_CUR_NOSAVE</span><span class="s">(</span><span class="w">PADLIST</span> <span class="w">padlist</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">n</span><span class="s">)</span></pre>
268
<li><a name="PAD_SV-PAD_SV"></a><b>PAD_SV
271
<li><a name="PAD_SV"></a><b>PAD_SV
270
<p>Get the value at offset <code class="inline">po</code>
273
<p>Get the value at offset <code class="inline"><span class="w">po</span></code>
271
274
in the current pad</p>
272
<pre class="verbatim"> void <span class="i">PAD_SV</span><span class="s">(</span>PADOFFSET po<span class="s">)</span></pre>
275
<pre class="verbatim"> <span class="w">void</span> <span class="i">PAD_SV</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></pre>
274
<li><a name="PAD_SVl-PAD_SVl"></a><b>PAD_SVl
277
<li><a name="PAD_SVl"></a><b>PAD_SVl
276
<p>Lightweight and lvalue version of <code class="inline">PAD_SV</code>
279
<p>Lightweight and lvalue version of <code class="inline"><span class="w">PAD_SV</span></code>
278
Get or set the value at offset <code class="inline">po</code>
281
Get or set the value at offset <code class="inline"><span class="w">po</span></code>
279
282
in the current pad.
280
Unlike <code class="inline">PAD_SV</code>
283
Unlike <code class="inline"><span class="w">PAD_SV</span></code>
281
284
, does not print diagnostics with -DX.
282
285
For internal use only.</p>
283
<pre class="verbatim"> SV * <span class="i">PAD_SVl</span><span class="s">(</span>PADOFFSET po<span class="s">)</span></pre>
286
<pre class="verbatim"> <span class="w">SV</span> * <span class="i">PAD_SVl</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></pre>
285
<li><a name="SAVECLEARSV-SAVECLEARSV"></a><b>SAVECLEARSV
288
<li><a name="SAVECLEARSV"></a><b>SAVECLEARSV
287
290
<p>Clear the pointed to pad value on scope exit. (i.e. the runtime action of 'my')</p>
288
<pre class="verbatim"> void <span class="i">SAVECLEARSV</span><span class="s">(</span>SV **svp<span class="s">)</span></pre>
291
<pre class="verbatim"> <span class="w">void</span> <span class="i">SAVECLEARSV</span><span class="s">(</span><span class="w">SV</span> **<span class="w">svp</span><span class="s">)</span></pre>
290
<li><a name="SAVECOMPPAD-SAVECOMPPAD"></a><b>SAVECOMPPAD
293
<li><a name="SAVECOMPPAD"></a><b>SAVECOMPPAD
292
295
<p>save PL_comppad and PL_curpad</p>
293
<pre class="verbatim"> void <span class="i">SAVECOMPPAD</span><span class="s">(</span><span class="s">)</span></pre>
296
<pre class="verbatim"> <span class="w">void</span> <span class="i">SAVECOMPPAD</span><span class="s">(</span><span class="s">)</span></pre>
295
<li><a name="SAVEPADSV-SAVEPADSV"></a><b>SAVEPADSV
298
<li><a name="SAVEPADSV"></a><b>SAVEPADSV
297
300
<p>Save a pad slot (used to restore after an iteration)</p>
298
301
<p>XXX DAPM it would make more sense to make the arg a PADOFFSET
299
302
void SAVEPADSV(PADOFFSET po)</p>
302
<a name="Functions-in-file-pp_ctl.c"></a><h1>Functions in file pp_ctl.c</h1>
304
<li><a name="find_runcv-find_runcv"></a><b>find_runcv
306
<p>Locate the CV corresponding to the currently executing sub or eval.
307
If db_seqp is non_null, skip CVs that are in the DB package and populate
308
*db_seqp with the cop sequence number at the point that the DB:: code was
309
entered. (allows debuggers to eval in the scope of the breakpoint rather
310
than in the scope of the debugger itself).</p>
311
<pre class="verbatim"> CV* <span class="i">find_runcv</span><span class="s">(</span>U32 *db_seqp<span class="s">)</span></pre>
314
<a name="Global-Variables"></a><h1>Global Variables</h1>
316
<li><a name="PL_DBsingle-PL_DBsingle"></a><b>PL_DBsingle
318
<p>When Perl is run in debugging mode, with the <b>-d</b> switch, this SV is a
319
boolean which indicates whether subs are being single-stepped.
320
Single-stepping is automatically turned on after every step. This is the C
321
variable which corresponds to Perl's $DB::single variable. See
322
<code class="inline">PL_DBsub</code>
324
<pre class="verbatim"> SV * PL_DBsingle</pre>
326
<li><a name="PL_DBsub-PL_DBsub"></a><b>PL_DBsub
328
<p>When Perl is run in debugging mode, with the <b>-d</b> switch, this GV contains
329
the SV which holds the name of the sub being debugged. This is the C
330
variable which corresponds to Perl's $DB::sub variable. See
331
<code class="inline">PL_DBsingle</code>
333
<pre class="verbatim"> GV * PL_DBsub</pre>
335
<li><a name="PL_DBtrace-PL_DBtrace"></a><b>PL_DBtrace
337
<p>Trace variable used when Perl is run in debugging mode, with the <b>-d</b>
338
switch. This is the C variable which corresponds to Perl's $DB::trace
339
variable. See <code class="inline">PL_DBsingle</code>
341
<pre class="verbatim"> SV * PL_DBtrace</pre>
343
<li><a name="PL_dowarn-PL_dowarn"></a><b>PL_dowarn
345
<p>The C variable which corresponds to Perl's $^W warning variable.</p>
346
<pre class="verbatim"> bool PL_dowarn</pre>
348
<li><a name="PL_last_in_gv-PL_last_in_gv"></a><b>PL_last_in_gv
350
<p>The GV which was last used for a filehandle input operation. (<code class="inline"><span class="q"><FH></span></code>
352
<pre class="verbatim"> GV* PL_last_in_gv</pre>
354
<li><a name="PL_ofs_sv-PL_ofs_sv"></a><b>PL_ofs_sv
356
<p>The output field separator - <code class="inline"><span class="i">$,</span></code>
358
<pre class="verbatim"> SV* PL_ofs_sv</pre>
360
<li><a name="PL_rs-PL_rs"></a><b>PL_rs
362
<p>The input record separator - <code class="inline"><span class="i">$/</span></code>
364
<pre class="verbatim"> SV* PL_rs</pre>
367
305
<a name="GV-Functions"></a><h1>GV Functions</h1>
369
<li><a name="is_gv_magical-is_gv_magical"></a><b>is_gv_magical
307
<li><a name="is_gv_magical"></a><b>is_gv_magical
371
<p>Returns <code class="inline">TRUE</code>
309
<p>Returns <code class="inline"><span class="w">TRUE</span></code>
372
310
if given the name of a magical GV.</p>
373
311
<p>Currently only useful internally when determining if a GV should be
374
312
created even in rvalue contexts.</p>
375
<p><code class="inline">flags</code>
313
<p><code class="inline"><span class="w">flags</span></code>
376
314
is not used at present but available for future extension to
377
315
allow selecting particular classes of magical variable.</p>
378
<p>Currently assumes that <code class="inline">name</code>
316
<p>Currently assumes that <code class="inline"><span class="w">name</span></code>
379
317
is NUL terminated (as well as len being valid).
380
318
This assumption is met by all callers within the perl core, which all pass
381
319
pointers returned by SvPV.</p>
382
<pre class="verbatim"> bool <span class="i">is_gv_magical</span><span class="s">(</span>char *name<span class="cm">,</span> STRLEN len<span class="cm">,</span> U32 flags<span class="s">)</span></pre>
320
<pre class="verbatim"> <span class="w">bool</span> <span class="i">is_gv_magical</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">STRLEN</span> <span class="w">len</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></pre>
322
<li><a name="is_gv_magical_sv"></a><b>is_gv_magical_sv
324
<p>Returns <code class="inline"><span class="w">TRUE</span></code>
325
if given the name of a magical GV. Calls is_gv_magical.</p>
326
<pre class="verbatim"> <span class="w">bool</span> <span class="i">is_gv_magical_sv</span><span class="s">(</span><span class="w">SV</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></pre>
329
<a name="Hash-Manipulation-Functions"></a><h1>Hash Manipulation Functions</h1>
331
<li><a name="refcounted_he_chain_2hv"></a><b>refcounted_he_chain_2hv
333
<p>Generates and returns a <code class="inline"><span class="w">HV</span> *</code>
334
by walking up the tree starting at the passed
335
in <code class="inline"><span class="w">struct</span> <span class="w">refcounted_he</span> *</code>
337
<pre class="verbatim"> <span class="w">HV</span> * <span class="i">refcounted_he_chain_2hv</span><span class="s">(</span><span class="w">const</span> <span class="w">struct</span> <span class="w">refcounted_he</span> *<span class="w">c</span><span class="s">)</span></pre>
339
<li><a name="refcounted_he_free"></a><b>refcounted_he_free
341
<p>Decrements the reference count of the passed in <code class="inline"><span class="w">struct</span> <span class="w">refcounted_he</span> *</code>
343
by one. If the reference count reaches zero the structure's memory is freed,
344
and <code class="inline"><span class="w">refcounted_he_free</span></code>
345
iterates onto the parent node.</p>
346
<pre class="verbatim"> <span class="w">void</span> <span class="i">refcounted_he_free</span><span class="s">(</span><span class="w">struct</span> <span class="w">refcounted_he</span> *<span class="w">he</span><span class="s">)</span></pre>
348
<li><a name="refcounted_he_new"></a><b>refcounted_he_new
350
<p>Creates a new <code class="inline"><span class="w">struct</span> <span class="w">refcounted_he</span></code>
351
. As key is copied, and value is
352
stored in a compact form, all references remain the property of the caller.
353
The <code class="inline"><span class="w">struct</span> <span class="w">refcounted_he</span></code>
354
is returned with a reference count of 1.</p>
355
<pre class="verbatim"> <span class="w">struct</span> <span class="w">refcounted_he</span> * <span class="i">refcounted_he_new</span><span class="s">(</span><span class="w">struct</span> <span class="w">refcounted_he</span> *<span class="w">const</span> <span class="w">parent</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">key</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">const</span> <span class="w">value</span><span class="s">)</span></pre>
385
358
<a name="IO-Functions"></a><h1>IO Functions</h1>
387
<li><a name="start_glob-start_glob"></a><b>start_glob
360
<li><a name="start_glob"></a><b>start_glob
389
<p>Function called by <code class="inline">do_readline</code>
362
<p>Function called by <code class="inline"><span class="w">do_readline</span></code>
390
363
to spawn a glob (or do the glob inside
391
perl on VMS). This code used to be inline, but now perl uses <code class="inline"><a class="l_w" href="File/Glob.html">File::Glob</a></code>
364
perl on VMS). This code used to be inline, but now perl uses <code class="inline"><span class="w">File::Glob</span></code>
392
366
this glob starter is only used by miniperl during the build process.
393
367
Moving it away shrinks pp_hot.c; shrinking pp_hot.c helps speed perl up.</p>
394
<pre class="verbatim"> <a class="l_w" href="PerlIO.html">PerlIO</a>* <span class="i">start_glob</span><span class="s">(</span>SV* pattern<span class="cm">,</span> <a class="l_w" href="IO.html">IO</a> *io<span class="s">)</span></pre>
368
<pre class="verbatim"> <span class="w">PerlIO</span>* <span class="i">start_glob</span><span class="s">(</span><span class="w">SV</span>* <span class="w">pattern</span><span class="cm">,</span> <span class="w">IO</span> *<span class="w">io</span><span class="s">)</span></pre>
371
<a name="Magical-Functions"></a><h1>Magical Functions</h1>
373
<li><a name="magic_sethint"></a><b>magic_sethint
375
<p>Triggered by a delete from %^H, records the key to
376
<code class="inline"><span class="w">PL_compiling</span>.<span class="w">cop_hints_hash</span></code>
378
<pre class="verbatim"> <a class="l_k" href="functions/int.html">int</a> <span class="i">magic_sethint</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">MAGIC</span>* <span class="w">mg</span><span class="s">)</span></pre>
380
<li><a name="mg_localize"></a><b>mg_localize
382
<p>Copy some of the magic from an existing SV to new localized version of
383
that SV. Container magic (eg %ENV, $1, tie) gets copied, value magic
384
doesn't (eg taint, pos).</p>
385
<pre class="verbatim"> <span class="w">void</span> <span class="i">mg_localize</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">nsv</span><span class="s">)</span></pre>
388
<a name="MRO-Functions"></a><h1>MRO Functions</h1>
390
<li><a name="mro_get_linear_isa_c3"></a><b>mro_get_linear_isa_c3
392
<p>Returns the C3 linearization of @ISA
393
the given stash. The return value is a read-only AV*.
394
<code class="inline"><span class="w">level</span></code>
395
should be 0 (it is used internally in this
396
function's recursion).</p>
397
<p>You are responsible for <code class="inline"><span class="i">SvREFCNT_inc</span><span class="s">(</span><span class="s">)</span></code>
399
return value if you plan to store it anywhere
400
semi-permanently (otherwise it might be deleted
401
out from under you the next time the cache is
403
<pre class="verbatim"> <span class="w">AV</span>* <span class="i">mro_get_linear_isa_c3</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">level</span><span class="s">)</span></pre>
405
<li><a name="mro_get_linear_isa_dfs"></a><b>mro_get_linear_isa_dfs
407
<p>Returns the Depth-First Search linearization of @ISA
408
the given stash. The return value is a read-only AV*.
409
<code class="inline"><span class="w">level</span></code>
410
should be 0 (it is used internally in this
411
function's recursion).</p>
412
<p>You are responsible for <code class="inline"><span class="i">SvREFCNT_inc</span><span class="s">(</span><span class="s">)</span></code>
414
return value if you plan to store it anywhere
415
semi-permanently (otherwise it might be deleted
416
out from under you the next time the cache is
418
<pre class="verbatim"> <span class="w">AV</span>* <span class="i">mro_get_linear_isa_dfs</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="cm">,</span> <span class="w">I32</span> <span class="w">level</span><span class="s">)</span></pre>
420
<li><a name="mro_isa_changed_in"></a><b>mro_isa_changed_in
422
<p>Takes the necessary steps (cache invalidations, mostly)
423
when the @ISA of the given package has changed. Invoked
424
by the <code class="inline"><span class="w">setisa</span></code>
425
magic, should not need to invoke directly.</p>
426
<pre class="verbatim"> <span class="w">void</span> <span class="i">mro_isa_changed_in</span><span class="s">(</span><span class="w">HV</span>* <span class="w">stash</span><span class="s">)</span></pre>
397
429
<a name="Pad-Data-Structures"></a><h1>Pad Data Structures</h1>
399
<li><a name="CvPADLIST-CvPADLIST"></a><b>CvPADLIST
431
<li><a name="CvPADLIST"></a><b>CvPADLIST
401
433
<p>CV's can have CvPADLIST(cv) set to point to an AV.</p>
402
434
<p>For these purposes "forms" are a kind-of CV, eval""s are too (except they're
403
435
not callable at will and are always thrown away after the eval"" is done
436
executing). Require'd files are simply evals without any outer lexical
405
438
<p>XSUBs don't have CvPADLIST set - dXSTARG fetches values from PL_curpad,
406
439
but that is really the callers pad (a slot of which is allocated by
407
440
every entersub).</p>
436
469
but only by their index allocated at compile time (which is usually
437
470
in PL_op->op_targ), wasting a name SV for them doesn't make sense.</p>
438
471
<p>The SVs in the names AV have their PV being the name of the variable.
439
NV+1..IV inclusive is a range of cop_seq numbers for which the name is
440
valid. For typed lexicals name SV is SVt_PVMG and SvSTASH points at the
441
type. For <code class="inline"><a class="l_k" href="functions/our.html">our</a></code> lexicals, the type is SVt_PVGV, and GvSTASH points at the
442
stash of the associated global (so that duplicate <code class="inline"><a class="l_k" href="functions/our.html">our</a></code> declarations in the
443
same package can be detected). SvCUR is sometimes hijacked to
444
store the generation number during compilation.</p>
445
<p>If SvFAKE is set on the name SV then slot in the frame AVs are
446
a REFCNT'ed references to a lexical from "outside". In this case,
447
the name SV does not have a cop_seq range, since it is in scope
472
xlow+1..xhigh inclusive in the NV union is a range of cop_seq numbers for
473
which the name is valid. For typed lexicals name SV is SVt_PVMG and SvSTASH
474
points at the type. For <code class="inline"><a class="l_k" href="functions/our.html">our</a></code> lexicals, the type is also SVt_PVMG, with the
475
SvOURSTASH slot pointing at the stash of the associated global (so that
476
duplicate <code class="inline"><a class="l_k" href="functions/our.html">our</a></code> declarations in the same package can be detected). SvUVX is
477
sometimes hijacked to store the generation number during compilation.</p>
478
<p>If SvFAKE is set on the name SV, then that slot in the frame AV is
479
a REFCNT'ed reference to a lexical from "outside". In this case,
480
the name SV does not use xlow and xhigh to store a cop_seq range, since it is
481
in scope throughout. Instead xhigh stores some flags containing info about
482
the real lexical (is it declared in an anon, and is it capable of being
483
instantiated multiple times?), and for fake ANONs, xlow contains the index
484
within the parent's pad where the lexical's value is stored, to make
449
486
<p>If the 'name' is '&' the corresponding entry in frame AV
450
487
is a CV representing a possible closure.
451
488
(SvFAKE and name of '&' is not a meaningful combination currently but could
452
489
become so if <code class="inline"><a name="foo"></a><a class="l_k" href="functions/my.html">my</a> sub <span class="m">foo</span> <span class="s">{</span><span class="s">}</span></code>
453
490
is implemented.)</p>
491
<p>Note that formats are treated as anon subs, and are cloned each time
492
write is called (if necessary).</p>
454
493
<p>The flag SVf_PADSTALE is cleared on lexicals each time the my() is executed,
455
494
and set on scope exit. This allows the 'Variable $x is not available' warning
456
to be generated in evals, such as </p>
495
to be generated in evals, such as</p>
457
496
<pre class="verbatim"><a name="f"></a> <span class="s">{</span> <a class="l_k" href="functions/my.html">my</a> <span class="i">$x</span> = <span class="n">1</span><span class="sc">;</span> sub <span class="m">f</span> <span class="s">{</span> <a class="l_k" href="functions/eval.html">eval</a> <span class="q">'$x'</span><span class="s">}</span> <span class="s">}</span> <span class="i">f</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></pre>
458
<pre class="verbatim"> AV * <span class="i">CvPADLIST</span><span class="s">(</span>CV *cv<span class="s">)</span></pre>
497
<pre class="verbatim"> <span class="w">AV</span> * <span class="i">CvPADLIST</span><span class="s">(</span><span class="w">CV</span> *<span class="w">cv</span><span class="s">)</span></pre>
460
<li><a name="cv_clone-cv_clone"></a><b>cv_clone
499
<li><a name="cv_clone"></a><b>cv_clone
462
501
<p>Clone a CV: make a new CV which points to the same code etc, but which
463
502
has a newly-created pad built by copying the prototype pad and capturing
464
503
any outer lexicals.</p>
465
<pre class="verbatim"> CV* <span class="i">cv_clone</span><span class="s">(</span>CV* proto<span class="s">)</span></pre>
504
<pre class="verbatim"> <span class="w">CV</span>* <span class="i">cv_clone</span><span class="s">(</span><span class="w">CV</span>* <span class="w">proto</span><span class="s">)</span></pre>
467
<li><a name="cv_dump-cv_dump"></a><b>cv_dump
506
<li><a name="cv_dump"></a><b>cv_dump
469
508
<p>dump the contents of a CV</p>
470
<pre class="verbatim"> void <span class="i">cv_dump</span><span class="s">(</span>const CV *cv<span class="cm">,</span> const char *title<span class="s">)</span></pre>
509
<pre class="verbatim"> <span class="w">void</span> <span class="i">cv_dump</span><span class="s">(</span><span class="w">const</span> <span class="w">CV</span> *<span class="w">cv</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">title</span><span class="s">)</span></pre>
472
<li><a name="do_dump_pad-do_dump_pad"></a><b>do_dump_pad
511
<li><a name="do_dump_pad"></a><b>do_dump_pad
474
513
<p>Dump the contents of a padlist</p>
475
<pre class="verbatim"> void <span class="i">do_dump_pad</span><span class="s">(</span>I32 level<span class="cm">,</span> <a class="l_w" href="PerlIO.html">PerlIO</a> *file<span class="cm">,</span> PADLIST *padlist<span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> full<span class="s">)</span></pre>
514
<pre class="verbatim"> <span class="w">void</span> <span class="i">do_dump_pad</span><span class="s">(</span><span class="w">I32</span> <span class="w">level</span><span class="cm">,</span> <span class="w">PerlIO</span> *<span class="w">file</span><span class="cm">,</span> <span class="w">PADLIST</span> *<span class="w">padlist</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">full</span><span class="s">)</span></pre>
477
<li><a name="intro_my-intro_my"></a><b>intro_my
516
<li><a name="intro_my"></a><b>intro_my
479
518
<p>"Introduce" my variables to visible status.</p>
480
<pre class="verbatim"> U32 <span class="i">intro_my</span><span class="s">(</span><span class="s">)</span></pre>
519
<pre class="verbatim"> <span class="w">U32</span> <span class="i">intro_my</span><span class="s">(</span><span class="s">)</span></pre>
482
<li><a name="pad_add_anon-pad_add_anon"></a><b>pad_add_anon
521
<li><a name="pad_add_anon"></a><b>pad_add_anon
484
523
<p>Add an anon code entry to the current compiling pad</p>
485
<pre class="verbatim"> PADOFFSET <span class="i">pad_add_anon</span><span class="s">(</span>SV* sv<span class="cm">,</span> OPCODE op_type<span class="s">)</span></pre>
524
<pre class="verbatim"> <span class="w">PADOFFSET</span> <span class="i">pad_add_anon</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="cm">,</span> <span class="w">OPCODE</span> <span class="w">op_type</span><span class="s">)</span></pre>
487
<li><a name="pad_add_name-pad_add_name"></a><b>pad_add_name
526
<li><a name="pad_add_name"></a><b>pad_add_name
489
<p>Create a new name in the current pad at the specified offset.
490
If <code class="inline">typestash</code>
528
<p>Create a new name and associated PADMY SV in the current pad; return the
530
If <code class="inline"><span class="w">typestash</span></code>
491
531
is valid, the name is for a typed lexical; set the
492
532
name's stash to that value.
493
If <code class="inline">ourstash</code>
533
If <code class="inline"><span class="w">ourstash</span></code>
494
534
is valid, it's an our lexical, set the name's
495
GvSTASH to that value</p>
496
<p>Also, if the name is @.. or %.., create a new array or hash for that slot</p>
535
SvOURSTASH to that value</p>
497
536
<p>If fake, it means we're cloning an existing entry</p>
498
<pre class="verbatim"> PADOFFSET <span class="i">pad_add_name</span><span class="s">(</span>char *name<span class="cm">,</span> HV* typestash<span class="cm">,</span> HV* ourstash<span class="cm">,</span> bool clone<span class="s">)</span></pre>
537
<pre class="verbatim"> <span class="w">PADOFFSET</span> <span class="i">pad_add_name</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">HV</span>* <span class="w">typestash</span><span class="cm">,</span> <span class="w">HV</span>* <span class="w">ourstash</span><span class="cm">,</span> <span class="w">bool</span> <span class="w">clone</span><span class="cm">,</span> <span class="w">bool</span> <span class="w">state</span><span class="s">)</span></pre>
500
<li><a name="pad_alloc-pad_alloc"></a><b>pad_alloc
539
<li><a name="pad_alloc"></a><b>pad_alloc
502
541
<p>Allocate a new my or tmp pad entry. For a my, simply push a null SV onto
503
542
the end of PL_comppad, but for a tmp, scan the pad from PL_padix upwards
504
543
for a slot which has no name and no active value.</p>
505
<pre class="verbatim"> PADOFFSET <span class="i">pad_alloc</span><span class="s">(</span>I32 optype<span class="cm">,</span> U32 tmptype<span class="s">)</span></pre>
544
<pre class="verbatim"> <span class="w">PADOFFSET</span> <span class="i">pad_alloc</span><span class="s">(</span><span class="w">I32</span> <span class="w">optype</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">tmptype</span><span class="s">)</span></pre>
507
<li><a name="pad_block_start-pad_block_start"></a><b>pad_block_start
546
<li><a name="pad_block_start"></a><b>pad_block_start
509
548
<p>Update the pad compilation state variables on entry to a new block</p>
510
<pre class="verbatim"> void <span class="i">pad_block_start</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> full<span class="s">)</span></pre>
549
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_block_start</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <span class="w">full</span><span class="s">)</span></pre>
512
<li><a name="pad_check_dup-pad_check_dup"></a><b>pad_check_dup
551
<li><a name="pad_check_dup"></a><b>pad_check_dup
514
553
<p>Check for duplicate declarations: report any of:
515
554
* a my in the current scope with the same name;
516
555
* an our (anywhere in the pad) with the same name and the same stash
517
as <code class="inline">ourstash</code>
556
as <code class="inline"><span class="w">ourstash</span></code>
519
<code class="inline">is_our</code>
558
<code class="inline"><span class="w">is_our</span></code>
520
559
indicates that the name to check is an 'our' declaration</p>
521
<pre class="verbatim"> void <span class="i">pad_check_dup</span><span class="s">(</span>char* name<span class="cm">,</span> bool is_our<span class="cm">,</span> HV* ourstash<span class="s">)</span></pre>
560
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_check_dup</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="cm">,</span> <span class="w">bool</span> <span class="w">is_our</span><span class="cm">,</span> <span class="w">const</span> <span class="w">HV</span>* <span class="w">ourstash</span><span class="s">)</span></pre>
523
<li><a name="pad_findlex-pad_findlex"></a><b>pad_findlex
562
<li><a name="pad_findlex"></a><b>pad_findlex
525
564
<p>Find a named lexical anywhere in a chain of nested pads. Add fake entries
526
in the inner pads if it's found in an outer one. innercv is the CV *inside*
527
the chain of outer CVs to be searched. If newoff is non-null, this is a
528
run-time cloning: don't add fake entries, just find the lexical and add a
529
ref to it at newoff in the current pad.</p>
530
<pre class="verbatim"> PADOFFSET <span class="i">pad_findlex</span><span class="s">(</span>const char* name<span class="cm">,</span> PADOFFSET newoff<span class="cm">,</span> const CV* innercv<span class="s">)</span></pre>
565
in the inner pads if it's found in an outer one.</p>
566
<p>Returns the offset in the bottom pad of the lex or the fake lex.
567
cv is the CV in which to start the search, and seq is the current cop_seq
568
to match against. If warn is true, print appropriate warnings. The out_*
569
vars return values, and so are pointers to where the returned values
570
should be stored. out_capture, if non-null, requests that the innermost
571
instance of the lexical is captured; out_name_sv is set to the innermost
572
matched namesv or fake namesv; out_flags returns the flags normally
573
associated with the IVX field of a fake namesv.</p>
574
<p>Note that pad_findlex() is recursive; it recurses up the chain of CVs,
575
then comes back down, adding fake entries as it goes. It has to be this way
576
because fake namesvs in anon protoypes have to store in xlow the index into
578
<pre class="verbatim"> <span class="w">PADOFFSET</span> <span class="i">pad_findlex</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">name</span><span class="cm">,</span> <span class="w">const</span> <span class="w">CV</span>* <span class="w">cv</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">seq</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <a class="l_k" href="functions/warn.html">warn</a><span class="cm">,</span> <span class="w">SV</span>** <span class="w">out_capture</span><span class="cm">,</span> <span class="w">SV</span>** <span class="w">out_name_sv</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="i">*out_flags</span><span class="s">)</span></pre>
532
<li><a name="pad_findmy-pad_findmy"></a><b>pad_findmy
580
<li><a name="pad_findmy"></a><b>pad_findmy
534
582
<p>Given a lexical name, try to find its offset, first in the current pad,
535
583
or failing that, in the pads of any lexically enclosing subs (including
536
584
the complications introduced by eval). If the name is found in an outer pad,
537
585
then a fake entry is added to the current pad.
538
586
Returns the offset in the current pad, or NOT_IN_PAD on failure.</p>
539
<pre class="verbatim"> PADOFFSET <span class="i">pad_findmy</span><span class="s">(</span>char* name<span class="s">)</span></pre>
587
<pre class="verbatim"> <span class="w">PADOFFSET</span> <span class="i">pad_findmy</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span>* <span class="w">name</span><span class="s">)</span></pre>
541
<li><a name="pad_fixup_inner_anons-pad_fixup_inner_anons"></a><b>pad_fixup_inner_anons
589
<li><a name="pad_fixup_inner_anons"></a><b>pad_fixup_inner_anons
543
591
<p>For any anon CVs in the pad, change CvOUTSIDE of that CV from
544
592
old_cv to new_cv if necessary. Needed when a newly-compiled CV has to be
545
593
moved to a pre-existing CV struct.</p>
546
<pre class="verbatim"> void <span class="i">pad_fixup_inner_anons</span><span class="s">(</span>PADLIST *padlist<span class="cm">,</span> CV *old_cv<span class="cm">,</span> CV *new_cv<span class="s">)</span></pre>
594
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_fixup_inner_anons</span><span class="s">(</span><span class="w">PADLIST</span> *<span class="w">padlist</span><span class="cm">,</span> <span class="w">CV</span> *<span class="w">old_cv</span><span class="cm">,</span> <span class="w">CV</span> *<span class="w">new_cv</span><span class="s">)</span></pre>
548
<li><a name="pad_free-pad_free"></a><b>pad_free
596
<li><a name="pad_free"></a><b>pad_free
550
598
<p>Free the SV at offset po in the current pad.</p>
551
<pre class="verbatim"> void <span class="i">pad_free</span><span class="s">(</span>PADOFFSET po<span class="s">)</span></pre>
599
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_free</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="s">)</span></pre>
553
<li><a name="pad_leavemy-pad_leavemy"></a><b>pad_leavemy
601
<li><a name="pad_leavemy"></a><b>pad_leavemy
555
603
<p>Cleanup at end of scope during compilation: set the max seq number for
556
604
lexicals in this scope and warn of any lexicals that never got introduced.</p>
557
<pre class="verbatim"> void <span class="i">pad_leavemy</span><span class="s">(</span><span class="s">)</span></pre>
605
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_leavemy</span><span class="s">(</span><span class="s">)</span></pre>
559
<li><a name="pad_new-pad_new"></a><b>pad_new
607
<li><a name="pad_new"></a><b>pad_new
561
609
<p>Create a new compiling padlist, saving and updating the various global
562
610
vars at the same time as creating the pad itself. The following flags
563
611
can be OR'ed together:</p>
564
<pre class="verbatim"> padnew_CLONE this pad is for a cloned CV
565
padnew_SAVE save old globals
566
padnew_SAVESUB also save extra stuff for start of <a class="l_k" href="functions/sub.html">sub</a></pre>
567
<pre class="verbatim"> PADLIST* <span class="i">pad_new</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> flags<span class="s">)</span></pre>
612
<pre class="verbatim"> <span class="w">padnew_CLONE</span> <span class="w">this</span> <span class="w">pad</span> <span class="w">is</span> for <span class="w">a</span> <span class="w">cloned</span> <span class="w">CV</span>
613
<span class="w">padnew_SAVE</span> <span class="w">save</span> <span class="w">old</span> <span class="w">globals</span>
614
<span class="w">padnew_SAVESUB</span> <span class="w">also</span> <span class="w">save</span> <span class="w">extra</span> <span class="w">stuff</span> for <span class="w">start</span> <span class="w">of</span> <a class="l_k" href="functions/sub.html">sub</a></pre>
615
<pre class="verbatim"> <span class="w">PADLIST</span>* <span class="i">pad_new</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <span class="w">flags</span><span class="s">)</span></pre>
569
<li><a name="pad_push-pad_push"></a><b>pad_push
617
<li><a name="pad_push"></a><b>pad_push
571
619
<p>Push a new pad frame onto the padlist, unless there's already a pad at
572
this depth, in which case don't bother creating a new one.
573
If has_args is true, give the new pad an @_ in slot zero.</p>
574
<pre class="verbatim"> void <span class="i">pad_push</span><span class="s">(</span>PADLIST *padlist<span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> depth<span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> has_args<span class="s">)</span></pre>
620
this depth, in which case don't bother creating a new one. Then give
621
the new pad an @_ in slot zero.</p>
622
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_push</span><span class="s">(</span><span class="w">PADLIST</span> *<span class="w">padlist</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">depth</span><span class="s">)</span></pre>
576
<li><a name="pad_reset-pad_reset"></a><b>pad_reset
624
<li><a name="pad_reset"></a><b>pad_reset
578
626
<p>Mark all the current temporaries for reuse</p>
579
<pre class="verbatim"> void <span class="i">pad_reset</span><span class="s">(</span><span class="s">)</span></pre>
627
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_reset</span><span class="s">(</span><span class="s">)</span></pre>
581
<li><a name="pad_setsv-pad_setsv"></a><b>pad_setsv
629
<li><a name="pad_setsv"></a><b>pad_setsv
583
631
<p>Set the entry at offset po in the current pad to sv.
584
632
Use the macro PAD_SETSV() rather than calling this function directly.</p>
585
<pre class="verbatim"> void <span class="i">pad_setsv</span><span class="s">(</span>PADOFFSET po<span class="cm">,</span> SV* sv<span class="s">)</span></pre>
633
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_setsv</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></pre>
587
<li><a name="pad_swipe-pad_swipe"></a><b>pad_swipe
635
<li><a name="pad_swipe"></a><b>pad_swipe
589
637
<p>Abandon the tmp in the current pad at offset po and replace with a
591
<pre class="verbatim"> void <span class="i">pad_swipe</span><span class="s">(</span>PADOFFSET po<span class="cm">,</span> bool refadjust<span class="s">)</span></pre>
639
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_swipe</span><span class="s">(</span><span class="w">PADOFFSET</span> <span class="w">po</span><span class="cm">,</span> <span class="w">bool</span> <span class="w">refadjust</span><span class="s">)</span></pre>
593
<li><a name="pad_tidy-pad_tidy"></a><b>pad_tidy
641
<li><a name="pad_tidy"></a><b>pad_tidy
595
643
<p>Tidy up a pad after we've finished compiling it:
596
644
* remove most stuff from the pads of anonsub prototypes;
598
646
* mark tmps as such.</p>
599
<pre class="verbatim"> void <span class="i">pad_tidy</span><span class="s">(</span>padtidy_type type<span class="s">)</span></pre>
647
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_tidy</span><span class="s">(</span><span class="w">padtidy_type</span> <span class="w">type</span><span class="s">)</span></pre>
601
<li><a name="pad_undef-pad_undef"></a><b>pad_undef
649
<li><a name="pad_undef"></a><b>pad_undef
603
651
<p>Free the padlist associated with a CV.
604
652
If parts of it happen to be current, we null the relevant
607
655
inner subs to the outer of this cv.</p>
608
656
<p>(This function should really be called pad_free, but the name was already
610
<pre class="verbatim"> void <span class="i">pad_undef</span><span class="s">(</span>CV* cv<span class="s">)</span></pre>
658
<pre class="verbatim"> <span class="w">void</span> <span class="i">pad_undef</span><span class="s">(</span><span class="w">CV</span>* <span class="w">cv</span><span class="s">)</span></pre>
661
<a name="Per-Interpreter-Variables"></a><h1>Per-Interpreter Variables</h1>
663
<li><a name="PL_DBsingle"></a><b>PL_DBsingle
665
<p>When Perl is run in debugging mode, with the <b>-d</b> switch, this SV is a
666
boolean which indicates whether subs are being single-stepped.
667
Single-stepping is automatically turned on after every step. This is the C
668
variable which corresponds to Perl's $DB::single variable. See
669
<code class="inline"><span class="w">PL_DBsub</span></code>
671
<pre class="verbatim"> <span class="w">SV</span> * <span class="w">PL_DBsingle</span></pre>
673
<li><a name="PL_DBsub"></a><b>PL_DBsub
675
<p>When Perl is run in debugging mode, with the <b>-d</b> switch, this GV contains
676
the SV which holds the name of the sub being debugged. This is the C
677
variable which corresponds to Perl's $DB::sub variable. See
678
<code class="inline"><span class="w">PL_DBsingle</span></code>
680
<pre class="verbatim"> <span class="w">GV</span> * <span class="w">PL_DBsub</span></pre>
682
<li><a name="PL_DBtrace"></a><b>PL_DBtrace
684
<p>Trace variable used when Perl is run in debugging mode, with the <b>-d</b>
685
switch. This is the C variable which corresponds to Perl's $DB::trace
686
variable. See <code class="inline"><span class="w">PL_DBsingle</span></code>
688
<pre class="verbatim"> <span class="w">SV</span> * <span class="w">PL_DBtrace</span></pre>
690
<li><a name="PL_dowarn"></a><b>PL_dowarn
692
<p>The C variable which corresponds to Perl's $^W warning variable.</p>
693
<pre class="verbatim"> <span class="w">bool</span> <span class="w">PL_dowarn</span></pre>
695
<li><a name="PL_last_in_gv"></a><b>PL_last_in_gv
697
<p>The GV which was last used for a filehandle input operation. (<code class="inline"><span class="q"><FH></span></code>
699
<pre class="verbatim"> <span class="w">GV</span>* <span class="w">PL_last_in_gv</span></pre>
701
<li><a name="PL_ofs_sv"></a><b>PL_ofs_sv
703
<p>The output field separator - <code class="inline"><span class="i">$,</span></code>
705
<pre class="verbatim"> <span class="w">SV</span>* <span class="w">PL_ofs_sv</span></pre>
707
<li><a name="PL_rs"></a><b>PL_rs
709
<p>The input record separator - <code class="inline"><span class="i">$/</span></code>
711
<pre class="verbatim"> <span class="w">SV</span>* <span class="w">PL_rs</span></pre>
613
714
<a name="Stack-Manipulation-Macros"></a><h1>Stack Manipulation Macros</h1>
615
<li><a name="djSP-djSP"></a><b>djSP
716
<li><a name="djSP"></a><b>djSP
617
<p>Declare Just <code class="inline">SP</code>
618
. This is actually identical to <code class="inline">dSP</code>
718
<p>Declare Just <code class="inline"><span class="w">SP</span></code>
719
. This is actually identical to <code class="inline"><span class="w">dSP</span></code>
620
a local copy of perl's stack pointer, available via the <code class="inline">SP</code>
721
a local copy of perl's stack pointer, available via the <code class="inline"><span class="w">SP</span></code>
622
See <code class="inline">SP</code>
723
See <code class="inline"><span class="w">SP</span></code>
623
724
. (Available for backward source code compatibility with the
624
725
old (Perl 5.005) thread model.)</p>
625
<pre class="verbatim"> djSP<span class="sc">;</span></pre>
726
<pre class="verbatim"> <span class="w">djSP</span><span class="sc">;</span></pre>
627
<li><a name="LVRET-LVRET"></a><b>LVRET
728
<li><a name="LVRET"></a><b>LVRET
629
730
<p>True if this op will be the return value of an lvalue subroutine</p>
632
733
<a name="SV-Manipulation-Functions"></a><h1>SV Manipulation Functions</h1>
634
<li><a name="report_uninit-report_uninit"></a><b>report_uninit
636
<p>Print appropriate "Use of uninitialized variable" warning</p>
637
<pre class="verbatim"> void <span class="i">report_uninit</span><span class="s">(</span><span class="s">)</span></pre>
639
<li><a name="sv_add_arena-sv_add_arena"></a><b>sv_add_arena
735
<li><a name="sv_add_arena"></a><b>sv_add_arena
641
737
<p>Given a chunk of memory, link it to the head of the list of arenas,
642
738
and split it into a list of free SVs.</p>
643
<pre class="verbatim"> void <span class="i">sv_add_arena</span><span class="s">(</span>char* ptr<span class="cm">,</span> U32 size<span class="cm">,</span> U32 flags<span class="s">)</span></pre>
739
<pre class="verbatim"> <span class="w">void</span> <span class="i">sv_add_arena</span><span class="s">(</span><span class="w">char</span>* <span class="w">ptr</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">size</span><span class="cm">,</span> <span class="w">U32</span> <span class="w">flags</span><span class="s">)</span></pre>
645
<li><a name="sv_clean_all-sv_clean_all"></a><b>sv_clean_all
741
<li><a name="sv_clean_all"></a><b>sv_clean_all
647
743
<p>Decrement the refcnt of each remaining SV, possibly triggering a
648
744
cleanup. This function may have to be called multiple times to free
649
745
SVs which are in complex self-referential hierarchies.</p>
650
<pre class="verbatim"> I32 <span class="i">sv_clean_all</span><span class="s">(</span><span class="s">)</span></pre>
746
<pre class="verbatim"> <span class="w">I32</span> <span class="i">sv_clean_all</span><span class="s">(</span><span class="s">)</span></pre>
652
<li><a name="sv_clean_objs-sv_clean_objs"></a><b>sv_clean_objs
748
<li><a name="sv_clean_objs"></a><b>sv_clean_objs
654
750
<p>Attempt to destroy all objects not yet freed</p>
655
<pre class="verbatim"> void <span class="i">sv_clean_objs</span><span class="s">(</span><span class="s">)</span></pre>
751
<pre class="verbatim"> <span class="w">void</span> <span class="i">sv_clean_objs</span><span class="s">(</span><span class="s">)</span></pre>
657
<li><a name="sv_free_arenas-sv_free_arenas"></a><b>sv_free_arenas
753
<li><a name="sv_free_arenas"></a><b>sv_free_arenas
659
755
<p>Deallocate the memory used by all arenas. Note that all the individual SV
660
756
heads and bodies within the arenas must already have been freed.</p>
661
<pre class="verbatim"> void <span class="i">sv_free_arenas</span><span class="s">(</span><span class="s">)</span></pre>
757
<pre class="verbatim"> <span class="w">void</span> <span class="i">sv_free_arenas</span><span class="s">(</span><span class="s">)</span></pre>
760
<a name="SV-Body-Allocation"></a><h1>SV-Body Allocation</h1>
762
<li><a name="sv_2num"></a><b>sv_2num
764
<p>Return an SV with the numeric value of the source SV, doing any necessary
765
reference or overload conversion. You must use the <code class="inline"><span class="i">SvNUM</span><span class="s">(</span><span class="w">sv</span><span class="s">)</span></code>
767
access this function.</p>
768
<pre class="verbatim"> <span class="w">SV</span>* <span class="i">sv_2num</span><span class="s">(</span><span class="w">SV</span>* <span class="w">sv</span><span class="s">)</span></pre>
771
<a name="Unicode-Support"></a><h1>Unicode Support</h1>
773
<li><a name="find_uninit_var"></a><b>find_uninit_var
775
<p>Find the name of the undefined variable (if any) that caused the operator o
776
to issue a "Use of uninitialized value" warning.
777
If match is true, only return a name if it's value matches uninit_sv.
778
So roughly speaking, if a unary operator (such as OP_COS) generates a
779
warning, then following the direct child of the op may yield an
780
OP_PADSV or OP_GV that gives the name of the undefined variable. On the
781
other hand, with OP_ADD there are two branches to follow, so we only print
782
the variable name if we get an exact match.</p>
783
<p>The name is returned as a mortal SV.</p>
784
<p>Assumes that PL_op is the op that originally triggered the error, and that
785
PL_comppad/PL_curpad points to the currently executing pad.</p>
786
<pre class="verbatim"> <span class="w">SV</span>* <span class="i">find_uninit_var</span><span class="s">(</span><span class="w">OP</span>* <span class="w">obase</span><span class="cm">,</span> <span class="w">SV</span>* <span class="w">uninit_sv</span><span class="cm">,</span> <span class="w">bool</span> <span class="w">top</span><span class="s">)</span></pre>
788
<li><a name="report_uninit"></a><b>report_uninit
790
<p>Print appropriate "Use of uninitialized variable" warning</p>
791
<pre class="verbatim"> <span class="w">void</span> <span class="i">report_uninit</span><span class="s">(</span><span class="w">SV</span>* <span class="w">uninit_sv</span><span class="s">)</span></pre>
664
794
<a name="AUTHORS"></a><h1>AUTHORS</h1>