6a1bf2b33da86557383ed92fb8f8042fc4e20e57
[p5sagit/p5-mst-13.2.git] / pod / perlapi.pod
1 =head1 NAME
2
3 perlapi - autogenerated documentation for the perl public API
4
5 =head1 DESCRIPTION
6 X<Perl API> X<API> X<api>
7
8 This file contains the documentation of the perl public API generated by
9 embed.pl, specifically a listing of functions, macros, flags, and variables
10 that may be used by extension writers.  The interfaces of any functions that
11 are not listed here are subject to change without notice.  For this reason,
12 blindly using functions listed in proto.h is to be avoided when writing
13 extensions.
14
15 Note that all Perl API global variables must be referenced with the C<PL_>
16 prefix.  Some macros are provided for compatibility with the older,
17 unadorned names, but this support may be disabled in a future release.
18
19 The listing is alphabetical, case insensitive.
20
21
22 =head1 "Gimme" Values
23
24 =over 8
25
26 =item GIMME
27 X<GIMME>
28
29 A backward-compatible version of C<GIMME_V> which can only return
30 C<G_SCALAR> or C<G_ARRAY>; in a void context, it returns C<G_SCALAR>.
31 Deprecated.  Use C<GIMME_V> instead.
32
33         U32     GIMME
34
35 =for hackers
36 Found in file op.h
37
38 =item GIMME_V
39 X<GIMME_V>
40
41 The XSUB-writer's equivalent to Perl's C<wantarray>.  Returns C<G_VOID>,
42 C<G_SCALAR> or C<G_ARRAY> for void, scalar or list context,
43 respectively.
44
45         U32     GIMME_V
46
47 =for hackers
48 Found in file op.h
49
50 =item G_ARRAY
51 X<G_ARRAY>
52
53 Used to indicate list context.  See C<GIMME_V>, C<GIMME> and
54 L<perlcall>.
55
56 =for hackers
57 Found in file cop.h
58
59 =item G_DISCARD
60 X<G_DISCARD>
61
62 Indicates that arguments returned from a callback should be discarded.  See
63 L<perlcall>.
64
65 =for hackers
66 Found in file cop.h
67
68 =item G_EVAL
69 X<G_EVAL>
70
71 Used to force a Perl C<eval> wrapper around a callback.  See
72 L<perlcall>.
73
74 =for hackers
75 Found in file cop.h
76
77 =item G_NOARGS
78 X<G_NOARGS>
79
80 Indicates that no arguments are being sent to a callback.  See
81 L<perlcall>.
82
83 =for hackers
84 Found in file cop.h
85
86 =item G_SCALAR
87 X<G_SCALAR>
88
89 Used to indicate scalar context.  See C<GIMME_V>, C<GIMME>, and
90 L<perlcall>.
91
92 =for hackers
93 Found in file cop.h
94
95 =item G_VOID
96 X<G_VOID>
97
98 Used to indicate void context.  See C<GIMME_V> and L<perlcall>.
99
100 =for hackers
101 Found in file cop.h
102
103
104 =back
105
106 =head1 Array Manipulation Functions
107
108 =over 8
109
110 =item AvFILL
111 X<AvFILL>
112
113 Same as C<av_len()>.  Deprecated, use C<av_len()> instead.
114
115         int     AvFILL(AV* av)
116
117 =for hackers
118 Found in file av.h
119
120 =item av_clear
121 X<av_clear>
122
123 Clears an array, making it empty.  Does not free the memory used by the
124 array itself.
125
126         void    av_clear(AV* ar)
127
128 =for hackers
129 Found in file av.c
130
131 =item av_delete
132 X<av_delete>
133
134 Deletes the element indexed by C<key> from the array.  Returns the
135 deleted element. If C<flags> equals C<G_DISCARD>, the element is freed
136 and null is returned.
137
138         SV*     av_delete(AV* ar, I32 key, I32 flags)
139
140 =for hackers
141 Found in file av.c
142
143 =item av_exists
144 X<av_exists>
145
146 Returns true if the element indexed by C<key> has been initialized.
147
148 This relies on the fact that uninitialized array elements are set to
149 C<&PL_sv_undef>.
150
151         bool    av_exists(AV* ar, I32 key)
152
153 =for hackers
154 Found in file av.c
155
156 =item av_extend
157 X<av_extend>
158
159 Pre-extend an array.  The C<key> is the index to which the array should be
160 extended.
161
162         void    av_extend(AV* ar, I32 key)
163
164 =for hackers
165 Found in file av.c
166
167 =item av_fetch
168 X<av_fetch>
169
170 Returns the SV at the specified index in the array.  The C<key> is the
171 index.  If C<lval> is set then the fetch will be part of a store.  Check
172 that the return value is non-null before dereferencing it to a C<SV*>.
173
174 See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for
175 more information on how to use this function on tied arrays. 
176
177         SV**    av_fetch(AV* ar, I32 key, I32 lval)
178
179 =for hackers
180 Found in file av.c
181
182 =item av_fill
183 X<av_fill>
184
185 Ensure than an array has a given number of elements, equivalent to
186 Perl's C<$#array = $fill;>.
187
188         void    av_fill(AV* ar, I32 fill)
189
190 =for hackers
191 Found in file av.c
192
193 =item av_len
194 X<av_len>
195
196 Returns the highest index in the array.  Returns -1 if the array is
197 empty.
198
199         I32     av_len(const AV* ar)
200
201 =for hackers
202 Found in file av.c
203
204 =item av_make
205 X<av_make>
206
207 Creates a new AV and populates it with a list of SVs.  The SVs are copied
208 into the array, so they may be freed after the call to av_make.  The new AV
209 will have a reference count of 1.
210
211         AV*     av_make(I32 size, SV** svp)
212
213 =for hackers
214 Found in file av.c
215
216 =item av_pop
217 X<av_pop>
218
219 Pops an SV off the end of the array.  Returns C<&PL_sv_undef> if the array
220 is empty.
221
222         SV*     av_pop(AV* ar)
223
224 =for hackers
225 Found in file av.c
226
227 =item av_push
228 X<av_push>
229
230 Pushes an SV onto the end of the array.  The array will grow automatically
231 to accommodate the addition.
232
233         void    av_push(AV* ar, SV* val)
234
235 =for hackers
236 Found in file av.c
237
238 =item av_shift
239 X<av_shift>
240
241 Shifts an SV off the beginning of the array.
242
243         SV*     av_shift(AV* ar)
244
245 =for hackers
246 Found in file av.c
247
248 =item av_store
249 X<av_store>
250
251 Stores an SV in an array.  The array index is specified as C<key>.  The
252 return value will be NULL if the operation failed or if the value did not
253 need to be actually stored within the array (as in the case of tied
254 arrays). Otherwise it can be dereferenced to get the original C<SV*>.  Note
255 that the caller is responsible for suitably incrementing the reference
256 count of C<val> before the call, and decrementing it if the function
257 returned NULL.
258
259 See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for
260 more information on how to use this function on tied arrays.
261
262         SV**    av_store(AV* ar, I32 key, SV* val)
263
264 =for hackers
265 Found in file av.c
266
267 =item av_undef
268 X<av_undef>
269
270 Undefines the array.  Frees the memory used by the array itself.
271
272         void    av_undef(AV* ar)
273
274 =for hackers
275 Found in file av.c
276
277 =item av_unshift
278 X<av_unshift>
279
280 Unshift the given number of C<undef> values onto the beginning of the
281 array.  The array will grow automatically to accommodate the addition.  You
282 must then use C<av_store> to assign values to these new elements.
283
284         void    av_unshift(AV* ar, I32 num)
285
286 =for hackers
287 Found in file av.c
288
289 =item get_av
290 X<get_av>
291
292 Returns the AV of the specified Perl array.  If C<create> is set and the
293 Perl variable does not exist then it will be created.  If C<create> is not
294 set and the variable does not exist then NULL is returned.
295
296 NOTE: the perl_ form of this function is deprecated.
297
298         AV*     get_av(const char* name, I32 create)
299
300 =for hackers
301 Found in file perl.c
302
303 =item newAV
304 X<newAV>
305
306 Creates a new AV.  The reference count is set to 1.
307
308         AV*     newAV()
309
310 =for hackers
311 Found in file av.c
312
313 =item sortsv
314 X<sortsv>
315
316 Sort an array. Here is an example:
317
318     sortsv(AvARRAY(av), av_len(av)+1, Perl_sv_cmp_locale);
319
320 See lib/sort.pm for details about controlling the sorting algorithm.
321
322         void    sortsv(SV** array, size_t num_elts, SVCOMPARE_t cmp)
323
324 =for hackers
325 Found in file pp_sort.c
326
327
328 =back
329
330 =head1 Callback Functions
331
332 =over 8
333
334 =item call_argv
335 X<call_argv>
336
337 Performs a callback to the specified Perl sub.  See L<perlcall>.
338
339 NOTE: the perl_ form of this function is deprecated.
340
341         I32     call_argv(const char* sub_name, I32 flags, char** argv)
342
343 =for hackers
344 Found in file perl.c
345
346 =item call_method
347 X<call_method>
348
349 Performs a callback to the specified Perl method.  The blessed object must
350 be on the stack.  See L<perlcall>.
351
352 NOTE: the perl_ form of this function is deprecated.
353
354         I32     call_method(const char* methname, I32 flags)
355
356 =for hackers
357 Found in file perl.c
358
359 =item call_pv
360 X<call_pv>
361
362 Performs a callback to the specified Perl sub.  See L<perlcall>.
363
364 NOTE: the perl_ form of this function is deprecated.
365
366         I32     call_pv(const char* sub_name, I32 flags)
367
368 =for hackers
369 Found in file perl.c
370
371 =item call_sv
372 X<call_sv>
373
374 Performs a callback to the Perl sub whose name is in the SV.  See
375 L<perlcall>.
376
377 NOTE: the perl_ form of this function is deprecated.
378
379         I32     call_sv(SV* sv, I32 flags)
380
381 =for hackers
382 Found in file perl.c
383
384 =item ENTER
385 X<ENTER>
386
387 Opening bracket on a callback.  See C<LEAVE> and L<perlcall>.
388
389                 ENTER;
390
391 =for hackers
392 Found in file scope.h
393
394 =item eval_pv
395 X<eval_pv>
396
397 Tells Perl to C<eval> the given string and return an SV* result.
398
399 NOTE: the perl_ form of this function is deprecated.
400
401         SV*     eval_pv(const char* p, I32 croak_on_error)
402
403 =for hackers
404 Found in file perl.c
405
406 =item eval_sv
407 X<eval_sv>
408
409 Tells Perl to C<eval> the string in the SV.
410
411 NOTE: the perl_ form of this function is deprecated.
412
413         I32     eval_sv(SV* sv, I32 flags)
414
415 =for hackers
416 Found in file perl.c
417
418 =item FREETMPS
419 X<FREETMPS>
420
421 Closing bracket for temporaries on a callback.  See C<SAVETMPS> and
422 L<perlcall>.
423
424                 FREETMPS;
425
426 =for hackers
427 Found in file scope.h
428
429 =item LEAVE
430 X<LEAVE>
431
432 Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
433
434                 LEAVE;
435
436 =for hackers
437 Found in file scope.h
438
439 =item SAVETMPS
440 X<SAVETMPS>
441
442 Opening bracket for temporaries on a callback.  See C<FREETMPS> and
443 L<perlcall>.
444
445                 SAVETMPS;
446
447 =for hackers
448 Found in file scope.h
449
450
451 =back
452
453 =head1 Character classes
454
455 =over 8
456
457 =item isALNUM
458 X<isALNUM>
459
460 Returns a boolean indicating whether the C C<char> is an ASCII alphanumeric
461 character (including underscore) or digit.
462
463         bool    isALNUM(char ch)
464
465 =for hackers
466 Found in file handy.h
467
468 =item isALPHA
469 X<isALPHA>
470
471 Returns a boolean indicating whether the C C<char> is an ASCII alphabetic
472 character.
473
474         bool    isALPHA(char ch)
475
476 =for hackers
477 Found in file handy.h
478
479 =item isDIGIT
480 X<isDIGIT>
481
482 Returns a boolean indicating whether the C C<char> is an ASCII
483 digit.
484
485         bool    isDIGIT(char ch)
486
487 =for hackers
488 Found in file handy.h
489
490 =item isLOWER
491 X<isLOWER>
492
493 Returns a boolean indicating whether the C C<char> is a lowercase
494 character.
495
496         bool    isLOWER(char ch)
497
498 =for hackers
499 Found in file handy.h
500
501 =item isSPACE
502 X<isSPACE>
503
504 Returns a boolean indicating whether the C C<char> is whitespace.
505
506         bool    isSPACE(char ch)
507
508 =for hackers
509 Found in file handy.h
510
511 =item isUPPER
512 X<isUPPER>
513
514 Returns a boolean indicating whether the C C<char> is an uppercase
515 character.
516
517         bool    isUPPER(char ch)
518
519 =for hackers
520 Found in file handy.h
521
522 =item toLOWER
523 X<toLOWER>
524
525 Converts the specified character to lowercase.
526
527         char    toLOWER(char ch)
528
529 =for hackers
530 Found in file handy.h
531
532 =item toUPPER
533 X<toUPPER>
534
535 Converts the specified character to uppercase.
536
537         char    toUPPER(char ch)
538
539 =for hackers
540 Found in file handy.h
541
542
543 =back
544
545 =head1 Cloning an interpreter
546
547 =over 8
548
549 =item perl_clone
550 X<perl_clone>
551
552 Create and return a new interpreter by cloning the current one.
553
554 perl_clone takes these flags as parameters:
555
556 CLONEf_COPY_STACKS - is used to, well, copy the stacks also,
557 without it we only clone the data and zero the stacks,
558 with it we copy the stacks and the new perl interpreter is
559 ready to run at the exact same point as the previous one.
560 The pseudo-fork code uses COPY_STACKS while the
561 threads->new doesn't.
562
563 CLONEf_KEEP_PTR_TABLE
564 perl_clone keeps a ptr_table with the pointer of the old
565 variable as a key and the new variable as a value,
566 this allows it to check if something has been cloned and not
567 clone it again but rather just use the value and increase the
568 refcount. If KEEP_PTR_TABLE is not set then perl_clone will kill
569 the ptr_table using the function
570 C<ptr_table_free(PL_ptr_table); PL_ptr_table = NULL;>,
571 reason to keep it around is if you want to dup some of your own
572 variable who are outside the graph perl scans, example of this
573 code is in threads.xs create
574
575 CLONEf_CLONE_HOST
576 This is a win32 thing, it is ignored on unix, it tells perls
577 win32host code (which is c++) to clone itself, this is needed on
578 win32 if you want to run two threads at the same time,
579 if you just want to do some stuff in a separate perl interpreter
580 and then throw it away and return to the original one,
581 you don't need to do anything.
582
583         PerlInterpreter*        perl_clone(PerlInterpreter* interp, UV flags)
584
585 =for hackers
586 Found in file sv.c
587
588
589 =back
590
591 =head1 CV Manipulation Functions
592
593 =over 8
594
595 =item CvSTASH
596 X<CvSTASH>
597
598 Returns the stash of the CV.
599
600         HV*     CvSTASH(CV* cv)
601
602 =for hackers
603 Found in file cv.h
604
605 =item get_cv
606 X<get_cv>
607
608 Returns the CV of the specified Perl subroutine.  If C<create> is set and
609 the Perl subroutine does not exist then it will be declared (which has the
610 same effect as saying C<sub name;>).  If C<create> is not set and the
611 subroutine does not exist then NULL is returned.
612
613 NOTE: the perl_ form of this function is deprecated.
614
615         CV*     get_cv(const char* name, I32 create)
616
617 =for hackers
618 Found in file perl.c
619
620
621 =back
622
623 =head1 Embedding Functions
624
625 =over 8
626
627 =item cv_undef
628 X<cv_undef>
629
630 Clear out all the active components of a CV. This can happen either
631 by an explicit C<undef &foo>, or by the reference count going to zero.
632 In the former case, we keep the CvOUTSIDE pointer, so that any anonymous
633 children can still follow the full lexical scope chain.
634
635         void    cv_undef(CV* cv)
636
637 =for hackers
638 Found in file op.c
639
640 =item load_module
641 X<load_module>
642
643 Loads the module whose name is pointed to by the string part of name.
644 Note that the actual module name, not its filename, should be given.
645 Eg, "Foo::Bar" instead of "Foo/Bar.pm".  flags can be any of
646 PERL_LOADMOD_DENY, PERL_LOADMOD_NOIMPORT, or PERL_LOADMOD_IMPORT_OPS
647 (or 0 for no flags). ver, if specified, provides version semantics
648 similar to C<use Foo::Bar VERSION>.  The optional trailing SV*
649 arguments can be used to specify arguments to the module's import()
650 method, similar to C<use Foo::Bar VERSION LIST>.
651
652         void    load_module(U32 flags, SV* name, SV* ver, ...)
653
654 =for hackers
655 Found in file op.c
656
657 =item nothreadhook
658 X<nothreadhook>
659
660 Stub that provides thread hook for perl_destruct when there are
661 no threads.
662
663         int     nothreadhook()
664
665 =for hackers
666 Found in file perl.c
667
668 =item perl_alloc
669 X<perl_alloc>
670
671 Allocates a new Perl interpreter.  See L<perlembed>.
672
673         PerlInterpreter*        perl_alloc()
674
675 =for hackers
676 Found in file perl.c
677
678 =item perl_construct
679 X<perl_construct>
680
681 Initializes a new Perl interpreter.  See L<perlembed>.
682
683         void    perl_construct(PerlInterpreter* interp)
684
685 =for hackers
686 Found in file perl.c
687
688 =item perl_destruct
689 X<perl_destruct>
690
691 Shuts down a Perl interpreter.  See L<perlembed>.
692
693         int     perl_destruct(PerlInterpreter* interp)
694
695 =for hackers
696 Found in file perl.c
697
698 =item perl_free
699 X<perl_free>
700
701 Releases a Perl interpreter.  See L<perlembed>.
702
703         void    perl_free(PerlInterpreter* interp)
704
705 =for hackers
706 Found in file perl.c
707
708 =item perl_parse
709 X<perl_parse>
710
711 Tells a Perl interpreter to parse a Perl script.  See L<perlembed>.
712
713         int     perl_parse(PerlInterpreter* interp, XSINIT_t xsinit, int argc, char** argv, char** env)
714
715 =for hackers
716 Found in file perl.c
717
718 =item perl_run
719 X<perl_run>
720
721 Tells a Perl interpreter to run.  See L<perlembed>.
722
723         int     perl_run(PerlInterpreter* interp)
724
725 =for hackers
726 Found in file perl.c
727
728 =item require_pv
729 X<require_pv>
730
731 Tells Perl to C<require> the file named by the string argument.  It is
732 analogous to the Perl code C<eval "require '$file'">.  It's even
733 implemented that way; consider using load_module instead.
734
735 NOTE: the perl_ form of this function is deprecated.
736
737         void    require_pv(const char* pv)
738
739 =for hackers
740 Found in file perl.c
741
742
743 =back
744
745 =head1 Functions in file mathoms.c
746
747
748 =over 8
749
750 =item gv_fetchmethod
751 X<gv_fetchmethod>
752
753 See L<gv_fetchmethod_autoload>.
754
755         GV*     gv_fetchmethod(HV* stash, const char* name)
756
757 =for hackers
758 Found in file mathoms.c
759
760 =item sv_2pvbyte_nolen
761 X<sv_2pvbyte_nolen>
762
763 Return a pointer to the byte-encoded representation of the SV.
764 May cause the SV to be downgraded from UTF-8 as a side-effect.
765
766 Usually accessed via the C<SvPVbyte_nolen> macro.
767
768         char*   sv_2pvbyte_nolen(SV* sv)
769
770 =for hackers
771 Found in file mathoms.c
772
773 =item sv_2pvutf8_nolen
774 X<sv_2pvutf8_nolen>
775
776 Return a pointer to the UTF-8-encoded representation of the SV.
777 May cause the SV to be upgraded to UTF-8 as a side-effect.
778
779 Usually accessed via the C<SvPVutf8_nolen> macro.
780
781         char*   sv_2pvutf8_nolen(SV* sv)
782
783 =for hackers
784 Found in file mathoms.c
785
786 =item sv_2pv_nolen
787 X<sv_2pv_nolen>
788
789 Like C<sv_2pv()>, but doesn't return the length too. You should usually
790 use the macro wrapper C<SvPV_nolen(sv)> instead.
791         char*   sv_2pv_nolen(SV* sv)
792
793 =for hackers
794 Found in file mathoms.c
795
796 =item sv_catpvn_mg
797 X<sv_catpvn_mg>
798
799 Like C<sv_catpvn>, but also handles 'set' magic.
800
801         void    sv_catpvn_mg(SV *sv, const char *ptr, STRLEN len)
802
803 =for hackers
804 Found in file mathoms.c
805
806 =item sv_catsv_mg
807 X<sv_catsv_mg>
808
809 Like C<sv_catsv>, but also handles 'set' magic.
810
811         void    sv_catsv_mg(SV *dstr, SV *sstr)
812
813 =for hackers
814 Found in file mathoms.c
815
816 =item sv_force_normal
817 X<sv_force_normal>
818
819 Undo various types of fakery on an SV: if the PV is a shared string, make
820 a private copy; if we're a ref, stop refing; if we're a glob, downgrade to
821 an xpvmg. See also C<sv_force_normal_flags>.
822
823         void    sv_force_normal(SV *sv)
824
825 =for hackers
826 Found in file mathoms.c
827
828 =item sv_iv
829 X<sv_iv>
830
831 A private implementation of the C<SvIVx> macro for compilers which can't
832 cope with complex macro expressions. Always use the macro instead.
833
834         IV      sv_iv(SV* sv)
835
836 =for hackers
837 Found in file mathoms.c
838
839 =item sv_nolocking
840 X<sv_nolocking>
841
842 Dummy routine which "locks" an SV when there is no locking module present.
843 Exists to avoid test for a NULL function pointer and because it could
844 potentially warn under some level of strict-ness.
845
846 "Superseded" by sv_nosharing().
847
848         void    sv_nolocking(SV *)
849
850 =for hackers
851 Found in file mathoms.c
852
853 =item sv_nounlocking
854 X<sv_nounlocking>
855
856 Dummy routine which "unlocks" an SV when there is no locking module present.
857 Exists to avoid test for a NULL function pointer and because it could
858 potentially warn under some level of strict-ness.
859
860 "Superseded" by sv_nosharing().
861
862         void    sv_nounlocking(SV *)
863
864 =for hackers
865 Found in file mathoms.c
866
867 =item sv_nv
868 X<sv_nv>
869
870 A private implementation of the C<SvNVx> macro for compilers which can't
871 cope with complex macro expressions. Always use the macro instead.
872
873         NV      sv_nv(SV* sv)
874
875 =for hackers
876 Found in file mathoms.c
877
878 =item sv_pv
879 X<sv_pv>
880
881 Use the C<SvPV_nolen> macro instead
882
883         char*   sv_pv(SV *sv)
884
885 =for hackers
886 Found in file mathoms.c
887
888 =item sv_pvbyte
889 X<sv_pvbyte>
890
891 Use C<SvPVbyte_nolen> instead.
892
893         char*   sv_pvbyte(SV *sv)
894
895 =for hackers
896 Found in file mathoms.c
897
898 =item sv_pvbyten
899 X<sv_pvbyten>
900
901 A private implementation of the C<SvPVbyte> macro for compilers
902 which can't cope with complex macro expressions. Always use the macro
903 instead.
904
905         char*   sv_pvbyten(SV *sv, STRLEN *len)
906
907 =for hackers
908 Found in file mathoms.c
909
910 =item sv_pvn
911 X<sv_pvn>
912
913 A private implementation of the C<SvPV> macro for compilers which can't
914 cope with complex macro expressions. Always use the macro instead.
915
916         char*   sv_pvn(SV *sv, STRLEN *len)
917
918 =for hackers
919 Found in file mathoms.c
920
921 =item sv_pvutf8
922 X<sv_pvutf8>
923
924 Use the C<SvPVutf8_nolen> macro instead
925
926         char*   sv_pvutf8(SV *sv)
927
928 =for hackers
929 Found in file mathoms.c
930
931 =item sv_pvutf8n
932 X<sv_pvutf8n>
933
934 A private implementation of the C<SvPVutf8> macro for compilers
935 which can't cope with complex macro expressions. Always use the macro
936 instead.
937
938         char*   sv_pvutf8n(SV *sv, STRLEN *len)
939
940 =for hackers
941 Found in file mathoms.c
942
943 =item sv_taint
944 X<sv_taint>
945
946 Taint an SV. Use C<SvTAINTED_on> instead.
947         void    sv_taint(SV* sv)
948
949 =for hackers
950 Found in file mathoms.c
951
952 =item sv_unref
953 X<sv_unref>
954
955 Unsets the RV status of the SV, and decrements the reference count of
956 whatever was being referenced by the RV.  This can almost be thought of
957 as a reversal of C<newSVrv>.  This is C<sv_unref_flags> with the C<flag>
958 being zero.  See C<SvROK_off>.
959
960         void    sv_unref(SV* sv)
961
962 =for hackers
963 Found in file mathoms.c
964
965 =item sv_uv
966 X<sv_uv>
967
968 A private implementation of the C<SvUVx> macro for compilers which can't
969 cope with complex macro expressions. Always use the macro instead.
970
971         UV      sv_uv(SV* sv)
972
973 =for hackers
974 Found in file mathoms.c
975
976
977 =back
978
979 =head1 Functions in file pp_pack.c
980
981
982 =over 8
983
984 =item packlist
985 X<packlist>
986
987 The engine implementing pack() Perl function.
988
989         void    packlist(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist)
990
991 =for hackers
992 Found in file pp_pack.c
993
994 =item pack_cat
995 X<pack_cat>
996
997 The engine implementing pack() Perl function. Note: parameters next_in_list and
998 flags are not used. This call should not be used; use packlist instead.
999
1000         void    pack_cat(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
1001
1002 =for hackers
1003 Found in file pp_pack.c
1004
1005 =item unpackstring
1006 X<unpackstring>
1007
1008 The engine implementing unpack() Perl function. C<unpackstring> puts the
1009 extracted list items on the stack and returns the number of elements.
1010 Issue C<PUTBACK> before and C<SPAGAIN> after the call to this function.
1011
1012         I32     unpackstring(const char *pat, const char *patend, const char *s, const char *strend, U32 flags)
1013
1014 =for hackers
1015 Found in file pp_pack.c
1016
1017 =item unpack_str
1018 X<unpack_str>
1019
1020 The engine implementing unpack() Perl function. Note: parameters strbeg, new_s
1021 and ocnt are not used. This call should not be used, use unpackstring instead.
1022
1023         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)
1024
1025 =for hackers
1026 Found in file pp_pack.c
1027
1028
1029 =back
1030
1031 =head1 Global Variables
1032
1033 =over 8
1034
1035 =item PL_modglobal
1036 X<PL_modglobal>
1037
1038 C<PL_modglobal> is a general purpose, interpreter global HV for use by
1039 extensions that need to keep information on a per-interpreter basis.
1040 In a pinch, it can also be used as a symbol table for extensions
1041 to share data among each other.  It is a good idea to use keys
1042 prefixed by the package name of the extension that owns the data.
1043
1044         HV*     PL_modglobal
1045
1046 =for hackers
1047 Found in file intrpvar.h
1048
1049 =item PL_na
1050 X<PL_na>
1051
1052 A convenience variable which is typically used with C<SvPV> when one
1053 doesn't care about the length of the string.  It is usually more efficient
1054 to either declare a local variable and use that instead or to use the
1055 C<SvPV_nolen> macro.
1056
1057         STRLEN  PL_na
1058
1059 =for hackers
1060 Found in file thrdvar.h
1061
1062 =item PL_sv_no
1063 X<PL_sv_no>
1064
1065 This is the C<false> SV.  See C<PL_sv_yes>.  Always refer to this as
1066 C<&PL_sv_no>.
1067
1068         SV      PL_sv_no
1069
1070 =for hackers
1071 Found in file intrpvar.h
1072
1073 =item PL_sv_undef
1074 X<PL_sv_undef>
1075
1076 This is the C<undef> SV.  Always refer to this as C<&PL_sv_undef>.
1077
1078         SV      PL_sv_undef
1079
1080 =for hackers
1081 Found in file intrpvar.h
1082
1083 =item PL_sv_yes
1084 X<PL_sv_yes>
1085
1086 This is the C<true> SV.  See C<PL_sv_no>.  Always refer to this as
1087 C<&PL_sv_yes>.
1088
1089         SV      PL_sv_yes
1090
1091 =for hackers
1092 Found in file intrpvar.h
1093
1094
1095 =back
1096
1097 =head1 GV Functions
1098
1099 =over 8
1100
1101 =item GvSV
1102 X<GvSV>
1103
1104 Return the SV from the GV.
1105
1106         SV*     GvSV(GV* gv)
1107
1108 =for hackers
1109 Found in file gv.h
1110
1111 =item gv_fetchmeth
1112 X<gv_fetchmeth>
1113
1114 Returns the glob with the given C<name> and a defined subroutine or
1115 C<NULL>.  The glob lives in the given C<stash>, or in the stashes
1116 accessible via @ISA and UNIVERSAL::.
1117
1118 The argument C<level> should be either 0 or -1.  If C<level==0>, as a
1119 side-effect creates a glob with the given C<name> in the given C<stash>
1120 which in the case of success contains an alias for the subroutine, and sets
1121 up caching info for this glob.  Similarly for all the searched stashes.
1122
1123 This function grants C<"SUPER"> token as a postfix of the stash name. The
1124 GV returned from C<gv_fetchmeth> may be a method cache entry, which is not
1125 visible to Perl code.  So when calling C<call_sv>, you should not use
1126 the GV directly; instead, you should use the method's CV, which can be
1127 obtained from the GV with the C<GvCV> macro.
1128
1129         GV*     gv_fetchmeth(HV* stash, const char* name, STRLEN len, I32 level)
1130
1131 =for hackers
1132 Found in file gv.c
1133
1134 =item gv_fetchmethod_autoload
1135 X<gv_fetchmethod_autoload>
1136
1137 Returns the glob which contains the subroutine to call to invoke the method
1138 on the C<stash>.  In fact in the presence of autoloading this may be the
1139 glob for "AUTOLOAD".  In this case the corresponding variable $AUTOLOAD is
1140 already setup.
1141
1142 The third parameter of C<gv_fetchmethod_autoload> determines whether
1143 AUTOLOAD lookup is performed if the given method is not present: non-zero
1144 means yes, look for AUTOLOAD; zero means no, don't look for AUTOLOAD.
1145 Calling C<gv_fetchmethod> is equivalent to calling C<gv_fetchmethod_autoload>
1146 with a non-zero C<autoload> parameter.
1147
1148 These functions grant C<"SUPER"> token as a prefix of the method name. Note
1149 that if you want to keep the returned glob for a long time, you need to
1150 check for it being "AUTOLOAD", since at the later time the call may load a
1151 different subroutine due to $AUTOLOAD changing its value. Use the glob
1152 created via a side effect to do this.
1153
1154 These functions have the same side-effects and as C<gv_fetchmeth> with
1155 C<level==0>.  C<name> should be writable if contains C<':'> or C<'
1156 ''>. The warning against passing the GV returned by C<gv_fetchmeth> to
1157 C<call_sv> apply equally to these functions.
1158
1159         GV*     gv_fetchmethod_autoload(HV* stash, const char* name, I32 autoload)
1160
1161 =for hackers
1162 Found in file gv.c
1163
1164 =item gv_fetchmeth_autoload
1165 X<gv_fetchmeth_autoload>
1166
1167 Same as gv_fetchmeth(), but looks for autoloaded subroutines too.
1168 Returns a glob for the subroutine.
1169
1170 For an autoloaded subroutine without a GV, will create a GV even
1171 if C<level < 0>.  For an autoloaded subroutine without a stub, GvCV()
1172 of the result may be zero.
1173
1174         GV*     gv_fetchmeth_autoload(HV* stash, const char* name, STRLEN len, I32 level)
1175
1176 =for hackers
1177 Found in file gv.c
1178
1179 =item gv_stashpv
1180 X<gv_stashpv>
1181
1182 Returns a pointer to the stash for a specified package.  C<name> should
1183 be a valid UTF-8 string and must be null-terminated.  If C<create> is set
1184 then the package will be created if it does not already exist.  If C<create>
1185 is not set and the package does not exist then NULL is returned.
1186
1187         HV*     gv_stashpv(const char* name, I32 create)
1188
1189 =for hackers
1190 Found in file gv.c
1191
1192 =item gv_stashpvn
1193 X<gv_stashpvn>
1194
1195 Returns a pointer to the stash for a specified package.  C<name> should
1196 be a valid UTF-8 string.  The C<namelen> parameter indicates the length of
1197 the C<name>, in bytes.  If C<create> is set then the package will be
1198 created if it does not already exist.  If C<create> is not set and the
1199 package does not exist then NULL is returned.
1200
1201         HV*     gv_stashpvn(const char* name, U32 namelen, I32 create)
1202
1203 =for hackers
1204 Found in file gv.c
1205
1206 =item gv_stashsv
1207 X<gv_stashsv>
1208
1209 Returns a pointer to the stash for a specified package, which must be a
1210 valid UTF-8 string.  See C<gv_stashpv>.
1211
1212         HV*     gv_stashsv(SV* sv, I32 create)
1213
1214 =for hackers
1215 Found in file gv.c
1216
1217
1218 =back
1219
1220 =head1 Handy Values
1221
1222 =over 8
1223
1224 =item Nullav
1225 X<Nullav>
1226
1227 Null AV pointer.
1228
1229 =for hackers
1230 Found in file av.h
1231
1232 =item Nullch
1233 X<Nullch>
1234
1235 Null character pointer.
1236
1237 =for hackers
1238 Found in file handy.h
1239
1240 =item Nullcv
1241 X<Nullcv>
1242
1243 Null CV pointer.
1244
1245 =for hackers
1246 Found in file cv.h
1247
1248 =item Nullhv
1249 X<Nullhv>
1250
1251 Null HV pointer.
1252
1253 =for hackers
1254 Found in file hv.h
1255
1256 =item Nullsv
1257 X<Nullsv>
1258
1259 Null SV pointer.
1260
1261 =for hackers
1262 Found in file handy.h
1263
1264
1265 =back
1266
1267 =head1 Hash Manipulation Functions
1268
1269 =over 8
1270
1271 =item get_hv
1272 X<get_hv>
1273
1274 Returns the HV of the specified Perl hash.  If C<create> is set and the
1275 Perl variable does not exist then it will be created.  If C<create> is not
1276 set and the variable does not exist then NULL is returned.
1277
1278 NOTE: the perl_ form of this function is deprecated.
1279
1280         HV*     get_hv(const char* name, I32 create)
1281
1282 =for hackers
1283 Found in file perl.c
1284
1285 =item HEf_SVKEY
1286 X<HEf_SVKEY>
1287
1288 This flag, used in the length slot of hash entries and magic structures,
1289 specifies the structure contains an C<SV*> pointer where a C<char*> pointer
1290 is to be expected. (For information only--not to be used).
1291
1292 =for hackers
1293 Found in file hv.h
1294
1295 =item HeHASH
1296 X<HeHASH>
1297
1298 Returns the computed hash stored in the hash entry.
1299
1300         U32     HeHASH(HE* he)
1301
1302 =for hackers
1303 Found in file hv.h
1304
1305 =item HeKEY
1306 X<HeKEY>
1307
1308 Returns the actual pointer stored in the key slot of the hash entry. The
1309 pointer may be either C<char*> or C<SV*>, depending on the value of
1310 C<HeKLEN()>.  Can be assigned to.  The C<HePV()> or C<HeSVKEY()> macros are
1311 usually preferable for finding the value of a key.
1312
1313         void*   HeKEY(HE* he)
1314
1315 =for hackers
1316 Found in file hv.h
1317
1318 =item HeKLEN
1319 X<HeKLEN>
1320
1321 If this is negative, and amounts to C<HEf_SVKEY>, it indicates the entry
1322 holds an C<SV*> key.  Otherwise, holds the actual length of the key.  Can
1323 be assigned to. The C<HePV()> macro is usually preferable for finding key
1324 lengths.
1325
1326         STRLEN  HeKLEN(HE* he)
1327
1328 =for hackers
1329 Found in file hv.h
1330
1331 =item HePV
1332 X<HePV>
1333
1334 Returns the key slot of the hash entry as a C<char*> value, doing any
1335 necessary dereferencing of possibly C<SV*> keys.  The length of the string
1336 is placed in C<len> (this is a macro, so do I<not> use C<&len>).  If you do
1337 not care about what the length of the key is, you may use the global
1338 variable C<PL_na>, though this is rather less efficient than using a local
1339 variable.  Remember though, that hash keys in perl are free to contain
1340 embedded nulls, so using C<strlen()> or similar is not a good way to find
1341 the length of hash keys. This is very similar to the C<SvPV()> macro
1342 described elsewhere in this document.
1343
1344         char*   HePV(HE* he, STRLEN len)
1345
1346 =for hackers
1347 Found in file hv.h
1348
1349 =item HeSVKEY
1350 X<HeSVKEY>
1351
1352 Returns the key as an C<SV*>, or C<Nullsv> if the hash entry does not
1353 contain an C<SV*> key.
1354
1355         SV*     HeSVKEY(HE* he)
1356
1357 =for hackers
1358 Found in file hv.h
1359
1360 =item HeSVKEY_force
1361 X<HeSVKEY_force>
1362
1363 Returns the key as an C<SV*>.  Will create and return a temporary mortal
1364 C<SV*> if the hash entry contains only a C<char*> key.
1365
1366         SV*     HeSVKEY_force(HE* he)
1367
1368 =for hackers
1369 Found in file hv.h
1370
1371 =item HeSVKEY_set
1372 X<HeSVKEY_set>
1373
1374 Sets the key to a given C<SV*>, taking care to set the appropriate flags to
1375 indicate the presence of an C<SV*> key, and returns the same
1376 C<SV*>.
1377
1378         SV*     HeSVKEY_set(HE* he, SV* sv)
1379
1380 =for hackers
1381 Found in file hv.h
1382
1383 =item HeVAL
1384 X<HeVAL>
1385
1386 Returns the value slot (type C<SV*>) stored in the hash entry.
1387
1388         SV*     HeVAL(HE* he)
1389
1390 =for hackers
1391 Found in file hv.h
1392
1393 =item HvNAME
1394 X<HvNAME>
1395
1396 Returns the package name of a stash, or NULL if C<stash> isn't a stash.
1397 See C<SvSTASH>, C<CvSTASH>.
1398
1399         char*   HvNAME(HV* stash)
1400
1401 =for hackers
1402 Found in file hv.h
1403
1404 =item hv_assert
1405 X<hv_assert>
1406
1407 Check that a hash is in an internally consistent state.
1408
1409         void    hv_assert(HV* tb)
1410
1411 =for hackers
1412 Found in file hv.c
1413
1414 =item hv_clear
1415 X<hv_clear>
1416
1417 Clears a hash, making it empty.
1418
1419         void    hv_clear(HV* tb)
1420
1421 =for hackers
1422 Found in file hv.c
1423
1424 =item hv_clear_placeholders
1425 X<hv_clear_placeholders>
1426
1427 Clears any placeholders from a hash.  If a restricted hash has any of its keys
1428 marked as readonly and the key is subsequently deleted, the key is not actually
1429 deleted but is marked by assigning it a value of &PL_sv_placeholder.  This tags
1430 it so it will be ignored by future operations such as iterating over the hash,
1431 but will still allow the hash to have a value reassigned to the key at some
1432 future point.  This function clears any such placeholder keys from the hash.
1433 See Hash::Util::lock_keys() for an example of its use.
1434
1435         void    hv_clear_placeholders(HV* hb)
1436
1437 =for hackers
1438 Found in file hv.c
1439
1440 =item hv_delete
1441 X<hv_delete>
1442
1443 Deletes a key/value pair in the hash.  The value SV is removed from the
1444 hash and returned to the caller.  The C<klen> is the length of the key.
1445 The C<flags> value will normally be zero; if set to G_DISCARD then NULL
1446 will be returned.
1447
1448         SV*     hv_delete(HV* tb, const char* key, I32 klen, I32 flags)
1449
1450 =for hackers
1451 Found in file hv.c
1452
1453 =item hv_delete_ent
1454 X<hv_delete_ent>
1455
1456 Deletes a key/value pair in the hash.  The value SV is removed from the
1457 hash and returned to the caller.  The C<flags> value will normally be zero;
1458 if set to G_DISCARD then NULL will be returned.  C<hash> can be a valid
1459 precomputed hash value, or 0 to ask for it to be computed.
1460
1461         SV*     hv_delete_ent(HV* tb, SV* key, I32 flags, U32 hash)
1462
1463 =for hackers
1464 Found in file hv.c
1465
1466 =item hv_exists
1467 X<hv_exists>
1468
1469 Returns a boolean indicating whether the specified hash key exists.  The
1470 C<klen> is the length of the key.
1471
1472         bool    hv_exists(HV* tb, const char* key, I32 klen)
1473
1474 =for hackers
1475 Found in file hv.c
1476
1477 =item hv_exists_ent
1478 X<hv_exists_ent>
1479
1480 Returns a boolean indicating whether the specified hash key exists. C<hash>
1481 can be a valid precomputed hash value, or 0 to ask for it to be
1482 computed.
1483
1484         bool    hv_exists_ent(HV* tb, SV* key, U32 hash)
1485
1486 =for hackers
1487 Found in file hv.c
1488
1489 =item hv_fetch
1490 X<hv_fetch>
1491
1492 Returns the SV which corresponds to the specified key in the hash.  The
1493 C<klen> is the length of the key.  If C<lval> is set then the fetch will be
1494 part of a store.  Check that the return value is non-null before
1495 dereferencing it to an C<SV*>.
1496
1497 See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
1498 information on how to use this function on tied hashes.
1499
1500         SV**    hv_fetch(HV* tb, const char* key, I32 klen, I32 lval)
1501
1502 =for hackers
1503 Found in file hv.c
1504
1505 =item hv_fetch_ent
1506 X<hv_fetch_ent>
1507
1508 Returns the hash entry which corresponds to the specified key in the hash.
1509 C<hash> must be a valid precomputed hash number for the given C<key>, or 0
1510 if you want the function to compute it.  IF C<lval> is set then the fetch
1511 will be part of a store.  Make sure the return value is non-null before
1512 accessing it.  The return value when C<tb> is a tied hash is a pointer to a
1513 static location, so be sure to make a copy of the structure if you need to
1514 store it somewhere.
1515
1516 See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
1517 information on how to use this function on tied hashes.
1518
1519         HE*     hv_fetch_ent(HV* tb, SV* key, I32 lval, U32 hash)
1520
1521 =for hackers
1522 Found in file hv.c
1523
1524 =item hv_iterinit
1525 X<hv_iterinit>
1526
1527 Prepares a starting point to traverse a hash table.  Returns the number of
1528 keys in the hash (i.e. the same as C<HvKEYS(tb)>).  The return value is
1529 currently only meaningful for hashes without tie magic.
1530
1531 NOTE: Before version 5.004_65, C<hv_iterinit> used to return the number of
1532 hash buckets that happen to be in use.  If you still need that esoteric
1533 value, you can get it through the macro C<HvFILL(tb)>.
1534
1535
1536         I32     hv_iterinit(HV* tb)
1537
1538 =for hackers
1539 Found in file hv.c
1540
1541 =item hv_iterkey
1542 X<hv_iterkey>
1543
1544 Returns the key from the current position of the hash iterator.  See
1545 C<hv_iterinit>.
1546
1547         char*   hv_iterkey(HE* entry, I32* retlen)
1548
1549 =for hackers
1550 Found in file hv.c
1551
1552 =item hv_iterkeysv
1553 X<hv_iterkeysv>
1554
1555 Returns the key as an C<SV*> from the current position of the hash
1556 iterator.  The return value will always be a mortal copy of the key.  Also
1557 see C<hv_iterinit>.
1558
1559         SV*     hv_iterkeysv(HE* entry)
1560
1561 =for hackers
1562 Found in file hv.c
1563
1564 =item hv_iternext
1565 X<hv_iternext>
1566
1567 Returns entries from a hash iterator.  See C<hv_iterinit>.
1568
1569 You may call C<hv_delete> or C<hv_delete_ent> on the hash entry that the
1570 iterator currently points to, without losing your place or invalidating your
1571 iterator.  Note that in this case the current entry is deleted from the hash
1572 with your iterator holding the last reference to it.  Your iterator is flagged
1573 to free the entry on the next call to C<hv_iternext>, so you must not discard
1574 your iterator immediately else the entry will leak - call C<hv_iternext> to
1575 trigger the resource deallocation.
1576
1577         HE*     hv_iternext(HV* tb)
1578
1579 =for hackers
1580 Found in file hv.c
1581
1582 =item hv_iternextsv
1583 X<hv_iternextsv>
1584
1585 Performs an C<hv_iternext>, C<hv_iterkey>, and C<hv_iterval> in one
1586 operation.
1587
1588         SV*     hv_iternextsv(HV* hv, char** key, I32* retlen)
1589
1590 =for hackers
1591 Found in file hv.c
1592
1593 =item hv_iternext_flags
1594 X<hv_iternext_flags>
1595
1596 Returns entries from a hash iterator.  See C<hv_iterinit> and C<hv_iternext>.
1597 The C<flags> value will normally be zero; if HV_ITERNEXT_WANTPLACEHOLDERS is
1598 set the placeholders keys (for restricted hashes) will be returned in addition
1599 to normal keys. By default placeholders are automatically skipped over.
1600 Currently a placeholder is implemented with a value that is
1601 C<&Perl_sv_placeholder>. Note that the implementation of placeholders and
1602 restricted hashes may change, and the implementation currently is
1603 insufficiently abstracted for any change to be tidy.
1604
1605 NOTE: this function is experimental and may change or be
1606 removed without notice.
1607
1608         HE*     hv_iternext_flags(HV* tb, I32 flags)
1609
1610 =for hackers
1611 Found in file hv.c
1612
1613 =item hv_iterval
1614 X<hv_iterval>
1615
1616 Returns the value from the current position of the hash iterator.  See
1617 C<hv_iterkey>.
1618
1619         SV*     hv_iterval(HV* tb, HE* entry)
1620
1621 =for hackers
1622 Found in file hv.c
1623
1624 =item hv_magic
1625 X<hv_magic>
1626
1627 Adds magic to a hash.  See C<sv_magic>.
1628
1629         void    hv_magic(HV* hv, GV* gv, int how)
1630
1631 =for hackers
1632 Found in file hv.c
1633
1634 =item hv_scalar
1635 X<hv_scalar>
1636
1637 Evaluates the hash in scalar context and returns the result. Handles magic when the hash is tied.
1638
1639         SV*     hv_scalar(HV* hv)
1640
1641 =for hackers
1642 Found in file hv.c
1643
1644 =item hv_store
1645 X<hv_store>
1646
1647 Stores an SV in a hash.  The hash key is specified as C<key> and C<klen> is
1648 the length of the key.  The C<hash> parameter is the precomputed hash
1649 value; if it is zero then Perl will compute it.  The return value will be
1650 NULL if the operation failed or if the value did not need to be actually
1651 stored within the hash (as in the case of tied hashes).  Otherwise it can
1652 be dereferenced to get the original C<SV*>.  Note that the caller is
1653 responsible for suitably incrementing the reference count of C<val> before
1654 the call, and decrementing it if the function returned NULL.  Effectively
1655 a successful hv_store takes ownership of one reference to C<val>.  This is
1656 usually what you want; a newly created SV has a reference count of one, so
1657 if all your code does is create SVs then store them in a hash, hv_store
1658 will own the only reference to the new SV, and your code doesn't need to do
1659 anything further to tidy up.  hv_store is not implemented as a call to
1660 hv_store_ent, and does not create a temporary SV for the key, so if your
1661 key data is not already in SV form then use hv_store in preference to
1662 hv_store_ent.
1663
1664 See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
1665 information on how to use this function on tied hashes.
1666
1667         SV**    hv_store(HV* tb, const char* key, I32 klen, SV* val, U32 hash)
1668
1669 =for hackers
1670 Found in file hv.c
1671
1672 =item hv_store_ent
1673 X<hv_store_ent>
1674
1675 Stores C<val> in a hash.  The hash key is specified as C<key>.  The C<hash>
1676 parameter is the precomputed hash value; if it is zero then Perl will
1677 compute it.  The return value is the new hash entry so created.  It will be
1678 NULL if the operation failed or if the value did not need to be actually
1679 stored within the hash (as in the case of tied hashes).  Otherwise the
1680 contents of the return value can be accessed using the C<He?> macros
1681 described here.  Note that the caller is responsible for suitably
1682 incrementing the reference count of C<val> before the call, and
1683 decrementing it if the function returned NULL.  Effectively a successful
1684 hv_store_ent takes ownership of one reference to C<val>.  This is
1685 usually what you want; a newly created SV has a reference count of one, so
1686 if all your code does is create SVs then store them in a hash, hv_store
1687 will own the only reference to the new SV, and your code doesn't need to do
1688 anything further to tidy up.  Note that hv_store_ent only reads the C<key>;
1689 unlike C<val> it does not take ownership of it, so maintaining the correct
1690 reference count on C<key> is entirely the caller's responsibility.  hv_store
1691 is not implemented as a call to hv_store_ent, and does not create a temporary
1692 SV for the key, so if your key data is not already in SV form then use
1693 hv_store in preference to hv_store_ent.
1694
1695 See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
1696 information on how to use this function on tied hashes.
1697
1698         HE*     hv_store_ent(HV* tb, SV* key, SV* val, U32 hash)
1699
1700 =for hackers
1701 Found in file hv.c
1702
1703 =item hv_undef
1704 X<hv_undef>
1705
1706 Undefines the hash.
1707
1708         void    hv_undef(HV* tb)
1709
1710 =for hackers
1711 Found in file hv.c
1712
1713 =item newHV
1714 X<newHV>
1715
1716 Creates a new HV.  The reference count is set to 1.
1717
1718         HV*     newHV()
1719
1720 =for hackers
1721 Found in file hv.c
1722
1723
1724 =back
1725
1726 =head1 Magical Functions
1727
1728 =over 8
1729
1730 =item mg_clear
1731 X<mg_clear>
1732
1733 Clear something magical that the SV represents.  See C<sv_magic>.
1734
1735         int     mg_clear(SV* sv)
1736
1737 =for hackers
1738 Found in file mg.c
1739
1740 =item mg_copy
1741 X<mg_copy>
1742
1743 Copies the magic from one SV to another.  See C<sv_magic>.
1744
1745         int     mg_copy(SV* sv, SV* nsv, const char* key, I32 klen)
1746
1747 =for hackers
1748 Found in file mg.c
1749
1750 =item mg_find
1751 X<mg_find>
1752
1753 Finds the magic pointer for type matching the SV.  See C<sv_magic>.
1754
1755         MAGIC*  mg_find(const SV* sv, int type)
1756
1757 =for hackers
1758 Found in file mg.c
1759
1760 =item mg_free
1761 X<mg_free>
1762
1763 Free any magic storage used by the SV.  See C<sv_magic>.
1764
1765         int     mg_free(SV* sv)
1766
1767 =for hackers
1768 Found in file mg.c
1769
1770 =item mg_get
1771 X<mg_get>
1772
1773 Do magic after a value is retrieved from the SV.  See C<sv_magic>.
1774
1775         int     mg_get(SV* sv)
1776
1777 =for hackers
1778 Found in file mg.c
1779
1780 =item mg_length
1781 X<mg_length>
1782
1783 Report on the SV's length.  See C<sv_magic>.
1784
1785         U32     mg_length(SV* sv)
1786
1787 =for hackers
1788 Found in file mg.c
1789
1790 =item mg_magical
1791 X<mg_magical>
1792
1793 Turns on the magical status of an SV.  See C<sv_magic>.
1794
1795         void    mg_magical(SV* sv)
1796
1797 =for hackers
1798 Found in file mg.c
1799
1800 =item mg_set
1801 X<mg_set>
1802
1803 Do magic after a value is assigned to the SV.  See C<sv_magic>.
1804
1805         int     mg_set(SV* sv)
1806
1807 =for hackers
1808 Found in file mg.c
1809
1810 =item SvGETMAGIC
1811 X<SvGETMAGIC>
1812
1813 Invokes C<mg_get> on an SV if it has 'get' magic.  This macro evaluates its
1814 argument more than once.
1815
1816         void    SvGETMAGIC(SV* sv)
1817
1818 =for hackers
1819 Found in file sv.h
1820
1821 =item SvLOCK
1822 X<SvLOCK>
1823
1824 Arranges for a mutual exclusion lock to be obtained on sv if a suitable module
1825 has been loaded.
1826
1827         void    SvLOCK(SV* sv)
1828
1829 =for hackers
1830 Found in file sv.h
1831
1832 =item SvSETMAGIC
1833 X<SvSETMAGIC>
1834
1835 Invokes C<mg_set> on an SV if it has 'set' magic.  This macro evaluates its
1836 argument more than once.
1837
1838         void    SvSETMAGIC(SV* sv)
1839
1840 =for hackers
1841 Found in file sv.h
1842
1843 =item SvSetMagicSV
1844 X<SvSetMagicSV>
1845
1846 Like C<SvSetSV>, but does any set magic required afterwards.
1847
1848         void    SvSetMagicSV(SV* dsb, SV* ssv)
1849
1850 =for hackers
1851 Found in file sv.h
1852
1853 =item SvSetMagicSV_nosteal
1854 X<SvSetMagicSV_nosteal>
1855
1856 Like C<SvSetSV_nosteal>, but does any set magic required afterwards.
1857
1858         void    SvSetMagicSV_nosteal(SV* dsv, SV* ssv)
1859
1860 =for hackers
1861 Found in file sv.h
1862
1863 =item SvSetSV
1864 X<SvSetSV>
1865
1866 Calls C<sv_setsv> if dsv is not the same as ssv.  May evaluate arguments
1867 more than once.
1868
1869         void    SvSetSV(SV* dsb, SV* ssv)
1870
1871 =for hackers
1872 Found in file sv.h
1873
1874 =item SvSetSV_nosteal
1875 X<SvSetSV_nosteal>
1876
1877 Calls a non-destructive version of C<sv_setsv> if dsv is not the same as
1878 ssv. May evaluate arguments more than once.
1879
1880         void    SvSetSV_nosteal(SV* dsv, SV* ssv)
1881
1882 =for hackers
1883 Found in file sv.h
1884
1885 =item SvSHARE
1886 X<SvSHARE>
1887
1888 Arranges for sv to be shared between threads if a suitable module
1889 has been loaded.
1890
1891         void    SvSHARE(SV* sv)
1892
1893 =for hackers
1894 Found in file sv.h
1895
1896 =item SvUNLOCK
1897 X<SvUNLOCK>
1898
1899 Releases a mutual exclusion lock on sv if a suitable module
1900 has been loaded.
1901
1902         void    SvUNLOCK(SV* sv)
1903
1904 =for hackers
1905 Found in file sv.h
1906
1907
1908 =back
1909
1910 =head1 Memory Management
1911
1912 =over 8
1913
1914 =item Copy
1915 X<Copy>
1916
1917 The XSUB-writer's interface to the C C<memcpy> function.  The C<src> is the
1918 source, C<dest> is the destination, C<nitems> is the number of items, and C<type> is
1919 the type.  May fail on overlapping copies.  See also C<Move>.
1920
1921         void    Copy(void* src, void* dest, int nitems, type)
1922
1923 =for hackers
1924 Found in file handy.h
1925
1926 =item CopyD
1927 X<CopyD>
1928
1929 Like C<Copy> but returns dest. Useful for encouraging compilers to tail-call
1930 optimise.
1931
1932         void *  CopyD(void* src, void* dest, int nitems, type)
1933
1934 =for hackers
1935 Found in file handy.h
1936
1937 =item Move
1938 X<Move>
1939
1940 The XSUB-writer's interface to the C C<memmove> function.  The C<src> is the
1941 source, C<dest> is the destination, C<nitems> is the number of items, and C<type> is
1942 the type.  Can do overlapping moves.  See also C<Copy>.
1943
1944         void    Move(void* src, void* dest, int nitems, type)
1945
1946 =for hackers
1947 Found in file handy.h
1948
1949 =item MoveD
1950 X<MoveD>
1951
1952 Like C<Move> but returns dest. Useful for encouraging compilers to tail-call
1953 optimise.
1954
1955         void *  MoveD(void* src, void* dest, int nitems, type)
1956
1957 =for hackers
1958 Found in file handy.h
1959
1960 =item Newx
1961 X<Newx>
1962
1963 The XSUB-writer's interface to the C C<malloc> function.
1964
1965 In 5.9.3, Newx() and friends replace the older New() API, and drops
1966 the first parameter, I<x>, a debug aid which allowed callers to identify
1967 themselves.  This aid has been superceded by a new build option,
1968 PERL_MEM_LOG (see L<perlhack/PERL_MEM_LOG>).  The older API is still
1969 there for use in XS modules supporting older perls.
1970
1971         void    Newx(void* ptr, int nitems, type)
1972
1973 =for hackers
1974 Found in file handy.h
1975
1976 =item Newxc
1977 X<Newxc>
1978
1979 The XSUB-writer's interface to the C C<malloc> function, with
1980 cast.  See also C<Newx>.
1981
1982         void    Newxc(void* ptr, int nitems, type, cast)
1983
1984 =for hackers
1985 Found in file handy.h
1986
1987 =item Newxz
1988 X<Newxz>
1989
1990 The XSUB-writer's interface to the C C<malloc> function.  The allocated
1991 memory is zeroed with C<memzero>.  See also C<Newx>.
1992
1993         void    Newxz(void* ptr, int nitems, type)
1994
1995 =for hackers
1996 Found in file handy.h
1997
1998 =item Poison
1999 X<Poison>
2000
2001 Fill up memory with a pattern (byte 0xAB over and over again) that
2002 hopefully catches attempts to access uninitialized memory.
2003
2004         void    Poison(void* dest, int nitems, type)
2005
2006 =for hackers
2007 Found in file handy.h
2008
2009 =item Renew
2010 X<Renew>
2011
2012 The XSUB-writer's interface to the C C<realloc> function.
2013
2014         void    Renew(void* ptr, int nitems, type)
2015
2016 =for hackers
2017 Found in file handy.h
2018
2019 =item Renewc
2020 X<Renewc>
2021
2022 The XSUB-writer's interface to the C C<realloc> function, with
2023 cast.
2024
2025         void    Renewc(void* ptr, int nitems, type, cast)
2026
2027 =for hackers
2028 Found in file handy.h
2029
2030 =item Safefree
2031 X<Safefree>
2032
2033 The XSUB-writer's interface to the C C<free> function.
2034
2035         void    Safefree(void* ptr)
2036
2037 =for hackers
2038 Found in file handy.h
2039
2040 =item savepv
2041 X<savepv>
2042
2043 Perl's version of C<strdup()>. Returns a pointer to a newly allocated
2044 string which is a duplicate of C<pv>. The size of the string is
2045 determined by C<strlen()>. The memory allocated for the new string can
2046 be freed with the C<Safefree()> function.
2047
2048         char*   savepv(const char* pv)
2049
2050 =for hackers
2051 Found in file util.c
2052
2053 =item savepvn
2054 X<savepvn>
2055
2056 Perl's version of what C<strndup()> would be if it existed. Returns a
2057 pointer to a newly allocated string which is a duplicate of the first
2058 C<len> bytes from C<pv>. The memory allocated for the new string can be
2059 freed with the C<Safefree()> function.
2060
2061         char*   savepvn(const char* pv, I32 len)
2062
2063 =for hackers
2064 Found in file util.c
2065
2066 =item savesharedpv
2067 X<savesharedpv>
2068
2069 A version of C<savepv()> which allocates the duplicate string in memory
2070 which is shared between threads.
2071
2072         char*   savesharedpv(const char* pv)
2073
2074 =for hackers
2075 Found in file util.c
2076
2077 =item savesvpv
2078 X<savesvpv>
2079
2080 A version of C<savepv()>/C<savepvn()> which gets the string to duplicate from
2081 the passed in SV using C<SvPV()>
2082
2083         char*   savesvpv(SV* sv)
2084
2085 =for hackers
2086 Found in file util.c
2087
2088 =item StructCopy
2089 X<StructCopy>
2090
2091 This is an architecture-independent macro to copy one structure to another.
2092
2093         void    StructCopy(type src, type dest, type)
2094
2095 =for hackers
2096 Found in file handy.h
2097
2098 =item Zero
2099 X<Zero>
2100
2101 The XSUB-writer's interface to the C C<memzero> function.  The C<dest> is the
2102 destination, C<nitems> is the number of items, and C<type> is the type.
2103
2104         void    Zero(void* dest, int nitems, type)
2105
2106 =for hackers
2107 Found in file handy.h
2108
2109 =item ZeroD
2110 X<ZeroD>
2111
2112 Like C<Zero> but returns dest. Useful for encouraging compilers to tail-call
2113 optimise.
2114
2115         void *  ZeroD(void* dest, int nitems, type)
2116
2117 =for hackers
2118 Found in file handy.h
2119
2120
2121 =back
2122
2123 =head1 Miscellaneous Functions
2124
2125 =over 8
2126
2127 =item fbm_compile
2128 X<fbm_compile>
2129
2130 Analyses the string in order to make fast searches on it using fbm_instr()
2131 -- the Boyer-Moore algorithm.
2132
2133         void    fbm_compile(SV* sv, U32 flags)
2134
2135 =for hackers
2136 Found in file util.c
2137
2138 =item fbm_instr
2139 X<fbm_instr>
2140
2141 Returns the location of the SV in the string delimited by C<str> and
2142 C<strend>.  It returns C<Nullch> if the string can't be found.  The C<sv>
2143 does not have to be fbm_compiled, but the search will not be as fast
2144 then.
2145
2146         char*   fbm_instr(unsigned char* big, unsigned char* bigend, SV* littlesv, U32 flags)
2147
2148 =for hackers
2149 Found in file util.c
2150
2151 =item form
2152 X<form>
2153
2154 Takes a sprintf-style format pattern and conventional
2155 (non-SV) arguments and returns the formatted string.
2156
2157     (char *) Perl_form(pTHX_ const char* pat, ...)
2158
2159 can be used any place a string (char *) is required:
2160
2161     char * s = Perl_form("%d.%d",major,minor);
2162
2163 Uses a single private buffer so if you want to format several strings you
2164 must explicitly copy the earlier strings away (and free the copies when you
2165 are done).
2166
2167         char*   form(const char* pat, ...)
2168
2169 =for hackers
2170 Found in file util.c
2171
2172 =item getcwd_sv
2173 X<getcwd_sv>
2174
2175 Fill the sv with current working directory
2176
2177         int     getcwd_sv(SV* sv)
2178
2179 =for hackers
2180 Found in file util.c
2181
2182 =item my_sprintf
2183 X<my_sprintf>
2184
2185 The C library C<sprintf>, wrapped if necessary, to ensure that it will return
2186 the length of the string written to the buffer. Only rare pre-ANSI systems
2187 need the wrapper function - usually this is a direct call to C<sprintf>.
2188
2189         int     my_sprintf(char *buffer, const char *pat, ...)
2190
2191 =for hackers
2192 Found in file util.c
2193
2194 =item new_version
2195 X<new_version>
2196
2197 Returns a new version object based on the passed in SV:
2198
2199     SV *sv = new_version(SV *ver);
2200
2201 Does not alter the passed in ver SV.  See "upg_version" if you
2202 want to upgrade the SV.
2203
2204         SV*     new_version(SV *ver)
2205
2206 =for hackers
2207 Found in file util.c
2208
2209 =item scan_version
2210 X<scan_version>
2211
2212 Returns a pointer to the next character after the parsed
2213 version string, as well as upgrading the passed in SV to
2214 an RV.
2215
2216 Function must be called with an already existing SV like
2217
2218     sv = newSV(0);
2219     s = scan_version(s,SV *sv, bool qv);
2220
2221 Performs some preprocessing to the string to ensure that
2222 it has the correct characteristics of a version.  Flags the
2223 object if it contains an underscore (which denotes this
2224 is a alpha version).  The boolean qv denotes that the version
2225 should be interpreted as if it had multiple decimals, even if
2226 it doesn't.
2227
2228         const char*     scan_version(const char *vstr, SV *sv, bool qv)
2229
2230 =for hackers
2231 Found in file util.c
2232
2233 =item strEQ
2234 X<strEQ>
2235
2236 Test two strings to see if they are equal.  Returns true or false.
2237
2238         bool    strEQ(char* s1, char* s2)
2239
2240 =for hackers
2241 Found in file handy.h
2242
2243 =item strGE
2244 X<strGE>
2245
2246 Test two strings to see if the first, C<s1>, is greater than or equal to
2247 the second, C<s2>.  Returns true or false.
2248
2249         bool    strGE(char* s1, char* s2)
2250
2251 =for hackers
2252 Found in file handy.h
2253
2254 =item strGT
2255 X<strGT>
2256
2257 Test two strings to see if the first, C<s1>, is greater than the second,
2258 C<s2>.  Returns true or false.
2259
2260         bool    strGT(char* s1, char* s2)
2261
2262 =for hackers
2263 Found in file handy.h
2264
2265 =item strLE
2266 X<strLE>
2267
2268 Test two strings to see if the first, C<s1>, is less than or equal to the
2269 second, C<s2>.  Returns true or false.
2270
2271         bool    strLE(char* s1, char* s2)
2272
2273 =for hackers
2274 Found in file handy.h
2275
2276 =item strLT
2277 X<strLT>
2278
2279 Test two strings to see if the first, C<s1>, is less than the second,
2280 C<s2>.  Returns true or false.
2281
2282         bool    strLT(char* s1, char* s2)
2283
2284 =for hackers
2285 Found in file handy.h
2286
2287 =item strNE
2288 X<strNE>
2289
2290 Test two strings to see if they are different.  Returns true or
2291 false.
2292
2293         bool    strNE(char* s1, char* s2)
2294
2295 =for hackers
2296 Found in file handy.h
2297
2298 =item strnEQ
2299 X<strnEQ>
2300
2301 Test two strings to see if they are equal.  The C<len> parameter indicates
2302 the number of bytes to compare.  Returns true or false. (A wrapper for
2303 C<strncmp>).
2304
2305         bool    strnEQ(char* s1, char* s2, STRLEN len)
2306
2307 =for hackers
2308 Found in file handy.h
2309
2310 =item strnNE
2311 X<strnNE>
2312
2313 Test two strings to see if they are different.  The C<len> parameter
2314 indicates the number of bytes to compare.  Returns true or false. (A
2315 wrapper for C<strncmp>).
2316
2317         bool    strnNE(char* s1, char* s2, STRLEN len)
2318
2319 =for hackers
2320 Found in file handy.h
2321
2322 =item sv_nosharing
2323 X<sv_nosharing>
2324
2325 Dummy routine which "shares" an SV when there is no sharing module present.
2326 Or "locks" it. Or "unlocks" it. In other words, ignores its single SV argument.
2327 Exists to avoid test for a NULL function pointer and because it could
2328 potentially warn under some level of strict-ness.
2329
2330         void    sv_nosharing(SV *)
2331
2332 =for hackers
2333 Found in file util.c
2334
2335 =item upg_version
2336 X<upg_version>
2337
2338 In-place upgrade of the supplied SV to a version object.
2339
2340     SV *sv = upg_version(SV *sv);
2341
2342 Returns a pointer to the upgraded SV.
2343
2344         SV*     upg_version(SV *ver)
2345
2346 =for hackers
2347 Found in file util.c
2348
2349 =item vcmp
2350 X<vcmp>
2351
2352 Version object aware cmp.  Both operands must already have been 
2353 converted into version objects.
2354
2355         int     vcmp(SV *lvs, SV *rvs)
2356
2357 =for hackers
2358 Found in file util.c
2359
2360 =item vnormal
2361 X<vnormal>
2362
2363 Accepts a version object and returns the normalized string
2364 representation.  Call like:
2365
2366     sv = vnormal(rv);
2367
2368 NOTE: you can pass either the object directly or the SV
2369 contained within the RV.
2370
2371         SV*     vnormal(SV *vs)
2372
2373 =for hackers
2374 Found in file util.c
2375
2376 =item vnumify
2377 X<vnumify>
2378
2379 Accepts a version object and returns the normalized floating
2380 point representation.  Call like:
2381
2382     sv = vnumify(rv);
2383
2384 NOTE: you can pass either the object directly or the SV
2385 contained within the RV.
2386
2387         SV*     vnumify(SV *vs)
2388
2389 =for hackers
2390 Found in file util.c
2391
2392 =item vstringify
2393 X<vstringify>
2394
2395 In order to maintain maximum compatibility with earlier versions
2396 of Perl, this function will return either the floating point
2397 notation or the multiple dotted notation, depending on whether
2398 the original version contained 1 or more dots, respectively
2399
2400         SV*     vstringify(SV *vs)
2401
2402 =for hackers
2403 Found in file util.c
2404
2405 =item vverify
2406 X<vverify>
2407
2408 Validates that the SV contains a valid version object.
2409
2410     bool vverify(SV *vobj);
2411
2412 Note that it only confirms the bare minimum structure (so as not to get
2413 confused by derived classes which may contain additional hash entries):
2414
2415         bool    vverify(SV *vs)
2416
2417 =for hackers
2418 Found in file util.c
2419
2420
2421 =back
2422
2423 =head1 Multicall Functions
2424
2425 =over 8
2426
2427 =item dMULTICALL
2428 X<dMULTICALL>
2429
2430 Declare local variables for a multicall. See L<perlcall/Lightweight Callbacks>.
2431
2432                 dMULTICALL;
2433
2434 =for hackers
2435 Found in file cop.h
2436
2437 =item MULTICALL
2438 X<MULTICALL>
2439
2440 Make a lightweight callback. See L<perlcall/Lightweight Callbacks>.
2441
2442                 MULTICALL;
2443
2444 =for hackers
2445 Found in file cop.h
2446
2447 =item POP_MULTICALL
2448 X<POP_MULTICALL>
2449
2450 Closing bracket for a lightweight callback.
2451 See L<perlcall/Lightweight Callbacks>.
2452
2453                 POP_MULTICALL;
2454
2455 =for hackers
2456 Found in file cop.h
2457
2458 =item PUSH_MULTICALL
2459 X<PUSH_MULTICALL>
2460
2461 Opening bracket for a lightweight callback.
2462 See L<perlcall/Lightweight Callbacks>.
2463
2464                 PUSH_MULTICALL;
2465
2466 =for hackers
2467 Found in file cop.h
2468
2469
2470 =back
2471
2472 =head1 Numeric functions
2473
2474 =over 8
2475
2476 =item grok_bin
2477 X<grok_bin>
2478
2479 converts a string representing a binary number to numeric form.
2480
2481 On entry I<start> and I<*len> give the string to scan, I<*flags> gives
2482 conversion flags, and I<result> should be NULL or a pointer to an NV.
2483 The scan stops at the end of the string, or the first invalid character.
2484 Unless C<PERL_SCAN_SILENT_ILLDIGIT> is set in I<*flags>, encountering an
2485 invalid character will also trigger a warning.
2486 On return I<*len> is set to the length of the scanned string,
2487 and I<*flags> gives output flags.
2488
2489 If the value is <= C<UV_MAX> it is returned as a UV, the output flags are clear,
2490 and nothing is written to I<*result>. If the value is > UV_MAX C<grok_bin>
2491 returns UV_MAX, sets C<PERL_SCAN_GREATER_THAN_UV_MAX> in the output flags,
2492 and writes the value to I<*result> (or the value is discarded if I<result>
2493 is NULL).
2494
2495 The binary number may optionally be prefixed with "0b" or "b" unless
2496 C<PERL_SCAN_DISALLOW_PREFIX> is set in I<*flags> on entry. If
2497 C<PERL_SCAN_ALLOW_UNDERSCORES> is set in I<*flags> then the binary
2498 number may use '_' characters to separate digits.
2499
2500         UV      grok_bin(const char* start, STRLEN* len_p, I32* flags, NV *result)
2501
2502 =for hackers
2503 Found in file numeric.c
2504
2505 =item grok_hex
2506 X<grok_hex>
2507
2508 converts a string representing a hex number to numeric form.
2509
2510 On entry I<start> and I<*len> give the string to scan, I<*flags> gives
2511 conversion flags, and I<result> should be NULL or a pointer to an NV.
2512 The scan stops at the end of the string, or the first invalid character.
2513 Unless C<PERL_SCAN_SILENT_ILLDIGIT> is set in I<*flags>, encountering an
2514 invalid character will also trigger a warning.
2515 On return I<*len> is set to the length of the scanned string,
2516 and I<*flags> gives output flags.
2517
2518 If the value is <= UV_MAX it is returned as a UV, the output flags are clear,
2519 and nothing is written to I<*result>. If the value is > UV_MAX C<grok_hex>
2520 returns UV_MAX, sets C<PERL_SCAN_GREATER_THAN_UV_MAX> in the output flags,
2521 and writes the value to I<*result> (or the value is discarded if I<result>
2522 is NULL).
2523
2524 The hex number may optionally be prefixed with "0x" or "x" unless
2525 C<PERL_SCAN_DISALLOW_PREFIX> is set in I<*flags> on entry. If
2526 C<PERL_SCAN_ALLOW_UNDERSCORES> is set in I<*flags> then the hex
2527 number may use '_' characters to separate digits.
2528
2529         UV      grok_hex(const char* start, STRLEN* len_p, I32* flags, NV *result)
2530
2531 =for hackers
2532 Found in file numeric.c
2533
2534 =item grok_number
2535 X<grok_number>
2536
2537 Recognise (or not) a number.  The type of the number is returned
2538 (0 if unrecognised), otherwise it is a bit-ORed combination of
2539 IS_NUMBER_IN_UV, IS_NUMBER_GREATER_THAN_UV_MAX, IS_NUMBER_NOT_INT,
2540 IS_NUMBER_NEG, IS_NUMBER_INFINITY, IS_NUMBER_NAN (defined in perl.h).
2541
2542 If the value of the number can fit an in UV, it is returned in the *valuep
2543 IS_NUMBER_IN_UV will be set to indicate that *valuep is valid, IS_NUMBER_IN_UV
2544 will never be set unless *valuep is valid, but *valuep may have been assigned
2545 to during processing even though IS_NUMBER_IN_UV is not set on return.
2546 If valuep is NULL, IS_NUMBER_IN_UV will be set for the same cases as when
2547 valuep is non-NULL, but no actual assignment (or SEGV) will occur.
2548
2549 IS_NUMBER_NOT_INT will be set with IS_NUMBER_IN_UV if trailing decimals were
2550 seen (in which case *valuep gives the true value truncated to an integer), and
2551 IS_NUMBER_NEG if the number is negative (in which case *valuep holds the
2552 absolute value).  IS_NUMBER_IN_UV is not set if e notation was used or the
2553 number is larger than a UV.
2554
2555         int     grok_number(const char *pv, STRLEN len, UV *valuep)
2556
2557 =for hackers
2558 Found in file numeric.c
2559
2560 =item grok_numeric_radix
2561 X<grok_numeric_radix>
2562
2563 Scan and skip for a numeric decimal separator (radix).
2564
2565         bool    grok_numeric_radix(const char **sp, const char *send)
2566
2567 =for hackers
2568 Found in file numeric.c
2569
2570 =item grok_oct
2571 X<grok_oct>
2572
2573 converts a string representing an octal number to numeric form.
2574
2575 On entry I<start> and I<*len> give the string to scan, I<*flags> gives
2576 conversion flags, and I<result> should be NULL or a pointer to an NV.
2577 The scan stops at the end of the string, or the first invalid character.
2578 Unless C<PERL_SCAN_SILENT_ILLDIGIT> is set in I<*flags>, encountering an
2579 invalid character will also trigger a warning.
2580 On return I<*len> is set to the length of the scanned string,
2581 and I<*flags> gives output flags.
2582
2583 If the value is <= UV_MAX it is returned as a UV, the output flags are clear,
2584 and nothing is written to I<*result>. If the value is > UV_MAX C<grok_oct>
2585 returns UV_MAX, sets C<PERL_SCAN_GREATER_THAN_UV_MAX> in the output flags,
2586 and writes the value to I<*result> (or the value is discarded if I<result>
2587 is NULL).
2588
2589 If C<PERL_SCAN_ALLOW_UNDERSCORES> is set in I<*flags> then the octal
2590 number may use '_' characters to separate digits.
2591
2592         UV      grok_oct(const char* start, STRLEN* len_p, I32* flags, NV *result)
2593
2594 =for hackers
2595 Found in file numeric.c
2596
2597 =item scan_bin
2598 X<scan_bin>
2599
2600 For backwards compatibility. Use C<grok_bin> instead.
2601
2602         NV      scan_bin(const char* start, STRLEN len, STRLEN* retlen)
2603
2604 =for hackers
2605 Found in file numeric.c
2606
2607 =item scan_hex
2608 X<scan_hex>
2609
2610 For backwards compatibility. Use C<grok_hex> instead.
2611
2612         NV      scan_hex(const char* start, STRLEN len, STRLEN* retlen)
2613
2614 =for hackers
2615 Found in file numeric.c
2616
2617 =item scan_oct
2618 X<scan_oct>
2619
2620 For backwards compatibility. Use C<grok_oct> instead.
2621
2622         NV      scan_oct(const char* start, STRLEN len, STRLEN* retlen)
2623
2624 =for hackers
2625 Found in file numeric.c
2626
2627
2628 =back
2629
2630 =head1 Optree Manipulation Functions
2631
2632 =over 8
2633
2634 =item cv_const_sv
2635 X<cv_const_sv>
2636
2637 If C<cv> is a constant sub eligible for inlining. returns the constant
2638 value returned by the sub.  Otherwise, returns NULL.
2639
2640 Constant subs can be created with C<newCONSTSUB> or as described in
2641 L<perlsub/"Constant Functions">.
2642
2643         SV*     cv_const_sv(CV* cv)
2644
2645 =for hackers
2646 Found in file op.c
2647
2648 =item newCONSTSUB
2649 X<newCONSTSUB>
2650
2651 Creates a constant sub equivalent to Perl C<sub FOO () { 123 }> which is
2652 eligible for inlining at compile-time.
2653
2654         CV*     newCONSTSUB(HV* stash, const char* name, SV* sv)
2655
2656 =for hackers
2657 Found in file op.c
2658
2659 =item newXS
2660 X<newXS>
2661
2662 Used by C<xsubpp> to hook up XSUBs as Perl subs.
2663
2664 =for hackers
2665 Found in file op.c
2666
2667
2668 =back
2669
2670 =head1 Pad Data Structures
2671
2672 =over 8
2673
2674 =item pad_sv
2675 X<pad_sv>
2676
2677 Get the value at offset po in the current pad.
2678 Use macro PAD_SV instead of calling this function directly.
2679
2680         SV*     pad_sv(PADOFFSET po)
2681
2682 =for hackers
2683 Found in file pad.c
2684
2685
2686 =back
2687
2688 =head1 Simple Exception Handling Macros
2689
2690 =over 8
2691
2692 =item dXCPT
2693 X<dXCPT>
2694
2695 Set up necessary local variables for exception handling.
2696 See L<perlguts/"Exception Handling">.
2697
2698                 dXCPT;
2699
2700 =for hackers
2701 Found in file XSUB.h
2702
2703 =item XCPT_CATCH
2704 X<XCPT_CATCH>
2705
2706 Introduces a catch block.  See L<perlguts/"Exception Handling">.
2707
2708 =for hackers
2709 Found in file XSUB.h
2710
2711 =item XCPT_RETHROW
2712 X<XCPT_RETHROW>
2713
2714 Rethrows a previously caught exception.  See L<perlguts/"Exception Handling">.
2715
2716                 XCPT_RETHROW;
2717
2718 =for hackers
2719 Found in file XSUB.h
2720
2721 =item XCPT_TRY_END
2722 X<XCPT_TRY_END>
2723
2724 Ends a try block.  See L<perlguts/"Exception Handling">.
2725
2726 =for hackers
2727 Found in file XSUB.h
2728
2729 =item XCPT_TRY_START
2730 X<XCPT_TRY_START>
2731
2732 Starts a try block.  See L<perlguts/"Exception Handling">.
2733
2734 =for hackers
2735 Found in file XSUB.h
2736
2737
2738 =back
2739
2740 =head1 Stack Manipulation Macros
2741
2742 =over 8
2743
2744 =item dMARK
2745 X<dMARK>
2746
2747 Declare a stack marker variable, C<mark>, for the XSUB.  See C<MARK> and
2748 C<dORIGMARK>.
2749
2750                 dMARK;
2751
2752 =for hackers
2753 Found in file pp.h
2754
2755 =item dORIGMARK
2756 X<dORIGMARK>
2757
2758 Saves the original stack mark for the XSUB.  See C<ORIGMARK>.
2759
2760                 dORIGMARK;
2761
2762 =for hackers
2763 Found in file pp.h
2764
2765 =item dSP
2766 X<dSP>
2767
2768 Declares a local copy of perl's stack pointer for the XSUB, available via
2769 the C<SP> macro.  See C<SP>.
2770
2771                 dSP;
2772
2773 =for hackers
2774 Found in file pp.h
2775
2776 =item EXTEND
2777 X<EXTEND>
2778
2779 Used to extend the argument stack for an XSUB's return values. Once
2780 used, guarantees that there is room for at least C<nitems> to be pushed
2781 onto the stack.
2782
2783         void    EXTEND(SP, int nitems)
2784
2785 =for hackers
2786 Found in file pp.h
2787
2788 =item MARK
2789 X<MARK>
2790
2791 Stack marker variable for the XSUB.  See C<dMARK>.
2792
2793 =for hackers
2794 Found in file pp.h
2795
2796 =item mPUSHi
2797 X<mPUSHi>
2798
2799 Push an integer onto the stack.  The stack must have room for this element.
2800 Handles 'set' magic.  Does not use C<TARG>.  See also C<PUSHi>, C<mXPUSHi>
2801 and C<XPUSHi>.
2802
2803         void    mPUSHi(IV iv)
2804
2805 =for hackers
2806 Found in file pp.h
2807
2808 =item mPUSHn
2809 X<mPUSHn>
2810
2811 Push a double onto the stack.  The stack must have room for this element.
2812 Handles 'set' magic.  Does not use C<TARG>.  See also C<PUSHn>, C<mXPUSHn>
2813 and C<XPUSHn>.
2814
2815         void    mPUSHn(NV nv)
2816
2817 =for hackers
2818 Found in file pp.h
2819
2820 =item mPUSHp
2821 X<mPUSHp>
2822
2823 Push a string onto the stack.  The stack must have room for this element.
2824 The C<len> indicates the length of the string.  Handles 'set' magic.  Does
2825 not use C<TARG>.  See also C<PUSHp>, C<mXPUSHp> and C<XPUSHp>.
2826
2827         void    mPUSHp(char* str, STRLEN len)
2828
2829 =for hackers
2830 Found in file pp.h
2831
2832 =item mPUSHu
2833 X<mPUSHu>
2834
2835 Push an unsigned integer onto the stack.  The stack must have room for this
2836 element.  Handles 'set' magic.  Does not use C<TARG>.  See also C<PUSHu>,
2837 C<mXPUSHu> and C<XPUSHu>.
2838
2839         void    mPUSHu(UV uv)
2840
2841 =for hackers
2842 Found in file pp.h
2843
2844 =item mXPUSHi
2845 X<mXPUSHi>
2846
2847 Push an integer onto the stack, extending the stack if necessary.  Handles
2848 'set' magic.  Does not use C<TARG>.  See also C<XPUSHi>, C<mPUSHi> and
2849 C<PUSHi>.
2850
2851         void    mXPUSHi(IV iv)
2852
2853 =for hackers
2854 Found in file pp.h
2855
2856 =item mXPUSHn
2857 X<mXPUSHn>
2858
2859 Push a double onto the stack, extending the stack if necessary.  Handles
2860 'set' magic.  Does not use C<TARG>.  See also C<XPUSHn>, C<mPUSHn> and
2861 C<PUSHn>.
2862
2863         void    mXPUSHn(NV nv)
2864
2865 =for hackers
2866 Found in file pp.h
2867
2868 =item mXPUSHp
2869 X<mXPUSHp>
2870
2871 Push a string onto the stack, extending the stack if necessary.  The C<len>
2872 indicates the length of the string.  Handles 'set' magic.  Does not use
2873 C<TARG>.  See also C<XPUSHp>, C<mPUSHp> and C<PUSHp>.
2874
2875         void    mXPUSHp(char* str, STRLEN len)
2876
2877 =for hackers
2878 Found in file pp.h
2879
2880 =item mXPUSHu
2881 X<mXPUSHu>
2882
2883 Push an unsigned integer onto the stack, extending the stack if necessary.
2884 Handles 'set' magic.  Does not use C<TARG>.  See also C<XPUSHu>, C<mPUSHu>
2885 and C<PUSHu>.
2886
2887         void    mXPUSHu(UV uv)
2888
2889 =for hackers
2890 Found in file pp.h
2891
2892 =item ORIGMARK
2893 X<ORIGMARK>
2894
2895 The original stack mark for the XSUB.  See C<dORIGMARK>.
2896
2897 =for hackers
2898 Found in file pp.h
2899
2900 =item POPi
2901 X<POPi>
2902
2903 Pops an integer off the stack.
2904
2905         IV      POPi
2906
2907 =for hackers
2908 Found in file pp.h
2909
2910 =item POPl
2911 X<POPl>
2912
2913 Pops a long off the stack.
2914
2915         long    POPl
2916
2917 =for hackers
2918 Found in file pp.h
2919
2920 =item POPn
2921 X<POPn>
2922
2923 Pops a double off the stack.
2924
2925         NV      POPn
2926
2927 =for hackers
2928 Found in file pp.h
2929
2930 =item POPp
2931 X<POPp>
2932
2933 Pops a string off the stack. Deprecated. New code should use POPpx.
2934
2935         char*   POPp
2936
2937 =for hackers
2938 Found in file pp.h
2939
2940 =item POPpbytex
2941 X<POPpbytex>
2942
2943 Pops a string off the stack which must consist of bytes i.e. characters < 256.
2944
2945         char*   POPpbytex
2946
2947 =for hackers
2948 Found in file pp.h
2949
2950 =item POPpx
2951 X<POPpx>
2952
2953 Pops a string off the stack.
2954
2955         char*   POPpx
2956
2957 =for hackers
2958 Found in file pp.h
2959
2960 =item POPs
2961 X<POPs>
2962
2963 Pops an SV off the stack.
2964
2965         SV*     POPs
2966
2967 =for hackers
2968 Found in file pp.h
2969
2970 =item PUSHi
2971 X<PUSHi>
2972
2973 Push an integer onto the stack.  The stack must have room for this element.
2974 Handles 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
2975 called to declare it.  Do not call multiple C<TARG>-oriented macros to 
2976 return lists from XSUB's - see C<mPUSHi> instead.  See also C<XPUSHi> and
2977 C<mXPUSHi>.
2978
2979         void    PUSHi(IV iv)
2980
2981 =for hackers
2982 Found in file pp.h
2983
2984 =item PUSHMARK
2985 X<PUSHMARK>
2986
2987 Opening bracket for arguments on a callback.  See C<PUTBACK> and
2988 L<perlcall>.
2989
2990         void    PUSHMARK(SP)
2991
2992 =for hackers
2993 Found in file pp.h
2994
2995 =item PUSHmortal
2996 X<PUSHmortal>
2997
2998 Push a new mortal SV onto the stack.  The stack must have room for this
2999 element.  Does not handle 'set' magic.  Does not use C<TARG>.  See also
3000 C<PUSHs>, C<XPUSHmortal> and C<XPUSHs>.
3001
3002         void    PUSHmortal()
3003
3004 =for hackers
3005 Found in file pp.h
3006
3007 =item PUSHn
3008 X<PUSHn>
3009
3010 Push a double onto the stack.  The stack must have room for this element.
3011 Handles 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
3012 called to declare it.  Do not call multiple C<TARG>-oriented macros to
3013 return lists from XSUB's - see C<mPUSHn> instead.  See also C<XPUSHn> and
3014 C<mXPUSHn>.
3015
3016         void    PUSHn(NV nv)
3017
3018 =for hackers
3019 Found in file pp.h
3020
3021 =item PUSHp
3022 X<PUSHp>
3023
3024 Push a string onto the stack.  The stack must have room for this element.
3025 The C<len> indicates the length of the string.  Handles 'set' magic.  Uses
3026 C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to declare it.  Do not
3027 call multiple C<TARG>-oriented macros to return lists from XSUB's - see
3028 C<mPUSHp> instead.  See also C<XPUSHp> and C<mXPUSHp>.
3029
3030         void    PUSHp(char* str, STRLEN len)
3031
3032 =for hackers
3033 Found in file pp.h
3034
3035 =item PUSHs
3036 X<PUSHs>
3037
3038 Push an SV onto the stack.  The stack must have room for this element.
3039 Does not handle 'set' magic.  Does not use C<TARG>.  See also C<PUSHmortal>,
3040 C<XPUSHs> and C<XPUSHmortal>.
3041
3042         void    PUSHs(SV* sv)
3043
3044 =for hackers
3045 Found in file pp.h
3046
3047 =item PUSHu
3048 X<PUSHu>
3049
3050 Push an unsigned integer onto the stack.  The stack must have room for this
3051 element.  Handles 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG>
3052 should be called to declare it.  Do not call multiple C<TARG>-oriented
3053 macros to return lists from XSUB's - see C<mPUSHu> instead.  See also
3054 C<XPUSHu> and C<mXPUSHu>.
3055
3056         void    PUSHu(UV uv)
3057
3058 =for hackers
3059 Found in file pp.h
3060
3061 =item PUTBACK
3062 X<PUTBACK>
3063
3064 Closing bracket for XSUB arguments.  This is usually handled by C<xsubpp>.
3065 See C<PUSHMARK> and L<perlcall> for other uses.
3066
3067                 PUTBACK;
3068
3069 =for hackers
3070 Found in file pp.h
3071
3072 =item SP
3073 X<SP>
3074
3075 Stack pointer.  This is usually handled by C<xsubpp>.  See C<dSP> and
3076 C<SPAGAIN>.
3077
3078 =for hackers
3079 Found in file pp.h
3080
3081 =item SPAGAIN
3082 X<SPAGAIN>
3083
3084 Refetch the stack pointer.  Used after a callback.  See L<perlcall>.
3085
3086                 SPAGAIN;
3087
3088 =for hackers
3089 Found in file pp.h
3090
3091 =item XPUSHi
3092 X<XPUSHi>
3093
3094 Push an integer onto the stack, extending the stack if necessary.  Handles
3095 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to
3096 declare it.  Do not call multiple C<TARG>-oriented macros to return lists
3097 from XSUB's - see C<mXPUSHi> instead.  See also C<PUSHi> and C<mPUSHi>.
3098
3099         void    XPUSHi(IV iv)
3100
3101 =for hackers
3102 Found in file pp.h
3103
3104 =item XPUSHmortal
3105 X<XPUSHmortal>
3106
3107 Push a new mortal SV onto the stack, extending the stack if necessary.  Does
3108 not handle 'set' magic.  Does not use C<TARG>.  See also C<XPUSHs>,
3109 C<PUSHmortal> and C<PUSHs>.
3110
3111         void    XPUSHmortal()
3112
3113 =for hackers
3114 Found in file pp.h
3115
3116 =item XPUSHn
3117 X<XPUSHn>
3118
3119 Push a double onto the stack, extending the stack if necessary.  Handles
3120 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to
3121 declare it.  Do not call multiple C<TARG>-oriented macros to return lists
3122 from XSUB's - see C<mXPUSHn> instead.  See also C<PUSHn> and C<mPUSHn>.
3123
3124         void    XPUSHn(NV nv)
3125
3126 =for hackers
3127 Found in file pp.h
3128
3129 =item XPUSHp
3130 X<XPUSHp>
3131
3132 Push a string onto the stack, extending the stack if necessary.  The C<len>
3133 indicates the length of the string.  Handles 'set' magic.  Uses C<TARG>, so
3134 C<dTARGET> or C<dXSTARG> should be called to declare it.  Do not call
3135 multiple C<TARG>-oriented macros to return lists from XSUB's - see
3136 C<mXPUSHp> instead.  See also C<PUSHp> and C<mPUSHp>.
3137
3138         void    XPUSHp(char* str, STRLEN len)
3139
3140 =for hackers
3141 Found in file pp.h
3142
3143 =item XPUSHs
3144 X<XPUSHs>
3145
3146 Push an SV onto the stack, extending the stack if necessary.  Does not
3147 handle 'set' magic.  Does not use C<TARG>.  See also C<XPUSHmortal>,
3148 C<PUSHs> and C<PUSHmortal>.
3149
3150         void    XPUSHs(SV* sv)
3151
3152 =for hackers
3153 Found in file pp.h
3154
3155 =item XPUSHu
3156 X<XPUSHu>
3157
3158 Push an unsigned integer onto the stack, extending the stack if necessary.
3159 Handles 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
3160 called to declare it.  Do not call multiple C<TARG>-oriented macros to
3161 return lists from XSUB's - see C<mXPUSHu> instead.  See also C<PUSHu> and
3162 C<mPUSHu>.
3163
3164         void    XPUSHu(UV uv)
3165
3166 =for hackers
3167 Found in file pp.h
3168
3169 =item XSRETURN
3170 X<XSRETURN>
3171
3172 Return from XSUB, indicating number of items on the stack.  This is usually
3173 handled by C<xsubpp>.
3174
3175         void    XSRETURN(int nitems)
3176
3177 =for hackers
3178 Found in file XSUB.h
3179
3180 =item XSRETURN_EMPTY
3181 X<XSRETURN_EMPTY>
3182
3183 Return an empty list from an XSUB immediately.
3184
3185                 XSRETURN_EMPTY;
3186
3187 =for hackers
3188 Found in file XSUB.h
3189
3190 =item XSRETURN_IV
3191 X<XSRETURN_IV>
3192
3193 Return an integer from an XSUB immediately.  Uses C<XST_mIV>.
3194
3195         void    XSRETURN_IV(IV iv)
3196
3197 =for hackers
3198 Found in file XSUB.h
3199
3200 =item XSRETURN_NO
3201 X<XSRETURN_NO>
3202
3203 Return C<&PL_sv_no> from an XSUB immediately.  Uses C<XST_mNO>.
3204
3205                 XSRETURN_NO;
3206
3207 =for hackers
3208 Found in file XSUB.h
3209
3210 =item XSRETURN_NV
3211 X<XSRETURN_NV>
3212
3213 Return a double from an XSUB immediately.  Uses C<XST_mNV>.
3214
3215         void    XSRETURN_NV(NV nv)
3216
3217 =for hackers
3218 Found in file XSUB.h
3219
3220 =item XSRETURN_PV
3221 X<XSRETURN_PV>
3222
3223 Return a copy of a string from an XSUB immediately.  Uses C<XST_mPV>.
3224
3225         void    XSRETURN_PV(char* str)
3226
3227 =for hackers
3228 Found in file XSUB.h
3229
3230 =item XSRETURN_UNDEF
3231 X<XSRETURN_UNDEF>
3232
3233 Return C<&PL_sv_undef> from an XSUB immediately.  Uses C<XST_mUNDEF>.
3234
3235                 XSRETURN_UNDEF;
3236
3237 =for hackers
3238 Found in file XSUB.h
3239
3240 =item XSRETURN_UV
3241 X<XSRETURN_UV>
3242
3243 Return an integer from an XSUB immediately.  Uses C<XST_mUV>.
3244
3245         void    XSRETURN_UV(IV uv)
3246
3247 =for hackers
3248 Found in file XSUB.h
3249
3250 =item XSRETURN_YES
3251 X<XSRETURN_YES>
3252
3253 Return C<&PL_sv_yes> from an XSUB immediately.  Uses C<XST_mYES>.
3254
3255                 XSRETURN_YES;
3256
3257 =for hackers
3258 Found in file XSUB.h
3259
3260 =item XST_mIV
3261 X<XST_mIV>
3262
3263 Place an integer into the specified position C<pos> on the stack.  The
3264 value is stored in a new mortal SV.
3265
3266         void    XST_mIV(int pos, IV iv)
3267
3268 =for hackers
3269 Found in file XSUB.h
3270
3271 =item XST_mNO
3272 X<XST_mNO>
3273
3274 Place C<&PL_sv_no> into the specified position C<pos> on the
3275 stack.
3276
3277         void    XST_mNO(int pos)
3278
3279 =for hackers
3280 Found in file XSUB.h
3281
3282 =item XST_mNV
3283 X<XST_mNV>
3284
3285 Place a double into the specified position C<pos> on the stack.  The value
3286 is stored in a new mortal SV.
3287
3288         void    XST_mNV(int pos, NV nv)
3289
3290 =for hackers
3291 Found in file XSUB.h
3292
3293 =item XST_mPV
3294 X<XST_mPV>
3295
3296 Place a copy of a string into the specified position C<pos> on the stack. 
3297 The value is stored in a new mortal SV.
3298
3299         void    XST_mPV(int pos, char* str)
3300
3301 =for hackers
3302 Found in file XSUB.h
3303
3304 =item XST_mUNDEF
3305 X<XST_mUNDEF>
3306
3307 Place C<&PL_sv_undef> into the specified position C<pos> on the
3308 stack.
3309
3310         void    XST_mUNDEF(int pos)
3311
3312 =for hackers
3313 Found in file XSUB.h
3314
3315 =item XST_mYES
3316 X<XST_mYES>
3317
3318 Place C<&PL_sv_yes> into the specified position C<pos> on the
3319 stack.
3320
3321         void    XST_mYES(int pos)
3322
3323 =for hackers
3324 Found in file XSUB.h
3325
3326
3327 =back
3328
3329 =head1 SV Flags
3330
3331 =over 8
3332
3333 =item svtype
3334 X<svtype>
3335
3336 An enum of flags for Perl types.  These are found in the file B<sv.h>
3337 in the C<svtype> enum.  Test these flags with the C<SvTYPE> macro.
3338
3339 =for hackers
3340 Found in file sv.h
3341
3342 =item SVt_IV
3343 X<SVt_IV>
3344
3345 Integer type flag for scalars.  See C<svtype>.
3346
3347 =for hackers
3348 Found in file sv.h
3349
3350 =item SVt_NV
3351 X<SVt_NV>
3352
3353 Double type flag for scalars.  See C<svtype>.
3354
3355 =for hackers
3356 Found in file sv.h
3357
3358 =item SVt_PV
3359 X<SVt_PV>
3360
3361 Pointer type flag for scalars.  See C<svtype>.
3362
3363 =for hackers
3364 Found in file sv.h
3365
3366 =item SVt_PVAV
3367 X<SVt_PVAV>
3368
3369 Type flag for arrays.  See C<svtype>.
3370
3371 =for hackers
3372 Found in file sv.h
3373
3374 =item SVt_PVCV
3375 X<SVt_PVCV>
3376
3377 Type flag for code refs.  See C<svtype>.
3378
3379 =for hackers
3380 Found in file sv.h
3381
3382 =item SVt_PVHV
3383 X<SVt_PVHV>
3384
3385 Type flag for hashes.  See C<svtype>.
3386
3387 =for hackers
3388 Found in file sv.h
3389
3390 =item SVt_PVMG
3391 X<SVt_PVMG>
3392
3393 Type flag for blessed scalars.  See C<svtype>.
3394
3395 =for hackers
3396 Found in file sv.h
3397
3398
3399 =back
3400
3401 =head1 SV Manipulation Functions
3402
3403 =over 8
3404
3405 =item get_sv
3406 X<get_sv>
3407
3408 Returns the SV of the specified Perl scalar.  If C<create> is set and the
3409 Perl variable does not exist then it will be created.  If C<create> is not
3410 set and the variable does not exist then NULL is returned.
3411
3412 NOTE: the perl_ form of this function is deprecated.
3413
3414         SV*     get_sv(const char* name, I32 create)
3415
3416 =for hackers
3417 Found in file perl.c
3418
3419 =item looks_like_number
3420 X<looks_like_number>
3421
3422 Test if the content of an SV looks like a number (or is a number).
3423 C<Inf> and C<Infinity> are treated as numbers (so will not issue a
3424 non-numeric warning), even if your atof() doesn't grok them.
3425
3426         I32     looks_like_number(SV* sv)
3427
3428 =for hackers
3429 Found in file sv.c
3430
3431 =item newRV_inc
3432 X<newRV_inc>
3433
3434 Creates an RV wrapper for an SV.  The reference count for the original SV is
3435 incremented.
3436
3437         SV*     newRV_inc(SV* sv)
3438
3439 =for hackers
3440 Found in file sv.h
3441
3442 =item newRV_noinc
3443 X<newRV_noinc>
3444
3445 Creates an RV wrapper for an SV.  The reference count for the original
3446 SV is B<not> incremented.
3447
3448         SV*     newRV_noinc(SV *sv)
3449
3450 =for hackers
3451 Found in file sv.c
3452
3453 =item NEWSV
3454 X<NEWSV>
3455
3456 Creates a new SV.  A non-zero C<len> parameter indicates the number of
3457 bytes of preallocated string space the SV should have.  An extra byte for a
3458 tailing NUL is also reserved.  (SvPOK is not set for the SV even if string
3459 space is allocated.)  The reference count for the new SV is set to 1.
3460 C<id> is an integer id between 0 and 1299 (used to identify leaks).
3461
3462         SV*     NEWSV(int id, STRLEN len)
3463
3464 =for hackers
3465 Found in file handy.h
3466
3467 =item newSV
3468 X<newSV>
3469
3470 Create a new null SV, or if len > 0, create a new empty SVt_PV type SV
3471 with an initial PV allocation of len+1. Normally accessed via the C<NEWSV>
3472 macro.
3473
3474         SV*     newSV(STRLEN len)
3475
3476 =for hackers
3477 Found in file sv.c
3478
3479 =item newSVhek
3480 X<newSVhek>
3481
3482 Creates a new SV from the hash key structure.  It will generate scalars that
3483 point to the shared string table where possible. Returns a new (undefined)
3484 SV if the hek is NULL.
3485
3486         SV*     newSVhek(const HEK *hek)
3487
3488 =for hackers
3489 Found in file sv.c
3490
3491 =item newSViv
3492 X<newSViv>
3493
3494 Creates a new SV and copies an integer into it.  The reference count for the
3495 SV is set to 1.
3496
3497         SV*     newSViv(IV i)
3498
3499 =for hackers
3500 Found in file sv.c
3501
3502 =item newSVnv
3503 X<newSVnv>
3504
3505 Creates a new SV and copies a floating point value into it.
3506 The reference count for the SV is set to 1.
3507
3508         SV*     newSVnv(NV n)
3509
3510 =for hackers
3511 Found in file sv.c
3512
3513 =item newSVpv
3514 X<newSVpv>
3515
3516 Creates a new SV and copies a string into it.  The reference count for the
3517 SV is set to 1.  If C<len> is zero, Perl will compute the length using
3518 strlen().  For efficiency, consider using C<newSVpvn> instead.
3519
3520         SV*     newSVpv(const char* s, STRLEN len)
3521
3522 =for hackers
3523 Found in file sv.c
3524
3525 =item newSVpvf
3526 X<newSVpvf>
3527
3528 Creates a new SV and initializes it with the string formatted like
3529 C<sprintf>.
3530
3531         SV*     newSVpvf(const char* pat, ...)
3532
3533 =for hackers
3534 Found in file sv.c
3535
3536 =item newSVpvn
3537 X<newSVpvn>
3538
3539 Creates a new SV and copies a string into it.  The reference count for the
3540 SV is set to 1.  Note that if C<len> is zero, Perl will create a zero length
3541 string.  You are responsible for ensuring that the source string is at least
3542 C<len> bytes long.  If the C<s> argument is NULL the new SV will be undefined.
3543
3544         SV*     newSVpvn(const char* s, STRLEN len)
3545
3546 =for hackers
3547 Found in file sv.c
3548
3549 =item newSVpvn_share
3550 X<newSVpvn_share>
3551
3552 Creates a new SV with its SvPVX_const pointing to a shared string in the string
3553 table. If the string does not already exist in the table, it is created
3554 first.  Turns on READONLY and FAKE.  The string's hash is stored in the UV
3555 slot of the SV; if the C<hash> parameter is non-zero, that value is used;
3556 otherwise the hash is computed.  The idea here is that as the string table
3557 is used for shared hash keys these strings will have SvPVX_const == HeKEY and
3558 hash lookup will avoid string compare.
3559
3560         SV*     newSVpvn_share(const char* s, I32 len, U32 hash)
3561
3562 =for hackers
3563 Found in file sv.c
3564
3565 =item newSVrv
3566 X<newSVrv>
3567
3568 Creates a new SV for the RV, C<rv>, to point to.  If C<rv> is not an RV then
3569 it will be upgraded to one.  If C<classname> is non-null then the new SV will
3570 be blessed in the specified package.  The new SV is returned and its
3571 reference count is 1.
3572
3573         SV*     newSVrv(SV* rv, const char* classname)
3574
3575 =for hackers
3576 Found in file sv.c
3577
3578 =item newSVsv
3579 X<newSVsv>
3580
3581 Creates a new SV which is an exact duplicate of the original SV.
3582 (Uses C<sv_setsv>).
3583
3584         SV*     newSVsv(SV* old)
3585
3586 =for hackers
3587 Found in file sv.c
3588
3589 =item newSVuv
3590 X<newSVuv>
3591
3592 Creates a new SV and copies an unsigned integer into it.
3593 The reference count for the SV is set to 1.
3594
3595         SV*     newSVuv(UV u)
3596
3597 =for hackers
3598 Found in file sv.c
3599
3600 =item SvCUR
3601 X<SvCUR>
3602
3603 Returns the length of the string which is in the SV.  See C<SvLEN>.
3604
3605         STRLEN  SvCUR(SV* sv)
3606
3607 =for hackers
3608 Found in file sv.h
3609
3610 =item SvCUR_set
3611 X<SvCUR_set>
3612
3613 Set the current length of the string which is in the SV.  See C<SvCUR>
3614 and C<SvIV_set>.
3615
3616         void    SvCUR_set(SV* sv, STRLEN len)
3617
3618 =for hackers
3619 Found in file sv.h
3620
3621 =item SvEND
3622 X<SvEND>
3623
3624 Returns a pointer to the last character in the string which is in the SV.
3625 See C<SvCUR>.  Access the character as *(SvEND(sv)).
3626
3627         char*   SvEND(SV* sv)
3628
3629 =for hackers
3630 Found in file sv.h
3631
3632 =item SvGROW
3633 X<SvGROW>
3634
3635 Expands the character buffer in the SV so that it has room for the
3636 indicated number of bytes (remember to reserve space for an extra trailing
3637 NUL character).  Calls C<sv_grow> to perform the expansion if necessary.
3638 Returns a pointer to the character buffer.
3639
3640         char *  SvGROW(SV* sv, STRLEN len)
3641
3642 =for hackers
3643 Found in file sv.h
3644
3645 =item SvIOK
3646 X<SvIOK>
3647
3648 Returns a boolean indicating whether the SV contains an integer.
3649
3650         bool    SvIOK(SV* sv)
3651
3652 =for hackers
3653 Found in file sv.h
3654
3655 =item SvIOKp
3656 X<SvIOKp>
3657
3658 Returns a boolean indicating whether the SV contains an integer.  Checks
3659 the B<private> setting.  Use C<SvIOK>.
3660
3661         bool    SvIOKp(SV* sv)
3662
3663 =for hackers
3664 Found in file sv.h
3665
3666 =item SvIOK_notUV
3667 X<SvIOK_notUV>
3668
3669 Returns a boolean indicating whether the SV contains a signed integer.
3670
3671         bool    SvIOK_notUV(SV* sv)
3672
3673 =for hackers
3674 Found in file sv.h
3675
3676 =item SvIOK_off
3677 X<SvIOK_off>
3678
3679 Unsets the IV status of an SV.
3680
3681         void    SvIOK_off(SV* sv)
3682
3683 =for hackers
3684 Found in file sv.h
3685
3686 =item SvIOK_on
3687 X<SvIOK_on>
3688
3689 Tells an SV that it is an integer.
3690
3691         void    SvIOK_on(SV* sv)
3692
3693 =for hackers
3694 Found in file sv.h
3695
3696 =item SvIOK_only
3697 X<SvIOK_only>
3698
3699 Tells an SV that it is an integer and disables all other OK bits.
3700
3701         void    SvIOK_only(SV* sv)
3702
3703 =for hackers
3704 Found in file sv.h
3705
3706 =item SvIOK_only_UV
3707 X<SvIOK_only_UV>
3708
3709 Tells and SV that it is an unsigned integer and disables all other OK bits.
3710
3711         void    SvIOK_only_UV(SV* sv)
3712
3713 =for hackers
3714 Found in file sv.h
3715
3716 =item SvIOK_UV
3717 X<SvIOK_UV>
3718
3719 Returns a boolean indicating whether the SV contains an unsigned integer.
3720
3721         bool    SvIOK_UV(SV* sv)
3722
3723 =for hackers
3724 Found in file sv.h
3725
3726 =item SvIsCOW
3727 X<SvIsCOW>
3728
3729 Returns a boolean indicating whether the SV is Copy-On-Write. (either shared
3730 hash key scalars, or full Copy On Write scalars if 5.9.0 is configured for
3731 COW)
3732
3733         bool    SvIsCOW(SV* sv)
3734
3735 =for hackers
3736 Found in file sv.h
3737
3738 =item SvIsCOW_shared_hash
3739 X<SvIsCOW_shared_hash>
3740
3741 Returns a boolean indicating whether the SV is Copy-On-Write shared hash key
3742 scalar.
3743
3744         bool    SvIsCOW_shared_hash(SV* sv)
3745
3746 =for hackers
3747 Found in file sv.h
3748
3749 =item SvIV
3750 X<SvIV>
3751
3752 Coerces the given SV to an integer and returns it. See  C<SvIVx> for a
3753 version which guarantees to evaluate sv only once.
3754
3755         IV      SvIV(SV* sv)
3756
3757 =for hackers
3758 Found in file sv.h
3759
3760 =item SvIVX
3761 X<SvIVX>
3762
3763 Returns the raw value in the SV's IV slot, without checks or conversions.
3764 Only use when you are sure SvIOK is true. See also C<SvIV()>.
3765
3766         IV      SvIVX(SV* sv)
3767
3768 =for hackers
3769 Found in file sv.h
3770
3771 =item SvIVx
3772 X<SvIVx>
3773
3774 Coerces the given SV to an integer and returns it. Guarantees to evaluate
3775 sv only once. Use the more efficient C<SvIV> otherwise.
3776
3777         IV      SvIVx(SV* sv)
3778
3779 =for hackers
3780 Found in file sv.h
3781
3782 =item SvIV_nomg
3783 X<SvIV_nomg>
3784
3785 Like C<SvIV> but doesn't process magic.
3786
3787         IV      SvIV_nomg(SV* sv)
3788
3789 =for hackers
3790 Found in file sv.h
3791
3792 =item SvIV_set
3793 X<SvIV_set>
3794
3795 Set the value of the IV pointer in sv to val.  It is possible to perform
3796 the same function of this macro with an lvalue assignment to C<SvIVX>.
3797 With future Perls, however, it will be more efficient to use 
3798 C<SvIV_set> instead of the lvalue assignment to C<SvIVX>.
3799
3800         void    SvIV_set(SV* sv, IV val)
3801
3802 =for hackers
3803 Found in file sv.h
3804
3805 =item SvLEN
3806 X<SvLEN>
3807
3808 Returns the size of the string buffer in the SV, not including any part
3809 attributable to C<SvOOK>.  See C<SvCUR>.
3810
3811         STRLEN  SvLEN(SV* sv)
3812
3813 =for hackers
3814 Found in file sv.h
3815
3816 =item SvLEN_set
3817 X<SvLEN_set>
3818
3819 Set the actual length of the string which is in the SV.  See C<SvIV_set>.
3820
3821         void    SvLEN_set(SV* sv, STRLEN len)
3822
3823 =for hackers
3824 Found in file sv.h
3825
3826 =item SvMAGIC_set
3827 X<SvMAGIC_set>
3828
3829 Set the value of the MAGIC pointer in sv to val.  See C<SvIV_set>.
3830
3831         void    SvMAGIC_set(SV* sv, MAGIC* val)
3832
3833 =for hackers
3834 Found in file sv.h
3835
3836 =item SvNIOK
3837 X<SvNIOK>
3838
3839 Returns a boolean indicating whether the SV contains a number, integer or
3840 double.
3841
3842         bool    SvNIOK(SV* sv)
3843
3844 =for hackers
3845 Found in file sv.h
3846
3847 =item SvNIOKp
3848 X<SvNIOKp>
3849
3850 Returns a boolean indicating whether the SV contains a number, integer or
3851 double.  Checks the B<private> setting.  Use C<SvNIOK>.
3852
3853         bool    SvNIOKp(SV* sv)
3854
3855 =for hackers
3856 Found in file sv.h
3857
3858 =item SvNIOK_off
3859 X<SvNIOK_off>
3860
3861 Unsets the NV/IV status of an SV.
3862
3863         void    SvNIOK_off(SV* sv)
3864
3865 =for hackers
3866 Found in file sv.h
3867
3868 =item SvNOK
3869 X<SvNOK>
3870
3871 Returns a boolean indicating whether the SV contains a double.
3872
3873         bool    SvNOK(SV* sv)
3874
3875 =for hackers
3876 Found in file sv.h
3877
3878 =item SvNOKp
3879 X<SvNOKp>
3880
3881 Returns a boolean indicating whether the SV contains a double.  Checks the
3882 B<private> setting.  Use C<SvNOK>.
3883
3884         bool    SvNOKp(SV* sv)
3885
3886 =for hackers
3887 Found in file sv.h
3888
3889 =item SvNOK_off
3890 X<SvNOK_off>
3891
3892 Unsets the NV status of an SV.
3893
3894         void    SvNOK_off(SV* sv)
3895
3896 =for hackers
3897 Found in file sv.h
3898
3899 =item SvNOK_on
3900 X<SvNOK_on>
3901
3902 Tells an SV that it is a double.
3903
3904         void    SvNOK_on(SV* sv)
3905
3906 =for hackers
3907 Found in file sv.h
3908
3909 =item SvNOK_only
3910 X<SvNOK_only>
3911
3912 Tells an SV that it is a double and disables all other OK bits.
3913
3914         void    SvNOK_only(SV* sv)
3915
3916 =for hackers
3917 Found in file sv.h
3918
3919 =item SvNV
3920 X<SvNV>
3921
3922 Coerce the given SV to a double and return it. See  C<SvNVx> for a version
3923 which guarantees to evaluate sv only once.
3924
3925         NV      SvNV(SV* sv)
3926
3927 =for hackers
3928 Found in file sv.h
3929
3930 =item SvNVX
3931 X<SvNVX>
3932
3933 Returns the raw value in the SV's NV slot, without checks or conversions.
3934 Only use when you are sure SvNOK is true. See also C<SvNV()>.
3935
3936         NV      SvNVX(SV* sv)
3937
3938 =for hackers
3939 Found in file sv.h
3940
3941 =item SvNVx
3942 X<SvNVx>
3943
3944 Coerces the given SV to a double and returns it. Guarantees to evaluate
3945 sv only once. Use the more efficient C<SvNV> otherwise.
3946
3947         NV      SvNVx(SV* sv)
3948
3949 =for hackers
3950 Found in file sv.h
3951
3952 =item SvNV_set
3953 X<SvNV_set>
3954
3955 Set the value of the NV pointer in sv to val.  See C<SvIV_set>.
3956
3957         void    SvNV_set(SV* sv, NV val)
3958
3959 =for hackers
3960 Found in file sv.h
3961
3962 =item SvOK
3963 X<SvOK>
3964
3965 Returns a boolean indicating whether the value is an SV. It also tells
3966 whether the value is defined or not.
3967
3968         bool    SvOK(SV* sv)
3969
3970 =for hackers
3971 Found in file sv.h
3972
3973 =item SvOOK
3974 X<SvOOK>
3975
3976 Returns a boolean indicating whether the SvIVX is a valid offset value for
3977 the SvPVX.  This hack is used internally to speed up removal of characters
3978 from the beginning of a SvPV.  When SvOOK is true, then the start of the
3979 allocated string buffer is really (SvPVX - SvIVX).
3980
3981         bool    SvOOK(SV* sv)
3982
3983 =for hackers
3984 Found in file sv.h
3985
3986 =item SvPOK
3987 X<SvPOK>
3988
3989 Returns a boolean indicating whether the SV contains a character
3990 string.
3991
3992         bool    SvPOK(SV* sv)
3993
3994 =for hackers
3995 Found in file sv.h
3996
3997 =item SvPOKp
3998 X<SvPOKp>
3999
4000 Returns a boolean indicating whether the SV contains a character string.
4001 Checks the B<private> setting.  Use C<SvPOK>.
4002
4003         bool    SvPOKp(SV* sv)
4004
4005 =for hackers
4006 Found in file sv.h
4007
4008 =item SvPOK_off
4009 X<SvPOK_off>
4010
4011 Unsets the PV status of an SV.
4012
4013         void    SvPOK_off(SV* sv)
4014
4015 =for hackers
4016 Found in file sv.h
4017
4018 =item SvPOK_on
4019 X<SvPOK_on>
4020
4021 Tells an SV that it is a string.
4022
4023         void    SvPOK_on(SV* sv)
4024
4025 =for hackers
4026 Found in file sv.h
4027
4028 =item SvPOK_only
4029 X<SvPOK_only>
4030
4031 Tells an SV that it is a string and disables all other OK bits.
4032 Will also turn off the UTF-8 status.
4033
4034         void    SvPOK_only(SV* sv)
4035
4036 =for hackers
4037 Found in file sv.h
4038
4039 =item SvPOK_only_UTF8
4040 X<SvPOK_only_UTF8>
4041
4042 Tells an SV that it is a string and disables all other OK bits,
4043 and leaves the UTF-8 status as it was.
4044
4045         void    SvPOK_only_UTF8(SV* sv)
4046
4047 =for hackers
4048 Found in file sv.h
4049
4050 =item SvPV
4051 X<SvPV>
4052
4053 Returns a pointer to the string in the SV, or a stringified form of
4054 the SV if the SV does not contain a string.  The SV may cache the
4055 stringified version becoming C<SvPOK>.  Handles 'get' magic. See also
4056 C<SvPVx> for a version which guarantees to evaluate sv only once.
4057
4058         char*   SvPV(SV* sv, STRLEN len)
4059
4060 =for hackers
4061 Found in file sv.h
4062
4063 =item SvPVbyte
4064 X<SvPVbyte>
4065
4066 Like C<SvPV>, but converts sv to byte representation first if necessary.
4067
4068         char*   SvPVbyte(SV* sv, STRLEN len)
4069
4070 =for hackers
4071 Found in file sv.h
4072
4073 =item SvPVbytex
4074 X<SvPVbytex>
4075
4076 Like C<SvPV>, but converts sv to byte representation first if necessary.
4077 Guarantees to evaluate sv only once; use the more efficient C<SvPVbyte>
4078 otherwise.
4079
4080         char*   SvPVbytex(SV* sv, STRLEN len)
4081
4082 =for hackers
4083 Found in file sv.h
4084
4085 =item SvPVbytex_force
4086 X<SvPVbytex_force>
4087
4088 Like C<SvPV_force>, but converts sv to byte representation first if necessary.
4089 Guarantees to evaluate sv only once; use the more efficient C<SvPVbyte_force>
4090 otherwise.
4091
4092         char*   SvPVbytex_force(SV* sv, STRLEN len)
4093
4094 =for hackers
4095 Found in file sv.h
4096
4097 =item SvPVbyte_force
4098 X<SvPVbyte_force>
4099
4100 Like C<SvPV_force>, but converts sv to byte representation first if necessary.
4101
4102         char*   SvPVbyte_force(SV* sv, STRLEN len)
4103
4104 =for hackers
4105 Found in file sv.h
4106
4107 =item SvPVbyte_nolen
4108 X<SvPVbyte_nolen>
4109
4110 Like C<SvPV_nolen>, but converts sv to byte representation first if necessary.
4111
4112         char*   SvPVbyte_nolen(SV* sv)
4113
4114 =for hackers
4115 Found in file sv.h
4116
4117 =item SvPVutf8
4118 X<SvPVutf8>
4119
4120 Like C<SvPV>, but converts sv to utf8 first if necessary.
4121
4122         char*   SvPVutf8(SV* sv, STRLEN len)
4123
4124 =for hackers
4125 Found in file sv.h
4126
4127 =item SvPVutf8x
4128 X<SvPVutf8x>
4129
4130 Like C<SvPV>, but converts sv to utf8 first if necessary.
4131 Guarantees to evaluate sv only once; use the more efficient C<SvPVutf8>
4132 otherwise.
4133
4134         char*   SvPVutf8x(SV* sv, STRLEN len)
4135
4136 =for hackers
4137 Found in file sv.h
4138
4139 =item SvPVutf8x_force
4140 X<SvPVutf8x_force>
4141
4142 Like C<SvPV_force>, but converts sv to utf8 first if necessary.
4143 Guarantees to evaluate sv only once; use the more efficient C<SvPVutf8_force>
4144 otherwise.
4145
4146         char*   SvPVutf8x_force(SV* sv, STRLEN len)
4147
4148 =for hackers
4149 Found in file sv.h
4150
4151 =item SvPVutf8_force
4152 X<SvPVutf8_force>
4153
4154 Like C<SvPV_force>, but converts sv to utf8 first if necessary.
4155
4156         char*   SvPVutf8_force(SV* sv, STRLEN len)
4157
4158 =for hackers
4159 Found in file sv.h
4160
4161 =item SvPVutf8_nolen
4162 X<SvPVutf8_nolen>
4163
4164 Like C<SvPV_nolen>, but converts sv to utf8 first if necessary.
4165
4166         char*   SvPVutf8_nolen(SV* sv)
4167
4168 =for hackers
4169 Found in file sv.h
4170
4171 =item SvPVX
4172 X<SvPVX>
4173
4174 Returns a pointer to the physical string in the SV.  The SV must contain a
4175 string.
4176
4177         char*   SvPVX(SV* sv)
4178
4179 =for hackers
4180 Found in file sv.h
4181
4182 =item SvPVx
4183 X<SvPVx>
4184
4185 A version of C<SvPV> which guarantees to evaluate sv only once.
4186
4187         char*   SvPVx(SV* sv, STRLEN len)
4188
4189 =for hackers
4190 Found in file sv.h
4191
4192 =item SvPV_force
4193 X<SvPV_force>
4194
4195 Like C<SvPV> but will force the SV into containing just a string
4196 (C<SvPOK_only>).  You want force if you are going to update the C<SvPVX>
4197 directly.
4198
4199         char*   SvPV_force(SV* sv, STRLEN len)
4200
4201 =for hackers
4202 Found in file sv.h
4203
4204 =item SvPV_force_nomg
4205 X<SvPV_force_nomg>
4206
4207 Like C<SvPV> but will force the SV into containing just a string
4208 (C<SvPOK_only>).  You want force if you are going to update the C<SvPVX>
4209 directly. Doesn't process magic.
4210
4211         char*   SvPV_force_nomg(SV* sv, STRLEN len)
4212
4213 =for hackers
4214 Found in file sv.h
4215
4216 =item SvPV_nolen
4217 X<SvPV_nolen>
4218
4219 Returns a pointer to the string in the SV, or a stringified form of
4220 the SV if the SV does not contain a string.  The SV may cache the
4221 stringified form becoming C<SvPOK>.  Handles 'get' magic.
4222
4223         char*   SvPV_nolen(SV* sv)
4224
4225 =for hackers
4226 Found in file sv.h
4227
4228 =item SvPV_nomg
4229 X<SvPV_nomg>
4230
4231 Like C<SvPV> but doesn't process magic.
4232
4233         char*   SvPV_nomg(SV* sv, STRLEN len)
4234
4235 =for hackers
4236 Found in file sv.h
4237
4238 =item SvPV_set
4239 X<SvPV_set>
4240
4241 Set the value of the PV pointer in sv to val.  See C<SvIV_set>.
4242
4243         void    SvPV_set(SV* sv, char* val)
4244
4245 =for hackers
4246 Found in file sv.h
4247
4248 =item SvREFCNT
4249 X<SvREFCNT>
4250
4251 Returns the value of the object's reference count.
4252
4253         U32     SvREFCNT(SV* sv)
4254
4255 =for hackers
4256 Found in file sv.h
4257
4258 =item SvREFCNT_dec
4259 X<SvREFCNT_dec>
4260
4261 Decrements the reference count of the given SV.
4262
4263         void    SvREFCNT_dec(SV* sv)
4264
4265 =for hackers
4266 Found in file sv.h
4267
4268 =item SvREFCNT_inc
4269 X<SvREFCNT_inc>
4270
4271 Increments the reference count of the given SV.
4272
4273         SV*     SvREFCNT_inc(SV* sv)
4274
4275 =for hackers
4276 Found in file sv.h
4277
4278 =item SvROK
4279 X<SvROK>
4280
4281 Tests if the SV is an RV.
4282
4283         bool    SvROK(SV* sv)
4284
4285 =for hackers
4286 Found in file sv.h
4287
4288 =item SvROK_off
4289 X<SvROK_off>
4290
4291 Unsets the RV status of an SV.
4292
4293         void    SvROK_off(SV* sv)
4294
4295 =for hackers
4296 Found in file sv.h
4297
4298 =item SvROK_on
4299 X<SvROK_on>
4300
4301 Tells an SV that it is an RV.
4302
4303         void    SvROK_on(SV* sv)
4304
4305 =for hackers
4306 Found in file sv.h
4307
4308 =item SvRV
4309 X<SvRV>
4310
4311 Dereferences an RV to return the SV.
4312
4313         SV*     SvRV(SV* sv)
4314
4315 =for hackers
4316 Found in file sv.h
4317
4318 =item SvRV_set
4319 X<SvRV_set>
4320
4321 Set the value of the RV pointer in sv to val.  See C<SvIV_set>.
4322
4323         void    SvRV_set(SV* sv, SV* val)
4324
4325 =for hackers
4326 Found in file sv.h
4327
4328 =item SvSTASH
4329 X<SvSTASH>
4330
4331 Returns the stash of the SV.
4332
4333         HV*     SvSTASH(SV* sv)
4334
4335 =for hackers
4336 Found in file sv.h
4337
4338 =item SvSTASH_set
4339 X<SvSTASH_set>
4340
4341 Set the value of the STASH pointer in sv to val.  See C<SvIV_set>.
4342
4343         void    SvSTASH_set(SV* sv, STASH* val)
4344
4345 =for hackers
4346 Found in file sv.h
4347
4348 =item SvTAINT
4349 X<SvTAINT>
4350
4351 Taints an SV if tainting is enabled.
4352
4353         void    SvTAINT(SV* sv)
4354
4355 =for hackers
4356 Found in file sv.h
4357
4358 =item SvTAINTED
4359 X<SvTAINTED>
4360
4361 Checks to see if an SV is tainted. Returns TRUE if it is, FALSE if
4362 not.
4363
4364         bool    SvTAINTED(SV* sv)
4365
4366 =for hackers
4367 Found in file sv.h
4368
4369 =item SvTAINTED_off
4370 X<SvTAINTED_off>
4371
4372 Untaints an SV. Be I<very> careful with this routine, as it short-circuits
4373 some of Perl's fundamental security features. XS module authors should not
4374 use this function unless they fully understand all the implications of
4375 unconditionally untainting the value. Untainting should be done in the
4376 standard perl fashion, via a carefully crafted regexp, rather than directly
4377 untainting variables.
4378
4379         void    SvTAINTED_off(SV* sv)
4380
4381 =for hackers
4382 Found in file sv.h
4383
4384 =item SvTAINTED_on
4385 X<SvTAINTED_on>
4386
4387 Marks an SV as tainted if tainting is enabled.
4388
4389         void    SvTAINTED_on(SV* sv)
4390
4391 =for hackers
4392 Found in file sv.h
4393
4394 =item SvTRUE
4395 X<SvTRUE>
4396
4397 Returns a boolean indicating whether Perl would evaluate the SV as true or
4398 false, defined or undefined.  Does not handle 'get' magic.
4399
4400         bool    SvTRUE(SV* sv)
4401
4402 =for hackers
4403 Found in file sv.h
4404
4405 =item SvTYPE
4406 X<SvTYPE>
4407
4408 Returns the type of the SV.  See C<svtype>.
4409
4410         svtype  SvTYPE(SV* sv)
4411
4412 =for hackers
4413 Found in file sv.h
4414
4415 =item SvUOK
4416 X<SvUOK>
4417
4418 Returns a boolean indicating whether the SV contains an unsigned integer.
4419
4420         void    SvUOK(SV* sv)
4421
4422 =for hackers
4423 Found in file sv.h
4424
4425 =item SvUPGRADE
4426 X<SvUPGRADE>
4427
4428 Used to upgrade an SV to a more complex form.  Uses C<sv_upgrade> to
4429 perform the upgrade if necessary.  See C<svtype>.
4430
4431         void    SvUPGRADE(SV* sv, svtype type)
4432
4433 =for hackers
4434 Found in file sv.h
4435
4436 =item SvUTF8
4437 X<SvUTF8>
4438
4439 Returns a boolean indicating whether the SV contains UTF-8 encoded data.
4440
4441         bool    SvUTF8(SV* sv)
4442
4443 =for hackers
4444 Found in file sv.h
4445
4446 =item SvUTF8_off
4447 X<SvUTF8_off>
4448
4449 Unsets the UTF-8 status of an SV.
4450
4451         void    SvUTF8_off(SV *sv)
4452
4453 =for hackers
4454 Found in file sv.h
4455
4456 =item SvUTF8_on
4457 X<SvUTF8_on>
4458
4459 Turn on the UTF-8 status of an SV (the data is not changed, just the flag).
4460 Do not use frivolously.
4461
4462         void    SvUTF8_on(SV *sv)
4463
4464 =for hackers
4465 Found in file sv.h
4466
4467 =item SvUV
4468 X<SvUV>
4469
4470 Coerces the given SV to an unsigned integer and returns it.  See C<SvUVx>
4471 for a version which guarantees to evaluate sv only once.
4472
4473         UV      SvUV(SV* sv)
4474
4475 =for hackers
4476 Found in file sv.h
4477
4478 =item SvUVX
4479 X<SvUVX>
4480
4481 Returns the raw value in the SV's UV slot, without checks or conversions.
4482 Only use when you are sure SvIOK is true. See also C<SvUV()>.
4483
4484         UV      SvUVX(SV* sv)
4485
4486 =for hackers
4487 Found in file sv.h
4488
4489 =item SvUVx
4490 X<SvUVx>
4491
4492 Coerces the given SV to an unsigned integer and returns it. Guarantees to
4493 evaluate sv only once. Use the more efficient C<SvUV> otherwise.
4494
4495         UV      SvUVx(SV* sv)
4496
4497 =for hackers
4498 Found in file sv.h
4499
4500 =item SvUV_nomg
4501 X<SvUV_nomg>
4502
4503 Like C<SvUV> but doesn't process magic.
4504
4505         UV      SvUV_nomg(SV* sv)
4506
4507 =for hackers
4508 Found in file sv.h
4509
4510 =item SvUV_set
4511 X<SvUV_set>
4512
4513 Set the value of the UV pointer in sv to val.  See C<SvIV_set>.
4514
4515         void    SvUV_set(SV* sv, UV val)
4516
4517 =for hackers
4518 Found in file sv.h
4519
4520 =item SvVOK
4521 X<SvVOK>
4522
4523 Returns a boolean indicating whether the SV contains a v-string.
4524
4525         bool    SvVOK(SV* sv)
4526
4527 =for hackers
4528 Found in file sv.h
4529
4530 =item sv_2bool
4531 X<sv_2bool>
4532
4533 This function is only called on magical items, and is only used by
4534 sv_true() or its macro equivalent.
4535
4536         bool    sv_2bool(SV* sv)
4537
4538 =for hackers
4539 Found in file sv.c
4540
4541 =item sv_2cv
4542 X<sv_2cv>
4543
4544 Using various gambits, try to get a CV from an SV; in addition, try if
4545 possible to set C<*st> and C<*gvp> to the stash and GV associated with it.
4546
4547         CV*     sv_2cv(SV* sv, HV** st, GV** gvp, I32 lref)
4548
4549 =for hackers
4550 Found in file sv.c
4551
4552 =item sv_2io
4553 X<sv_2io>
4554
4555 Using various gambits, try to get an IO from an SV: the IO slot if its a
4556 GV; or the recursive result if we're an RV; or the IO slot of the symbol
4557 named after the PV if we're a string.
4558
4559         IO*     sv_2io(SV* sv)
4560
4561 =for hackers
4562 Found in file sv.c
4563
4564 =item sv_2iv_flags
4565 X<sv_2iv_flags>
4566
4567 Return the integer value of an SV, doing any necessary string
4568 conversion.  If flags includes SV_GMAGIC, does an mg_get() first.
4569 Normally used via the C<SvIV(sv)> and C<SvIVx(sv)> macros.
4570
4571         IV      sv_2iv_flags(SV* sv, I32 flags)
4572
4573 =for hackers
4574 Found in file sv.c
4575
4576 =item sv_2mortal
4577 X<sv_2mortal>
4578
4579 Marks an existing SV as mortal.  The SV will be destroyed "soon", either
4580 by an explicit call to FREETMPS, or by an implicit call at places such as
4581 statement boundaries.  SvTEMP() is turned on which means that the SV's
4582 string buffer can be "stolen" if this SV is copied. See also C<sv_newmortal>
4583 and C<sv_mortalcopy>.
4584
4585         SV*     sv_2mortal(SV* sv)
4586
4587 =for hackers
4588 Found in file sv.c
4589
4590 =item sv_2nv
4591 X<sv_2nv>
4592
4593 Return the num value of an SV, doing any necessary string or integer
4594 conversion, magic etc. Normally used via the C<SvNV(sv)> and C<SvNVx(sv)>
4595 macros.
4596
4597         NV      sv_2nv(SV* sv)
4598
4599 =for hackers
4600 Found in file sv.c
4601
4602 =item sv_2pvbyte
4603 X<sv_2pvbyte>
4604
4605 Return a pointer to the byte-encoded representation of the SV, and set *lp
4606 to its length.  May cause the SV to be downgraded from UTF-8 as a
4607 side-effect.
4608
4609 Usually accessed via the C<SvPVbyte> macro.
4610
4611         char*   sv_2pvbyte(SV* sv, STRLEN* lp)
4612
4613 =for hackers
4614 Found in file sv.c
4615
4616 =item sv_2pv_flags
4617 X<sv_2pv_flags>
4618
4619 Returns a pointer to the string value of an SV, and sets *lp to its length.
4620 If flags includes SV_GMAGIC, does an mg_get() first. Coerces sv to a string
4621 if necessary.
4622 Normally invoked via the C<SvPV_flags> macro. C<sv_2pv()> and C<sv_2pv_nomg>
4623 usually end up here too.
4624
4625         char*   sv_2pv_flags(SV* sv, STRLEN* lp, I32 flags)
4626
4627 =for hackers
4628 Found in file sv.c
4629
4630 =item sv_2uv_flags
4631 X<sv_2uv_flags>
4632
4633 Return the unsigned integer value of an SV, doing any necessary string
4634 conversion.  If flags includes SV_GMAGIC, does an mg_get() first.
4635 Normally used via the C<SvUV(sv)> and C<SvUVx(sv)> macros.
4636
4637         UV      sv_2uv_flags(SV* sv, I32 flags)
4638
4639 =for hackers
4640 Found in file sv.c
4641
4642 =item sv_backoff
4643 X<sv_backoff>
4644
4645 Remove any string offset. You should normally use the C<SvOOK_off> macro
4646 wrapper instead.
4647
4648         int     sv_backoff(SV* sv)
4649
4650 =for hackers
4651 Found in file sv.c
4652
4653 =item sv_bless
4654 X<sv_bless>
4655
4656 Blesses an SV into a specified package.  The SV must be an RV.  The package
4657 must be designated by its stash (see C<gv_stashpv()>).  The reference count
4658 of the SV is unaffected.
4659
4660         SV*     sv_bless(SV* sv, HV* stash)
4661
4662 =for hackers
4663 Found in file sv.c
4664
4665 =item sv_catpv
4666 X<sv_catpv>
4667
4668 Concatenates the string onto the end of the string which is in the SV.
4669 If the SV has the UTF-8 status set, then the bytes appended should be
4670 valid UTF-8.  Handles 'get' magic, but not 'set' magic.  See C<sv_catpv_mg>.
4671
4672         void    sv_catpv(SV* sv, const char* ptr)
4673
4674 =for hackers
4675 Found in file sv.c
4676
4677 =item sv_catpvf
4678 X<sv_catpvf>
4679
4680 Processes its arguments like C<sprintf> and appends the formatted
4681 output to an SV.  If the appended data contains "wide" characters
4682 (including, but not limited to, SVs with a UTF-8 PV formatted with %s,
4683 and characters >255 formatted with %c), the original SV might get
4684 upgraded to UTF-8.  Handles 'get' magic, but not 'set' magic.  See
4685 C<sv_catpvf_mg>. If the original SV was UTF-8, the pattern should be
4686 valid UTF-8; if the original SV was bytes, the pattern should be too.
4687
4688         void    sv_catpvf(SV* sv, const char* pat, ...)
4689
4690 =for hackers
4691 Found in file sv.c
4692
4693 =item sv_catpvf_mg
4694 X<sv_catpvf_mg>
4695
4696 Like C<sv_catpvf>, but also handles 'set' magic.
4697
4698         void    sv_catpvf_mg(SV *sv, const char* pat, ...)
4699
4700 =for hackers
4701 Found in file sv.c
4702
4703 =item sv_catpvn
4704 X<sv_catpvn>
4705
4706 Concatenates the string onto the end of the string which is in the SV.  The
4707 C<len> indicates number of bytes to copy.  If the SV has the UTF-8
4708 status set, then the bytes appended should be valid UTF-8.
4709 Handles 'get' magic, but not 'set' magic.  See C<sv_catpvn_mg>.
4710
4711         void    sv_catpvn(SV* sv, const char* ptr, STRLEN len)
4712
4713 =for hackers
4714 Found in file sv.c
4715
4716 =item sv_catpvn_flags
4717 X<sv_catpvn_flags>
4718
4719 Concatenates the string onto the end of the string which is in the SV.  The
4720 C<len> indicates number of bytes to copy.  If the SV has the UTF-8
4721 status set, then the bytes appended should be valid UTF-8.
4722 If C<flags> has C<SV_GMAGIC> bit set, will C<mg_get> on C<dsv> if
4723 appropriate, else not. C<sv_catpvn> and C<sv_catpvn_nomg> are implemented
4724 in terms of this function.
4725
4726         void    sv_catpvn_flags(SV* sv, const char* ptr, STRLEN len, I32 flags)
4727
4728 =for hackers
4729 Found in file sv.c
4730
4731 =item sv_catpvn_nomg
4732 X<sv_catpvn_nomg>
4733
4734 Like C<sv_catpvn> but doesn't process magic.
4735
4736         void    sv_catpvn_nomg(SV* sv, const char* ptr, STRLEN len)
4737
4738 =for hackers
4739 Found in file sv.h
4740
4741 =item sv_catpv_mg
4742 X<sv_catpv_mg>
4743
4744 Like C<sv_catpv>, but also handles 'set' magic.
4745
4746         void    sv_catpv_mg(SV *sv, const char *ptr)
4747
4748 =for hackers
4749 Found in file sv.c
4750
4751 =item sv_catsv
4752 X<sv_catsv>
4753
4754 Concatenates the string from SV C<ssv> onto the end of the string in
4755 SV C<dsv>.  Modifies C<dsv> but not C<ssv>.  Handles 'get' magic, but
4756 not 'set' magic.  See C<sv_catsv_mg>.
4757
4758         void    sv_catsv(SV* dsv, SV* ssv)
4759
4760 =for hackers
4761 Found in file sv.c
4762
4763 =item sv_catsv_flags
4764 X<sv_catsv_flags>
4765
4766 Concatenates the string from SV C<ssv> onto the end of the string in
4767 SV C<dsv>.  Modifies C<dsv> but not C<ssv>.  If C<flags> has C<SV_GMAGIC>
4768 bit set, will C<mg_get> on the SVs if appropriate, else not. C<sv_catsv>
4769 and C<sv_catsv_nomg> are implemented in terms of this function.
4770
4771         void    sv_catsv_flags(SV* dsv, SV* ssv, I32 flags)
4772
4773 =for hackers
4774 Found in file sv.c
4775
4776 =item sv_catsv_nomg
4777 X<sv_catsv_nomg>
4778
4779 Like C<sv_catsv> but doesn't process magic.
4780
4781         void    sv_catsv_nomg(SV* dsv, SV* ssv)
4782
4783 =for hackers
4784 Found in file sv.h
4785
4786 =item sv_chop
4787 X<sv_chop>
4788
4789 Efficient removal of characters from the beginning of the string buffer.
4790 SvPOK(sv) must be true and the C<ptr> must be a pointer to somewhere inside
4791 the string buffer.  The C<ptr> becomes the first character of the adjusted
4792 string. Uses the "OOK hack".
4793 Beware: after this function returns, C<ptr> and SvPVX_const(sv) may no longer
4794 refer to the same chunk of data.
4795
4796         void    sv_chop(SV* sv, const char* ptr)
4797
4798 =for hackers
4799 Found in file sv.c
4800
4801 =item sv_clear
4802 X<sv_clear>
4803
4804 Clear an SV: call any destructors, free up any memory used by the body,
4805 and free the body itself. The SV's head is I<not> freed, although
4806 its type is set to all 1's so that it won't inadvertently be assumed
4807 to be live during global destruction etc.
4808 This function should only be called when REFCNT is zero. Most of the time
4809 you'll want to call C<sv_free()> (or its macro wrapper C<SvREFCNT_dec>)
4810 instead.
4811
4812         void    sv_clear(SV* sv)
4813
4814 =for hackers
4815 Found in file sv.c
4816
4817 =item sv_cmp
4818 X<sv_cmp>
4819
4820 Compares the strings in two SVs.  Returns -1, 0, or 1 indicating whether the
4821 string in C<sv1> is less than, equal to, or greater than the string in
4822 C<sv2>. Is UTF-8 and 'use bytes' aware, handles get magic, and will
4823 coerce its args to strings if necessary.  See also C<sv_cmp_locale>.
4824
4825         I32     sv_cmp(SV* sv1, SV* sv2)
4826
4827 =for hackers
4828 Found in file sv.c
4829
4830 =item sv_cmp_locale
4831 X<sv_cmp_locale>
4832
4833 Compares the strings in two SVs in a locale-aware manner. Is UTF-8 and
4834 'use bytes' aware, handles get magic, and will coerce its args to strings
4835 if necessary.  See also C<sv_cmp_locale>.  See also C<sv_cmp>.
4836
4837         I32     sv_cmp_locale(SV* sv1, SV* sv2)
4838
4839 =for hackers
4840 Found in file sv.c
4841
4842 =item sv_collxfrm
4843 X<sv_collxfrm>
4844
4845 Add Collate Transform magic to an SV if it doesn't already have it.
4846
4847 Any scalar variable may carry PERL_MAGIC_collxfrm magic that contains the
4848 scalar data of the variable, but transformed to such a format that a normal
4849 memory comparison can be used to compare the data according to the locale
4850 settings.
4851
4852         char*   sv_collxfrm(SV* sv, STRLEN* nxp)
4853
4854 =for hackers
4855 Found in file sv.c
4856
4857 =item sv_copypv
4858 X<sv_copypv>
4859
4860 Copies a stringified representation of the source SV into the
4861 destination SV.  Automatically performs any necessary mg_get and
4862 coercion of numeric values into strings.  Guaranteed to preserve
4863 UTF-8 flag even from overloaded objects.  Similar in nature to
4864 sv_2pv[_flags] but operates directly on an SV instead of just the
4865 string.  Mostly uses sv_2pv_flags to do its work, except when that
4866 would lose the UTF-8'ness of the PV.
4867
4868         void    sv_copypv(SV* dsv, SV* ssv)
4869
4870 =for hackers
4871 Found in file sv.c
4872
4873 =item sv_dec
4874 X<sv_dec>
4875
4876 Auto-decrement of the value in the SV, doing string to numeric conversion
4877 if necessary. Handles 'get' magic.
4878
4879         void    sv_dec(SV* sv)
4880
4881 =for hackers
4882 Found in file sv.c
4883
4884 =item sv_derived_from
4885 X<sv_derived_from>
4886
4887 Returns a boolean indicating whether the SV is derived from the specified
4888 class.  This is the function that implements C<UNIVERSAL::isa>.  It works
4889 for class names as well as for objects.
4890
4891         bool    sv_derived_from(SV* sv, const char* name)
4892
4893 =for hackers
4894 Found in file universal.c
4895
4896 =item sv_eq
4897 X<sv_eq>
4898
4899 Returns a boolean indicating whether the strings in the two SVs are
4900 identical. Is UTF-8 and 'use bytes' aware, handles get magic, and will
4901 coerce its args to strings if necessary.
4902
4903         I32     sv_eq(SV* sv1, SV* sv2)
4904
4905 =for hackers
4906 Found in file sv.c
4907
4908 =item sv_force_normal_flags
4909 X<sv_force_normal_flags>
4910
4911 Undo various types of fakery on an SV: if the PV is a shared string, make
4912 a private copy; if we're a ref, stop refing; if we're a glob, downgrade to
4913 an xpvmg; if we're a copy-on-write scalar, this is the on-write time when
4914 we do the copy, and is also used locally. If C<SV_COW_DROP_PV> is set
4915 then a copy-on-write scalar drops its PV buffer (if any) and becomes
4916 SvPOK_off rather than making a copy. (Used where this scalar is about to be
4917 set to some other value.) In addition, the C<flags> parameter gets passed to
4918 C<sv_unref_flags()> when unrefing. C<sv_force_normal> calls this function
4919 with flags set to 0.
4920
4921         void    sv_force_normal_flags(SV *sv, U32 flags)
4922
4923 =for hackers
4924 Found in file sv.c
4925
4926 =item sv_free
4927 X<sv_free>
4928
4929 Decrement an SV's reference count, and if it drops to zero, call
4930 C<sv_clear> to invoke destructors and free up any memory used by
4931 the body; finally, deallocate the SV's head itself.
4932 Normally called via a wrapper macro C<SvREFCNT_dec>.
4933
4934         void    sv_free(SV* sv)
4935
4936 =for hackers
4937 Found in file sv.c
4938
4939 =item sv_gets
4940 X<sv_gets>
4941
4942 Get a line from the filehandle and store it into the SV, optionally
4943 appending to the currently-stored string.
4944
4945         char*   sv_gets(SV* sv, PerlIO* fp, I32 append)
4946
4947 =for hackers
4948 Found in file sv.c
4949
4950 =item sv_grow
4951 X<sv_grow>
4952
4953 Expands the character buffer in the SV.  If necessary, uses C<sv_unref> and
4954 upgrades the SV to C<SVt_PV>.  Returns a pointer to the character buffer.
4955 Use the C<SvGROW> wrapper instead.
4956
4957         char*   sv_grow(SV* sv, STRLEN newlen)
4958
4959 =for hackers
4960 Found in file sv.c
4961
4962 =item sv_inc
4963 X<sv_inc>
4964
4965 Auto-increment of the value in the SV, doing string to numeric conversion
4966 if necessary. Handles 'get' magic.
4967
4968         void    sv_inc(SV* sv)
4969
4970 =for hackers
4971 Found in file sv.c
4972
4973 =item sv_insert
4974 X<sv_insert>
4975
4976 Inserts a string at the specified offset/length within the SV. Similar to
4977 the Perl substr() function.
4978
4979         void    sv_insert(SV* bigsv, STRLEN offset, STRLEN len, const char* little, STRLEN littlelen)
4980
4981 =for hackers
4982 Found in file sv.c
4983
4984 =item sv_isa
4985 X<sv_isa>
4986
4987 Returns a boolean indicating whether the SV is blessed into the specified
4988 class.  This does not check for subtypes; use C<sv_derived_from> to verify
4989 an inheritance relationship.
4990
4991         int     sv_isa(SV* sv, const char* name)
4992
4993 =for hackers
4994 Found in file sv.c
4995
4996 =item sv_isobject
4997 X<sv_isobject>
4998
4999 Returns a boolean indicating whether the SV is an RV pointing to a blessed
5000 object.  If the SV is not an RV, or if the object is not blessed, then this
5001 will return false.
5002
5003         int     sv_isobject(SV* sv)
5004
5005 =for hackers
5006 Found in file sv.c
5007
5008 =item sv_len
5009 X<sv_len>
5010
5011 Returns the length of the string in the SV. Handles magic and type
5012 coercion.  See also C<SvCUR>, which gives raw access to the xpv_cur slot.
5013
5014         STRLEN  sv_len(SV* sv)
5015
5016 =for hackers
5017 Found in file sv.c
5018
5019 =item sv_len_utf8
5020 X<sv_len_utf8>
5021
5022 Returns the number of characters in the string in an SV, counting wide
5023 UTF-8 bytes as a single character. Handles magic and type coercion.
5024
5025         STRLEN  sv_len_utf8(SV* sv)
5026
5027 =for hackers
5028 Found in file sv.c
5029
5030 =item sv_magic
5031 X<sv_magic>
5032
5033 Adds magic to an SV. First upgrades C<sv> to type C<SVt_PVMG> if necessary,
5034 then adds a new magic item of type C<how> to the head of the magic list.
5035
5036 See C<sv_magicext> (which C<sv_magic> now calls) for a description of the
5037 handling of the C<name> and C<namlen> arguments.
5038
5039 You need to use C<sv_magicext> to add magic to SvREADONLY SVs and also
5040 to add more than one instance of the same 'how'.
5041
5042         void    sv_magic(SV* sv, SV* obj, int how, const char* name, I32 namlen)
5043
5044 =for hackers
5045 Found in file sv.c
5046
5047 =item sv_magicext
5048 X<sv_magicext>
5049
5050 Adds magic to an SV, upgrading it if necessary. Applies the
5051 supplied vtable and returns a pointer to the magic added.
5052
5053 Note that C<sv_magicext> will allow things that C<sv_magic> will not.
5054 In particular, you can add magic to SvREADONLY SVs, and add more than
5055 one instance of the same 'how'.
5056
5057 If C<namlen> is greater than zero then a C<savepvn> I<copy> of C<name> is
5058 stored, if C<namlen> is zero then C<name> is stored as-is and - as another
5059 special case - if C<(name && namlen == HEf_SVKEY)> then C<name> is assumed
5060 to contain an C<SV*> and is stored as-is with its REFCNT incremented.
5061
5062 (This is now used as a subroutine by C<sv_magic>.)
5063
5064         MAGIC * sv_magicext(SV* sv, SV* obj, int how, const MGVTBL *vtbl, const char* name, I32 namlen)
5065
5066 =for hackers
5067 Found in file sv.c
5068
5069 =item sv_mortalcopy
5070 X<sv_mortalcopy>
5071
5072 Creates a new SV which is a copy of the original SV (using C<sv_setsv>).
5073 The new SV is marked as mortal. It will be destroyed "soon", either by an
5074 explicit call to FREETMPS, or by an implicit call at places such as
5075 statement boundaries.  See also C<sv_newmortal> and C<sv_2mortal>.
5076
5077         SV*     sv_mortalcopy(SV* oldsv)
5078
5079 =for hackers
5080 Found in file sv.c
5081
5082 =item sv_newmortal
5083 X<sv_newmortal>
5084
5085 Creates a new null SV which is mortal.  The reference count of the SV is
5086 set to 1. It will be destroyed "soon", either by an explicit call to
5087 FREETMPS, or by an implicit call at places such as statement boundaries.
5088 See also C<sv_mortalcopy> and C<sv_2mortal>.
5089
5090         SV*     sv_newmortal()
5091
5092 =for hackers
5093 Found in file sv.c
5094
5095 =item sv_newref
5096 X<sv_newref>
5097
5098 Increment an SV's reference count. Use the C<SvREFCNT_inc()> wrapper
5099 instead.
5100
5101         SV*     sv_newref(SV* sv)
5102
5103 =for hackers
5104 Found in file sv.c
5105
5106 =item sv_pos_b2u
5107 X<sv_pos_b2u>
5108
5109 Converts the value pointed to by offsetp from a count of bytes from the
5110 start of the string, to a count of the equivalent number of UTF-8 chars.
5111 Handles magic and type coercion.
5112
5113         void    sv_pos_b2u(SV* sv, I32* offsetp)
5114
5115 =for hackers
5116 Found in file sv.c
5117
5118 =item sv_pos_u2b
5119 X<sv_pos_u2b>
5120
5121 Converts the value pointed to by offsetp from a count of UTF-8 chars from
5122 the start of the string, to a count of the equivalent number of bytes; if
5123 lenp is non-zero, it does the same to lenp, but this time starting from
5124 the offset, rather than from the start of the string. Handles magic and
5125 type coercion.
5126
5127         void    sv_pos_u2b(SV* sv, I32* offsetp, I32* lenp)
5128
5129 =for hackers
5130 Found in file sv.c
5131
5132 =item sv_pvbyten_force
5133 X<sv_pvbyten_force>
5134
5135 The backend for the C<SvPVbytex_force> macro. Always use the macro instead.
5136
5137         char*   sv_pvbyten_force(SV* sv, STRLEN* lp)
5138
5139 =for hackers
5140 Found in file sv.c
5141
5142 =item sv_pvn_force
5143 X<sv_pvn_force>
5144
5145 Get a sensible string out of the SV somehow.
5146 A private implementation of the C<SvPV_force> macro for compilers which
5147 can't cope with complex macro expressions. Always use the macro instead.
5148
5149         char*   sv_pvn_force(SV* sv, STRLEN* lp)
5150
5151 =for hackers
5152 Found in file sv.c
5153
5154 =item sv_pvn_force_flags
5155 X<sv_pvn_force_flags>
5156
5157 Get a sensible string out of the SV somehow.
5158 If C<flags> has C<SV_GMAGIC> bit set, will C<mg_get> on C<sv> if
5159 appropriate, else not. C<sv_pvn_force> and C<sv_pvn_force_nomg> are
5160 implemented in terms of this function.
5161 You normally want to use the various wrapper macros instead: see
5162 C<SvPV_force> and C<SvPV_force_nomg>
5163
5164         char*   sv_pvn_force_flags(SV* sv, STRLEN* lp, I32 flags)
5165
5166 =for hackers
5167 Found in file sv.c
5168
5169 =item sv_pvutf8n_force
5170 X<sv_pvutf8n_force>
5171
5172 The backend for the C<SvPVutf8x_force> macro. Always use the macro instead.
5173
5174         char*   sv_pvutf8n_force(SV* sv, STRLEN* lp)
5175
5176 =for hackers
5177 Found in file sv.c
5178
5179 =item sv_reftype
5180 X<sv_reftype>
5181
5182 Returns a string describing what the SV is a reference to.
5183
5184         char*   sv_reftype(const SV* sv, int ob)
5185
5186 =for hackers
5187 Found in file sv.c
5188
5189 =item sv_replace
5190 X<sv_replace>
5191
5192 Make the first argument a copy of the second, then delete the original.
5193 The target SV physically takes over ownership of the body of the source SV
5194 and inherits its flags; however, the target keeps any magic it owns,
5195 and any magic in the source is discarded.
5196 Note that this is a rather specialist SV copying operation; most of the
5197 time you'll want to use C<sv_setsv> or one of its many macro front-ends.
5198
5199         void    sv_replace(SV* sv, SV* nsv)
5200
5201 =for hackers
5202 Found in file sv.c
5203
5204 =item sv_report_used
5205 X<sv_report_used>
5206
5207 Dump the contents of all SVs not yet freed. (Debugging aid).
5208
5209         void    sv_report_used()
5210
5211 =for hackers
5212 Found in file sv.c
5213
5214 =item sv_reset
5215 X<sv_reset>
5216
5217 Underlying implementation for the C<reset> Perl function.
5218 Note that the perl-level function is vaguely deprecated.
5219
5220         void    sv_reset(const char* s, HV* stash)
5221
5222 =for hackers
5223 Found in file sv.c
5224
5225 =item sv_rvweaken
5226 X<sv_rvweaken>
5227
5228 Weaken a reference: set the C<SvWEAKREF> flag on this RV; give the
5229 referred-to SV C<PERL_MAGIC_backref> magic if it hasn't already; and
5230 push a back-reference to this RV onto the array of backreferences
5231 associated with that magic.
5232
5233         SV*     sv_rvweaken(SV *sv)
5234
5235 =for hackers
5236 Found in file sv.c
5237
5238 =item sv_setiv
5239 X<sv_setiv>
5240
5241 Copies an integer into the given SV, upgrading first if necessary.
5242 Does not handle 'set' magic.  See also C<sv_setiv_mg>.
5243
5244         void    sv_setiv(SV* sv, IV num)
5245
5246 =for hackers
5247 Found in file sv.c
5248
5249 =item sv_setiv_mg
5250 X<sv_setiv_mg>
5251
5252 Like C<sv_setiv>, but also handles 'set' magic.
5253
5254         void    sv_setiv_mg(SV *sv, IV i)
5255
5256 =for hackers
5257 Found in file sv.c
5258
5259 =item sv_setnv
5260 X<sv_setnv>
5261
5262 Copies a double into the given SV, upgrading first if necessary.
5263 Does not handle 'set' magic.  See also C<sv_setnv_mg>.
5264
5265         void    sv_setnv(SV* sv, NV num)
5266
5267 =for hackers
5268 Found in file sv.c
5269
5270 =item sv_setnv_mg
5271 X<sv_setnv_mg>
5272
5273 Like C<sv_setnv>, but also handles 'set' magic.
5274
5275         void    sv_setnv_mg(SV *sv, NV num)
5276
5277 =for hackers
5278 Found in file sv.c
5279
5280 =item sv_setpv
5281 X<sv_setpv>
5282
5283 Copies a string into an SV.  The string must be null-terminated.  Does not
5284 handle 'set' magic.  See C<sv_setpv_mg>.
5285
5286         void    sv_setpv(SV* sv, const char* ptr)
5287
5288 =for hackers
5289 Found in file sv.c
5290
5291 =item sv_setpvf
5292 X<sv_setpvf>
5293
5294 Works like C<sv_catpvf> but copies the text into the SV instead of
5295 appending it.  Does not handle 'set' magic.  See C<sv_setpvf_mg>.
5296
5297         void    sv_setpvf(SV* sv, const char* pat, ...)
5298
5299 =for hackers
5300 Found in file sv.c
5301
5302 =item sv_setpvf_mg
5303 X<sv_setpvf_mg>
5304
5305 Like C<sv_setpvf>, but also handles 'set' magic.
5306
5307         void    sv_setpvf_mg(SV *sv, const char* pat, ...)
5308
5309 =for hackers
5310 Found in file sv.c
5311
5312 =item sv_setpviv
5313 X<sv_setpviv>
5314
5315 Copies an integer into the given SV, also updating its string value.
5316 Does not handle 'set' magic.  See C<sv_setpviv_mg>.
5317
5318         void    sv_setpviv(SV* sv, IV num)
5319
5320 =for hackers
5321 Found in file sv.c
5322
5323 =item sv_setpviv_mg
5324 X<sv_setpviv_mg>
5325
5326 Like C<sv_setpviv>, but also handles 'set' magic.
5327
5328         void    sv_setpviv_mg(SV *sv, IV iv)
5329
5330 =for hackers
5331 Found in file sv.c
5332
5333 =item sv_setpvn
5334 X<sv_setpvn>
5335
5336 Copies a string into an SV.  The C<len> parameter indicates the number of
5337 bytes to be copied.  If the C<ptr> argument is NULL the SV will become
5338 undefined.  Does not handle 'set' magic.  See C<sv_setpvn_mg>.
5339
5340         void    sv_setpvn(SV* sv, const char* ptr, STRLEN len)
5341
5342 =for hackers
5343 Found in file sv.c
5344
5345 =item sv_setpvn_mg
5346 X<sv_setpvn_mg>
5347
5348 Like C<sv_setpvn>, but also handles 'set' magic.
5349
5350         void    sv_setpvn_mg(SV *sv, const char *ptr, STRLEN len)
5351
5352 =for hackers
5353 Found in file sv.c
5354
5355 =item sv_setpv_mg
5356 X<sv_setpv_mg>
5357
5358 Like C<sv_setpv>, but also handles 'set' magic.
5359
5360         void    sv_setpv_mg(SV *sv, const char *ptr)
5361
5362 =for hackers
5363 Found in file sv.c
5364
5365 =item sv_setref_iv
5366 X<sv_setref_iv>
5367
5368 Copies an integer into a new SV, optionally blessing the SV.  The C<rv>
5369 argument will be upgraded to an RV.  That RV will be modified to point to
5370 the new SV.  The C<classname> argument indicates the package for the
5371 blessing.  Set C<classname> to C<Nullch> to avoid the blessing.  The new SV
5372 will have a reference count of 1, and the RV will be returned.
5373
5374         SV*     sv_setref_iv(SV* rv, const char* classname, IV iv)
5375
5376 =for hackers
5377 Found in file sv.c
5378
5379 =item sv_setref_nv
5380 X<sv_setref_nv>
5381
5382 Copies a double into a new SV, optionally blessing the SV.  The C<rv>
5383 argument will be upgraded to an RV.  That RV will be modified to point to
5384 the new SV.  The C<classname> argument indicates the package for the
5385 blessing.  Set C<classname> to C<Nullch> to avoid the blessing.  The new SV
5386 will have a reference count of 1, and the RV will be returned.
5387
5388         SV*     sv_setref_nv(SV* rv, const char* classname, NV nv)
5389
5390 =for hackers
5391 Found in file sv.c
5392
5393 =item sv_setref_pv
5394 X<sv_setref_pv>
5395
5396 Copies a pointer into a new SV, optionally blessing the SV.  The C<rv>
5397 argument will be upgraded to an RV.  That RV will be modified to point to
5398 the new SV.  If the C<pv> argument is NULL then C<PL_sv_undef> will be placed
5399 into the SV.  The C<classname> argument indicates the package for the
5400 blessing.  Set C<classname> to C<Nullch> to avoid the blessing.  The new SV
5401 will have a reference count of 1, and the RV will be returned.
5402
5403 Do not use with other Perl types such as HV, AV, SV, CV, because those
5404 objects will become corrupted by the pointer copy process.
5405
5406 Note that C<sv_setref_pvn> copies the string while this copies the pointer.
5407
5408         SV*     sv_setref_pv(SV* rv, const char* classname, void* pv)
5409
5410 =for hackers
5411 Found in file sv.c
5412
5413 =item sv_setref_pvn
5414 X<sv_setref_pvn>
5415
5416 Copies a string into a new SV, optionally blessing the SV.  The length of the
5417 string must be specified with C<n>.  The C<rv> argument will be upgraded to
5418 an RV.  That RV will be modified to point to the new SV.  The C<classname>
5419 argument indicates the package for the blessing.  Set C<classname> to
5420 C<Nullch> to avoid the blessing.  The new SV will have a reference count
5421 of 1, and the RV will be returned.
5422
5423 Note that C<sv_setref_pv> copies the pointer while this copies the string.
5424
5425         SV*     sv_setref_pvn(SV* rv, const char* classname, const char* pv, STRLEN n)
5426
5427 =for hackers
5428 Found in file sv.c
5429
5430 =item sv_setref_uv
5431 X<sv_setref_uv>
5432
5433 Copies an unsigned integer into a new SV, optionally blessing the SV.  The C<rv>
5434 argument will be upgraded to an RV.  That RV will be modified to point to
5435 the new SV.  The C<classname> argument indicates the package for the
5436 blessing.  Set C<classname> to C<Nullch> to avoid the blessing.  The new SV
5437 will have a reference count of 1, and the RV will be returned.
5438
5439         SV*     sv_setref_uv(SV* rv, const char* classname, UV uv)
5440
5441 =for hackers
5442 Found in file sv.c
5443
5444 =item sv_setsv
5445 X<sv_setsv>
5446
5447 Copies the contents of the source SV C<ssv> into the destination SV
5448 C<dsv>.  The source SV may be destroyed if it is mortal, so don't use this
5449 function if the source SV needs to be reused. Does not handle 'set' magic.
5450 Loosely speaking, it performs a copy-by-value, obliterating any previous
5451 content of the destination.
5452
5453 You probably want to use one of the assortment of wrappers, such as
5454 C<SvSetSV>, C<SvSetSV_nosteal>, C<SvSetMagicSV> and
5455 C<SvSetMagicSV_nosteal>.
5456
5457         void    sv_setsv(SV* dsv, SV* ssv)
5458
5459 =for hackers
5460 Found in file sv.c
5461
5462 =item sv_setsv_flags
5463 X<sv_setsv_flags>
5464
5465 Copies the contents of the source SV C<ssv> into the destination SV
5466 C<dsv>.  The source SV may be destroyed if it is mortal, so don't use this
5467 function if the source SV needs to be reused. Does not handle 'set' magic.
5468 Loosely speaking, it performs a copy-by-value, obliterating any previous
5469 content of the destination.
5470 If the C<flags> parameter has the C<SV_GMAGIC> bit set, will C<mg_get> on
5471 C<ssv> if appropriate, else not. If the C<flags> parameter has the
5472 C<NOSTEAL> bit set then the buffers of temps will not be stolen. <sv_setsv>
5473 and C<sv_setsv_nomg> are implemented in terms of this function.
5474
5475 You probably want to use one of the assortment of wrappers, such as
5476 C<SvSetSV>, C<SvSetSV_nosteal>, C<SvSetMagicSV> and
5477 C<SvSetMagicSV_nosteal>.
5478
5479 This is the primary function for copying scalars, and most other
5480 copy-ish functions and macros use this underneath.
5481
5482         void    sv_setsv_flags(SV* dsv, SV* ssv, I32 flags)
5483
5484 =for hackers
5485 Found in file sv.c
5486
5487 =item sv_setsv_mg
5488 X<sv_setsv_mg>
5489
5490 Like C<sv_setsv>, but also handles 'set' magic.
5491
5492         void    sv_setsv_mg(SV *dstr, SV *sstr)
5493
5494 =for hackers
5495 Found in file sv.c
5496
5497 =item sv_setsv_nomg
5498 X<sv_setsv_nomg>
5499
5500 Like C<sv_setsv> but doesn't process magic.
5501
5502         void    sv_setsv_nomg(SV* dsv, SV* ssv)
5503
5504 =for hackers
5505 Found in file sv.h
5506
5507 =item sv_setuv
5508 X<sv_setuv>
5509
5510 Copies an unsigned integer into the given SV, upgrading first if necessary.
5511 Does not handle 'set' magic.  See also C<sv_setuv_mg>.
5512
5513         void    sv_setuv(SV* sv, UV num)
5514
5515 =for hackers
5516 Found in file sv.c
5517
5518 =item sv_setuv_mg
5519 X<sv_setuv_mg>
5520
5521 Like C<sv_setuv>, but also handles 'set' magic.
5522
5523         void    sv_setuv_mg(SV *sv, UV u)
5524
5525 =for hackers
5526 Found in file sv.c
5527
5528 =item sv_tainted
5529 X<sv_tainted>
5530
5531 Test an SV for taintedness. Use C<SvTAINTED> instead.
5532         bool    sv_tainted(SV* sv)
5533
5534 =for hackers
5535 Found in file sv.c
5536
5537 =item sv_true
5538 X<sv_true>
5539
5540 Returns true if the SV has a true value by Perl's rules.
5541 Use the C<SvTRUE> macro instead, which may call C<sv_true()> or may
5542 instead use an in-line version.
5543
5544         I32     sv_true(SV *sv)
5545
5546 =for hackers
5547 Found in file sv.c
5548
5549 =item sv_unmagic
5550 X<sv_unmagic>
5551
5552 Removes all magic of type C<type> from an SV.
5553
5554         int     sv_unmagic(SV* sv, int type)
5555
5556 =for hackers
5557 Found in file sv.c
5558
5559 =item sv_unref_flags
5560 X<sv_unref_flags>
5561
5562 Unsets the RV status of the SV, and decrements the reference count of
5563 whatever was being referenced by the RV.  This can almost be thought of
5564 as a reversal of C<newSVrv>.  The C<cflags> argument can contain
5565 C<SV_IMMEDIATE_UNREF> to force the reference count to be decremented
5566 (otherwise the decrementing is conditional on the reference count being
5567 different from one or the reference being a readonly SV).
5568 See C<SvROK_off>.
5569
5570         void    sv_unref_flags(SV* sv, U32 flags)
5571
5572 =for hackers
5573 Found in file sv.c
5574
5575 =item sv_untaint
5576 X<sv_untaint>
5577
5578 Untaint an SV. Use C<SvTAINTED_off> instead.
5579         void    sv_untaint(SV* sv)
5580
5581 =for hackers
5582 Found in file sv.c
5583
5584 =item sv_upgrade
5585 X<sv_upgrade>
5586
5587 Upgrade an SV to a more complex form.  Generally adds a new body type to the
5588 SV, then copies across as much information as possible from the old body.
5589 You generally want to use the C<SvUPGRADE> macro wrapper. See also C<svtype>.
5590
5591         void    sv_upgrade(SV* sv, U32 mt)
5592
5593 =for hackers
5594 Found in file sv.c
5595
5596 =item sv_usepvn
5597 X<sv_usepvn>
5598
5599 Tells an SV to use C<ptr> to find its string value.  Normally the string is
5600 stored inside the SV but sv_usepvn allows the SV to use an outside string.
5601 The C<ptr> should point to memory that was allocated by C<malloc>.  The
5602 string length, C<len>, must be supplied.  This function will realloc the
5603 memory pointed to by C<ptr>, so that pointer should not be freed or used by
5604 the programmer after giving it to sv_usepvn.  Does not handle 'set' magic.
5605 See C<sv_usepvn_mg>.
5606
5607         void    sv_usepvn(SV* sv, char* ptr, STRLEN len)
5608
5609 =for hackers
5610 Found in file sv.c
5611
5612 =item sv_usepvn_mg
5613 X<sv_usepvn_mg>
5614
5615 Like C<sv_usepvn>, but also handles 'set' magic.
5616
5617         void    sv_usepvn_mg(SV *sv, char *ptr, STRLEN len)
5618
5619 =for hackers
5620 Found in file sv.c
5621
5622 =item sv_utf8_decode
5623 X<sv_utf8_decode>
5624
5625 If the PV of the SV is an octet sequence in UTF-8
5626 and contains a multiple-byte character, the C<SvUTF8> flag is turned on
5627 so that it looks like a character. If the PV contains only single-byte
5628 characters, the C<SvUTF8> flag stays being off.
5629 Scans PV for validity and returns false if the PV is invalid UTF-8.
5630
5631 NOTE: this function is experimental and may change or be
5632 removed without notice.
5633
5634         bool    sv_utf8_decode(SV *sv)
5635
5636 =for hackers
5637 Found in file sv.c
5638
5639 =item sv_utf8_downgrade
5640 X<sv_utf8_downgrade>
5641
5642 Attempts to convert the PV of an SV from characters to bytes.
5643 If the PV contains a character beyond byte, this conversion will fail;
5644 in this case, either returns false or, if C<fail_ok> is not
5645 true, croaks.
5646
5647 This is not as a general purpose Unicode to byte encoding interface:
5648 use the Encode extension for that.
5649
5650 NOTE: this function is experimental and may change or be
5651 removed without notice.
5652
5653         bool    sv_utf8_downgrade(SV *sv, bool fail_ok)
5654
5655 =for hackers
5656 Found in file sv.c
5657
5658 =item sv_utf8_encode
5659 X<sv_utf8_encode>
5660
5661 Converts the PV of an SV to UTF-8, but then turns the C<SvUTF8>
5662 flag off so that it looks like octets again.
5663
5664         void    sv_utf8_encode(SV *sv)
5665
5666 =for hackers
5667 Found in file sv.c
5668
5669 =item sv_utf8_upgrade
5670 X<sv_utf8_upgrade>
5671
5672 Converts the PV of an SV to its UTF-8-encoded form.
5673 Forces the SV to string form if it is not already.
5674 Always sets the SvUTF8 flag to avoid future validity checks even
5675 if all the bytes have hibit clear.
5676
5677 This is not as a general purpose byte encoding to Unicode interface:
5678 use the Encode extension for that.
5679
5680         STRLEN  sv_utf8_upgrade(SV *sv)
5681
5682 =for hackers
5683 Found in file sv.c
5684
5685 =item sv_utf8_upgrade_flags
5686 X<sv_utf8_upgrade_flags>
5687
5688 Converts the PV of an SV to its UTF-8-encoded form.
5689 Forces the SV to string form if it is not already.
5690 Always sets the SvUTF8 flag to avoid future validity checks even
5691 if all the bytes have hibit clear. If C<flags> has C<SV_GMAGIC> bit set,
5692 will C<mg_get> on C<sv> if appropriate, else not. C<sv_utf8_upgrade> and
5693 C<sv_utf8_upgrade_nomg> are implemented in terms of this function.
5694
5695 This is not as a general purpose byte encoding to Unicode interface:
5696 use the Encode extension for that.
5697
5698         STRLEN  sv_utf8_upgrade_flags(SV *sv, I32 flags)
5699
5700 =for hackers
5701 Found in file sv.c
5702
5703 =item sv_vcatpvf
5704 X<sv_vcatpvf>
5705
5706 Processes its arguments like C<vsprintf> and appends the formatted output
5707 to an SV.  Does not handle 'set' magic.  See C<sv_vcatpvf_mg>.
5708
5709 Usually used via its frontend C<sv_catpvf>.
5710
5711         void    sv_vcatpvf(SV* sv, const char* pat, va_list* args)
5712
5713 =for hackers
5714 Found in file sv.c
5715
5716 =item sv_vcatpvfn
5717 X<sv_vcatpvfn>
5718
5719 Processes its arguments like C<vsprintf> and appends the formatted output
5720 to an SV.  Uses an array of SVs if the C style variable argument list is
5721 missing (NULL).  When running with taint checks enabled, indicates via
5722 C<maybe_tainted> if results are untrustworthy (often due to the use of
5723 locales).
5724
5725 Usually used via one of its frontends C<sv_vcatpvf> and C<sv_vcatpvf_mg>.
5726
5727         void    sv_vcatpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
5728
5729 =for hackers
5730 Found in file sv.c
5731
5732 =item sv_vcatpvf_mg
5733 X<sv_vcatpvf_mg>
5734
5735 Like C<sv_vcatpvf>, but also handles 'set' magic.
5736
5737 Usually used via its frontend C<sv_catpvf_mg>.
5738
5739         void    sv_vcatpvf_mg(SV* sv, const char* pat, va_list* args)
5740
5741 =for hackers
5742 Found in file sv.c
5743
5744 =item sv_vsetpvf
5745 X<sv_vsetpvf>
5746
5747 Works like C<sv_vcatpvf> but copies the text into the SV instead of
5748 appending it.  Does not handle 'set' magic.  See C<sv_vsetpvf_mg>.
5749
5750 Usually used via its frontend C<sv_setpvf>.
5751
5752         void    sv_vsetpvf(SV* sv, const char* pat, va_list* args)
5753
5754 =for hackers
5755 Found in file sv.c
5756
5757 =item sv_vsetpvfn
5758 X<sv_vsetpvfn>
5759
5760 Works like C<sv_vcatpvfn> but copies the text into the SV instead of
5761 appending it.
5762
5763 Usually used via one of its frontends C<sv_vsetpvf> and C<sv_vsetpvf_mg>.
5764
5765         void    sv_vsetpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
5766
5767 =for hackers
5768 Found in file sv.c
5769
5770 =item sv_vsetpvf_mg
5771 X<sv_vsetpvf_mg>
5772
5773 Like C<sv_vsetpvf>, but also handles 'set' magic.
5774
5775 Usually used via its frontend C<sv_setpvf_mg>.
5776
5777         void    sv_vsetpvf_mg(SV* sv, const char* pat, va_list* args)
5778
5779 =for hackers
5780 Found in file sv.c
5781
5782
5783 =back
5784
5785 =head1 Unicode Support
5786
5787 =over 8
5788
5789 =item bytes_from_utf8
5790 X<bytes_from_utf8>
5791
5792 Converts a string C<s> of length C<len> from UTF-8 into byte encoding.
5793 Unlike C<utf8_to_bytes> but like C<bytes_to_utf8>, returns a pointer to
5794 the newly-created string, and updates C<len> to contain the new
5795 length.  Returns the original string if no conversion occurs, C<len>
5796 is unchanged. Do nothing if C<is_utf8> points to 0. Sets C<is_utf8> to
5797 0 if C<s> is converted or contains all 7bit characters.
5798
5799 NOTE: this function is experimental and may change or be
5800 removed without notice.
5801
5802         U8*     bytes_from_utf8(const U8 *s, STRLEN *len, bool *is_utf8)
5803
5804 =for hackers
5805 Found in file utf8.c
5806
5807 =item bytes_to_utf8
5808 X<bytes_to_utf8>
5809
5810 Converts a string C<s> of length C<len> from ASCII into UTF-8 encoding.
5811 Returns a pointer to the newly-created string, and sets C<len> to
5812 reflect the new length.
5813
5814 If you want to convert to UTF-8 from other encodings than ASCII,
5815 see sv_recode_to_utf8().
5816
5817 NOTE: this function is experimental and may change or be
5818 removed without notice.
5819
5820         U8*     bytes_to_utf8(const U8 *s, STRLEN *len)
5821
5822 =for hackers
5823 Found in file utf8.c
5824
5825 =item ibcmp_utf8
5826 X<ibcmp_utf8>
5827
5828 Return true if the strings s1 and s2 differ case-insensitively, false
5829 if not (if they are equal case-insensitively).  If u1 is true, the
5830 string s1 is assumed to be in UTF-8-encoded Unicode.  If u2 is true,
5831 the string s2 is assumed to be in UTF-8-encoded Unicode.  If u1 or u2
5832 are false, the respective string is assumed to be in native 8-bit
5833 encoding.
5834
5835 If the pe1 and pe2 are non-NULL, the scanning pointers will be copied
5836 in there (they will point at the beginning of the I<next> character).
5837 If the pointers behind pe1 or pe2 are non-NULL, they are the end
5838 pointers beyond which scanning will not continue under any
5839 circumstances.  If the byte lengths l1 and l2 are non-zero, s1+l1 and
5840 s2+l2 will be used as goal end pointers that will also stop the scan,
5841 and which qualify towards defining a successful match: all the scans
5842 that define an explicit length must reach their goal pointers for
5843 a match to succeed).
5844
5845 For case-insensitiveness, the "casefolding" of Unicode is used
5846 instead of upper/lowercasing both the characters, see
5847 http://www.unicode.org/unicode/reports/tr21/ (Case Mappings).
5848
5849         I32     ibcmp_utf8(const char* a, char **pe1, UV l1, bool u1, const char* b, char **pe2, UV l2, bool u2)
5850
5851 =for hackers
5852 Found in file utf8.c
5853
5854 =item is_utf8_char
5855 X<is_utf8_char>
5856
5857 Tests if some arbitrary number of bytes begins in a valid UTF-8
5858 character.  Note that an INVARIANT (i.e. ASCII) character is a valid
5859 UTF-8 character.  The actual number of bytes in the UTF-8 character
5860 will be returned if it is valid, otherwise 0.
5861
5862         STRLEN  is_utf8_char(const U8 *p)
5863
5864 =for hackers
5865 Found in file utf8.c
5866
5867 =item is_utf8_string
5868 X<is_utf8_string>
5869
5870 Returns true if first C<len> bytes of the given string form a valid
5871 UTF-8 string, false otherwise.  Note that 'a valid UTF-8 string' does
5872 not mean 'a string that contains code points above 0x7F encoded in UTF-8'
5873 because a valid ASCII string is a valid UTF-8 string.
5874
5875 See also is_utf8_string_loclen() and is_utf8_string_loc().
5876
5877         bool    is_utf8_string(const U8 *s, STRLEN len)
5878
5879 =for hackers
5880 Found in file utf8.c
5881
5882 =item is_utf8_string_loc
5883 X<is_utf8_string_loc>
5884
5885 Like is_utf8_string() but stores the location of the failure (in the
5886 case of "utf8ness failure") or the location s+len (in the case of
5887 "utf8ness success") in the C<ep>.
5888
5889 See also is_utf8_string_loclen() and is_utf8_string().
5890
5891         bool    is_utf8_string_loc(const U8 *s, STRLEN len, const U8 **p)
5892
5893 =for hackers
5894 Found in file utf8.c
5895
5896 =item is_utf8_string_loclen
5897 X<is_utf8_string_loclen>
5898
5899 Like is_utf8_string() but stores the location of the failure (in the
5900 case of "utf8ness failure") or the location s+len (in the case of
5901 "utf8ness success") in the C<ep>, and the number of UTF-8
5902 encoded characters in the C<el>.
5903
5904 See also is_utf8_string_loc() and is_utf8_string().
5905
5906         bool    is_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el)
5907
5908 =for hackers
5909 Found in file utf8.c
5910
5911 =item pv_uni_display
5912 X<pv_uni_display>
5913
5914 Build to the scalar dsv a displayable version of the string spv,
5915 length len, the displayable version being at most pvlim bytes long
5916 (if longer, the rest is truncated and "..." will be appended).
5917
5918 The flags argument can have UNI_DISPLAY_ISPRINT set to display
5919 isPRINT()able characters as themselves, UNI_DISPLAY_BACKSLASH
5920 to display the \\[nrfta\\] as the backslashed versions (like '\n')
5921 (UNI_DISPLAY_BACKSLASH is preferred over UNI_DISPLAY_ISPRINT for \\).
5922 UNI_DISPLAY_QQ (and its alias UNI_DISPLAY_REGEX) have both
5923 UNI_DISPLAY_BACKSLASH and UNI_DISPLAY_ISPRINT turned on.
5924
5925 The pointer to the PV of the dsv is returned.
5926
5927         char*   pv_uni_display(SV *dsv, const U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
5928
5929 =for hackers
5930 Found in file utf8.c
5931
5932 =item sv_cat_decode
5933 X<sv_cat_decode>
5934
5935 The encoding is assumed to be an Encode object, the PV of the ssv is
5936 assumed to be octets in that encoding and decoding the input starts
5937 from the position which (PV + *offset) pointed to.  The dsv will be
5938 concatenated the decoded UTF-8 string from ssv.  Decoding will terminate
5939 when the string tstr appears in decoding output or the input ends on
5940 the PV of the ssv. The value which the offset points will be modified
5941 to the last input position on the ssv.
5942
5943 Returns TRUE if the terminator was found, else returns FALSE.
5944
5945         bool    sv_cat_decode(SV* dsv, SV *encoding, SV *ssv, int *offset, char* tstr, int tlen)
5946
5947 =for hackers
5948 Found in file sv.c
5949
5950 =item sv_recode_to_utf8
5951 X<sv_recode_to_utf8>
5952
5953 The encoding is assumed to be an Encode object, on entry the PV
5954 of the sv is assumed to be octets in that encoding, and the sv
5955 will be converted into Unicode (and UTF-8).
5956
5957 If the sv already is UTF-8 (or if it is not POK), or if the encoding
5958 is not a reference, nothing is done to the sv.  If the encoding is not
5959 an C<Encode::XS> Encoding object, bad things will happen.
5960 (See F<lib/encoding.pm> and L<Encode>).
5961
5962 The PV of the sv is returned.
5963
5964         char*   sv_recode_to_utf8(SV* sv, SV *encoding)
5965
5966 =for hackers
5967 Found in file sv.c
5968
5969 =item sv_uni_display
5970 X<sv_uni_display>
5971
5972 Build to the scalar dsv a displayable version of the scalar sv,
5973 the displayable version being at most pvlim bytes long
5974 (if longer, the rest is truncated and "..." will be appended).
5975
5976 The flags argument is as in pv_uni_display().
5977
5978 The pointer to the PV of the dsv is returned.
5979
5980         char*   sv_uni_display(SV *dsv, SV *ssv, STRLEN pvlim, UV flags)
5981
5982 =for hackers
5983 Found in file utf8.c
5984
5985 =item to_utf8_case
5986 X<to_utf8_case>
5987
5988 The "p" contains the pointer to the UTF-8 string encoding
5989 the character that is being converted.
5990
5991 The "ustrp" is a pointer to the character buffer to put the
5992 conversion result to.  The "lenp" is a pointer to the length
5993 of the result.
5994
5995 The "swashp" is a pointer to the swash to use.
5996
5997 Both the special and normal mappings are stored lib/unicore/To/Foo.pl,
5998 and loaded by SWASHGET, using lib/utf8_heavy.pl.  The special (usually,
5999 but not always, a multicharacter mapping), is tried first.
6000
6001 The "special" is a string like "utf8::ToSpecLower", which means the
6002 hash %utf8::ToSpecLower.  The access to the hash is through
6003 Perl_to_utf8_case().
6004
6005 The "normal" is a string like "ToLower" which means the swash
6006 %utf8::ToLower.
6007
6008         UV      to_utf8_case(const U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, const char *normal, const char *special)
6009
6010 =for hackers
6011 Found in file utf8.c
6012
6013 =item to_utf8_fold
6014 X<to_utf8_fold>
6015
6016 Convert the UTF-8 encoded character at p to its foldcase version and
6017 store that in UTF-8 in ustrp and its length in bytes in lenp.  Note
6018 that the ustrp needs to be at least UTF8_MAXBYTES_CASE+1 bytes since the
6019 foldcase version may be longer than the original character (up to
6020 three characters).
6021
6022 The first character of the foldcased version is returned
6023 (but note, as explained above, that there may be more.)
6024
6025         UV      to_utf8_fold(const U8 *p, U8* ustrp, STRLEN *lenp)
6026
6027 =for hackers
6028 Found in file utf8.c
6029
6030 =item to_utf8_lower
6031 X<to_utf8_lower>
6032
6033 Convert the UTF-8 encoded character at p to its lowercase version and
6034 store that in UTF-8 in ustrp and its length in bytes in lenp.  Note
6035 that the ustrp needs to be at least UTF8_MAXBYTES_CASE+1 bytes since the
6036 lowercase version may be longer than the original character.
6037
6038 The first character of the lowercased version is returned
6039 (but note, as explained above, that there may be more.)
6040
6041         UV      to_utf8_lower(const U8 *p, U8* ustrp, STRLEN *lenp)
6042
6043 =for hackers
6044 Found in file utf8.c
6045
6046 =item to_utf8_title
6047 X<to_utf8_title>
6048
6049 Convert the UTF-8 encoded character at p to its titlecase version and
6050 store that in UTF-8 in ustrp and its length in bytes in lenp.  Note
6051 that the ustrp needs to be at least UTF8_MAXBYTES_CASE+1 bytes since the
6052 titlecase version may be longer than the original character.
6053
6054 The first character of the titlecased version is returned
6055 (but note, as explained above, that there may be more.)
6056
6057         UV      to_utf8_title(const U8 *p, U8* ustrp, STRLEN *lenp)
6058
6059 =for hackers
6060 Found in file utf8.c
6061
6062 =item to_utf8_upper
6063 X<to_utf8_upper>
6064
6065 Convert the UTF-8 encoded character at p to its uppercase version and
6066 store that in UTF-8 in ustrp and its length in bytes in lenp.  Note
6067 that the ustrp needs to be at least UTF8_MAXBYTES_CASE+1 bytes since
6068 the uppercase version may be longer than the original character.
6069
6070 The first character of the uppercased version is returned
6071 (but note, as explained above, that there may be more.)
6072
6073         UV      to_utf8_upper(const U8 *p, U8* ustrp, STRLEN *lenp)
6074
6075 =for hackers
6076 Found in file utf8.c
6077
6078 =item utf8n_to_uvchr
6079 X<utf8n_to_uvchr>
6080
6081 flags
6082
6083 Returns the native character value of the first character in the string 
6084 C<s>
6085 which is assumed to be in UTF-8 encoding; C<retlen> will be set to the
6086 length, in bytes, of that character.
6087
6088 Allows length and flags to be passed to low level routine.
6089
6090         UV      utf8n_to_uvchr(const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
6091
6092 =for hackers
6093 Found in file utf8.c
6094
6095 =item utf8n_to_uvuni
6096 X<utf8n_to_uvuni>
6097
6098 Bottom level UTF-8 decode routine.
6099 Returns the unicode code point value of the first character in the string C<s>
6100 which is assumed to be in UTF-8 encoding and no longer than C<curlen>;
6101 C<retlen> will be set to the length, in bytes, of that character.
6102
6103 If C<s> does not point to a well-formed UTF-8 character, the behaviour
6104 is dependent on the value of C<flags>: if it contains UTF8_CHECK_ONLY,
6105 it is assumed that the caller will raise a warning, and this function
6106 will silently just set C<retlen> to C<-1> and return zero.  If the
6107 C<flags> does not contain UTF8_CHECK_ONLY, warnings about
6108 malformations will be given, C<retlen> will be set to the expected
6109 length of the UTF-8 character in bytes, and zero will be returned.
6110
6111 The C<flags> can also contain various flags to allow deviations from
6112 the strict UTF-8 encoding (see F<utf8.h>).
6113
6114 Most code should use utf8_to_uvchr() rather than call this directly.
6115
6116         UV      utf8n_to_uvuni(const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
6117
6118 =for hackers
6119 Found in file utf8.c
6120
6121 =item utf8_distance
6122 X<utf8_distance>
6123
6124 Returns the number of UTF-8 characters between the UTF-8 pointers C<a>
6125 and C<b>.
6126
6127 WARNING: use only if you *know* that the pointers point inside the
6128 same UTF-8 buffer.
6129
6130         IV      utf8_distance(const U8 *a, const U8 *b)
6131
6132 =for hackers
6133 Found in file utf8.c
6134
6135 =item utf8_hop
6136 X<utf8_hop>
6137
6138 Return the UTF-8 pointer C<s> displaced by C<off> characters, either
6139 forward or backward.
6140
6141 WARNING: do not use the following unless you *know* C<off> is within
6142 the UTF-8 data pointed to by C<s> *and* that on entry C<s> is aligned
6143 on the first byte of character or just after the last byte of a character.
6144
6145         U8*     utf8_hop(const U8 *s, I32 off)
6146
6147 =for hackers
6148 Found in file utf8.c
6149
6150 =item utf8_length
6151 X<utf8_length>
6152
6153 Return the length of the UTF-8 char encoded string C<s> in characters.
6154 Stops at C<e> (inclusive).  If C<e E<lt> s> or if the scan would end
6155 up past C<e>, croaks.
6156
6157         STRLEN  utf8_length(const U8* s, const U8 *e)
6158
6159 =for hackers
6160 Found in file utf8.c
6161
6162 =item utf8_to_bytes
6163 X<utf8_to_bytes>
6164
6165 Converts a string C<s> of length C<len> from UTF-8 into byte encoding.
6166 Unlike C<bytes_to_utf8>, this over-writes the original string, and
6167 updates len to contain the new length.
6168 Returns zero on failure, setting C<len> to -1.
6169
6170 NOTE: this function is experimental and may change or be
6171 removed without notice.
6172
6173         U8*     utf8_to_bytes(U8 *s, STRLEN *len)
6174
6175 =for hackers
6176 Found in file utf8.c
6177
6178 =item utf8_to_uvchr
6179 X<utf8_to_uvchr>
6180
6181 Returns the native character value of the first character in the string C<s>
6182 which is assumed to be in UTF-8 encoding; C<retlen> will be set to the
6183 length, in bytes, of that character.
6184
6185 If C<s> does not point to a well-formed UTF-8 character, zero is
6186 returned and retlen is set, if possible, to -1.
6187
6188         UV      utf8_to_uvchr(const U8 *s, STRLEN *retlen)
6189
6190 =for hackers
6191 Found in file utf8.c
6192
6193 =item utf8_to_uvuni
6194 X<utf8_to_uvuni>
6195
6196 Returns the Unicode code point of the first character in the string C<s>
6197 which is assumed to be in UTF-8 encoding; C<retlen> will be set to the
6198 length, in bytes, of that character.
6199
6200 This function should only be used when returned UV is considered
6201 an index into the Unicode semantic tables (e.g. swashes).
6202
6203 If C<s> does not point to a well-formed UTF-8 character, zero is
6204 returned and retlen is set, if possible, to -1.
6205
6206         UV      utf8_to_uvuni(const U8 *s, STRLEN *retlen)
6207
6208 =for hackers
6209 Found in file utf8.c
6210
6211 =item uvchr_to_utf8
6212 X<uvchr_to_utf8>
6213
6214 Adds the UTF-8 representation of the Native codepoint C<uv> to the end
6215 of the string C<d>; C<d> should be have at least C<UTF8_MAXBYTES+1> free
6216 bytes available. The return value is the pointer to the byte after the
6217 end of the new character. In other words,
6218
6219     d = uvchr_to_utf8(d, uv);
6220
6221 is the recommended wide native character-aware way of saying
6222
6223     *(d++) = uv;
6224
6225         U8*     uvchr_to_utf8(U8 *d, UV uv)
6226
6227 =for hackers
6228 Found in file utf8.c
6229
6230 =item uvuni_to_utf8_flags
6231 X<uvuni_to_utf8_flags>
6232
6233 Adds the UTF-8 representation of the Unicode codepoint C<uv> to the end
6234 of the string C<d>; C<d> should be have at least C<UTF8_MAXBYTES+1> free
6235 bytes available. The return value is the pointer to the byte after the
6236 end of the new character. In other words,
6237
6238     d = uvuni_to_utf8_flags(d, uv, flags);
6239
6240 or, in most cases,
6241
6242     d = uvuni_to_utf8(d, uv);
6243
6244 (which is equivalent to)
6245
6246     d = uvuni_to_utf8_flags(d, uv, 0);
6247
6248 is the recommended Unicode-aware way of saying
6249
6250     *(d++) = uv;
6251
6252         U8*     uvuni_to_utf8_flags(U8 *d, UV uv, UV flags)
6253
6254 =for hackers
6255 Found in file utf8.c
6256
6257
6258 =back
6259
6260 =head1 Variables created by C<xsubpp> and C<xsubpp> internal functions
6261
6262 =over 8
6263
6264 =item ax
6265 X<ax>
6266
6267 Variable which is setup by C<xsubpp> to indicate the stack base offset,
6268 used by the C<ST>, C<XSprePUSH> and C<XSRETURN> macros.  The C<dMARK> macro
6269 must be called prior to setup the C<MARK> variable.
6270
6271         I32     ax
6272
6273 =for hackers
6274 Found in file XSUB.h
6275
6276 =item CLASS
6277 X<CLASS>
6278
6279 Variable which is setup by C<xsubpp> to indicate the 
6280 class name for a C++ XS constructor.  This is always a C<char*>.  See C<THIS>.
6281
6282         char*   CLASS
6283
6284 =for hackers
6285 Found in file XSUB.h
6286
6287 =item dAX
6288 X<dAX>
6289
6290 Sets up the C<ax> variable.
6291 This is usually handled automatically by C<xsubpp> by calling C<dXSARGS>.
6292
6293                 dAX;
6294
6295 =for hackers
6296 Found in file XSUB.h
6297
6298 =item dAXMARK
6299 X<dAXMARK>
6300
6301 Sets up the C<ax> variable and stack marker variable C<mark>.
6302 This is usually handled automatically by C<xsubpp> by calling C<dXSARGS>.
6303
6304                 dAXMARK;
6305
6306 =for hackers
6307 Found in file XSUB.h
6308
6309 =item dITEMS
6310 X<dITEMS>
6311
6312 Sets up the C<items> variable.
6313 This is usually handled automatically by C<xsubpp> by calling C<dXSARGS>.
6314
6315                 dITEMS;
6316
6317 =for hackers
6318 Found in file XSUB.h
6319
6320 =item dUNDERBAR
6321 X<dUNDERBAR>
6322
6323 Sets up the C<padoff_du> variable for an XSUB that wishes to use
6324 C<UNDERBAR>.
6325
6326                 dUNDERBAR;
6327
6328 =for hackers
6329 Found in file XSUB.h
6330
6331 =item dXSARGS
6332 X<dXSARGS>
6333
6334 Sets up stack and mark pointers for an XSUB, calling dSP and dMARK.
6335 Sets up the C<ax> and C<items> variables by calling C<dAX> and C<dITEMS>.
6336 This is usually handled automatically by C<xsubpp>.
6337
6338                 dXSARGS;
6339
6340 =for hackers
6341 Found in file XSUB.h
6342
6343 =item dXSI32
6344 X<dXSI32>
6345
6346 Sets up the C<ix> variable for an XSUB which has aliases.  This is usually
6347 handled automatically by C<xsubpp>.
6348
6349                 dXSI32;
6350
6351 =for hackers
6352 Found in file XSUB.h
6353
6354 =item items
6355 X<items>
6356
6357 Variable which is setup by C<xsubpp> to indicate the number of 
6358 items on the stack.  See L<perlxs/"Variable-length Parameter Lists">.
6359
6360         I32     items
6361
6362 =for hackers
6363 Found in file XSUB.h
6364
6365 =item ix
6366 X<ix>
6367
6368 Variable which is setup by C<xsubpp> to indicate which of an 
6369 XSUB's aliases was used to invoke it.  See L<perlxs/"The ALIAS: Keyword">.
6370
6371         I32     ix
6372
6373 =for hackers
6374 Found in file XSUB.h
6375
6376 =item newXSproto
6377 X<newXSproto>
6378
6379 Used by C<xsubpp> to hook up XSUBs as Perl subs.  Adds Perl prototypes to
6380 the subs.
6381
6382 =for hackers
6383 Found in file XSUB.h
6384
6385 =item RETVAL
6386 X<RETVAL>
6387
6388 Variable which is setup by C<xsubpp> to hold the return value for an 
6389 XSUB. This is always the proper type for the XSUB. See 
6390 L<perlxs/"The RETVAL Variable">.
6391
6392         (whatever)      RETVAL
6393
6394 =for hackers
6395 Found in file XSUB.h
6396
6397 =item ST
6398 X<ST>
6399
6400 Used to access elements on the XSUB's stack.
6401
6402         SV*     ST(int ix)
6403
6404 =for hackers
6405 Found in file XSUB.h
6406
6407 =item THIS
6408 X<THIS>
6409
6410 Variable which is setup by C<xsubpp> to designate the object in a C++ 
6411 XSUB.  This is always the proper type for the C++ object.  See C<CLASS> and 
6412 L<perlxs/"Using XS With C++">.
6413
6414         (whatever)      THIS
6415
6416 =for hackers
6417 Found in file XSUB.h
6418
6419 =item UNDERBAR
6420 X<UNDERBAR>
6421
6422 The SV* corresponding to the $_ variable. Works even if there
6423 is a lexical $_ in scope.
6424
6425 =for hackers
6426 Found in file XSUB.h
6427
6428 =item XS
6429 X<XS>
6430
6431 Macro to declare an XSUB and its C parameter list.  This is handled by
6432 C<xsubpp>.
6433
6434 =for hackers
6435 Found in file XSUB.h
6436
6437 =item XS_VERSION
6438 X<XS_VERSION>
6439
6440 The version identifier for an XS module.  This is usually
6441 handled automatically by C<ExtUtils::MakeMaker>.  See C<XS_VERSION_BOOTCHECK>.
6442
6443 =for hackers
6444 Found in file XSUB.h
6445
6446 =item XS_VERSION_BOOTCHECK
6447 X<XS_VERSION_BOOTCHECK>
6448
6449 Macro to verify that a PM module's $VERSION variable matches the XS
6450 module's C<XS_VERSION> variable.  This is usually handled automatically by
6451 C<xsubpp>.  See L<perlxs/"The VERSIONCHECK: Keyword">.
6452
6453                 XS_VERSION_BOOTCHECK;
6454
6455 =for hackers
6456 Found in file XSUB.h
6457
6458
6459 =back
6460
6461 =head1 Warning and Dieing
6462
6463 =over 8
6464
6465 =item croak
6466 X<croak>
6467
6468 This is the XSUB-writer's interface to Perl's C<die> function.
6469 Normally call this function the same way you call the C C<printf>
6470 function.  Calling C<croak> returns control directly to Perl,
6471 sidestepping the normal C order of execution. See C<warn>.
6472
6473 If you want to throw an exception object, assign the object to
6474 C<$@> and then pass C<Nullch> to croak():
6475
6476    errsv = get_sv("@", TRUE);
6477    sv_setsv(errsv, exception_object);
6478    croak(Nullch);
6479
6480         void    croak(const char* pat, ...)
6481
6482 =for hackers
6483 Found in file util.c
6484
6485 =item warn
6486 X<warn>
6487
6488 This is the XSUB-writer's interface to Perl's C<warn> function.  Call this
6489 function the same way you call the C C<printf> function.  See C<croak>.
6490
6491         void    warn(const char* pat, ...)
6492
6493 =for hackers
6494 Found in file util.c
6495
6496
6497 =back
6498
6499 =head1 AUTHORS
6500
6501 Until May 1997, this document was maintained by Jeff Okamoto
6502 <okamoto@corp.hp.com>.  It is now maintained as part of Perl itself.
6503
6504 With lots of help and suggestions from Dean Roehrich, Malcolm Beattie,
6505 Andreas Koenig, Paul Hudson, Ilya Zakharevich, Paul Marquess, Neil
6506 Bowers, Matthew Green, Tim Bunce, Spider Boardman, Ulrich Pfeifer,
6507 Stephen McCamant, and Gurusamy Sarathy.
6508
6509 API Listing originally by Dean Roehrich <roehrich@cray.com>.
6510
6511 Updated to be autogenerated from comments in the source by Benjamin Stuhl.
6512
6513 =head1 SEE ALSO
6514
6515 perlguts(1), perlxs(1), perlxstut(1), perlintern(1)
6516