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