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