This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Skip bug in new File::stat test.
[perl5.git] / pod / perlapi.pod
CommitLineData
e0492643
NC
1-*- buffer-read-only: t -*-
2
3!!!!!!! DO NOT EDIT THIS FILE !!!!!!!
4This file is built by autodoc.pl extracting documentation from the C source
5files.
6
954c1994
GS
7=head1 NAME
8
9perlapi - autogenerated documentation for the perl public API
10
11=head1 DESCRIPTION
d8c40edc 12X<Perl API> X<API> X<api>
954c1994 13
1c846c1f
NIS
14This file contains the documentation of the perl public API generated by
15embed.pl, specifically a listing of functions, macros, flags, and variables
16that may be used by extension writers. The interfaces of any functions that
954c1994
GS
17are not listed here are subject to change without notice. For this reason,
18blindly using functions listed in proto.h is to be avoided when writing
19extensions.
20
21Note that all Perl API global variables must be referenced with the C<PL_>
22prefix. Some macros are provided for compatibility with the older,
23unadorned names, but this support may be disabled in a future release.
24
2bbc8d55
SP
25Perl was originally written to handle US-ASCII only (that is characters
26whose ordinal numbers are in the range 0 - 127).
27And documentation and comments may still use the term ASCII, when
dc960812 28sometimes in fact the entire range from 0 - 255 is meant.
2bbc8d55
SP
29
30Note that Perl can be compiled and run under EBCDIC (See L<perlebcdic>)
31or ASCII. Most of the documentation (and even comments in the code)
32ignore the EBCDIC possibility.
33For almost all purposes the differences are transparent.
34As an example, under EBCDIC,
35instead of UTF-8, UTF-EBCDIC is used to encode Unicode strings, and so
36whenever this documentation refers to C<utf8>
37(and variants of that name, including in function names),
38it also (essentially transparently) means C<UTF-EBCDIC>.
39But the ordinals of characters differ between ASCII, EBCDIC, and
40the UTF- encodings, and a string encoded in UTF-EBCDIC may occupy more bytes
41than in UTF-8.
42
43Also, on some EBCDIC machines, functions that are documented as operating on
44US-ASCII (or Basic Latin in Unicode terminology) may in fact operate on all
45256 characters in the EBCDIC range, not just the subset corresponding to
46US-ASCII.
47
48The listing below is alphabetical, case insensitive.
954c1994 49
94bdecf9
JH
50
51=head1 "Gimme" Values
52
53=over 8
54
55=item GIMME
d8c40edc 56X<GIMME>
94bdecf9
JH
57
58A backward-compatible version of C<GIMME_V> which can only return
59C<G_SCALAR> or C<G_ARRAY>; in a void context, it returns C<G_SCALAR>.
60Deprecated. Use C<GIMME_V> instead.
61
62 U32 GIMME
63
64=for hackers
65Found in file op.h
66
67=item GIMME_V
d8c40edc 68X<GIMME_V>
94bdecf9
JH
69
70The XSUB-writer's equivalent to Perl's C<wantarray>. Returns C<G_VOID>,
71C<G_SCALAR> or C<G_ARRAY> for void, scalar or list context,
72respectively.
73
74 U32 GIMME_V
75
76=for hackers
77Found in file op.h
78
79=item G_ARRAY
d8c40edc 80X<G_ARRAY>
94bdecf9
JH
81
82Used to indicate list context. See C<GIMME_V>, C<GIMME> and
83L<perlcall>.
84
85=for hackers
86Found in file cop.h
87
88=item G_DISCARD
d8c40edc 89X<G_DISCARD>
94bdecf9
JH
90
91Indicates that arguments returned from a callback should be discarded. See
92L<perlcall>.
93
94=for hackers
95Found in file cop.h
96
97=item G_EVAL
d8c40edc 98X<G_EVAL>
94bdecf9
JH
99
100Used to force a Perl C<eval> wrapper around a callback. See
101L<perlcall>.
102
103=for hackers
104Found in file cop.h
105
106=item G_NOARGS
d8c40edc 107X<G_NOARGS>
94bdecf9
JH
108
109Indicates that no arguments are being sent to a callback. See
110L<perlcall>.
111
112=for hackers
113Found in file cop.h
114
115=item G_SCALAR
d8c40edc 116X<G_SCALAR>
94bdecf9
JH
117
118Used to indicate scalar context. See C<GIMME_V>, C<GIMME>, and
119L<perlcall>.
120
121=for hackers
122Found in file cop.h
123
124=item G_VOID
d8c40edc 125X<G_VOID>
94bdecf9
JH
126
127Used to indicate void context. See C<GIMME_V> and L<perlcall>.
128
129=for hackers
130Found in file cop.h
131
132
133=back
134
135=head1 Array Manipulation Functions
136
954c1994
GS
137=over 8
138
139=item AvFILL
d8c40edc 140X<AvFILL>
954c1994
GS
141
142Same as C<av_len()>. Deprecated, use C<av_len()> instead.
143
144 int AvFILL(AV* av)
145
497711e7
GS
146=for hackers
147Found in file av.h
148
954c1994 149=item av_clear
d8c40edc 150X<av_clear>
954c1994
GS
151
152Clears an array, making it empty. Does not free the memory used by the
153array itself.
154
4048f010 155 void av_clear(AV *av)
954c1994 156
497711e7
GS
157=for hackers
158Found in file av.c
159
bcdf7404
YO
160=item av_create_and_push
161X<av_create_and_push>
162
163Push an SV onto the end of the array, creating the array if necessary.
164A small internal helper function to remove a commonly duplicated idiom.
165
166NOTE: this function is experimental and may change or be
167removed without notice.
168
169 void av_create_and_push(AV **const avp, SV *const val)
170
171=for hackers
172Found in file av.c
173
174=item av_create_and_unshift_one
175X<av_create_and_unshift_one>
176
177Unshifts an SV onto the beginning of the array, creating the array if
178necessary.
179A small internal helper function to remove a commonly duplicated idiom.
180
181NOTE: this function is experimental and may change or be
182removed without notice.
183
184 SV** av_create_and_unshift_one(AV **const avp, SV *const val)
185
186=for hackers
187Found in file av.c
188
f3b76584 189=item av_delete
d8c40edc 190X<av_delete>
f3b76584
SC
191
192Deletes the element indexed by C<key> from the array. Returns the
b9381830
JP
193deleted element. If C<flags> equals C<G_DISCARD>, the element is freed
194and null is returned.
f3b76584 195
4048f010 196 SV* av_delete(AV *av, I32 key, I32 flags)
f3b76584
SC
197
198=for hackers
199Found in file av.c
200
201=item av_exists
d8c40edc 202X<av_exists>
f3b76584
SC
203
204Returns true if the element indexed by C<key> has been initialized.
205
206This relies on the fact that uninitialized array elements are set to
207C<&PL_sv_undef>.
208
4048f010 209 bool av_exists(AV *av, I32 key)
f3b76584
SC
210
211=for hackers
212Found in file av.c
213
954c1994 214=item av_extend
d8c40edc 215X<av_extend>
954c1994
GS
216
217Pre-extend an array. The C<key> is the index to which the array should be
218extended.
219
4048f010 220 void av_extend(AV *av, I32 key)
954c1994 221
497711e7
GS
222=for hackers
223Found in file av.c
224
954c1994 225=item av_fetch
d8c40edc 226X<av_fetch>
954c1994
GS
227
228Returns the SV at the specified index in the array. The C<key> is the
229index. If C<lval> is set then the fetch will be part of a store. Check
230that the return value is non-null before dereferencing it to a C<SV*>.
231
96f1132b
GS
232See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for
233more information on how to use this function on tied arrays.
954c1994 234
4048f010 235 SV** av_fetch(AV *av, I32 key, I32 lval)
954c1994 236
497711e7
GS
237=for hackers
238Found in file av.c
239
f3b76584 240=item av_fill
d8c40edc 241X<av_fill>
f3b76584 242
1d51329b 243Set the highest index in the array to the given number, equivalent to
f3b76584
SC
244Perl's C<$#array = $fill;>.
245
1d51329b
RGS
246The number of elements in the an array will be C<fill + 1> after
247av_fill() returns. If the array was previously shorter then the
248additional elements appended are set to C<PL_sv_undef>. If the array
249was longer, then the excess elements are freed. C<av_fill(av, -1)> is
250the same as C<av_clear(av)>.
251
4048f010 252 void av_fill(AV *av, I32 fill)
f3b76584
SC
253
254=for hackers
255Found in file av.c
256
954c1994 257=item av_len
d8c40edc 258X<av_len>
954c1994 259
1d51329b
RGS
260Returns the highest index in the array. The number of elements in the
261array is C<av_len(av) + 1>. Returns -1 if the array is empty.
954c1994 262
87cea99e 263 I32 av_len(AV *av)
954c1994 264
497711e7
GS
265=for hackers
266Found in file av.c
267
954c1994 268=item av_make
d8c40edc 269X<av_make>
954c1994
GS
270
271Creates a new AV and populates it with a list of SVs. The SVs are copied
272into the array, so they may be freed after the call to av_make. The new AV
273will have a reference count of 1.
274
4048f010 275 AV* av_make(I32 size, SV **strp)
954c1994 276
497711e7
GS
277=for hackers
278Found in file av.c
279
954c1994 280=item av_pop
d8c40edc 281X<av_pop>
954c1994
GS
282
283Pops an SV off the end of the array. Returns C<&PL_sv_undef> if the array
284is empty.
285
4048f010 286 SV* av_pop(AV *av)
954c1994 287
497711e7
GS
288=for hackers
289Found in file av.c
290
954c1994 291=item av_push
d8c40edc 292X<av_push>
954c1994
GS
293
294Pushes an SV onto the end of the array. The array will grow automatically
295to accommodate the addition.
296
4048f010 297 void av_push(AV *av, SV *val)
954c1994 298
497711e7
GS
299=for hackers
300Found in file av.c
301
954c1994 302=item av_shift
d8c40edc 303X<av_shift>
954c1994 304
71c4dbc3
VP
305Shifts an SV off the beginning of the array. Returns C<&PL_sv_undef> if the
306array is empty.
954c1994 307
4048f010 308 SV* av_shift(AV *av)
954c1994 309
497711e7
GS
310=for hackers
311Found in file av.c
312
954c1994 313=item av_store
d8c40edc 314X<av_store>
954c1994
GS
315
316Stores an SV in an array. The array index is specified as C<key>. The
317return value will be NULL if the operation failed or if the value did not
318need to be actually stored within the array (as in the case of tied
319arrays). Otherwise it can be dereferenced to get the original C<SV*>. Note
320that the caller is responsible for suitably incrementing the reference
321count of C<val> before the call, and decrementing it if the function
322returned NULL.
323
96f1132b 324See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for
954c1994
GS
325more information on how to use this function on tied arrays.
326
4048f010 327 SV** av_store(AV *av, I32 key, SV *val)
954c1994 328
497711e7
GS
329=for hackers
330Found in file av.c
331
954c1994 332=item av_undef
d8c40edc 333X<av_undef>
954c1994
GS
334
335Undefines the array. Frees the memory used by the array itself.
336
4048f010 337 void av_undef(AV *av)
954c1994 338
497711e7
GS
339=for hackers
340Found in file av.c
341
954c1994 342=item av_unshift
d8c40edc 343X<av_unshift>
954c1994
GS
344
345Unshift the given number of C<undef> values onto the beginning of the
346array. The array will grow automatically to accommodate the addition. You
347must then use C<av_store> to assign values to these new elements.
348
4048f010 349 void av_unshift(AV *av, I32 num)
954c1994 350
497711e7
GS
351=for hackers
352Found in file av.c
353
94bdecf9 354=item get_av
d8c40edc 355X<get_av>
9f2ea798 356
cbfd0a87
NC
357Returns the AV of the specified Perl array. C<flags> are passed to
358C<gv_fetchpv>. If C<GV_ADD> is set and the
359Perl variable does not exist then it will be created. If C<flags> is zero
360and the variable does not exist then NULL is returned.
9f2ea798 361
94bdecf9
JH
362NOTE: the perl_ form of this function is deprecated.
363
cbfd0a87 364 AV* get_av(const char *name, I32 flags)
9f2ea798
DM
365
366=for hackers
94bdecf9 367Found in file perl.c
9f2ea798 368
94bdecf9 369=item newAV
d8c40edc 370X<newAV>
f9a63242 371
94bdecf9 372Creates a new AV. The reference count is set to 1.
f9a63242 373
94bdecf9
JH
374 AV* newAV()
375
376=for hackers
6fc9eaaa 377Found in file av.h
94bdecf9 378
94bdecf9 379=item sortsv
d8c40edc 380X<sortsv>
497711e7 381
94bdecf9 382Sort an array. Here is an example:
497711e7 383
94bdecf9 384 sortsv(AvARRAY(av), av_len(av)+1, Perl_sv_cmp_locale);
eebe1485 385
7b9ef140
RH
386Currently this always uses mergesort. See sortsv_flags for a more
387flexible routine.
641d4181 388
aa924a5a 389 void sortsv(SV** array, size_t num_elts, SVCOMPARE_t cmp)
497711e7
GS
390
391=for hackers
94bdecf9
JH
392Found in file pp_sort.c
393
7b9ef140
RH
394=item sortsv_flags
395X<sortsv_flags>
396
397Sort an array, with various options.
398
399 void sortsv_flags(SV** array, size_t num_elts, SVCOMPARE_t cmp, U32 flags)
400
401=for hackers
402Found in file pp_sort.c
403
94bdecf9
JH
404
405=back
406
407=head1 Callback Functions
408
409=over 8
497711e7 410
954c1994 411=item call_argv
d8c40edc 412X<call_argv>
954c1994
GS
413
414Performs a callback to the specified Perl sub. See L<perlcall>.
415
416NOTE: the perl_ form of this function is deprecated.
417
8f42b153 418 I32 call_argv(const char* sub_name, I32 flags, char** argv)
954c1994 419
497711e7
GS
420=for hackers
421Found in file perl.c
422
954c1994 423=item call_method
d8c40edc 424X<call_method>
954c1994
GS
425
426Performs a callback to the specified Perl method. The blessed object must
427be on the stack. See L<perlcall>.
428
429NOTE: the perl_ form of this function is deprecated.
430
431 I32 call_method(const char* methname, I32 flags)
432
497711e7
GS
433=for hackers
434Found in file perl.c
435
954c1994 436=item call_pv
d8c40edc 437X<call_pv>
954c1994
GS
438
439Performs a callback to the specified Perl sub. See L<perlcall>.
440
441NOTE: the perl_ form of this function is deprecated.
442
443 I32 call_pv(const char* sub_name, I32 flags)
444
497711e7
GS
445=for hackers
446Found in file perl.c
447
954c1994 448=item call_sv
d8c40edc 449X<call_sv>
954c1994
GS
450
451Performs a callback to the Perl sub whose name is in the SV. See
452L<perlcall>.
453
454NOTE: the perl_ form of this function is deprecated.
455
8c54174d 456 I32 call_sv(SV* sv, VOL I32 flags)
954c1994 457
497711e7
GS
458=for hackers
459Found in file perl.c
460
94bdecf9 461=item ENTER
d8c40edc 462X<ENTER>
954c1994 463
94bdecf9 464Opening bracket on a callback. See C<LEAVE> and L<perlcall>.
954c1994 465
94bdecf9 466 ENTER;
954c1994 467
497711e7 468=for hackers
94bdecf9 469Found in file scope.h
497711e7 470
94bdecf9 471=item eval_pv
d8c40edc 472X<eval_pv>
954c1994 473
94bdecf9 474Tells Perl to C<eval> the given string and return an SV* result.
954c1994 475
94bdecf9 476NOTE: the perl_ form of this function is deprecated.
954c1994 477
94bdecf9 478 SV* eval_pv(const char* p, I32 croak_on_error)
497711e7 479
94bdecf9
JH
480=for hackers
481Found in file perl.c
954c1994 482
94bdecf9 483=item eval_sv
d8c40edc 484X<eval_sv>
c9d5ac95 485
94bdecf9 486Tells Perl to C<eval> the string in the SV.
c9d5ac95 487
94bdecf9 488NOTE: the perl_ form of this function is deprecated.
954c1994 489
94bdecf9 490 I32 eval_sv(SV* sv, I32 flags)
954c1994 491
497711e7 492=for hackers
94bdecf9 493Found in file perl.c
497711e7 494
94bdecf9 495=item FREETMPS
d8c40edc 496X<FREETMPS>
954c1994 497
94bdecf9
JH
498Closing bracket for temporaries on a callback. See C<SAVETMPS> and
499L<perlcall>.
954c1994 500
94bdecf9 501 FREETMPS;
954c1994 502
497711e7 503=for hackers
94bdecf9 504Found in file scope.h
beab0874 505
94bdecf9 506=item LEAVE
d8c40edc 507X<LEAVE>
beab0874 508
94bdecf9 509Closing bracket on a callback. See C<ENTER> and L<perlcall>.
beab0874 510
94bdecf9 511 LEAVE;
beab0874
JT
512
513=for hackers
94bdecf9 514Found in file scope.h
beab0874 515
94bdecf9 516=item SAVETMPS
d8c40edc 517X<SAVETMPS>
9f2ea798 518
94bdecf9
JH
519Opening bracket for temporaries on a callback. See C<FREETMPS> and
520L<perlcall>.
9f2ea798 521
94bdecf9 522 SAVETMPS;
9f2ea798
DM
523
524=for hackers
94bdecf9 525Found in file scope.h
9f2ea798 526
9f2ea798 527
94bdecf9 528=back
9f2ea798 529
94bdecf9 530=head1 Character classes
9f2ea798 531
94bdecf9 532=over 8
9f2ea798 533
94bdecf9 534=item isALNUM
d8c40edc 535X<isALNUM>
954c1994 536
2bbc8d55
SP
537Returns a boolean indicating whether the C C<char> is a US-ASCII (Basic Latin)
538alphanumeric character (including underscore) or digit.
954c1994 539
94bdecf9 540 bool isALNUM(char ch)
954c1994 541
497711e7 542=for hackers
94bdecf9 543Found in file handy.h
497711e7 544
94bdecf9 545=item isALPHA
d8c40edc 546X<isALPHA>
954c1994 547
2bbc8d55
SP
548Returns a boolean indicating whether the C C<char> is a US-ASCII (Basic Latin)
549alphabetic character.
954c1994 550
94bdecf9 551 bool isALPHA(char ch)
954c1994 552
497711e7 553=for hackers
94bdecf9 554Found in file handy.h
497711e7 555
94bdecf9 556=item isDIGIT
d8c40edc 557X<isDIGIT>
954c1994 558
2bbc8d55 559Returns a boolean indicating whether the C C<char> is a US-ASCII (Basic Latin)
94bdecf9 560digit.
954c1994 561
94bdecf9 562 bool isDIGIT(char ch)
954c1994 563
497711e7 564=for hackers
94bdecf9 565Found in file handy.h
497711e7 566
94bdecf9 567=item isLOWER
d8c40edc 568X<isLOWER>
954c1994 569
2bbc8d55
SP
570Returns a boolean indicating whether the C C<char> is a US-ASCII (Basic Latin)
571lowercase character.
954c1994 572
94bdecf9 573 bool isLOWER(char ch)
954c1994 574
497711e7 575=for hackers
94bdecf9 576Found in file handy.h
497711e7 577
94bdecf9 578=item isSPACE
d8c40edc 579X<isSPACE>
954c1994 580
2bbc8d55
SP
581Returns a boolean indicating whether the C C<char> is a US-ASCII (Basic Latin)
582whitespace.
954c1994 583
94bdecf9 584 bool isSPACE(char ch)
954c1994 585
497711e7 586=for hackers
94bdecf9 587Found in file handy.h
497711e7 588
94bdecf9 589=item isUPPER
d8c40edc 590X<isUPPER>
954c1994 591
2bbc8d55
SP
592Returns a boolean indicating whether the C C<char> is a US-ASCII (Basic Latin)
593uppercase character.
954c1994 594
94bdecf9 595 bool isUPPER(char ch)
954c1994 596
497711e7 597=for hackers
94bdecf9 598Found in file handy.h
497711e7 599
94bdecf9 600=item toLOWER
d8c40edc 601X<toLOWER>
954c1994 602
2bbc8d55
SP
603Converts the specified character to lowercase. Characters outside the
604US-ASCII (Basic Latin) range are viewed as not having any case.
954c1994 605
94bdecf9 606 char toLOWER(char ch)
954c1994 607
94bdecf9
JH
608=for hackers
609Found in file handy.h
610
611=item toUPPER
d8c40edc 612X<toUPPER>
94bdecf9 613
2bbc8d55
SP
614Converts the specified character to uppercase. Characters outside the
615US-ASCII (Basic Latin) range are viewed as not having any case.
94bdecf9
JH
616
617 char toUPPER(char ch)
954c1994 618
497711e7 619=for hackers
94bdecf9 620Found in file handy.h
497711e7 621
954c1994 622
94bdecf9 623=back
954c1994 624
94bdecf9 625=head1 Cloning an interpreter
954c1994 626
94bdecf9
JH
627=over 8
628
629=item perl_clone
d8c40edc 630X<perl_clone>
94bdecf9
JH
631
632Create and return a new interpreter by cloning the current one.
633
4be49ee6 634perl_clone takes these flags as parameters:
c78c2b74 635
b0bc38e6
NC
636CLONEf_COPY_STACKS - is used to, well, copy the stacks also,
637without it we only clone the data and zero the stacks,
638with it we copy the stacks and the new perl interpreter is
639ready to run at the exact same point as the previous one.
640The pseudo-fork code uses COPY_STACKS while the
878090d5 641threads->create doesn't.
c78c2b74
HS
642
643CLONEf_KEEP_PTR_TABLE
b0bc38e6
NC
644perl_clone keeps a ptr_table with the pointer of the old
645variable as a key and the new variable as a value,
646this allows it to check if something has been cloned and not
647clone it again but rather just use the value and increase the
648refcount. If KEEP_PTR_TABLE is not set then perl_clone will kill
649the ptr_table using the function
650C<ptr_table_free(PL_ptr_table); PL_ptr_table = NULL;>,
651reason to keep it around is if you want to dup some of your own
652variable who are outside the graph perl scans, example of this
c78c2b74
HS
653code is in threads.xs create
654
655CLONEf_CLONE_HOST
b0bc38e6
NC
656This is a win32 thing, it is ignored on unix, it tells perls
657win32host code (which is c++) to clone itself, this is needed on
658win32 if you want to run two threads at the same time,
659if you just want to do some stuff in a separate perl interpreter
660and then throw it away and return to the original one,
c78c2b74
HS
661you don't need to do anything.
662
4048f010 663 PerlInterpreter* perl_clone(PerlInterpreter *proto_perl, UV flags)
954c1994 664
497711e7 665=for hackers
94bdecf9 666Found in file sv.c
497711e7 667
954c1994 668
94bdecf9 669=back
954c1994 670
94bdecf9
JH
671=head1 CV Manipulation Functions
672
673=over 8
674
675=item CvSTASH
d8c40edc 676X<CvSTASH>
94bdecf9
JH
677
678Returns the stash of the CV.
679
680 HV* CvSTASH(CV* cv)
954c1994 681
497711e7 682=for hackers
94bdecf9 683Found in file cv.h
497711e7 684
94bdecf9 685=item get_cv
d8c40edc 686X<get_cv>
954c1994 687
36dfb072 688Uses C<strlen> to get the length of C<name>, then calls C<get_cvn_flags>.
954c1994 689
94bdecf9
JH
690NOTE: the perl_ form of this function is deprecated.
691
36dfb072
NC
692 CV* get_cv(const char* name, I32 flags)
693
694=for hackers
695Found in file perl.c
696
697=item get_cvn_flags
698X<get_cvn_flags>
699
700Returns the CV of the specified Perl subroutine. C<flags> are passed to
701C<gv_fetchpvn_flags>. If C<GV_ADD> is set and the Perl subroutine does not
702exist then it will be declared (which has the same effect as saying
703C<sub name;>). If C<GV_ADD> is not set and the subroutine does not exist
704then NULL is returned.
705
706NOTE: the perl_ form of this function is deprecated.
707
708 CV* get_cvn_flags(const char* name, STRLEN len, I32 flags)
954c1994 709
497711e7 710=for hackers
94bdecf9 711Found in file perl.c
497711e7 712
7c9e965c 713
94bdecf9 714=back
7c9e965c 715
94bdecf9 716=head1 Embedding Functions
7c9e965c 717
94bdecf9 718=over 8
7c9e965c 719
7dafbf52 720=item cv_undef
d8c40edc 721X<cv_undef>
7dafbf52
DM
722
723Clear out all the active components of a CV. This can happen either
724by an explicit C<undef &foo>, or by the reference count going to zero.
725In the former case, we keep the CvOUTSIDE pointer, so that any anonymous
726children can still follow the full lexical scope chain.
727
728 void cv_undef(CV* cv)
729
730=for hackers
731Found in file op.c
732
94bdecf9 733=item load_module
d8c40edc 734X<load_module>
7c9e965c 735
94bdecf9
JH
736Loads the module whose name is pointed to by the string part of name.
737Note that the actual module name, not its filename, should be given.
738Eg, "Foo::Bar" instead of "Foo/Bar.pm". flags can be any of
739PERL_LOADMOD_DENY, PERL_LOADMOD_NOIMPORT, or PERL_LOADMOD_IMPORT_OPS
740(or 0 for no flags). ver, if specified, provides version semantics
741similar to C<use Foo::Bar VERSION>. The optional trailing SV*
742arguments can be used to specify arguments to the module's import()
743method, similar to C<use Foo::Bar VERSION LIST>.
7c9e965c 744
94bdecf9 745 void load_module(U32 flags, SV* name, SV* ver, ...)
7c9e965c
JP
746
747=for hackers
94bdecf9 748Found in file op.c
7c9e965c 749
62375a60 750=item nothreadhook
d8c40edc 751X<nothreadhook>
62375a60
NIS
752
753Stub that provides thread hook for perl_destruct when there are
754no threads.
755
756 int nothreadhook()
757
758=for hackers
759Found in file perl.c
760
94bdecf9 761=item perl_alloc
d8c40edc 762X<perl_alloc>
954c1994 763
94bdecf9 764Allocates a new Perl interpreter. See L<perlembed>.
954c1994 765
94bdecf9 766 PerlInterpreter* perl_alloc()
954c1994 767
497711e7 768=for hackers
94bdecf9 769Found in file perl.c
497711e7 770
94bdecf9 771=item perl_construct
d8c40edc 772X<perl_construct>
89423764 773
94bdecf9 774Initializes a new Perl interpreter. See L<perlembed>.
89423764 775
4048f010 776 void perl_construct(PerlInterpreter *my_perl)
89423764
GS
777
778=for hackers
94bdecf9 779Found in file perl.c
954c1994 780
94bdecf9 781=item perl_destruct
d8c40edc 782X<perl_destruct>
954c1994 783
94bdecf9 784Shuts down a Perl interpreter. See L<perlembed>.
954c1994 785
4048f010 786 int perl_destruct(PerlInterpreter *my_perl)
954c1994 787
497711e7
GS
788=for hackers
789Found in file perl.c
790
94bdecf9 791=item perl_free
d8c40edc 792X<perl_free>
954c1994 793
94bdecf9 794Releases a Perl interpreter. See L<perlembed>.
954c1994 795
4048f010 796 void perl_free(PerlInterpreter *my_perl)
954c1994 797
497711e7
GS
798=for hackers
799Found in file perl.c
800
94bdecf9 801=item perl_parse
d8c40edc 802X<perl_parse>
954c1994 803
94bdecf9 804Tells a Perl interpreter to parse a Perl script. See L<perlembed>.
954c1994 805
4048f010 806 int perl_parse(PerlInterpreter *my_perl, XSINIT_t xsinit, int argc, char** argv, char** env)
954c1994 807
94bdecf9
JH
808=for hackers
809Found in file perl.c
810
811=item perl_run
d8c40edc 812X<perl_run>
94bdecf9
JH
813
814Tells a Perl interpreter to run. See L<perlembed>.
815
4048f010 816 int perl_run(PerlInterpreter *my_perl)
954c1994 817
497711e7
GS
818=for hackers
819Found in file perl.c
820
94bdecf9 821=item require_pv
d8c40edc 822X<require_pv>
954c1994 823
94bdecf9
JH
824Tells Perl to C<require> the file named by the string argument. It is
825analogous to the Perl code C<eval "require '$file'">. It's even
2307c6d0 826implemented that way; consider using load_module instead.
954c1994
GS
827
828NOTE: the perl_ form of this function is deprecated.
829
94bdecf9 830 void require_pv(const char* pv)
954c1994 831
497711e7
GS
832=for hackers
833Found in file perl.c
834
954c1994 835
94bdecf9 836=back
954c1994 837
3df15adc
YO
838=head1 Functions in file dump.c
839
840
841=over 8
842
843=item pv_display
844X<pv_display>
845
3df15adc
YO
846Similar to
847
848 pv_escape(dsv,pv,cur,pvlim,PERL_PV_ESCAPE_QUOTE);
849
850except that an additional "\0" will be appended to the string when
851len > cur and pv[cur] is "\0".
852
853Note that the final string may be up to 7 chars longer than pvlim.
854
855 char* pv_display(SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
856
857=for hackers
858Found in file dump.c
859
860=item pv_escape
861X<pv_escape>
862
863Escapes at most the first "count" chars of pv and puts the results into
ddc5bc0f 864dsv such that the size of the escaped string will not exceed "max" chars
3df15adc
YO
865and will not contain any incomplete escape sequences.
866
ddc5bc0f
YO
867If flags contains PERL_PV_ESCAPE_QUOTE then any double quotes in the string
868will also be escaped.
3df15adc
YO
869
870Normally the SV will be cleared before the escaped string is prepared,
ddc5bc0f
YO
871but when PERL_PV_ESCAPE_NOCLEAR is set this will not occur.
872
38a44b82 873If PERL_PV_ESCAPE_UNI is set then the input string is treated as Unicode,
ddc5bc0f 874if PERL_PV_ESCAPE_UNI_DETECT is set then the input string is scanned
38a44b82 875using C<is_utf8_string()> to determine if it is Unicode.
ddc5bc0f
YO
876
877If PERL_PV_ESCAPE_ALL is set then all input chars will be output
878using C<\x01F1> style escapes, otherwise only chars above 255 will be
879escaped using this style, other non printable chars will use octal or
880common escaped patterns like C<\n>. If PERL_PV_ESCAPE_NOBACKSLASH
881then all chars below 255 will be treated as printable and
882will be output as literals.
883
884If PERL_PV_ESCAPE_FIRSTCHAR is set then only the first char of the
885string will be escaped, regardles of max. If the string is utf8 and
886the chars value is >255 then it will be returned as a plain hex
887sequence. Thus the output will either be a single char,
888an octal escape sequence, a special escape like C<\n> or a 3 or
889more digit hex value.
890
44a2ac75
YO
891If PERL_PV_ESCAPE_RE is set then the escape char used will be a '%' and
892not a '\\'. This is because regexes very often contain backslashed
893sequences, whereas '%' is not a particularly common character in patterns.
894
ddc5bc0f 895Returns a pointer to the escaped text as held by dsv.
3df15adc 896
ddc5bc0f
YO
897 char* pv_escape(SV *dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags)
898
899=for hackers
900Found in file dump.c
3df15adc 901
ddc5bc0f
YO
902=item pv_pretty
903X<pv_pretty>
904
ddc5bc0f 905Converts a string into something presentable, handling escaping via
95b611b0 906pv_escape() and supporting quoting and ellipses.
ddc5bc0f
YO
907
908If the PERL_PV_PRETTY_QUOTE flag is set then the result will be
909double quoted with any double quotes in the string escaped. Otherwise
910if the PERL_PV_PRETTY_LTGT flag is set then the result be wrapped in
911angle brackets.
912
95b611b0
RGS
913If the PERL_PV_PRETTY_ELLIPSES flag is set and not all characters in
914string were output then an ellipsis C<...> will be appended to the
ddc5bc0f
YO
915string. Note that this happens AFTER it has been quoted.
916
917If start_color is non-null then it will be inserted after the opening
918quote (if there is one) but before the escaped text. If end_color
919is non-null then it will be inserted after the escaped text but before
95b611b0 920any quotes or ellipses.
ddc5bc0f
YO
921
922Returns a pointer to the prettified text as held by dsv.
923
ddc5bc0f 924 char* pv_pretty(SV *dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags)
3df15adc
YO
925
926=for hackers
927Found in file dump.c
928
929
930=back
931
9244d4ad
RGS
932=head1 Functions in file mathoms.c
933
934
935=over 8
936
937=item gv_fetchmethod
938X<gv_fetchmethod>
939
940See L<gv_fetchmethod_autoload>.
941
942 GV* gv_fetchmethod(HV* stash, const char* name)
943
944=for hackers
945Found in file mathoms.c
946
b47163a2
NC
947=item pack_cat
948X<pack_cat>
949
950The engine implementing pack() Perl function. Note: parameters next_in_list and
951flags are not used. This call should not be used; use packlist instead.
952
953 void pack_cat(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
954
955=for hackers
956Found in file mathoms.c
957
9244d4ad
RGS
958=item sv_2pvbyte_nolen
959X<sv_2pvbyte_nolen>
960
961Return a pointer to the byte-encoded representation of the SV.
962May cause the SV to be downgraded from UTF-8 as a side-effect.
963
964Usually accessed via the C<SvPVbyte_nolen> macro.
965
966 char* sv_2pvbyte_nolen(SV* sv)
967
968=for hackers
969Found in file mathoms.c
970
971=item sv_2pvutf8_nolen
972X<sv_2pvutf8_nolen>
973
974Return a pointer to the UTF-8-encoded representation of the SV.
975May cause the SV to be upgraded to UTF-8 as a side-effect.
976
977Usually accessed via the C<SvPVutf8_nolen> macro.
978
979 char* sv_2pvutf8_nolen(SV* sv)
980
981=for hackers
982Found in file mathoms.c
983
984=item sv_2pv_nolen
985X<sv_2pv_nolen>
986
987Like C<sv_2pv()>, but doesn't return the length too. You should usually
988use the macro wrapper C<SvPV_nolen(sv)> instead.
989 char* sv_2pv_nolen(SV* sv)
990
991=for hackers
992Found in file mathoms.c
993
994=item sv_catpvn_mg
995X<sv_catpvn_mg>
996
997Like C<sv_catpvn>, but also handles 'set' magic.
998
999 void sv_catpvn_mg(SV *sv, const char *ptr, STRLEN len)
1000
1001=for hackers
1002Found in file mathoms.c
1003
1004=item sv_catsv_mg
1005X<sv_catsv_mg>
1006
1007Like C<sv_catsv>, but also handles 'set' magic.
1008
4048f010 1009 void sv_catsv_mg(SV *dsv, SV *ssv)
9244d4ad
RGS
1010
1011=for hackers
1012Found in file mathoms.c
1013
1014=item sv_force_normal
1015X<sv_force_normal>
1016
1017Undo various types of fakery on an SV: if the PV is a shared string, make
1018a private copy; if we're a ref, stop refing; if we're a glob, downgrade to
1019an xpvmg. See also C<sv_force_normal_flags>.
1020
1021 void sv_force_normal(SV *sv)
1022
1023=for hackers
1024Found in file mathoms.c
1025
1026=item sv_iv
1027X<sv_iv>
1028
1029A private implementation of the C<SvIVx> macro for compilers which can't
1030cope with complex macro expressions. Always use the macro instead.
1031
1032 IV sv_iv(SV* sv)
1033
1034=for hackers
1035Found in file mathoms.c
1036
1037=item sv_nolocking
1038X<sv_nolocking>
1039
1040Dummy routine which "locks" an SV when there is no locking module present.
1041Exists to avoid test for a NULL function pointer and because it could
1042potentially warn under some level of strict-ness.
1043
1044"Superseded" by sv_nosharing().
1045
c48640ec 1046 void sv_nolocking(SV *sv)
9244d4ad
RGS
1047
1048=for hackers
1049Found in file mathoms.c
1050
1051=item sv_nounlocking
1052X<sv_nounlocking>
1053
1054Dummy routine which "unlocks" an SV when there is no locking module present.
1055Exists to avoid test for a NULL function pointer and because it could
1056potentially warn under some level of strict-ness.
1057
1058"Superseded" by sv_nosharing().
1059
c48640ec 1060 void sv_nounlocking(SV *sv)
9244d4ad
RGS
1061
1062=for hackers
1063Found in file mathoms.c
1064
1065=item sv_nv
1066X<sv_nv>
1067
1068A private implementation of the C<SvNVx> macro for compilers which can't
1069cope with complex macro expressions. Always use the macro instead.
1070
1071 NV sv_nv(SV* sv)
1072
1073=for hackers
1074Found in file mathoms.c
1075
1076=item sv_pv
1077X<sv_pv>
1078
1079Use the C<SvPV_nolen> macro instead
1080
1081 char* sv_pv(SV *sv)
1082
1083=for hackers
1084Found in file mathoms.c
1085
1086=item sv_pvbyte
1087X<sv_pvbyte>
1088
1089Use C<SvPVbyte_nolen> instead.
1090
1091 char* sv_pvbyte(SV *sv)
1092
1093=for hackers
1094Found in file mathoms.c
1095
1096=item sv_pvbyten
1097X<sv_pvbyten>
1098
1099A private implementation of the C<SvPVbyte> macro for compilers
1100which can't cope with complex macro expressions. Always use the macro
1101instead.
1102
4048f010 1103 char* sv_pvbyten(SV *sv, STRLEN *lp)
9244d4ad
RGS
1104
1105=for hackers
1106Found in file mathoms.c
1107
1108=item sv_pvn
1109X<sv_pvn>
1110
1111A private implementation of the C<SvPV> macro for compilers which can't
1112cope with complex macro expressions. Always use the macro instead.
1113
4048f010 1114 char* sv_pvn(SV *sv, STRLEN *lp)
9244d4ad
RGS
1115
1116=for hackers
1117Found in file mathoms.c
1118
1119=item sv_pvutf8
1120X<sv_pvutf8>
1121
1122Use the C<SvPVutf8_nolen> macro instead
1123
1124 char* sv_pvutf8(SV *sv)
1125
1126=for hackers
1127Found in file mathoms.c
1128
1129=item sv_pvutf8n
1130X<sv_pvutf8n>
1131
1132A private implementation of the C<SvPVutf8> macro for compilers
1133which can't cope with complex macro expressions. Always use the macro
1134instead.
1135
4048f010 1136 char* sv_pvutf8n(SV *sv, STRLEN *lp)
9244d4ad
RGS
1137
1138=for hackers
1139Found in file mathoms.c
1140
1141=item sv_taint
1142X<sv_taint>
1143
1144Taint an SV. Use C<SvTAINTED_on> instead.
1145 void sv_taint(SV* sv)
1146
1147=for hackers
1148Found in file mathoms.c
1149
1150=item sv_unref
1151X<sv_unref>
1152
1153Unsets the RV status of the SV, and decrements the reference count of
1154whatever was being referenced by the RV. This can almost be thought of
1155as a reversal of C<newSVrv>. This is C<sv_unref_flags> with the C<flag>
1156being zero. See C<SvROK_off>.
1157
1158 void sv_unref(SV* sv)
1159
1160=for hackers
1161Found in file mathoms.c
1162
fed01289
SP
1163=item sv_usepvn
1164X<sv_usepvn>
1165
1166Tells an SV to use C<ptr> to find its string value. Implemented by
1167calling C<sv_usepvn_flags> with C<flags> of 0, hence does not handle 'set'
1168magic. See C<sv_usepvn_flags>.
1169
1170 void sv_usepvn(SV* sv, char* ptr, STRLEN len)
1171
1172=for hackers
1173Found in file mathoms.c
1174
1175=item sv_usepvn_mg
1176X<sv_usepvn_mg>
1177
1178Like C<sv_usepvn>, but also handles 'set' magic.
1179
1180 void sv_usepvn_mg(SV *sv, char *ptr, STRLEN len)
1181
1182=for hackers
1183Found in file mathoms.c
1184
9244d4ad
RGS
1185=item sv_uv
1186X<sv_uv>
1187
1188A private implementation of the C<SvUVx> macro for compilers which can't
1189cope with complex macro expressions. Always use the macro instead.
1190
1191 UV sv_uv(SV* sv)
1192
1193=for hackers
1194Found in file mathoms.c
1195
95be277c
NC
1196=item unpack_str
1197X<unpack_str>
1198
1199The engine implementing unpack() Perl function. Note: parameters strbeg, new_s
1200and ocnt are not used. This call should not be used, use unpackstring instead.
1201
1202 I32 unpack_str(const char *pat, const char *patend, const char *s, const char *strbeg, const char *strend, char **new_s, I32 ocnt, U32 flags)
1203
1204=for hackers
1205Found in file mathoms.c
1206
9244d4ad
RGS
1207
1208=back
1209
daad78fc
RGS
1210=head1 Functions in file pp_ctl.c
1211
1212
1213=over 8
1214
1215=item find_runcv
1216X<find_runcv>
1217
1218Locate the CV corresponding to the currently executing sub or eval.
1219If db_seqp is non_null, skip CVs that are in the DB package and populate
1220*db_seqp with the cop sequence number at the point that the DB:: code was
1221entered. (allows debuggers to eval in the scope of the breakpoint rather
1222than in the scope of the debugger itself).
1223
1224 CV* find_runcv(U32 *db_seqp)
1225
1226=for hackers
1227Found in file pp_ctl.c
1228
1229
1230=back
1231
6050d10e
JP
1232=head1 Functions in file pp_pack.c
1233
1234
1235=over 8
1236
7accc089 1237=item packlist
d8c40edc 1238X<packlist>
6050d10e
JP
1239
1240The engine implementing pack() Perl function.
1241
f7fe979e 1242 void packlist(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist)
7accc089
JH
1243
1244=for hackers
1245Found in file pp_pack.c
1246
7accc089 1247=item unpackstring
d8c40edc 1248X<unpackstring>
6050d10e 1249
608d3aed
LW
1250The engine implementing unpack() Perl function. C<unpackstring> puts the
1251extracted list items on the stack and returns the number of elements.
1252Issue C<PUTBACK> before and C<SPAGAIN> after the call to this function.
6050d10e 1253
f7fe979e 1254 I32 unpackstring(const char *pat, const char *patend, const char *s, const char *strend, U32 flags)
7accc089
JH
1255
1256=for hackers
1257Found in file pp_pack.c
1258
6050d10e
JP
1259
1260=back
1261
8226a3d7
NC
1262=head1 Functions in file pp_sys.c
1263
1264
1265=over 8
1266
1267=item setdefout
1268X<setdefout>
1269
1270Sets PL_defoutgv, the default file handle for output, to the passed in
1271typeglob. As PL_defoutgv "owns" a reference on its typeglob, the reference
1272count of the passed in typeglob is increased by one, and the reference count
1273of the typeglob that PL_defoutgv points to is decreased by one.
1274
1275 void setdefout(GV* gv)
1276
1277=for hackers
1278Found in file pp_sys.c
1279
1280
1281=back
1282
94bdecf9 1283=head1 GV Functions
6e9d1081 1284
94bdecf9 1285=over 8
6e9d1081 1286
954c1994 1287=item GvSV
d8c40edc 1288X<GvSV>
954c1994
GS
1289
1290Return the SV from the GV.
1291
1292 SV* GvSV(GV* gv)
1293
497711e7
GS
1294=for hackers
1295Found in file gv.h
1296
9f435386
RGS
1297=item gv_const_sv
1298X<gv_const_sv>
1299
1300If C<gv> is a typeglob whose subroutine entry is a constant sub eligible for
1301inlining, or C<gv> is a placeholder reference that would be promoted to such
1302a typeglob, then returns the value returned by the sub. Otherwise, returns
1303NULL.
1304
1305 SV* gv_const_sv(GV* gv)
1306
1307=for hackers
1308Found in file gv.c
1309
954c1994 1310=item gv_fetchmeth
d8c40edc 1311X<gv_fetchmeth>
954c1994
GS
1312
1313Returns the glob with the given C<name> and a defined subroutine or
1314C<NULL>. The glob lives in the given C<stash>, or in the stashes
a453c169 1315accessible via @ISA and UNIVERSAL::.
954c1994
GS
1316
1317The argument C<level> should be either 0 or -1. If C<level==0>, as a
1318side-effect creates a glob with the given C<name> in the given C<stash>
1319which in the case of success contains an alias for the subroutine, and sets
e1a479c5 1320up caching info for this glob.
954c1994
GS
1321
1322This function grants C<"SUPER"> token as a postfix of the stash name. The
1323GV returned from C<gv_fetchmeth> may be a method cache entry, which is not
4929bf7b 1324visible to Perl code. So when calling C<call_sv>, you should not use
954c1994 1325the GV directly; instead, you should use the method's CV, which can be
1c846c1f 1326obtained from the GV with the C<GvCV> macro.
954c1994
GS
1327
1328 GV* gv_fetchmeth(HV* stash, const char* name, STRLEN len, I32 level)
1329
497711e7
GS
1330=for hackers
1331Found in file gv.c
1332
954c1994 1333=item gv_fetchmethod_autoload
d8c40edc 1334X<gv_fetchmethod_autoload>
954c1994
GS
1335
1336Returns the glob which contains the subroutine to call to invoke the method
1337on the C<stash>. In fact in the presence of autoloading this may be the
1338glob for "AUTOLOAD". In this case the corresponding variable $AUTOLOAD is
1c846c1f 1339already setup.
954c1994
GS
1340
1341The third parameter of C<gv_fetchmethod_autoload> determines whether
1342AUTOLOAD lookup is performed if the given method is not present: non-zero
1c846c1f 1343means yes, look for AUTOLOAD; zero means no, don't look for AUTOLOAD.
954c1994 1344Calling C<gv_fetchmethod> is equivalent to calling C<gv_fetchmethod_autoload>
1c846c1f 1345with a non-zero C<autoload> parameter.
954c1994
GS
1346
1347These functions grant C<"SUPER"> token as a prefix of the method name. Note
1348that if you want to keep the returned glob for a long time, you need to
1349check for it being "AUTOLOAD", since at the later time the call may load a
1350different subroutine due to $AUTOLOAD changing its value. Use the glob
1c846c1f 1351created via a side effect to do this.
954c1994
GS
1352
1353These functions have the same side-effects and as C<gv_fetchmeth> with
1354C<level==0>. C<name> should be writable if contains C<':'> or C<'
1355''>. The warning against passing the GV returned by C<gv_fetchmeth> to
1c846c1f 1356C<call_sv> apply equally to these functions.
954c1994
GS
1357
1358 GV* gv_fetchmethod_autoload(HV* stash, const char* name, I32 autoload)
1359
497711e7
GS
1360=for hackers
1361Found in file gv.c
1362
0c81b680 1363=item gv_fetchmeth_autoload
d8c40edc 1364X<gv_fetchmeth_autoload>
0c81b680
JH
1365
1366Same as gv_fetchmeth(), but looks for autoloaded subroutines too.
1367Returns a glob for the subroutine.
1368
1369For an autoloaded subroutine without a GV, will create a GV even
1370if C<level < 0>. For an autoloaded subroutine without a stub, GvCV()
1371of the result may be zero.
1372
1373 GV* gv_fetchmeth_autoload(HV* stash, const char* name, STRLEN len, I32 level)
1374
1375=for hackers
1376Found in file gv.c
1377
954c1994 1378=item gv_stashpv
d8c40edc 1379X<gv_stashpv>
954c1994 1380
da51bb9b 1381Returns a pointer to the stash for a specified package. Uses C<strlen> to
75c442e4 1382determine the length of C<name>, then calls C<gv_stashpvn()>.
bc96cb06 1383
da51bb9b 1384 HV* gv_stashpv(const char* name, I32 flags)
bc96cb06
SH
1385
1386=for hackers
1387Found in file gv.c
1388
1389=item gv_stashpvn
d8c40edc 1390X<gv_stashpvn>
bc96cb06 1391
da51bb9b
NC
1392Returns a pointer to the stash for a specified package. The C<namelen>
1393parameter indicates the length of the C<name>, in bytes. C<flags> is passed
1394to C<gv_fetchpvn_flags()>, so if set to C<GV_ADD> then the package will be
1395created if it does not already exist. If the package does not exist and
1396C<flags> is 0 (or any other setting that does not create packages) then NULL
1397is returned.
954c1994 1398
da51bb9b
NC
1399
1400 HV* gv_stashpvn(const char* name, U32 namelen, I32 flags)
954c1994 1401
497711e7
GS
1402=for hackers
1403Found in file gv.c
1404
3fe05580
MHM
1405=item gv_stashpvs
1406X<gv_stashpvs>
1407
1408Like C<gv_stashpvn>, but takes a literal string instead of a string/length pair.
1409
1410 HV* gv_stashpvs(const char* name, I32 create)
1411
1412=for hackers
1413Found in file handy.h
1414
954c1994 1415=item gv_stashsv
d8c40edc 1416X<gv_stashsv>
954c1994 1417
da51bb9b 1418Returns a pointer to the stash for a specified package. See C<gv_stashpvn>.
954c1994 1419
da51bb9b 1420 HV* gv_stashsv(SV* sv, I32 flags)
954c1994 1421
497711e7
GS
1422=for hackers
1423Found in file gv.c
1424
954c1994 1425
94bdecf9 1426=back
954c1994 1427
94bdecf9 1428=head1 Handy Values
497711e7 1429
94bdecf9 1430=over 8
954c1994 1431
e509e693 1432=item Nullav
d8c40edc 1433X<Nullav>
497711e7 1434
e509e693 1435Null AV pointer.
954c1994 1436
3ae1b226
NC
1437(deprecated - use C<(AV *)NULL> instead)
1438
94bdecf9 1439=for hackers
e509e693 1440Found in file av.h
954c1994 1441
dd2155a4 1442=item Nullch
d8c40edc 1443X<Nullch>
94bdecf9 1444
24792b8d 1445Null character pointer. (No longer available when C<PERL_CORE> is defined.)
2307c6d0 1446
497711e7 1447=for hackers
94bdecf9 1448Found in file handy.h
497711e7 1449
e509e693 1450=item Nullcv
d8c40edc 1451X<Nullcv>
e509e693
SH
1452
1453Null CV pointer.
1454
3ae1b226
NC
1455(deprecated - use C<(CV *)NULL> instead)
1456
e509e693
SH
1457=for hackers
1458Found in file cv.h
1459
1460=item Nullhv
d8c40edc 1461X<Nullhv>
e509e693
SH
1462
1463Null HV pointer.
1464
3ae1b226
NC
1465(deprecated - use C<(HV *)NULL> instead)
1466
e509e693
SH
1467=for hackers
1468Found in file hv.h
1469
94bdecf9 1470=item Nullsv
d8c40edc 1471X<Nullsv>
954c1994 1472
24792b8d 1473Null SV pointer. (No longer available when C<PERL_CORE> is defined.)
954c1994 1474
497711e7 1475=for hackers
94bdecf9 1476Found in file handy.h
497711e7 1477
954c1994 1478
94bdecf9 1479=back
954c1994 1480
94bdecf9 1481=head1 Hash Manipulation Functions
497711e7 1482
94bdecf9 1483=over 8
954c1994 1484
94bdecf9 1485=item get_hv
d8c40edc 1486X<get_hv>
954c1994 1487
6673a63c
NC
1488Returns the HV of the specified Perl hash. C<flags> are passed to
1489C<gv_fetchpv>. If C<GV_ADD> is set and the
1490Perl variable does not exist then it will be created. If C<flags> is zero
1491and the variable does not exist then NULL is returned.
497711e7 1492
94bdecf9 1493NOTE: the perl_ form of this function is deprecated.
954c1994 1494
6673a63c 1495 HV* get_hv(const char *name, I32 flags)
954c1994 1496
497711e7 1497=for hackers
94bdecf9 1498Found in file perl.c
497711e7 1499
e509e693 1500=item HEf_SVKEY
d8c40edc 1501X<HEf_SVKEY>
e509e693
SH
1502
1503This flag, used in the length slot of hash entries and magic structures,
1504specifies the structure contains an C<SV*> pointer where a C<char*> pointer
1505is to be expected. (For information only--not to be used).
1506
1507=for hackers
1508Found in file hv.h
1509
954c1994 1510=item HeHASH
d8c40edc 1511X<HeHASH>
954c1994
GS
1512
1513Returns the computed hash stored in the hash entry.
1514
1515 U32 HeHASH(HE* he)
1516
497711e7
GS
1517=for hackers
1518Found in file hv.h
1519
954c1994 1520=item HeKEY
d8c40edc 1521X<HeKEY>
954c1994
GS
1522
1523Returns the actual pointer stored in the key slot of the hash entry. The
1524pointer may be either C<char*> or C<SV*>, depending on the value of
1525C<HeKLEN()>. Can be assigned to. The C<HePV()> or C<HeSVKEY()> macros are
1526usually preferable for finding the value of a key.
1527
1528 void* HeKEY(HE* he)
1529
497711e7
GS
1530=for hackers
1531Found in file hv.h
1532
954c1994 1533=item HeKLEN
d8c40edc 1534X<HeKLEN>
954c1994
GS
1535
1536If this is negative, and amounts to C<HEf_SVKEY>, it indicates the entry
1537holds an C<SV*> key. Otherwise, holds the actual length of the key. Can
1538be assigned to. The C<HePV()> macro is usually preferable for finding key
1539lengths.
1540
1541 STRLEN HeKLEN(HE* he)
1542
497711e7
GS
1543=for hackers
1544Found in file hv.h
1545
954c1994 1546=item HePV
d8c40edc 1547X<HePV>
954c1994
GS
1548
1549Returns the key slot of the hash entry as a C<char*> value, doing any
1550necessary dereferencing of possibly C<SV*> keys. The length of the string
1551is placed in C<len> (this is a macro, so do I<not> use C<&len>). If you do
1552not care about what the length of the key is, you may use the global
1553variable C<PL_na>, though this is rather less efficient than using a local
1554variable. Remember though, that hash keys in perl are free to contain
1555embedded nulls, so using C<strlen()> or similar is not a good way to find
1556the length of hash keys. This is very similar to the C<SvPV()> macro
289d3c6a
NC
1557described elsewhere in this document. See also C<HeUTF8>.
1558
1559If you are using C<HePV> to get values to pass to C<newSVpvn()> to create a
1560new SV, you should consider using C<newSVhek(HeKEY_hek(he))> as it is more
1561efficient.
954c1994
GS
1562
1563 char* HePV(HE* he, STRLEN len)
1564
497711e7
GS
1565=for hackers
1566Found in file hv.h
1567
954c1994 1568=item HeSVKEY
d8c40edc 1569X<HeSVKEY>
954c1994 1570
458cb9d2 1571Returns the key as an C<SV*>, or C<NULL> if the hash entry does not
954c1994
GS
1572contain an C<SV*> key.
1573
1574 SV* HeSVKEY(HE* he)
1575
497711e7
GS
1576=for hackers
1577Found in file hv.h
1578
954c1994 1579=item HeSVKEY_force
d8c40edc 1580X<HeSVKEY_force>
954c1994
GS
1581
1582Returns the key as an C<SV*>. Will create and return a temporary mortal
1583C<SV*> if the hash entry contains only a C<char*> key.
1584
1585 SV* HeSVKEY_force(HE* he)
1586
497711e7
GS
1587=for hackers
1588Found in file hv.h
1589
954c1994 1590=item HeSVKEY_set
d8c40edc 1591X<HeSVKEY_set>
954c1994
GS
1592
1593Sets the key to a given C<SV*>, taking care to set the appropriate flags to
1594indicate the presence of an C<SV*> key, and returns the same
1595C<SV*>.
1596
1597 SV* HeSVKEY_set(HE* he, SV* sv)
1598
497711e7
GS
1599=for hackers
1600Found in file hv.h
1601
289d3c6a
NC
1602=item HeUTF8
1603X<HeUTF8>
1604
1605Returns whether the C<char *> value returned by C<HePV> is encoded in UTF-8,
1606doing any necessary dereferencing of possibly C<SV*> keys. The value returned
0a0b43fa 1607will be 0 or non-0, not necessarily 1 (or even a value with any low bits set),
289d3c6a
NC
1608so B<do not> blindly assign this to a C<bool> variable, as C<bool> may be a
1609typedef for C<char>.
1610
1611 char* HeUTF8(HE* he, STRLEN len)
1612
1613=for hackers
1614Found in file hv.h
1615
954c1994 1616=item HeVAL
d8c40edc 1617X<HeVAL>
954c1994
GS
1618
1619Returns the value slot (type C<SV*>) stored in the hash entry.
1620
1621 SV* HeVAL(HE* he)
1622
497711e7
GS
1623=for hackers
1624Found in file hv.h
1625
954c1994 1626=item HvNAME
d8c40edc 1627X<HvNAME>
954c1994 1628
9282b5fd
SH
1629Returns the package name of a stash, or NULL if C<stash> isn't a stash.
1630See C<SvSTASH>, C<CvSTASH>.
954c1994
GS
1631
1632 char* HvNAME(HV* stash)
1633
497711e7
GS
1634=for hackers
1635Found in file hv.h
1636
ecae49c0 1637=item hv_assert
d8c40edc 1638X<hv_assert>
ecae49c0
NC
1639
1640Check that a hash is in an internally consistent state.
1641
4048f010 1642 void hv_assert(HV *hv)
ecae49c0
NC
1643
1644=for hackers
1645Found in file hv.c
1646
954c1994 1647=item hv_clear
d8c40edc 1648X<hv_clear>
954c1994
GS
1649
1650Clears a hash, making it empty.
1651
4048f010 1652 void hv_clear(HV *hv)
954c1994 1653
497711e7
GS
1654=for hackers
1655Found in file hv.c
1656
3540d4ce 1657=item hv_clear_placeholders
d8c40edc 1658X<hv_clear_placeholders>
3540d4ce
AB
1659
1660Clears any placeholders from a hash. If a restricted hash has any of its keys
1661marked as readonly and the key is subsequently deleted, the key is not actually
1662deleted but is marked by assigning it a value of &PL_sv_placeholder. This tags
1663it so it will be ignored by future operations such as iterating over the hash,
fa11829f 1664but will still allow the hash to have a value reassigned to the key at some
3540d4ce
AB
1665future point. This function clears any such placeholder keys from the hash.
1666See Hash::Util::lock_keys() for an example of its use.
1667
4048f010 1668 void hv_clear_placeholders(HV *hv)
3540d4ce
AB
1669
1670=for hackers
1671Found in file hv.c
1672
954c1994 1673=item hv_delete
d8c40edc 1674X<hv_delete>
954c1994
GS
1675
1676Deletes a key/value pair in the hash. The value SV is removed from the
1c846c1f 1677hash and returned to the caller. The C<klen> is the length of the key.
954c1994
GS
1678The C<flags> value will normally be zero; if set to G_DISCARD then NULL
1679will be returned.
1680
4048f010 1681 SV* hv_delete(HV *hv, const char *key, I32 klen, I32 flags)
954c1994 1682
497711e7
GS
1683=for hackers
1684Found in file hv.c
1685
954c1994 1686=item hv_delete_ent
d8c40edc 1687X<hv_delete_ent>
954c1994
GS
1688
1689Deletes a key/value pair in the hash. The value SV is removed from the
1690hash and returned to the caller. The C<flags> value will normally be zero;
1691if set to G_DISCARD then NULL will be returned. C<hash> can be a valid
1692precomputed hash value, or 0 to ask for it to be computed.
1693
4048f010 1694 SV* hv_delete_ent(HV *hv, SV *keysv, I32 flags, U32 hash)
954c1994 1695
497711e7
GS
1696=for hackers
1697Found in file hv.c
1698
954c1994 1699=item hv_exists
d8c40edc 1700X<hv_exists>
954c1994
GS
1701
1702Returns a boolean indicating whether the specified hash key exists. The
1703C<klen> is the length of the key.
1704
4048f010 1705 bool hv_exists(HV *hv, const char *key, I32 klen)
954c1994 1706
497711e7
GS
1707=for hackers
1708Found in file hv.c
1709
954c1994 1710=item hv_exists_ent
d8c40edc 1711X<hv_exists_ent>
954c1994
GS
1712
1713Returns a boolean indicating whether the specified hash key exists. C<hash>
1714can be a valid precomputed hash value, or 0 to ask for it to be
1715computed.
1716
4048f010 1717 bool hv_exists_ent(HV *hv, SV *keysv, U32 hash)
954c1994 1718
497711e7
GS
1719=for hackers
1720Found in file hv.c
1721
954c1994 1722=item hv_fetch
d8c40edc 1723X<hv_fetch>
954c1994
GS
1724
1725Returns the SV which corresponds to the specified key in the hash. The
1726C<klen> is the length of the key. If C<lval> is set then the fetch will be
1727part of a store. Check that the return value is non-null before
f4758303 1728dereferencing it to an C<SV*>.
954c1994 1729
96f1132b 1730See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
954c1994
GS
1731information on how to use this function on tied hashes.
1732
4048f010 1733 SV** hv_fetch(HV *hv, const char *key, I32 klen, I32 lval)
954c1994 1734
497711e7
GS
1735=for hackers
1736Found in file hv.c
1737
3fe05580
MHM
1738=item hv_fetchs
1739X<hv_fetchs>
1740
1741Like C<hv_fetch>, but takes a literal string instead of a string/length pair.
1742
1743 SV** hv_fetchs(HV* tb, const char* key, I32 lval)
1744
1745=for hackers
1746Found in file handy.h
1747
954c1994 1748=item hv_fetch_ent
d8c40edc 1749X<hv_fetch_ent>
954c1994
GS
1750
1751Returns the hash entry which corresponds to the specified key in the hash.
1752C<hash> must be a valid precomputed hash number for the given C<key>, or 0
1753if you want the function to compute it. IF C<lval> is set then the fetch
1754will be part of a store. Make sure the return value is non-null before
1755accessing it. The return value when C<tb> is a tied hash is a pointer to a
1756static location, so be sure to make a copy of the structure if you need to
1c846c1f 1757store it somewhere.
954c1994 1758
96f1132b 1759See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
954c1994
GS
1760information on how to use this function on tied hashes.
1761
4048f010 1762 HE* hv_fetch_ent(HV *hv, SV *keysv, I32 lval, U32 hash)
954c1994 1763
497711e7
GS
1764=for hackers
1765Found in file hv.c
1766
954c1994 1767=item hv_iterinit
d8c40edc 1768X<hv_iterinit>
954c1994
GS
1769
1770Prepares a starting point to traverse a hash table. Returns the number of
1771keys in the hash (i.e. the same as C<HvKEYS(tb)>). The return value is
1c846c1f 1772currently only meaningful for hashes without tie magic.
954c1994
GS
1773
1774NOTE: Before version 5.004_65, C<hv_iterinit> used to return the number of
1775hash buckets that happen to be in use. If you still need that esoteric
1776value, you can get it through the macro C<HvFILL(tb)>.
1777
641d4181 1778
4048f010 1779 I32 hv_iterinit(HV *hv)
954c1994 1780
497711e7
GS
1781=for hackers
1782Found in file hv.c
1783
954c1994 1784=item hv_iterkey
d8c40edc 1785X<hv_iterkey>
954c1994
GS
1786
1787Returns the key from the current position of the hash iterator. See
1788C<hv_iterinit>.
1789
1790 char* hv_iterkey(HE* entry, I32* retlen)
1791
497711e7
GS
1792=for hackers
1793Found in file hv.c
1794
954c1994 1795=item hv_iterkeysv
d8c40edc 1796X<hv_iterkeysv>
954c1994
GS
1797
1798Returns the key as an C<SV*> from the current position of the hash
1799iterator. The return value will always be a mortal copy of the key. Also
1800see C<hv_iterinit>.
1801
1802 SV* hv_iterkeysv(HE* entry)
1803
497711e7
GS
1804=for hackers
1805Found in file hv.c
1806
954c1994 1807=item hv_iternext
d8c40edc 1808X<hv_iternext>
954c1994
GS
1809
1810Returns entries from a hash iterator. See C<hv_iterinit>.
1811
641d4181
JH
1812You may call C<hv_delete> or C<hv_delete_ent> on the hash entry that the
1813iterator currently points to, without losing your place or invalidating your
1814iterator. Note that in this case the current entry is deleted from the hash
1815with your iterator holding the last reference to it. Your iterator is flagged
1816to free the entry on the next call to C<hv_iternext>, so you must not discard
1817your iterator immediately else the entry will leak - call C<hv_iternext> to
1818trigger the resource deallocation.
1819
4048f010 1820 HE* hv_iternext(HV *hv)
954c1994 1821
497711e7
GS
1822=for hackers
1823Found in file hv.c
1824
954c1994 1825=item hv_iternextsv
d8c40edc 1826X<hv_iternextsv>
954c1994
GS
1827
1828Performs an C<hv_iternext>, C<hv_iterkey>, and C<hv_iterval> in one
1829operation.
1830
4048f010 1831 SV* hv_iternextsv(HV *hv, char **key, I32 *retlen)
954c1994 1832
497711e7
GS
1833=for hackers
1834Found in file hv.c
1835
641d4181 1836=item hv_iternext_flags
d8c40edc 1837X<hv_iternext_flags>
641d4181
JH
1838
1839Returns entries from a hash iterator. See C<hv_iterinit> and C<hv_iternext>.
1840The C<flags> value will normally be zero; if HV_ITERNEXT_WANTPLACEHOLDERS is
1841set the placeholders keys (for restricted hashes) will be returned in addition
1842to normal keys. By default placeholders are automatically skipped over.
384679aa
RGS
1843Currently a placeholder is implemented with a value that is
1844C<&Perl_sv_placeholder>. Note that the implementation of placeholders and
641d4181
JH
1845restricted hashes may change, and the implementation currently is
1846insufficiently abstracted for any change to be tidy.
1847
1848NOTE: this function is experimental and may change or be
1849removed without notice.
1850
4048f010 1851 HE* hv_iternext_flags(HV *hv, I32 flags)
641d4181
JH
1852
1853=for hackers
1854Found in file hv.c
1855
954c1994 1856=item hv_iterval
d8c40edc 1857X<hv_iterval>
954c1994
GS
1858
1859Returns the value from the current position of the hash iterator. See
1860C<hv_iterkey>.
1861
4048f010 1862 SV* hv_iterval(HV *hv, HE *entry)
954c1994 1863
497711e7
GS
1864=for hackers
1865Found in file hv.c
1866
954c1994 1867=item hv_magic
d8c40edc 1868X<hv_magic>
954c1994
GS
1869
1870Adds magic to a hash. See C<sv_magic>.
1871
4048f010 1872 void hv_magic(HV *hv, GV *gv, int how)
954c1994 1873
497711e7
GS
1874=for hackers
1875Found in file hv.c
1876
a3bcc51e 1877=item hv_scalar
d8c40edc 1878X<hv_scalar>
a3bcc51e
TP
1879
1880Evaluates the hash in scalar context and returns the result. Handles magic when the hash is tied.
1881
4048f010 1882 SV* hv_scalar(HV *hv)
a3bcc51e
TP
1883
1884=for hackers
1885Found in file hv.c
1886
954c1994 1887=item hv_store
d8c40edc 1888X<hv_store>
954c1994
GS
1889
1890Stores an SV in a hash. The hash key is specified as C<key> and C<klen> is
1891the length of the key. The C<hash> parameter is the precomputed hash
1892value; if it is zero then Perl will compute it. The return value will be
1893NULL if the operation failed or if the value did not need to be actually
1894stored within the hash (as in the case of tied hashes). Otherwise it can
1895be dereferenced to get the original C<SV*>. Note that the caller is
1896responsible for suitably incrementing the reference count of C<val> before
7e8c5dac
HS
1897the call, and decrementing it if the function returned NULL. Effectively
1898a successful hv_store takes ownership of one reference to C<val>. This is
1899usually what you want; a newly created SV has a reference count of one, so
1900if all your code does is create SVs then store them in a hash, hv_store
1901will own the only reference to the new SV, and your code doesn't need to do
1902anything further to tidy up. hv_store is not implemented as a call to
1903hv_store_ent, and does not create a temporary SV for the key, so if your
1904key data is not already in SV form then use hv_store in preference to
1905hv_store_ent.
954c1994 1906
96f1132b 1907See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
954c1994
GS
1908information on how to use this function on tied hashes.
1909
4048f010 1910 SV** hv_store(HV *hv, const char *key, I32 klen, SV *val, U32 hash)
954c1994 1911
497711e7
GS
1912=for hackers
1913Found in file hv.c
1914
3fe05580
MHM
1915=item hv_stores
1916X<hv_stores>
1917
1918Like C<hv_store>, but takes a literal string instead of a string/length pair
1919and omits the hash parameter.
1920
1921 SV** hv_stores(HV* tb, const char* key, NULLOK SV* val)
1922
1923=for hackers
1924Found in file handy.h
1925
954c1994 1926=item hv_store_ent
d8c40edc 1927X<hv_store_ent>
954c1994
GS
1928
1929Stores C<val> in a hash. The hash key is specified as C<key>. The C<hash>
1930parameter is the precomputed hash value; if it is zero then Perl will
1931compute it. The return value is the new hash entry so created. It will be
1932NULL if the operation failed or if the value did not need to be actually
1933stored within the hash (as in the case of tied hashes). Otherwise the
f22d8e4b 1934contents of the return value can be accessed using the C<He?> macros
954c1994
GS
1935described here. Note that the caller is responsible for suitably
1936incrementing the reference count of C<val> before the call, and
7e8c5dac
HS
1937decrementing it if the function returned NULL. Effectively a successful
1938hv_store_ent takes ownership of one reference to C<val>. This is
1939usually what you want; a newly created SV has a reference count of one, so
1940if all your code does is create SVs then store them in a hash, hv_store
1941will own the only reference to the new SV, and your code doesn't need to do
1942anything further to tidy up. Note that hv_store_ent only reads the C<key>;
1943unlike C<val> it does not take ownership of it, so maintaining the correct
1944reference count on C<key> is entirely the caller's responsibility. hv_store
1945is not implemented as a call to hv_store_ent, and does not create a temporary
1946SV for the key, so if your key data is not already in SV form then use
1947hv_store in preference to hv_store_ent.
954c1994 1948
96f1132b 1949See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
954c1994
GS
1950information on how to use this function on tied hashes.
1951
4048f010 1952 HE* hv_store_ent(HV *hv, SV *key, SV *val, U32 hash)
954c1994 1953
497711e7
GS
1954=for hackers
1955Found in file hv.c
1956
954c1994 1957=item hv_undef
d8c40edc 1958X<hv_undef>
954c1994
GS
1959
1960Undefines the hash.
1961
4048f010 1962 void hv_undef(HV *hv)
954c1994 1963
497711e7
GS
1964=for hackers
1965Found in file hv.c
1966
94bdecf9 1967=item newHV
d8c40edc 1968X<newHV>
d2cc3551 1969
94bdecf9 1970Creates a new HV. The reference count is set to 1.
d2cc3551 1971
94bdecf9 1972 HV* newHV()
d2cc3551
JH
1973
1974=for hackers
6fc9eaaa 1975Found in file hv.h
d2cc3551 1976
954c1994 1977
94bdecf9 1978=back
954c1994 1979
94bdecf9 1980=head1 Magical Functions
954c1994 1981
94bdecf9 1982=over 8
497711e7 1983
94bdecf9 1984=item mg_clear
d8c40edc 1985X<mg_clear>
954c1994 1986
94bdecf9 1987Clear something magical that the SV represents. See C<sv_magic>.
954c1994 1988
94bdecf9 1989 int mg_clear(SV* sv)
954c1994 1990
497711e7 1991=for hackers
94bdecf9 1992Found in file mg.c
497711e7 1993
94bdecf9 1994=item mg_copy
d8c40edc 1995X<mg_copy>
954c1994 1996
94bdecf9 1997Copies the magic from one SV to another. See C<sv_magic>.
954c1994 1998
4048f010 1999 int mg_copy(SV *sv, SV *nsv, const char *key, I32 klen)
954c1994 2000
497711e7 2001=for hackers
94bdecf9 2002Found in file mg.c
497711e7 2003
94bdecf9 2004=item mg_find
d8c40edc 2005X<mg_find>
954c1994 2006
94bdecf9 2007Finds the magic pointer for type matching the SV. See C<sv_magic>.
954c1994 2008
35a4481c 2009 MAGIC* mg_find(const SV* sv, int type)
954c1994 2010
497711e7 2011=for hackers
94bdecf9 2012Found in file mg.c
497711e7 2013
94bdecf9 2014=item mg_free
d8c40edc 2015X<mg_free>
954c1994 2016
94bdecf9 2017Free any magic storage used by the SV. See C<sv_magic>.
954c1994 2018
94bdecf9 2019 int mg_free(SV* sv)
954c1994 2020
497711e7 2021=for hackers
94bdecf9 2022Found in file mg.c
497711e7 2023
94bdecf9 2024=item mg_get
d8c40edc 2025X<mg_get>
eebe1485 2026
94bdecf9 2027Do magic after a value is retrieved from the SV. See C<sv_magic>.
282f25c9 2028
94bdecf9 2029 int mg_get(SV* sv)
eebe1485
SC
2030
2031=for hackers
94bdecf9 2032Found in file mg.c
eebe1485 2033
94bdecf9 2034=item mg_length
d8c40edc 2035X<mg_length>
eebe1485 2036
94bdecf9 2037Report on the SV's length. See C<sv_magic>.
eebe1485 2038
94bdecf9 2039 U32 mg_length(SV* sv)
eebe1485
SC
2040
2041=for hackers
94bdecf9 2042Found in file mg.c
eebe1485 2043
94bdecf9 2044=item mg_magical
d8c40edc 2045X<mg_magical>
954c1994 2046
94bdecf9 2047Turns on the magical status of an SV. See C<sv_magic>.
954c1994 2048
94bdecf9 2049 void mg_magical(SV* sv)
954c1994 2050
497711e7 2051=for hackers
94bdecf9 2052Found in file mg.c
497711e7 2053
94bdecf9 2054=item mg_set
d8c40edc 2055X<mg_set>
954c1994 2056
94bdecf9 2057Do magic after a value is assigned to the SV. See C<sv_magic>.
954c1994 2058
94bdecf9 2059 int mg_set(SV* sv)
954c1994 2060
497711e7 2061=for hackers
94bdecf9 2062Found in file mg.c
497711e7 2063
94bdecf9 2064=item SvGETMAGIC
d8c40edc 2065X<SvGETMAGIC>
954c1994 2066
94bdecf9
JH
2067Invokes C<mg_get> on an SV if it has 'get' magic. This macro evaluates its
2068argument more than once.
954c1994 2069
94bdecf9 2070 void SvGETMAGIC(SV* sv)
954c1994 2071
497711e7 2072=for hackers
94bdecf9 2073Found in file sv.h
497711e7 2074
a4f1a029 2075=item SvLOCK
d8c40edc 2076X<SvLOCK>
a4f1a029
NIS
2077
2078Arranges for a mutual exclusion lock to be obtained on sv if a suitable module
2079has been loaded.
2080
2081 void SvLOCK(SV* sv)
2082
2083=for hackers
2084Found in file sv.h
2085
94bdecf9 2086=item SvSETMAGIC
d8c40edc 2087X<SvSETMAGIC>
7d3fb230 2088
94bdecf9
JH
2089Invokes C<mg_set> on an SV if it has 'set' magic. This macro evaluates its
2090argument more than once.
7d3fb230 2091
94bdecf9 2092 void SvSETMAGIC(SV* sv)
7d3fb230
BS
2093
2094=for hackers
94bdecf9 2095Found in file sv.h
7d3fb230 2096
94bdecf9 2097=item SvSetMagicSV
d8c40edc 2098X<SvSetMagicSV>
954c1994 2099
94bdecf9 2100Like C<SvSetSV>, but does any set magic required afterwards.
954c1994 2101
94bdecf9 2102 void SvSetMagicSV(SV* dsb, SV* ssv)
954c1994 2103
497711e7 2104=for hackers
94bdecf9 2105Found in file sv.h
497711e7 2106
a4f1a029 2107=item SvSetMagicSV_nosteal
d8c40edc 2108X<SvSetMagicSV_nosteal>
a4f1a029 2109
80663158 2110Like C<SvSetSV_nosteal>, but does any set magic required afterwards.
a4f1a029
NIS
2111
2112 void SvSetMagicSV_nosteal(SV* dsv, SV* ssv)
2113
2114=for hackers
2115Found in file sv.h
2116
94bdecf9 2117=item SvSetSV
d8c40edc 2118X<SvSetSV>
954c1994 2119
94bdecf9
JH
2120Calls C<sv_setsv> if dsv is not the same as ssv. May evaluate arguments
2121more than once.
2122
2123 void SvSetSV(SV* dsb, SV* ssv)
954c1994 2124
497711e7 2125=for hackers
94bdecf9 2126Found in file sv.h
497711e7 2127
94bdecf9 2128=item SvSetSV_nosteal
d8c40edc 2129X<SvSetSV_nosteal>
954c1994 2130
94bdecf9
JH
2131Calls a non-destructive version of C<sv_setsv> if dsv is not the same as
2132ssv. May evaluate arguments more than once.
954c1994 2133
94bdecf9 2134 void SvSetSV_nosteal(SV* dsv, SV* ssv)
954c1994 2135
497711e7 2136=for hackers
94bdecf9 2137Found in file sv.h
497711e7 2138
a4f1a029 2139=item SvSHARE
d8c40edc 2140X<SvSHARE>
a4f1a029
NIS
2141
2142Arranges for sv to be shared between threads if a suitable module
2143has been loaded.
2144
2145 void SvSHARE(SV* sv)
2146
2147=for hackers
2148Found in file sv.h
2149
e509e693 2150=item SvUNLOCK
d8c40edc 2151X<SvUNLOCK>
e509e693
SH
2152
2153Releases a mutual exclusion lock on sv if a suitable module
2154has been loaded.
2155
2156 void SvUNLOCK(SV* sv)
2157
2158=for hackers
2159Found in file sv.h
2160
954c1994 2161
94bdecf9 2162=back
954c1994 2163
94bdecf9 2164=head1 Memory Management
954c1994 2165
94bdecf9 2166=over 8
497711e7 2167
94bdecf9 2168=item Copy
d8c40edc 2169X<Copy>
954c1994 2170
94bdecf9
JH
2171The XSUB-writer's interface to the C C<memcpy> function. The C<src> is the
2172source, C<dest> is the destination, C<nitems> is the number of items, and C<type> is
2173the type. May fail on overlapping copies. See also C<Move>.
954c1994 2174
94bdecf9 2175 void Copy(void* src, void* dest, int nitems, type)
954c1994 2176
497711e7 2177=for hackers
94bdecf9 2178Found in file handy.h
497711e7 2179
e90e2364 2180=item CopyD
d8c40edc 2181X<CopyD>
e90e2364
NC
2182
2183Like C<Copy> but returns dest. Useful for encouraging compilers to tail-call
2184optimise.
2185
2186 void * CopyD(void* src, void* dest, int nitems, type)
2187
2188=for hackers
2189Found in file handy.h
2190
94bdecf9 2191=item Move
d8c40edc 2192X<Move>
954c1994 2193
94bdecf9
JH
2194The XSUB-writer's interface to the C C<memmove> function. The C<src> is the
2195source, C<dest> is the destination, C<nitems> is the number of items, and C<type> is
2196the type. Can do overlapping moves. See also C<Copy>.
954c1994 2197
94bdecf9 2198 void Move(void* src, void* dest, int nitems, type)
954c1994 2199
497711e7 2200=for hackers
94bdecf9 2201Found in file handy.h
497711e7 2202
e90e2364 2203=item MoveD
d8c40edc 2204X<MoveD>
e90e2364
NC
2205
2206Like C<Move> but returns dest. Useful for encouraging compilers to tail-call
2207optimise.
2208
2209 void * MoveD(void* src, void* dest, int nitems, type)
2210
2211=for hackers
2212Found in file handy.h
2213
a02a5408 2214=item Newx
d8c40edc 2215X<Newx>
954c1994 2216
94bdecf9 2217The XSUB-writer's interface to the C C<malloc> function.
954c1994 2218
c5008215
JC
2219In 5.9.3, Newx() and friends replace the older New() API, and drops
2220the first parameter, I<x>, a debug aid which allowed callers to identify
37b8b4c9 2221themselves. This aid has been superseded by a new build option,
c5008215
JC
2222PERL_MEM_LOG (see L<perlhack/PERL_MEM_LOG>). The older API is still
2223there for use in XS modules supporting older perls.
2224
a02a5408 2225 void Newx(void* ptr, int nitems, type)
954c1994 2226
497711e7 2227=for hackers
94bdecf9 2228Found in file handy.h
497711e7 2229
a02a5408 2230=item Newxc
d8c40edc 2231X<Newxc>
954c1994 2232
94bdecf9 2233The XSUB-writer's interface to the C C<malloc> function, with
c5008215 2234cast. See also C<Newx>.
954c1994 2235
a02a5408 2236 void Newxc(void* ptr, int nitems, type, cast)
954c1994 2237
497711e7 2238=for hackers
94bdecf9 2239Found in file handy.h
954c1994 2240
a02a5408 2241=item Newxz
d8c40edc 2242X<Newxz>
954c1994 2243
94bdecf9 2244The XSUB-writer's interface to the C C<malloc> function. The allocated
c5008215 2245memory is zeroed with C<memzero>. See also C<Newx>.
a02a5408
JC
2246
2247 void Newxz(void* ptr, int nitems, type)
954c1994 2248
497711e7
GS
2249=for hackers
2250Found in file handy.h
2251
9965345d 2252=item Poison
d8c40edc 2253X<Poison>
9965345d 2254
7e337ee0 2255PoisonWith(0xEF) for catching access to freed memory.
9965345d
JH
2256
2257 void Poison(void* dest, int nitems, type)
2258
2259=for hackers
2260Found in file handy.h
2261
3fe05580
MHM
2262=item PoisonFree
2263X<PoisonFree>
2264
2265PoisonWith(0xEF) for catching access to freed memory.
2266
2267 void PoisonFree(void* dest, int nitems, type)
2268
2269=for hackers
2270Found in file handy.h
2271
7e337ee0
JH
2272=item PoisonNew
2273X<PoisonNew>
2274
2275PoisonWith(0xAB) for catching access to allocated but uninitialized memory.
2276
2277 void PoisonNew(void* dest, int nitems, type)
2278
2279=for hackers
2280Found in file handy.h
2281
2282=item PoisonWith
2283X<PoisonWith>
2284
2285Fill up memory with a byte pattern (a byte repeated over and over
2286again) that hopefully catches attempts to access uninitialized memory.
2287
2288 void PoisonWith(void* dest, int nitems, type, U8 byte)
2289
2290=for hackers
2291Found in file handy.h
2292
94bdecf9 2293=item Renew
d8c40edc 2294X<Renew>
954c1994 2295
94bdecf9 2296The XSUB-writer's interface to the C C<realloc> function.
954c1994 2297
94bdecf9 2298 void Renew(void* ptr, int nitems, type)
954c1994 2299
497711e7
GS
2300=for hackers
2301Found in file handy.h
2302
94bdecf9 2303=item Renewc
d8c40edc 2304X<Renewc>
954c1994 2305
94bdecf9
JH
2306The XSUB-writer's interface to the C C<realloc> function, with
2307cast.
954c1994 2308
94bdecf9 2309 void Renewc(void* ptr, int nitems, type, cast)
954c1994 2310
497711e7 2311=for hackers
94bdecf9 2312Found in file handy.h
497711e7 2313
94bdecf9 2314=item Safefree
d8c40edc 2315X<Safefree>
954c1994 2316
94bdecf9 2317The XSUB-writer's interface to the C C<free> function.
954c1994 2318
94bdecf9 2319 void Safefree(void* ptr)
954c1994 2320
497711e7
GS
2321=for hackers
2322Found in file handy.h
2323
94bdecf9 2324=item savepv
d8c40edc 2325X<savepv>
954c1994 2326
641d4181
JH
2327Perl's version of C<strdup()>. Returns a pointer to a newly allocated
2328string which is a duplicate of C<pv>. The size of the string is
2329determined by C<strlen()>. The memory allocated for the new string can
2330be freed with the C<Safefree()> function.
954c1994 2331
641d4181 2332 char* savepv(const char* pv)
954c1994 2333
497711e7 2334=for hackers
94bdecf9 2335Found in file util.c
497711e7 2336
94bdecf9 2337=item savepvn
d8c40edc 2338X<savepvn>
954c1994 2339
641d4181
JH
2340Perl's version of what C<strndup()> would be if it existed. Returns a
2341pointer to a newly allocated string which is a duplicate of the first
cbf82dd0
NC
2342C<len> bytes from C<pv>, plus a trailing NUL byte. The memory allocated for
2343the new string can be freed with the C<Safefree()> function.
954c1994 2344
641d4181 2345 char* savepvn(const char* pv, I32 len)
954c1994 2346
497711e7 2347=for hackers
94bdecf9 2348Found in file util.c
497711e7 2349
3fe05580
MHM
2350=item savepvs
2351X<savepvs>
2352
2353Like C<savepvn>, but takes a literal string instead of a string/length pair.
2354
2355 char* savepvs(const char* s)
2356
2357=for hackers
2358Found in file handy.h
2359
a4f1a029 2360=item savesharedpv
d8c40edc 2361X<savesharedpv>
a4f1a029 2362
641d4181
JH
2363A version of C<savepv()> which allocates the duplicate string in memory
2364which is shared between threads.
a4f1a029 2365
641d4181 2366 char* savesharedpv(const char* pv)
a4f1a029
NIS
2367
2368=for hackers
2369Found in file util.c
2370
d9095cec
NC
2371=item savesharedpvn
2372X<savesharedpvn>
2373
2374A version of C<savepvn()> which allocates the duplicate string in memory
2375which is shared between threads. (With the specific difference that a NULL
2376pointer is not acceptable)
2377
2378 char* savesharedpvn(const char *const pv, const STRLEN len)
2379
2380=for hackers
2381Found in file util.c
2382
766f8916 2383=item savesvpv
d8c40edc 2384X<savesvpv>
766f8916 2385
9c2fe30c 2386A version of C<savepv()>/C<savepvn()> which gets the string to duplicate from
766f8916
MHM
2387the passed in SV using C<SvPV()>
2388
2389 char* savesvpv(SV* sv)
2390
2391=for hackers
2392Found in file util.c
2393
94bdecf9 2394=item StructCopy
d8c40edc 2395X<StructCopy>
954c1994 2396
94bdecf9 2397This is an architecture-independent macro to copy one structure to another.
954c1994 2398
94bdecf9 2399 void StructCopy(type src, type dest, type)
954c1994 2400
497711e7 2401=for hackers
94bdecf9 2402Found in file handy.h
497711e7 2403
94bdecf9 2404=item Zero
d8c40edc 2405X<Zero>
954c1994 2406
94bdecf9
JH
2407The XSUB-writer's interface to the C C<memzero> function. The C<dest> is the
2408destination, C<nitems> is the number of items, and C<type> is the type.
954c1994 2409
94bdecf9 2410 void Zero(void* dest, int nitems, type)
954c1994 2411
497711e7 2412=for hackers
94bdecf9 2413Found in file handy.h
497711e7 2414
e90e2364 2415=item ZeroD
d8c40edc 2416X<ZeroD>
e90e2364
NC
2417
2418Like C<Zero> but returns dest. Useful for encouraging compilers to tail-call
2419optimise.
2420
2421 void * ZeroD(void* dest, int nitems, type)
2422
2423=for hackers
2424Found in file handy.h
2425
954c1994 2426
94bdecf9 2427=back
954c1994 2428
94bdecf9 2429=head1 Miscellaneous Functions
954c1994 2430
94bdecf9 2431=over 8
497711e7 2432
94bdecf9 2433=item fbm_compile
d8c40edc 2434X<fbm_compile>
8b4ac5a4 2435
94bdecf9
JH
2436Analyses the string in order to make fast searches on it using fbm_instr()
2437-- the Boyer-Moore algorithm.
8b4ac5a4 2438
94bdecf9 2439 void fbm_compile(SV* sv, U32 flags)
8b4ac5a4
JH
2440
2441=for hackers
94bdecf9 2442Found in file util.c
8b4ac5a4 2443
94bdecf9 2444=item fbm_instr
d8c40edc 2445X<fbm_instr>
954c1994 2446
94bdecf9 2447Returns the location of the SV in the string delimited by C<str> and
bd61b366 2448C<strend>. It returns C<NULL> if the string can't be found. The C<sv>
94bdecf9
JH
2449does not have to be fbm_compiled, but the search will not be as fast
2450then.
954c1994 2451
4048f010 2452 char* fbm_instr(unsigned char* big, unsigned char* bigend, SV* littlestr, U32 flags)
954c1994 2453
497711e7 2454=for hackers
94bdecf9 2455Found in file util.c
497711e7 2456
94bdecf9 2457=item form
d8c40edc 2458X<form>
954c1994 2459
94bdecf9
JH
2460Takes a sprintf-style format pattern and conventional
2461(non-SV) arguments and returns the formatted string.
954c1994 2462
94bdecf9 2463 (char *) Perl_form(pTHX_ const char* pat, ...)
954c1994 2464
94bdecf9 2465can be used any place a string (char *) is required:
497711e7 2466
94bdecf9 2467 char * s = Perl_form("%d.%d",major,minor);
954c1994 2468
94bdecf9
JH
2469Uses a single private buffer so if you want to format several strings you
2470must explicitly copy the earlier strings away (and free the copies when you
2471are done).
954c1994 2472
94bdecf9 2473 char* form(const char* pat, ...)
954c1994 2474
497711e7 2475=for hackers
94bdecf9 2476Found in file util.c
497711e7 2477
94bdecf9 2478=item getcwd_sv
d8c40edc 2479X<getcwd_sv>
954c1994 2480
94bdecf9 2481Fill the sv with current working directory
954c1994 2482
94bdecf9 2483 int getcwd_sv(SV* sv)
954c1994 2484
497711e7 2485=for hackers
94bdecf9 2486Found in file util.c
497711e7 2487
d9fad198
JH
2488=item my_snprintf
2489X<my_snprintf>
2490
2491The C library C<snprintf> functionality, if available and
5b692037 2492standards-compliant (uses C<vsnprintf>, actually). However, if the
d9fad198 2493C<vsnprintf> is not available, will unfortunately use the unsafe
5b692037
JH
2494C<vsprintf> which can overrun the buffer (there is an overrun check,
2495but that may be too late). Consider using C<sv_vcatpvf> instead, or
2496getting C<vsnprintf>.
d9fad198
JH
2497
2498 int my_snprintf(char *buffer, const Size_t len, const char *format, ...)
2499
2500=for hackers
2501Found in file util.c
2502
9244d4ad
RGS
2503=item my_sprintf
2504X<my_sprintf>
2505
2506The C library C<sprintf>, wrapped if necessary, to ensure that it will return
2507the length of the string written to the buffer. Only rare pre-ANSI systems
2508need the wrapper function - usually this is a direct call to C<sprintf>.
2509
2510 int my_sprintf(char *buffer, const char *pat, ...)
2511
2512=for hackers
2513Found in file util.c
2514
d9fad198
JH
2515=item my_vsnprintf
2516X<my_vsnprintf>
2517
5b692037
JH
2518The C library C<vsnprintf> if available and standards-compliant.
2519However, if if the C<vsnprintf> is not available, will unfortunately
2520use the unsafe C<vsprintf> which can overrun the buffer (there is an
2521overrun check, but that may be too late). Consider using
2522C<sv_vcatpvf> instead, or getting C<vsnprintf>.
d9fad198
JH
2523
2524 int my_vsnprintf(char *buffer, const Size_t len, const char *format, va_list ap)
2525
2526=for hackers
2527Found in file util.c
2528
f333445c 2529=item new_version
d8c40edc 2530X<new_version>
f333445c
JP
2531
2532Returns a new version object based on the passed in SV:
2533
2534 SV *sv = new_version(SV *ver);
2535
2536Does not alter the passed in ver SV. See "upg_version" if you
2537want to upgrade the SV.
2538
2539 SV* new_version(SV *ver)
2540
2541=for hackers
2542Found in file util.c
2543
2544=item scan_version
d8c40edc 2545X<scan_version>
f333445c
JP
2546
2547Returns a pointer to the next character after the parsed
2548version string, as well as upgrading the passed in SV to
2549an RV.
2550
2551Function must be called with an already existing SV like
2552
137d6fc0 2553 sv = newSV(0);
8a0be661 2554 s = scan_version(s, SV *sv, bool qv);
f333445c
JP
2555
2556Performs some preprocessing to the string to ensure that
2557it has the correct characteristics of a version. Flags the
2558object if it contains an underscore (which denotes this
8a0be661 2559is an alpha version). The boolean qv denotes that the version
137d6fc0
JP
2560should be interpreted as if it had multiple decimals, even if
2561it doesn't.
f333445c 2562
4048f010 2563 const char* scan_version(const char *s, SV *rv, bool qv)
f333445c
JP
2564
2565=for hackers
2566Found in file util.c
2567
94bdecf9 2568=item strEQ
d8c40edc 2569X<strEQ>
954c1994 2570
94bdecf9 2571Test two strings to see if they are equal. Returns true or false.
954c1994 2572
94bdecf9 2573 bool strEQ(char* s1, char* s2)
954c1994 2574
497711e7 2575=for hackers
94bdecf9 2576Found in file handy.h
497711e7 2577
94bdecf9 2578=item strGE
d8c40edc 2579X<strGE>
1c846c1f 2580
94bdecf9
JH
2581Test two strings to see if the first, C<s1>, is greater than or equal to
2582the second, C<s2>. Returns true or false.
1c846c1f 2583
94bdecf9 2584 bool strGE(char* s1, char* s2)
1c846c1f
NIS
2585
2586=for hackers
94bdecf9 2587Found in file handy.h
1c846c1f 2588
94bdecf9 2589=item strGT
d8c40edc 2590X<strGT>
954c1994 2591
94bdecf9
JH
2592Test two strings to see if the first, C<s1>, is greater than the second,
2593C<s2>. Returns true or false.
954c1994 2594
94bdecf9 2595 bool strGT(char* s1, char* s2)
954c1994 2596
497711e7 2597=for hackers
94bdecf9 2598Found in file handy.h
497711e7 2599
94bdecf9 2600=item strLE
d8c40edc 2601X<strLE>
954c1994 2602
94bdecf9
JH
2603Test two strings to see if the first, C<s1>, is less than or equal to the
2604second, C<s2>. Returns true or false.
954c1994 2605
94bdecf9 2606 bool strLE(char* s1, char* s2)
954c1994 2607
497711e7 2608=for hackers
94bdecf9 2609Found in file handy.h
497711e7 2610
94bdecf9 2611=item strLT
d8c40edc 2612X<strLT>
1a3327fb 2613
94bdecf9
JH
2614Test two strings to see if the first, C<s1>, is less than the second,
2615C<s2>. Returns true or false.
1a3327fb 2616
94bdecf9 2617 bool strLT(char* s1, char* s2)
1a3327fb 2618
497711e7 2619=for hackers
94bdecf9 2620Found in file handy.h
497711e7 2621
94bdecf9 2622=item strNE
d8c40edc 2623X<strNE>
954c1994 2624
94bdecf9
JH
2625Test two strings to see if they are different. Returns true or
2626false.
2627
2628 bool strNE(char* s1, char* s2)
954c1994 2629
497711e7 2630=for hackers
94bdecf9 2631Found in file handy.h
497711e7 2632
94bdecf9 2633=item strnEQ
d8c40edc 2634X<strnEQ>
954c1994 2635
94bdecf9
JH
2636Test two strings to see if they are equal. The C<len> parameter indicates
2637the number of bytes to compare. Returns true or false. (A wrapper for
2638C<strncmp>).
2639
2640 bool strnEQ(char* s1, char* s2, STRLEN len)
954c1994 2641
497711e7 2642=for hackers
94bdecf9 2643Found in file handy.h
497711e7 2644
94bdecf9 2645=item strnNE
d8c40edc 2646X<strnNE>
954c1994 2647
94bdecf9
JH
2648Test two strings to see if they are different. The C<len> parameter
2649indicates the number of bytes to compare. Returns true or false. (A
2650wrapper for C<strncmp>).
954c1994 2651
94bdecf9 2652 bool strnNE(char* s1, char* s2, STRLEN len)
954c1994 2653
497711e7
GS
2654=for hackers
2655Found in file handy.h
2656
eba16661
JH
2657=item sv_destroyable
2658X<sv_destroyable>
2659
2660Dummy routine which reports that object can be destroyed when there is no
2661sharing module present. It ignores its single SV argument, and returns
2662'true'. Exists to avoid test for a NULL function pointer and because it
2663could potentially warn under some level of strict-ness.
2664
2665 bool sv_destroyable(SV *sv)
2666
2667=for hackers
2668Found in file util.c
2669
f333445c 2670=item sv_nosharing
d8c40edc 2671X<sv_nosharing>
f333445c
JP
2672
2673Dummy routine which "shares" an SV when there is no sharing module present.
9244d4ad
RGS
2674Or "locks" it. Or "unlocks" it. In other words, ignores its single SV argument.
2675Exists to avoid test for a NULL function pointer and because it could
2676potentially warn under some level of strict-ness.
f333445c 2677
c48640ec 2678 void sv_nosharing(SV *sv)
f333445c
JP
2679
2680=for hackers
2681Found in file util.c
2682
f333445c 2683=item upg_version
d8c40edc 2684X<upg_version>
f333445c
JP
2685
2686In-place upgrade of the supplied SV to a version object.
2687
ac0e6a2f 2688 SV *sv = upg_version(SV *sv, bool qv);
f333445c 2689
ac0e6a2f
RGS
2690Returns a pointer to the upgraded SV. Set the boolean qv if you want
2691to force this SV to be interpreted as an "extended" version.
f333445c 2692
ac0e6a2f 2693 SV* upg_version(SV *ver, bool qv)
f333445c
JP
2694
2695=for hackers
2696Found in file util.c
2697
2698=item vcmp
d8c40edc 2699X<vcmp>
f333445c
JP
2700
2701Version object aware cmp. Both operands must already have been
2702converted into version objects.
2703
4048f010 2704 int vcmp(SV *lhv, SV *rhv)
f333445c
JP
2705
2706=for hackers
2707Found in file util.c
2708
b9381830 2709=item vnormal
d8c40edc 2710X<vnormal>
b9381830
JP
2711
2712Accepts a version object and returns the normalized string
2713representation. Call like:
2714
2715 sv = vnormal(rv);
2716
2717NOTE: you can pass either the object directly or the SV
2718contained within the RV.
2719
2720 SV* vnormal(SV *vs)
2721
2722=for hackers
2723Found in file util.c
2724
f333445c 2725=item vnumify
d8c40edc 2726X<vnumify>
f333445c
JP
2727
2728Accepts a version object and returns the normalized floating
2729point representation. Call like:
2730
2731 sv = vnumify(rv);
2732
2733NOTE: you can pass either the object directly or the SV
2734contained within the RV.
2735
2736 SV* vnumify(SV *vs)
2737
2738=for hackers
2739Found in file util.c
2740
2741=item vstringify
d8c40edc 2742X<vstringify>
f333445c 2743
b9381830
JP
2744In order to maintain maximum compatibility with earlier versions
2745of Perl, this function will return either the floating point
2746notation or the multiple dotted notation, depending on whether
2747the original version contained 1 or more dots, respectively
f333445c
JP
2748
2749 SV* vstringify(SV *vs)
2750
2751=for hackers
2752Found in file util.c
2753
e0218a61 2754=item vverify
d8c40edc 2755X<vverify>
e0218a61
JP
2756
2757Validates that the SV contains a valid version object.
2758
2759 bool vverify(SV *vobj);
2760
2761Note that it only confirms the bare minimum structure (so as not to get
2762confused by derived classes which may contain additional hash entries):
2763
2764 bool vverify(SV *vs)
2765
2766=for hackers
2767Found in file util.c
2768
f4758303 2769
94bdecf9 2770=back
7207e29d 2771
47c9dd14
BB
2772=head1 MRO Functions
2773
2774=over 8
2775
2776=item mro_get_linear_isa
2777X<mro_get_linear_isa>
2778
2779Returns either C<mro_get_linear_isa_c3> or
2780C<mro_get_linear_isa_dfs> for the given stash,
2781dependant upon which MRO is in effect
2782for that stash. The return value is a
2783read-only AV*.
2784
2785You are responsible for C<SvREFCNT_inc()> on the
2786return value if you plan to store it anywhere
2787semi-permanently (otherwise it might be deleted
2788out from under you the next time the cache is
2789invalidated).
2790
2791 AV* mro_get_linear_isa(HV* stash)
2792
2793=for hackers
2794Found in file mro.c
2795
47c9dd14
BB
2796=item mro_method_changed_in
2797X<mro_method_changed_in>
2798
2799Invalidates method caching on any child classes
2800of the given stash, so that they might notice
2801the changes in this one.
2802
2803Ideally, all instances of C<PL_sub_generation++> in
dd69841b
BB
2804perl source outside of C<mro.c> should be
2805replaced by calls to this.
2806
2807Perl automatically handles most of the common
2808ways a method might be redefined. However, there
2809are a few ways you could change a method in a stash
2810without the cache code noticing, in which case you
2811need to call this method afterwards:
2812
28131) Directly manipulating the stash HV entries from
2814XS code.
2815
28162) Assigning a reference to a readonly scalar
2817constant into a stash entry in order to create
2818a constant subroutine (like constant.pm
2819does).
2820
2821This same method is available from pure perl
2822via, C<mro::method_changed_in(classname)>.
47c9dd14
BB
2823
2824 void mro_method_changed_in(HV* stash)
2825
2826=for hackers
2827Found in file mro.c
2828
2829
2830=back
2831
cd299c6e
RGS
2832=head1 Multicall Functions
2833
2834=over 8
2835
2836=item dMULTICALL
2837X<dMULTICALL>
2838
2839Declare local variables for a multicall. See L<perlcall/Lightweight Callbacks>.
2840
2841 dMULTICALL;
2842
2843=for hackers
2844Found in file cop.h
2845
2846=item MULTICALL
2847X<MULTICALL>
2848
2849Make a lightweight callback. See L<perlcall/Lightweight Callbacks>.
2850
2851 MULTICALL;
2852
2853=for hackers
2854Found in file cop.h
2855
2856=item POP_MULTICALL
2857X<POP_MULTICALL>
2858
2859Closing bracket for a lightweight callback.
2860See L<perlcall/Lightweight Callbacks>.
2861
2862 POP_MULTICALL;
2863
2864=for hackers
2865Found in file cop.h
2866
2867=item PUSH_MULTICALL
2868X<PUSH_MULTICALL>
2869
2870Opening bracket for a lightweight callback.
2871See L<perlcall/Lightweight Callbacks>.
2872
2873 PUSH_MULTICALL;
2874
2875=for hackers
2876Found in file cop.h
2877
2878
2879=back
2880
94bdecf9 2881=head1 Numeric functions
7207e29d 2882
94bdecf9 2883=over 8
f4758303 2884
94bdecf9 2885=item grok_bin
d8c40edc 2886X<grok_bin>
f4758303 2887
94bdecf9
JH
2888converts a string representing a binary number to numeric form.
2889
2890On entry I<start> and I<*len> give the string to scan, I<*flags> gives
2891conversion flags, and I<result> should be NULL or a pointer to an NV.
2892The scan stops at the end of the string, or the first invalid character.
7b667b5f
MHM
2893Unless C<PERL_SCAN_SILENT_ILLDIGIT> is set in I<*flags>, encountering an
2894invalid character will also trigger a warning.
2895On return I<*len> is set to the length of the scanned string,
2896and I<*flags> gives output flags.
94bdecf9 2897
7fc63493 2898If the value is <= C<UV_MAX> it is returned as a UV, the output flags are clear,
94bdecf9
JH
2899and nothing is written to I<*result>. If the value is > UV_MAX C<grok_bin>
2900returns UV_MAX, sets C<PERL_SCAN_GREATER_THAN_UV_MAX> in the output flags,
2901and writes the value to I<*result> (or the value is discarded if I<result>
2902is NULL).
2903
7b667b5f 2904The binary number may optionally be prefixed with "0b" or "b" unless
94bdecf9
JH
2905C<PERL_SCAN_DISALLOW_PREFIX> is set in I<*flags> on entry. If
2906C<PERL_SCAN_ALLOW_UNDERSCORES> is set in I<*flags> then the binary
2907number may use '_' characters to separate digits.
2908
a3b680e6 2909 UV grok_bin(const char* start, STRLEN* len_p, I32* flags, NV *result)
f4758303
JP
2910
2911=for hackers
94bdecf9 2912Found in file numeric.c
f4758303 2913
94bdecf9 2914=item grok_hex
d8c40edc 2915X<grok_hex>
954c1994 2916
94bdecf9
JH
2917converts a string representing a hex number to numeric form.
2918
2919On entry I<start> and I<*len> give the string to scan, I<*flags> gives
2920conversion flags, and I<result> should be NULL or a pointer to an NV.
7b667b5f
MHM
2921The scan stops at the end of the string, or the first invalid character.
2922Unless C<PERL_SCAN_SILENT_ILLDIGIT> is set in I<*flags>, encountering an
2923invalid character will also trigger a warning.
2924On return I<*len> is set to the length of the scanned string,
2925and I<*flags> gives output flags.
94bdecf9
JH
2926
2927If the value is <= UV_MAX it is returned as a UV, the output flags are clear,
2928and nothing is written to I<*result>. If the value is > UV_MAX C<grok_hex>
2929returns UV_MAX, sets C<PERL_SCAN_GREATER_THAN_UV_MAX> in the output flags,
2930and writes the value to I<*result> (or the value is discarded if I<result>
2931is NULL).
2932
2933The hex number may optionally be prefixed with "0x" or "x" unless
2934C<PERL_SCAN_DISALLOW_PREFIX> is set in I<*flags> on entry. If
2935C<PERL_SCAN_ALLOW_UNDERSCORES> is set in I<*flags> then the hex
2936number may use '_' characters to separate digits.
2937
a3b680e6 2938 UV grok_hex(const char* start, STRLEN* len_p, I32* flags, NV *result)
954c1994 2939
497711e7 2940=for hackers
94bdecf9 2941Found in file numeric.c
497711e7 2942
94bdecf9 2943=item grok_number
d8c40edc 2944X<grok_number>
954c1994 2945
94bdecf9
JH
2946Recognise (or not) a number. The type of the number is returned
2947(0 if unrecognised), otherwise it is a bit-ORed combination of
2948IS_NUMBER_IN_UV, IS_NUMBER_GREATER_THAN_UV_MAX, IS_NUMBER_NOT_INT,
2949IS_NUMBER_NEG, IS_NUMBER_INFINITY, IS_NUMBER_NAN (defined in perl.h).
2950
2951If the value of the number can fit an in UV, it is returned in the *valuep
2952IS_NUMBER_IN_UV will be set to indicate that *valuep is valid, IS_NUMBER_IN_UV
2953will never be set unless *valuep is valid, but *valuep may have been assigned
2954to during processing even though IS_NUMBER_IN_UV is not set on return.
2955If valuep is NULL, IS_NUMBER_IN_UV will be set for the same cases as when
2956valuep is non-NULL, but no actual assignment (or SEGV) will occur.
2957
2958IS_NUMBER_NOT_INT will be set with IS_NUMBER_IN_UV if trailing decimals were
2959seen (in which case *valuep gives the true value truncated to an integer), and
2960IS_NUMBER_NEG if the number is negative (in which case *valuep holds the
2961absolute value). IS_NUMBER_IN_UV is not set if e notation was used or the
2962number is larger than a UV.
2963
2964 int grok_number(const char *pv, STRLEN len, UV *valuep)
954c1994 2965
497711e7 2966=for hackers
94bdecf9 2967Found in file numeric.c
497711e7 2968
94bdecf9 2969=item grok_numeric_radix
d8c40edc 2970X<grok_numeric_radix>
954c1994 2971
94bdecf9
JH
2972Scan and skip for a numeric decimal separator (radix).
2973
2974 bool grok_numeric_radix(const char **sp, const char *send)
954c1994 2975
497711e7 2976=for hackers
94bdecf9 2977Found in file numeric.c
497711e7 2978
94bdecf9 2979=item grok_oct
d8c40edc 2980X<grok_oct>
954c1994 2981
7b667b5f
MHM
2982converts a string representing an octal number to numeric form.
2983
2984On entry I<start> and I<*len> give the string to scan, I<*flags> gives
2985conversion flags, and I<result> should be NULL or a pointer to an NV.
2986The scan stops at the end of the string, or the first invalid character.
2987Unless C<PERL_SCAN_SILENT_ILLDIGIT> is set in I<*flags>, encountering an
2988invalid character will also trigger a warning.
2989On return I<*len> is set to the length of the scanned string,
2990and I<*flags> gives output flags.
2991
2992If the value is <= UV_MAX it is returned as a UV, the output flags are clear,
2993and nothing is written to I<*result>. If the value is > UV_MAX C<grok_oct>
2994returns UV_MAX, sets C<PERL_SCAN_GREATER_THAN_UV_MAX> in the output flags,
2995and writes the value to I<*result> (or the value is discarded if I<result>
2996is NULL).
2997
2998If C<PERL_SCAN_ALLOW_UNDERSCORES> is set in I<*flags> then the octal
2999number may use '_' characters to separate digits.
94bdecf9 3000
a3b680e6 3001 UV grok_oct(const char* start, STRLEN* len_p, I32* flags, NV *result)
954c1994 3002
497711e7 3003=for hackers
94bdecf9 3004Found in file numeric.c
497711e7 3005
ed140128
AD
3006=item Perl_signbit
3007X<Perl_signbit>
3008
3009Return a non-zero integer if the sign bit on an NV is set, and 0 if
3010it is not.
3011
3012If Configure detects this system has a signbit() that will work with
3013our NVs, then we just use it via the #define in perl.h. Otherwise,
3014fall back on this implementation. As a first pass, this gets everything
3015right except -0.0. Alas, catching -0.0 is the main use for this function,
3016so this is not too helpful yet. Still, at least we have the scaffolding
3017in place to support other systems, should that prove useful.
3018
3019
3020Configure notes: This function is called 'Perl_signbit' instead of a
3021plain 'signbit' because it is easy to imagine a system having a signbit()
3022function or macro that doesn't happen to work with our particular choice
3023of NVs. We shouldn't just re-#define signbit as Perl_signbit and expect
3024the standard system headers to be happy. Also, this is a no-context
3025function (no pTHX_) because Perl_signbit() is usually re-#defined in
3026perl.h as a simple macro call to the system's signbit().
3027Users should just always call Perl_signbit().
3028
3029NOTE: this function is experimental and may change or be
3030removed without notice.
3031
3032 int Perl_signbit(NV f)
3033
3034=for hackers
3035Found in file numeric.c
3036
94bdecf9 3037=item scan_bin
d8c40edc 3038X<scan_bin>
954c1994 3039
94bdecf9
JH
3040For backwards compatibility. Use C<grok_bin> instead.
3041
73d840c0 3042 NV scan_bin(const char* start, STRLEN len, STRLEN* retlen)
954c1994 3043
497711e7 3044=for hackers
94bdecf9 3045Found in file numeric.c
497711e7 3046
94bdecf9 3047=item scan_hex
d8c40edc 3048X<scan_hex>
954c1994 3049
94bdecf9
JH
3050For backwards compatibility. Use C<grok_hex> instead.
3051
73d840c0 3052 NV scan_hex(const char* start, STRLEN len, STRLEN* retlen)
954c1994 3053
497711e7 3054=for hackers
94bdecf9 3055Found in file numeric.c
497711e7 3056
94bdecf9 3057=item scan_oct
d8c40edc 3058X<scan_oct>
954c1994 3059
94bdecf9 3060For backwards compatibility. Use C<grok_oct> instead.
954c1994 3061
73d840c0 3062 NV scan_oct(const char* start, STRLEN len, STRLEN* retlen)
954c1994 3063
497711e7 3064=for hackers
94bdecf9 3065Found in file numeric.c
497711e7 3066
645c22ef 3067
94bdecf9 3068=back
645c22ef 3069
94bdecf9
JH
3070=head1 Optree Manipulation Functions
3071
3072=over 8
3073
3074=item cv_const_sv
d8c40edc 3075X<cv_const_sv>
94bdecf9
JH
3076
3077If C<cv> is a constant sub eligible for inlining. returns the constant
3078value returned by the sub. Otherwise, returns NULL.
3079
3080Constant subs can be created with C<newCONSTSUB> or as described in
3081L<perlsub/"Constant Functions">.
3082
64f0785e 3083 SV* cv_const_sv(const CV *const cv)
645c22ef
DM
3084
3085=for hackers
94bdecf9 3086Found in file op.c
645c22ef 3087
94bdecf9 3088=item newCONSTSUB
d8c40edc 3089X<newCONSTSUB>
954c1994 3090
94bdecf9
JH
3091Creates a constant sub equivalent to Perl C<sub FOO () { 123 }> which is
3092eligible for inlining at compile-time.
954c1994 3093
99ab892b
NC
3094Passing NULL for SV creates a constant sub equivalent to C<sub BAR () {}>,
3095which won't be called if used as a destructor, but will suppress the overhead
3096of a call to C<AUTOLOAD>. (This form, however, isn't eligible for inlining at
3097compile time.)
3098
e1ec3a88 3099 CV* newCONSTSUB(HV* stash, const char* name, SV* sv)
954c1994 3100
497711e7 3101=for hackers
94bdecf9 3102Found in file op.c
497711e7 3103
94bdecf9 3104=item newXS
d8c40edc 3105X<newXS>
954c1994 3106
77004dee
NC
3107Used by C<xsubpp> to hook up XSUBs as Perl subs. I<filename> needs to be
3108static storage, as it is used directly as CvFILE(), without a copy being made.
954c1994 3109
94bdecf9
JH
3110=for hackers
3111Found in file op.c
3112
3113
3114=back
3115
dd2155a4
DM
3116=head1 Pad Data Structures
3117
3118=over 8
3119
3120=item pad_sv
d8c40edc 3121X<pad_sv>
dd2155a4
DM
3122
3123Get the value at offset po in the current pad.
3124Use macro PAD_SV instead of calling this function directly.
3125
3126 SV* pad_sv(PADOFFSET po)
3127
3128=for hackers
3129Found in file pad.c
3130
3131
3132=back
907b3e23
DM
3133
3134=head1 Per-Interpreter Variables
3135
3136=over 8
3137
3138=item PL_modglobal
3139X<PL_modglobal>
3140
3141C<PL_modglobal> is a general purpose, interpreter global HV for use by
3142extensions that need to keep information on a per-interpreter basis.
3143In a pinch, it can also be used as a symbol table for extensions
3144to share data among each other. It is a good idea to use keys
3145prefixed by the package name of the extension that owns the data.
3146
3147 HV* PL_modglobal
3148
3149=for hackers
3150Found in file intrpvar.h
3151
3152=item PL_na
3153X<PL_na>
3154
3155A convenience variable which is typically used with C<SvPV> when one
3156doesn't care about the length of the string. It is usually more efficient
3157to either declare a local variable and use that instead or to use the
3158C<SvPV_nolen> macro.
3159
3160 STRLEN PL_na
3161
3162=for hackers
3163Found in file intrpvar.h
3164
3165=item PL_sv_no
3166X<PL_sv_no>
3167
3168This is the C<false> SV. See C<PL_sv_yes>. Always refer to this as
3169C<&PL_sv_no>.
3170
3171 SV PL_sv_no
3172
3173=for hackers
3174Found in file intrpvar.h
3175
3176=item PL_sv_undef
3177X<PL_sv_undef>
3178
3179This is the C<undef> SV. Always refer to this as C<&PL_sv_undef>.
3180
3181 SV PL_sv_undef
3182
3183=for hackers
3184Found in file intrpvar.h
3185
3186=item PL_sv_yes
3187X<PL_sv_yes>
3188
3189This is the C<true> SV. See C<PL_sv_no>. Always refer to this as
3190C<&PL_sv_yes>.
3191
3192 SV PL_sv_yes
3193
3194=for hackers
3195Found in file intrpvar.h
3196
3197
3198=back
f7e71195
AB
3199
3200=head1 REGEXP Functions
3201
3202=over 8
3203
3204=item SvRX
3205X<SvRX>
3206
3207Convenience macro to get the REGEXP from a SV. This is approximately
3208equivalent to the following snippet:
3209
3210 if (SvMAGICAL(sv))
3211 mg_get(sv);
3212 if (SvROK(sv) &&
3213 (tmpsv = (SV*)SvRV(sv)) &&
3214 SvTYPE(tmpsv) == SVt_PVMG &&
3215 (tmpmg = mg_find(tmpsv, PERL_MAGIC_qr)))
3216 {
3217 return (REGEXP *)tmpmg->mg_obj;
3218 }
3219
3220NULL will be returned if a REGEXP* is not found.
3221
3222 REGEXP * SvRX(SV *sv)
3223
3224=for hackers
3225Found in file regexp.h
3226
3227=item SvRXOK
3228X<SvRXOK>
3229
3230Returns a boolean indicating whether the SV contains qr magic
3231(PERL_MAGIC_qr).
3232
3233If you want to do something with the REGEXP* later use SvRX instead
3234and check for NULL.
3235
3236 bool SvRXOK(SV* sv)
3237
3238=for hackers
3239Found in file regexp.h
3240
3241
3242=back
dd2155a4 3243
59887a99
MHM
3244=head1 Simple Exception Handling Macros
3245
3246=over 8
3247
3248=item dXCPT
d8c40edc 3249X<dXCPT>
59887a99 3250
2dfe1b17 3251Set up necessary local variables for exception handling.
59887a99
MHM
3252See L<perlguts/"Exception Handling">.
3253
3254 dXCPT;
3255
3256=for hackers
3257Found in file XSUB.h
3258
3259=item XCPT_CATCH
d8c40edc 3260X<XCPT_CATCH>
59887a99
MHM
3261
3262Introduces a catch block. See L<perlguts/"Exception Handling">.
3263
3264=for hackers
3265Found in file XSUB.h
3266
3267=item XCPT_RETHROW
d8c40edc 3268X<XCPT_RETHROW>
59887a99
MHM
3269
3270Rethrows a previously caught exception. See L<perlguts/"Exception Handling">.
3271
3272 XCPT_RETHROW;
3273
3274=for hackers
3275Found in file XSUB.h
3276
3277=item XCPT_TRY_END
d8c40edc 3278X<XCPT_TRY_END>
59887a99
MHM
3279
3280Ends a try block. See L<perlguts/"Exception Handling">.
3281
3282=for hackers
3283Found in file XSUB.h
3284
3285=item XCPT_TRY_START
d8c40edc 3286X<XCPT_TRY_START>
59887a99
MHM
3287
3288Starts a try block. See L<perlguts/"Exception Handling">.
3289
3290=for hackers
3291Found in file XSUB.h
3292
3293
3294=back
3295
94bdecf9
JH
3296=head1 Stack Manipulation Macros
3297
3298=over 8
3299
3300=item dMARK
d8c40edc 3301X<dMARK>
954c1994 3302
94bdecf9
JH
3303Declare a stack marker variable, C<mark>, for the XSUB. See C<MARK> and
3304C<dORIGMARK>.
954c1994 3305
94bdecf9 3306 dMARK;
954c1994 3307
497711e7 3308=for hackers
94bdecf9 3309Found in file pp.h
497711e7 3310
94bdecf9 3311=item dORIGMARK
d8c40edc 3312X<dORIGMARK>
954c1994 3313
94bdecf9 3314Saves the original stack mark for the XSUB. See C<ORIGMARK>.
954c1994 3315
94bdecf9 3316 dORIGMARK;
954c1994 3317
497711e7 3318=for hackers
94bdecf9 3319Found in file pp.h
497711e7 3320
94bdecf9 3321=item dSP
d8c40edc 3322X<dSP>
954c1994 3323
94bdecf9
JH
3324Declares a local copy of perl's stack pointer for the XSUB, available via
3325the C<SP> macro. See C<SP>.
954c1994 3326
94bdecf9 3327 dSP;
954c1994 3328
497711e7 3329=for hackers
94bdecf9 3330Found in file pp.h
497711e7 3331
94bdecf9 3332=item EXTEND
d8c40edc 3333X<EXTEND>
954c1994 3334
94bdecf9
JH
3335Used to extend the argument stack for an XSUB's return values. Once
3336used, guarantees that there is room for at least C<nitems> to be pushed
3337onto the stack.
954c1994 3338
94bdecf9 3339 void EXTEND(SP, int nitems)
954c1994 3340
497711e7 3341=for hackers
94bdecf9 3342Found in file pp.h
954c1994 3343
94bdecf9 3344=item MARK
d8c40edc 3345X<MARK>
954c1994 3346
94bdecf9 3347Stack marker variable for the XSUB. See C<dMARK>.
954c1994 3348
497711e7 3349=for hackers
94bdecf9 3350Found in file pp.h
954c1994 3351
d82b684c 3352=item mPUSHi
d8c40edc 3353X<mPUSHi>
d82b684c
SH
3354
3355Push an integer onto the stack. The stack must have room for this element.
121b7712 3356Does not use C<TARG>. See also C<PUSHi>, C<mXPUSHi> and C<XPUSHi>.
d82b684c
SH
3357
3358 void mPUSHi(IV iv)
3359
3360=for hackers
3361Found in file pp.h
3362
3363=item mPUSHn
d8c40edc 3364X<mPUSHn>
d82b684c
SH
3365
3366Push a double onto the stack. The stack must have room for this element.
121b7712 3367Does not use C<TARG>. See also C<PUSHn>, C<mXPUSHn> and C<XPUSHn>.
d82b684c
SH
3368
3369 void mPUSHn(NV nv)
3370
3371=for hackers
3372Found in file pp.h
3373
3374=item mPUSHp
d8c40edc 3375X<mPUSHp>
d82b684c
SH
3376
3377Push a string onto the stack. The stack must have room for this element.
121b7712
MHM
3378The C<len> indicates the length of the string. Does not use C<TARG>.
3379See also C<PUSHp>, C<mXPUSHp> and C<XPUSHp>.
d82b684c
SH
3380
3381 void mPUSHp(char* str, STRLEN len)
3382
3383=for hackers
3384Found in file pp.h
3385
ae374e95
SH
3386=item mPUSHs
3387X<mPUSHs>
3388
3389Push an SV onto the stack and mortalizes the SV. The stack must have room
121b7712 3390for this element. Does not use C<TARG>. See also C<PUSHs> and C<mXPUSHs>.
ae374e95
SH
3391
3392 void mPUSHs(SV* sv)
3393
3394=for hackers
3395Found in file pp.h
3396
d82b684c 3397=item mPUSHu
d8c40edc 3398X<mPUSHu>
d82b684c
SH
3399
3400Push an unsigned integer onto the stack. The stack must have room for this
121b7712 3401element. Does not use C<TARG>. See also C<PUSHu>, C<mXPUSHu> and C<XPUSHu>.
d82b684c
SH
3402
3403 void mPUSHu(UV uv)
3404
3405=for hackers
3406Found in file pp.h
3407
3408=item mXPUSHi
d8c40edc 3409X<mXPUSHi>
d82b684c 3410
121b7712
MHM
3411Push an integer onto the stack, extending the stack if necessary.
3412Does not use C<TARG>. See also C<XPUSHi>, C<mPUSHi> and C<PUSHi>.
d82b684c
SH
3413
3414 void mXPUSHi(IV iv)
3415
3416=for hackers
3417Found in file pp.h
3418
3419=item mXPUSHn
d8c40edc 3420X<mXPUSHn>
d82b684c 3421
121b7712
MHM
3422Push a double onto the stack, extending the stack if necessary.
3423Does not use C<TARG>. See also C<XPUSHn>, C<mPUSHn> and C<PUSHn>.
d82b684c
SH
3424
3425 void mXPUSHn(NV nv)
3426
3427=for hackers
3428Found in file pp.h
3429
3430=item mXPUSHp
d8c40edc 3431X<mXPUSHp>
d82b684c
SH
3432
3433Push a string onto the stack, extending the stack if necessary. The C<len>
121b7712
MHM
3434indicates the length of the string. Does not use C<TARG>. See also C<XPUSHp>,
3435C<mPUSHp> and C<PUSHp>.
d82b684c
SH
3436
3437 void mXPUSHp(char* str, STRLEN len)
3438
3439=for hackers
3440Found in file pp.h
3441
ae374e95
SH
3442=item mXPUSHs
3443X<mXPUSHs>
3444
3445Push an SV onto the stack, extending the stack if necessary and mortalizes
121b7712 3446the SV. Does not use C<TARG>. See also C<XPUSHs> and C<mPUSHs>.
ae374e95
SH
3447
3448 void mXPUSHs(SV* sv)
3449
3450=for hackers
3451Found in file pp.h
3452
d82b684c 3453=item mXPUSHu
d8c40edc 3454X<mXPUSHu>
d82b684c
SH
3455
3456Push an unsigned integer onto the stack, extending the stack if necessary.
121b7712 3457Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>.
d82b684c
SH
3458
3459 void mXPUSHu(UV uv)
3460
3461=for hackers
3462Found in file pp.h
3463
94bdecf9 3464=item ORIGMARK
d8c40edc 3465X<ORIGMARK>
954c1994 3466
94bdecf9 3467The original stack mark for the XSUB. See C<dORIGMARK>.
954c1994 3468
497711e7 3469=for hackers
94bdecf9 3470Found in file pp.h
497711e7 3471
954c1994 3472=item POPi
d8c40edc 3473X<POPi>
954c1994
GS
3474