A bug introduced in #8217 (the undefined variable in the
[p5sagit/p5-mst-13.2.git] / pod / perlapi.pod
CommitLineData
954c1994 1=head1 NAME
2
3perlapi - autogenerated documentation for the perl public API
4
5=head1 DESCRIPTION
6
1c846c1f 7This file contains the documentation of the perl public API generated by
8embed.pl, specifically a listing of functions, macros, flags, and variables
9that may be used by extension writers. The interfaces of any functions that
954c1994 10are not listed here are subject to change without notice. For this reason,
11blindly using functions listed in proto.h is to be avoided when writing
12extensions.
13
14Note that all Perl API global variables must be referenced with the C<PL_>
15prefix. Some macros are provided for compatibility with the older,
16unadorned names, but this support may be disabled in a future release.
17
18The listing is alphabetical, case insensitive.
19
20=over 8
21
22=item AvFILL
23
24Same as C<av_len()>. Deprecated, use C<av_len()> instead.
25
26 int AvFILL(AV* av)
27
497711e7 28=for hackers
29Found in file av.h
30
954c1994 31=item av_clear
32
33Clears an array, making it empty. Does not free the memory used by the
34array itself.
35
36 void av_clear(AV* ar)
37
497711e7 38=for hackers
39Found in file av.c
40
f3b76584 41=item av_delete
42
43Deletes the element indexed by C<key> from the array. Returns the
44deleted element. C<flags> is currently ignored.
45
46 SV* av_delete(AV* ar, I32 key, I32 flags)
47
48=for hackers
49Found in file av.c
50
51=item av_exists
52
53Returns true if the element indexed by C<key> has been initialized.
54
55This relies on the fact that uninitialized array elements are set to
56C<&PL_sv_undef>.
57
58 bool av_exists(AV* ar, I32 key)
59
60=for hackers
61Found in file av.c
62
954c1994 63=item av_extend
64
65Pre-extend an array. The C<key> is the index to which the array should be
66extended.
67
68 void av_extend(AV* ar, I32 key)
69
497711e7 70=for hackers
71Found in file av.c
72
954c1994 73=item av_fetch
74
75Returns the SV at the specified index in the array. The C<key> is the
76index. If C<lval> is set then the fetch will be part of a store. Check
77that the return value is non-null before dereferencing it to a C<SV*>.
78
96f1132b 79See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for
80more information on how to use this function on tied arrays.
954c1994 81
82 SV** av_fetch(AV* ar, I32 key, I32 lval)
83
497711e7 84=for hackers
85Found in file av.c
86
f3b76584 87=item av_fill
88
89Ensure than an array has a given number of elements, equivalent to
90Perl's C<$#array = $fill;>.
91
92 void av_fill(AV* ar, I32 fill)
93
94=for hackers
95Found in file av.c
96
954c1994 97=item av_len
98
99Returns the highest index in the array. Returns -1 if the array is
100empty.
101
102 I32 av_len(AV* ar)
103
497711e7 104=for hackers
105Found in file av.c
106
954c1994 107=item av_make
108
109Creates a new AV and populates it with a list of SVs. The SVs are copied
110into the array, so they may be freed after the call to av_make. The new AV
111will have a reference count of 1.
112
113 AV* av_make(I32 size, SV** svp)
114
497711e7 115=for hackers
116Found in file av.c
117
954c1994 118=item av_pop
119
120Pops an SV off the end of the array. Returns C<&PL_sv_undef> if the array
121is empty.
122
123 SV* av_pop(AV* ar)
124
497711e7 125=for hackers
126Found in file av.c
127
954c1994 128=item av_push
129
130Pushes an SV onto the end of the array. The array will grow automatically
131to accommodate the addition.
132
133 void av_push(AV* ar, SV* val)
134
497711e7 135=for hackers
136Found in file av.c
137
954c1994 138=item av_shift
139
140Shifts an SV off the beginning of the array.
141
142 SV* av_shift(AV* ar)
143
497711e7 144=for hackers
145Found in file av.c
146
954c1994 147=item av_store
148
149Stores an SV in an array. The array index is specified as C<key>. The
150return value will be NULL if the operation failed or if the value did not
151need to be actually stored within the array (as in the case of tied
152arrays). Otherwise it can be dereferenced to get the original C<SV*>. Note
153that the caller is responsible for suitably incrementing the reference
154count of C<val> before the call, and decrementing it if the function
155returned NULL.
156
96f1132b 157See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for
954c1994 158more information on how to use this function on tied arrays.
159
160 SV** av_store(AV* ar, I32 key, SV* val)
161
497711e7 162=for hackers
163Found in file av.c
164
954c1994 165=item av_undef
166
167Undefines the array. Frees the memory used by the array itself.
168
169 void av_undef(AV* ar)
170
497711e7 171=for hackers
172Found in file av.c
173
954c1994 174=item av_unshift
175
176Unshift the given number of C<undef> values onto the beginning of the
177array. The array will grow automatically to accommodate the addition. You
178must then use C<av_store> to assign values to these new elements.
179
180 void av_unshift(AV* ar, I32 num)
181
497711e7 182=for hackers
183Found in file av.c
184
185=item bytes_to_utf8
186
187Converts a string C<s> of length C<len> from ASCII into UTF8 encoding.
6662521e 188Returns a pointer to the newly-created string, and sets C<len> to
189reflect the new length.
497711e7 190
eebe1485 191NOTE: this function is experimental and may change or be
192removed without notice.
193
194 U8* bytes_to_utf8(U8 *s, STRLEN *len)
497711e7 195
196=for hackers
197Found in file utf8.c
198
954c1994 199=item call_argv
200
201Performs a callback to the specified Perl sub. See L<perlcall>.
202
203NOTE: the perl_ form of this function is deprecated.
204
205 I32 call_argv(const char* sub_name, I32 flags, char** argv)
206
497711e7 207=for hackers
208Found in file perl.c
209
954c1994 210=item call_method
211
212Performs a callback to the specified Perl method. The blessed object must
213be on the stack. See L<perlcall>.
214
215NOTE: the perl_ form of this function is deprecated.
216
217 I32 call_method(const char* methname, I32 flags)
218
497711e7 219=for hackers
220Found in file perl.c
221
954c1994 222=item call_pv
223
224Performs a callback to the specified Perl sub. See L<perlcall>.
225
226NOTE: the perl_ form of this function is deprecated.
227
228 I32 call_pv(const char* sub_name, I32 flags)
229
497711e7 230=for hackers
231Found in file perl.c
232
954c1994 233=item call_sv
234
235Performs a callback to the Perl sub whose name is in the SV. See
236L<perlcall>.
237
238NOTE: the perl_ form of this function is deprecated.
239
240 I32 call_sv(SV* sv, I32 flags)
241
497711e7 242=for hackers
243Found in file perl.c
244
954c1994 245=item CLASS
246
247Variable which is setup by C<xsubpp> to indicate the
248class name for a C++ XS constructor. This is always a C<char*>. See C<THIS>.
249
250 char* CLASS
251
497711e7 252=for hackers
253Found in file XSUB.h
254
954c1994 255=item Copy
256
257The XSUB-writer's interface to the C C<memcpy> function. The C<src> is the
258source, C<dest> is the destination, C<nitems> is the number of items, and C<type> is
259the type. May fail on overlapping copies. See also C<Move>.
260
261 void Copy(void* src, void* dest, int nitems, type)
262
497711e7 263=for hackers
264Found in file handy.h
265
954c1994 266=item croak
267
c9d5ac95 268This is the XSUB-writer's interface to Perl's C<die> function.
269Normally use this function the same way you use the C C<printf>
270function. See C<warn>.
271
272If you want to throw an exception object, assign the object to
273C<$@> and then pass C<Nullch> to croak():
274
275 errsv = get_sv("@", TRUE);
276 sv_setsv(errsv, exception_object);
277 croak(Nullch);
954c1994 278
279 void croak(const char* pat, ...)
280
497711e7 281=for hackers
282Found in file util.c
283
954c1994 284=item CvSTASH
285
286Returns the stash of the CV.
287
288 HV* CvSTASH(CV* cv)
289
497711e7 290=for hackers
291Found in file cv.h
292
beab0874 293=item cv_const_sv
294
295If C<cv> is a constant sub eligible for inlining. returns the constant
296value returned by the sub. Otherwise, returns NULL.
297
298Constant subs can be created with C<newCONSTSUB> or as described in
299L<perlsub/"Constant Functions">.
300
301 SV* cv_const_sv(CV* cv)
302
303=for hackers
35676c7e 304Found in file op.c
beab0874 305
954c1994 306=item dMARK
307
308Declare a stack marker variable, C<mark>, for the XSUB. See C<MARK> and
309C<dORIGMARK>.
310
311 dMARK;
312
497711e7 313=for hackers
314Found in file pp.h
315
954c1994 316=item dORIGMARK
317
318Saves the original stack mark for the XSUB. See C<ORIGMARK>.
319
320 dORIGMARK;
321
497711e7 322=for hackers
323Found in file pp.h
324
954c1994 325=item dSP
326
327Declares a local copy of perl's stack pointer for the XSUB, available via
328the C<SP> macro. See C<SP>.
329
330 dSP;
331
497711e7 332=for hackers
333Found in file pp.h
334
954c1994 335=item dXSARGS
336
337Sets up stack and mark pointers for an XSUB, calling dSP and dMARK. This
338is usually handled automatically by C<xsubpp>. Declares the C<items>
339variable to indicate the number of items on the stack.
340
341 dXSARGS;
342
497711e7 343=for hackers
344Found in file XSUB.h
345
954c1994 346=item dXSI32
347
348Sets up the C<ix> variable for an XSUB which has aliases. This is usually
349handled automatically by C<xsubpp>.
350
351 dXSI32;
352
497711e7 353=for hackers
354Found in file XSUB.h
355
954c1994 356=item ENTER
357
358Opening bracket on a callback. See C<LEAVE> and L<perlcall>.
359
360 ENTER;
361
497711e7 362=for hackers
363Found in file scope.h
364
954c1994 365=item eval_pv
366
367Tells Perl to C<eval> the given string and return an SV* result.
368
369NOTE: the perl_ form of this function is deprecated.
370
371 SV* eval_pv(const char* p, I32 croak_on_error)
372
497711e7 373=for hackers
374Found in file perl.c
375
954c1994 376=item eval_sv
377
378Tells Perl to C<eval> the string in the SV.
379
380NOTE: the perl_ form of this function is deprecated.
381
382 I32 eval_sv(SV* sv, I32 flags)
383
497711e7 384=for hackers
385Found in file perl.c
386
954c1994 387=item EXTEND
388
389Used to extend the argument stack for an XSUB's return values. Once
4375e838 390used, guarantees that there is room for at least C<nitems> to be pushed
954c1994 391onto the stack.
392
393 void EXTEND(SP, int nitems)
394
497711e7 395=for hackers
396Found in file pp.h
397
954c1994 398=item fbm_compile
399
400Analyses the string in order to make fast searches on it using fbm_instr()
401-- the Boyer-Moore algorithm.
402
403 void fbm_compile(SV* sv, U32 flags)
404
497711e7 405=for hackers
406Found in file util.c
407
954c1994 408=item fbm_instr
409
410Returns the location of the SV in the string delimited by C<str> and
411C<strend>. It returns C<Nullch> if the string can't be found. The C<sv>
412does not have to be fbm_compiled, but the search will not be as fast
413then.
414
415 char* fbm_instr(unsigned char* big, unsigned char* bigend, SV* littlesv, U32 flags)
416
497711e7 417=for hackers
418Found in file util.c
419
954c1994 420=item FREETMPS
421
422Closing bracket for temporaries on a callback. See C<SAVETMPS> and
423L<perlcall>.
424
425 FREETMPS;
426
497711e7 427=for hackers
428Found in file scope.h
429
954c1994 430=item get_av
431
432Returns the AV of the specified Perl array. If C<create> is set and the
433Perl variable does not exist then it will be created. If C<create> is not
434set and the variable does not exist then NULL is returned.
435
436NOTE: the perl_ form of this function is deprecated.
437
438 AV* get_av(const char* name, I32 create)
439
497711e7 440=for hackers
441Found in file perl.c
442
954c1994 443=item get_cv
444
445Returns the CV of the specified Perl subroutine. If C<create> is set and
446the Perl subroutine does not exist then it will be declared (which has the
447same effect as saying C<sub name;>). If C<create> is not set and the
448subroutine does not exist then NULL is returned.
449
450NOTE: the perl_ form of this function is deprecated.
451
452 CV* get_cv(const char* name, I32 create)
453
497711e7 454=for hackers
455Found in file perl.c
456
954c1994 457=item get_hv
458
459Returns the HV of the specified Perl hash. If C<create> is set and the
460Perl variable does not exist then it will be created. If C<create> is not
461set and the variable does not exist then NULL is returned.
462
463NOTE: the perl_ form of this function is deprecated.
464
465 HV* get_hv(const char* name, I32 create)
466
497711e7 467=for hackers
468Found in file perl.c
469
954c1994 470=item get_sv
471
472Returns the SV of the specified Perl scalar. If C<create> is set and the
473Perl variable does not exist then it will be created. If C<create> is not
474set and the variable does not exist then NULL is returned.
475
476NOTE: the perl_ form of this function is deprecated.
477
478 SV* get_sv(const char* name, I32 create)
479
497711e7 480=for hackers
481Found in file perl.c
482
954c1994 483=item GIMME
484
485A backward-compatible version of C<GIMME_V> which can only return
486C<G_SCALAR> or C<G_ARRAY>; in a void context, it returns C<G_SCALAR>.
487Deprecated. Use C<GIMME_V> instead.
488
489 U32 GIMME
490
497711e7 491=for hackers
492Found in file op.h
493
954c1994 494=item GIMME_V
495
496The XSUB-writer's equivalent to Perl's C<wantarray>. Returns C<G_VOID>,
90fdbbb7 497C<G_SCALAR> or C<G_ARRAY> for void, scalar or list context,
954c1994 498respectively.
499
500 U32 GIMME_V
501
497711e7 502=for hackers
503Found in file op.h
504
954c1994 505=item GvSV
506
507Return the SV from the GV.
508
509 SV* GvSV(GV* gv)
510
497711e7 511=for hackers
512Found in file gv.h
513
954c1994 514=item gv_fetchmeth
515
516Returns the glob with the given C<name> and a defined subroutine or
517C<NULL>. The glob lives in the given C<stash>, or in the stashes
1c846c1f 518accessible via @ISA and @UNIVERSAL.
954c1994 519
520The argument C<level> should be either 0 or -1. If C<level==0>, as a
521side-effect creates a glob with the given C<name> in the given C<stash>
522which in the case of success contains an alias for the subroutine, and sets
1c846c1f 523up caching info for this glob. Similarly for all the searched stashes.
954c1994 524
525This function grants C<"SUPER"> token as a postfix of the stash name. The
526GV returned from C<gv_fetchmeth> may be a method cache entry, which is not
4929bf7b 527visible to Perl code. So when calling C<call_sv>, you should not use
954c1994 528the GV directly; instead, you should use the method's CV, which can be
1c846c1f 529obtained from the GV with the C<GvCV> macro.
954c1994 530
531 GV* gv_fetchmeth(HV* stash, const char* name, STRLEN len, I32 level)
532
497711e7 533=for hackers
534Found in file gv.c
535
954c1994 536=item gv_fetchmethod
537
6d0f518e 538See L<gv_fetchmethod_autoload>.
954c1994 539
540 GV* gv_fetchmethod(HV* stash, const char* name)
541
497711e7 542=for hackers
543Found in file gv.c
544
954c1994 545=item gv_fetchmethod_autoload
546
547Returns the glob which contains the subroutine to call to invoke the method
548on the C<stash>. In fact in the presence of autoloading this may be the
549glob for "AUTOLOAD". In this case the corresponding variable $AUTOLOAD is
1c846c1f 550already setup.
954c1994 551
552The third parameter of C<gv_fetchmethod_autoload> determines whether
553AUTOLOAD lookup is performed if the given method is not present: non-zero
1c846c1f 554means yes, look for AUTOLOAD; zero means no, don't look for AUTOLOAD.
954c1994 555Calling C<gv_fetchmethod> is equivalent to calling C<gv_fetchmethod_autoload>
1c846c1f 556with a non-zero C<autoload> parameter.
954c1994 557
558These functions grant C<"SUPER"> token as a prefix of the method name. Note
559that if you want to keep the returned glob for a long time, you need to
560check for it being "AUTOLOAD", since at the later time the call may load a
561different subroutine due to $AUTOLOAD changing its value. Use the glob
1c846c1f 562created via a side effect to do this.
954c1994 563
564These functions have the same side-effects and as C<gv_fetchmeth> with
565C<level==0>. C<name> should be writable if contains C<':'> or C<'
566''>. The warning against passing the GV returned by C<gv_fetchmeth> to
1c846c1f 567C<call_sv> apply equally to these functions.
954c1994 568
569 GV* gv_fetchmethod_autoload(HV* stash, const char* name, I32 autoload)
570
497711e7 571=for hackers
572Found in file gv.c
573
954c1994 574=item gv_stashpv
575
386d01d6 576Returns a pointer to the stash for a specified package. C<name> should
577be a valid UTF-8 string. If C<create> is set then the package will be
578created if it does not already exist. If C<create> is not set and the
579package does not exist then NULL is returned.
954c1994 580
581 HV* gv_stashpv(const char* name, I32 create)
582
497711e7 583=for hackers
584Found in file gv.c
585
954c1994 586=item gv_stashsv
587
386d01d6 588Returns a pointer to the stash for a specified package, which must be a
589valid UTF-8 string. See C<gv_stashpv>.
954c1994 590
591 HV* gv_stashsv(SV* sv, I32 create)
592
497711e7 593=for hackers
594Found in file gv.c
595
954c1994 596=item G_ARRAY
597
90fdbbb7 598Used to indicate list context. See C<GIMME_V>, C<GIMME> and
954c1994 599L<perlcall>.
600
497711e7 601=for hackers
602Found in file cop.h
603
954c1994 604=item G_DISCARD
605
606Indicates that arguments returned from a callback should be discarded. See
607L<perlcall>.
608
497711e7 609=for hackers
610Found in file cop.h
611
954c1994 612=item G_EVAL
613
614Used to force a Perl C<eval> wrapper around a callback. See
615L<perlcall>.
616
497711e7 617=for hackers
618Found in file cop.h
619
954c1994 620=item G_NOARGS
621
622Indicates that no arguments are being sent to a callback. See
623L<perlcall>.
624
497711e7 625=for hackers
626Found in file cop.h
627
954c1994 628=item G_SCALAR
629
630Used to indicate scalar context. See C<GIMME_V>, C<GIMME>, and
631L<perlcall>.
632
497711e7 633=for hackers
634Found in file cop.h
635
954c1994 636=item G_VOID
637
638Used to indicate void context. See C<GIMME_V> and L<perlcall>.
639
497711e7 640=for hackers
641Found in file cop.h
642
954c1994 643=item HEf_SVKEY
644
645This flag, used in the length slot of hash entries and magic structures,
646specifies the structure contains a C<SV*> pointer where a C<char*> pointer
647is to be expected. (For information only--not to be used).
648
497711e7 649=for hackers
650Found in file hv.h
651
954c1994 652=item HeHASH
653
654Returns the computed hash stored in the hash entry.
655
656 U32 HeHASH(HE* he)
657
497711e7 658=for hackers
659Found in file hv.h
660
954c1994 661=item HeKEY
662
663Returns the actual pointer stored in the key slot of the hash entry. The
664pointer may be either C<char*> or C<SV*>, depending on the value of
665C<HeKLEN()>. Can be assigned to. The C<HePV()> or C<HeSVKEY()> macros are
666usually preferable for finding the value of a key.
667
668 void* HeKEY(HE* he)
669
497711e7 670=for hackers
671Found in file hv.h
672
954c1994 673=item HeKLEN
674
675If this is negative, and amounts to C<HEf_SVKEY>, it indicates the entry
676holds an C<SV*> key. Otherwise, holds the actual length of the key. Can
677be assigned to. The C<HePV()> macro is usually preferable for finding key
678lengths.
679
680 STRLEN HeKLEN(HE* he)
681
497711e7 682=for hackers
683Found in file hv.h
684
954c1994 685=item HePV
686
687Returns the key slot of the hash entry as a C<char*> value, doing any
688necessary dereferencing of possibly C<SV*> keys. The length of the string
689is placed in C<len> (this is a macro, so do I<not> use C<&len>). If you do
690not care about what the length of the key is, you may use the global
691variable C<PL_na>, though this is rather less efficient than using a local
692variable. Remember though, that hash keys in perl are free to contain
693embedded nulls, so using C<strlen()> or similar is not a good way to find
694the length of hash keys. This is very similar to the C<SvPV()> macro
695described elsewhere in this document.
696
697 char* HePV(HE* he, STRLEN len)
698
497711e7 699=for hackers
700Found in file hv.h
701
954c1994 702=item HeSVKEY
703
704Returns the key as an C<SV*>, or C<Nullsv> if the hash entry does not
705contain an C<SV*> key.
706
707 SV* HeSVKEY(HE* he)
708
497711e7 709=for hackers
710Found in file hv.h
711
954c1994 712=item HeSVKEY_force
713
714Returns the key as an C<SV*>. Will create and return a temporary mortal
715C<SV*> if the hash entry contains only a C<char*> key.
716
717 SV* HeSVKEY_force(HE* he)
718
497711e7 719=for hackers
720Found in file hv.h
721
954c1994 722=item HeSVKEY_set
723
724Sets the key to a given C<SV*>, taking care to set the appropriate flags to
725indicate the presence of an C<SV*> key, and returns the same
726C<SV*>.
727
728 SV* HeSVKEY_set(HE* he, SV* sv)
729
497711e7 730=for hackers
731Found in file hv.h
732
954c1994 733=item HeVAL
734
735Returns the value slot (type C<SV*>) stored in the hash entry.
736
737 SV* HeVAL(HE* he)
738
497711e7 739=for hackers
740Found in file hv.h
741
954c1994 742=item HvNAME
743
744Returns the package name of a stash. See C<SvSTASH>, C<CvSTASH>.
745
746 char* HvNAME(HV* stash)
747
497711e7 748=for hackers
749Found in file hv.h
750
954c1994 751=item hv_clear
752
753Clears a hash, making it empty.
754
755 void hv_clear(HV* tb)
756
497711e7 757=for hackers
758Found in file hv.c
759
954c1994 760=item hv_delete
761
762Deletes a key/value pair in the hash. The value SV is removed from the
1c846c1f 763hash and returned to the caller. The C<klen> is the length of the key.
954c1994 764The C<flags> value will normally be zero; if set to G_DISCARD then NULL
765will be returned.
766
da58a35d 767 SV* hv_delete(HV* tb, const char* key, I32 klen, I32 flags)
954c1994 768
497711e7 769=for hackers
770Found in file hv.c
771
954c1994 772=item hv_delete_ent
773
774Deletes a key/value pair in the hash. The value SV is removed from the
775hash and returned to the caller. The C<flags> value will normally be zero;
776if set to G_DISCARD then NULL will be returned. C<hash> can be a valid
777precomputed hash value, or 0 to ask for it to be computed.
778
779 SV* hv_delete_ent(HV* tb, SV* key, I32 flags, U32 hash)
780
497711e7 781=for hackers
782Found in file hv.c
783
954c1994 784=item hv_exists
785
786Returns a boolean indicating whether the specified hash key exists. The
787C<klen> is the length of the key.
788
da58a35d 789 bool hv_exists(HV* tb, const char* key, I32 klen)
954c1994 790
497711e7 791=for hackers
792Found in file hv.c
793
954c1994 794=item hv_exists_ent
795
796Returns a boolean indicating whether the specified hash key exists. C<hash>
797can be a valid precomputed hash value, or 0 to ask for it to be
798computed.
799
800 bool hv_exists_ent(HV* tb, SV* key, U32 hash)
801
497711e7 802=for hackers
803Found in file hv.c
804
954c1994 805=item hv_fetch
806
807Returns the SV which corresponds to the specified key in the hash. The
808C<klen> is the length of the key. If C<lval> is set then the fetch will be
809part of a store. Check that the return value is non-null before
1c846c1f 810dereferencing it to a C<SV*>.
954c1994 811
96f1132b 812See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
954c1994 813information on how to use this function on tied hashes.
814
da58a35d 815 SV** hv_fetch(HV* tb, const char* key, I32 klen, I32 lval)
954c1994 816
497711e7 817=for hackers
818Found in file hv.c
819
954c1994 820=item hv_fetch_ent
821
822Returns the hash entry which corresponds to the specified key in the hash.
823C<hash> must be a valid precomputed hash number for the given C<key>, or 0
824if you want the function to compute it. IF C<lval> is set then the fetch
825will be part of a store. Make sure the return value is non-null before
826accessing it. The return value when C<tb> is a tied hash is a pointer to a
827static location, so be sure to make a copy of the structure if you need to
1c846c1f 828store it somewhere.
954c1994 829
96f1132b 830See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
954c1994 831information on how to use this function on tied hashes.
832
833 HE* hv_fetch_ent(HV* tb, SV* key, I32 lval, U32 hash)
834
497711e7 835=for hackers
836Found in file hv.c
837
954c1994 838=item hv_iterinit
839
840Prepares a starting point to traverse a hash table. Returns the number of
841keys in the hash (i.e. the same as C<HvKEYS(tb)>). The return value is
1c846c1f 842currently only meaningful for hashes without tie magic.
954c1994 843
844NOTE: Before version 5.004_65, C<hv_iterinit> used to return the number of
845hash buckets that happen to be in use. If you still need that esoteric
846value, you can get it through the macro C<HvFILL(tb)>.
847
848 I32 hv_iterinit(HV* tb)
849
497711e7 850=for hackers
851Found in file hv.c
852
954c1994 853=item hv_iterkey
854
855Returns the key from the current position of the hash iterator. See
856C<hv_iterinit>.
857
858 char* hv_iterkey(HE* entry, I32* retlen)
859
497711e7 860=for hackers
861Found in file hv.c
862
954c1994 863=item hv_iterkeysv
864
865Returns the key as an C<SV*> from the current position of the hash
866iterator. The return value will always be a mortal copy of the key. Also
867see C<hv_iterinit>.
868
869 SV* hv_iterkeysv(HE* entry)
870
497711e7 871=for hackers
872Found in file hv.c
873
954c1994 874=item hv_iternext
875
876Returns entries from a hash iterator. See C<hv_iterinit>.
877
878 HE* hv_iternext(HV* tb)
879
497711e7 880=for hackers
881Found in file hv.c
882
954c1994 883=item hv_iternextsv
884
885Performs an C<hv_iternext>, C<hv_iterkey>, and C<hv_iterval> in one
886operation.
887
888 SV* hv_iternextsv(HV* hv, char** key, I32* retlen)
889
497711e7 890=for hackers
891Found in file hv.c
892
954c1994 893=item hv_iterval
894
895Returns the value from the current position of the hash iterator. See
896C<hv_iterkey>.
897
898 SV* hv_iterval(HV* tb, HE* entry)
899
497711e7 900=for hackers
901Found in file hv.c
902
954c1994 903=item hv_magic
904
905Adds magic to a hash. See C<sv_magic>.
906
907 void hv_magic(HV* hv, GV* gv, int how)
908
497711e7 909=for hackers
910Found in file hv.c
911
954c1994 912=item hv_store
913
914Stores an SV in a hash. The hash key is specified as C<key> and C<klen> is
915the length of the key. The C<hash> parameter is the precomputed hash
916value; if it is zero then Perl will compute it. The return value will be
917NULL if the operation failed or if the value did not need to be actually
918stored within the hash (as in the case of tied hashes). Otherwise it can
919be dereferenced to get the original C<SV*>. Note that the caller is
920responsible for suitably incrementing the reference count of C<val> before
1c846c1f 921the call, and decrementing it if the function returned NULL.
954c1994 922
96f1132b 923See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
954c1994 924information on how to use this function on tied hashes.
925
da58a35d 926 SV** hv_store(HV* tb, const char* key, I32 klen, SV* val, U32 hash)
954c1994 927
497711e7 928=for hackers
929Found in file hv.c
930
954c1994 931=item hv_store_ent
932
933Stores C<val> in a hash. The hash key is specified as C<key>. The C<hash>
934parameter is the precomputed hash value; if it is zero then Perl will
935compute it. The return value is the new hash entry so created. It will be
936NULL if the operation failed or if the value did not need to be actually
937stored within the hash (as in the case of tied hashes). Otherwise the
938contents of the return value can be accessed using the C<He???> macros
939described here. Note that the caller is responsible for suitably
940incrementing the reference count of C<val> before the call, and
1c846c1f 941decrementing it if the function returned NULL.
954c1994 942
96f1132b 943See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for more
954c1994 944information on how to use this function on tied hashes.
945
946 HE* hv_store_ent(HV* tb, SV* key, SV* val, U32 hash)
947
497711e7 948=for hackers
949Found in file hv.c
950
954c1994 951=item hv_undef
952
953Undefines the hash.
954
955 void hv_undef(HV* tb)
956
497711e7 957=for hackers
958Found in file hv.c
959
954c1994 960=item isALNUM
961
4375e838 962Returns a boolean indicating whether the C C<char> is an ASCII alphanumeric
f1cbbd6e 963character (including underscore) or digit.
954c1994 964
965 bool isALNUM(char ch)
966
497711e7 967=for hackers
968Found in file handy.h
969
954c1994 970=item isALPHA
971
4375e838 972Returns a boolean indicating whether the C C<char> is an ASCII alphabetic
954c1994 973character.
974
975 bool isALPHA(char ch)
976
497711e7 977=for hackers
978Found in file handy.h
979
954c1994 980=item isDIGIT
981
4375e838 982Returns a boolean indicating whether the C C<char> is an ASCII
954c1994 983digit.
984
985 bool isDIGIT(char ch)
986
497711e7 987=for hackers
988Found in file handy.h
989
954c1994 990=item isLOWER
991
992Returns a boolean indicating whether the C C<char> is a lowercase
993character.
994
995 bool isLOWER(char ch)
996
497711e7 997=for hackers
998Found in file handy.h
999
954c1994 1000=item isSPACE
1001
1002Returns a boolean indicating whether the C C<char> is whitespace.
1003
1004 bool isSPACE(char ch)
1005
497711e7 1006=for hackers
1007Found in file handy.h
1008
954c1994 1009=item isUPPER
1010
1011Returns a boolean indicating whether the C C<char> is an uppercase
1012character.
1013
1014 bool isUPPER(char ch)
1015
497711e7 1016=for hackers
1017Found in file handy.h
1018
eebe1485 1019=item is_utf8_char
1020
1021Tests if some arbitrary number of bytes begins in a valid UTF-8 character.
1022The actual number of bytes in the UTF-8 character will be returned if it
1023is valid, otherwise 0.
1024
1025 STRLEN is_utf8_char(U8 *p)
1026
1027=for hackers
1028Found in file utf8.c
1029
1030=item is_utf8_string
1031
1032Returns true if first C<len> bytes of the given string form valid a UTF8
1033string, false otherwise.
1034
1035 bool is_utf8_string(U8 *s, STRLEN len)
1036
1037=for hackers
1038Found in file utf8.c
1039
954c1994 1040=item items
1041
1042Variable which is setup by C<xsubpp> to indicate the number of
1043items on the stack. See L<perlxs/"Variable-length Parameter Lists">.
1044
1045 I32 items
1046
497711e7 1047=for hackers
1048Found in file XSUB.h
1049
954c1994 1050=item ix
1051
1052Variable which is setup by C<xsubpp> to indicate which of an
1053XSUB's aliases was used to invoke it. See L<perlxs/"The ALIAS: Keyword">.
1054
1055 I32 ix
1056
497711e7 1057=for hackers
1058Found in file XSUB.h
1059
954c1994 1060=item LEAVE
1061
1062Closing bracket on a callback. See C<ENTER> and L<perlcall>.
1063
1064 LEAVE;
1065
497711e7 1066=for hackers
1067Found in file scope.h
1068
954c1994 1069=item looks_like_number
1070
1071Test if an the content of an SV looks like a number (or is a
a8586c98 1072number). C<Inf> and C<Infinity> are treated as numbers (so will not
1073issue a non-numeric warning), even if your atof() doesn't grok them.
954c1994 1074
1075 I32 looks_like_number(SV* sv)
1076
497711e7 1077=for hackers
1078Found in file sv.c
1079
954c1994 1080=item MARK
1081
1082Stack marker variable for the XSUB. See C<dMARK>.
1083
497711e7 1084=for hackers
1085Found in file pp.h
1086
954c1994 1087=item mg_clear
1088
1089Clear something magical that the SV represents. See C<sv_magic>.
1090
1091 int mg_clear(SV* sv)
1092
497711e7 1093=for hackers
1094Found in file mg.c
1095
954c1994 1096=item mg_copy
1097
1098Copies the magic from one SV to another. See C<sv_magic>.
1099
1100 int mg_copy(SV* sv, SV* nsv, const char* key, I32 klen)
1101
497711e7 1102=for hackers
1103Found in file mg.c
1104
954c1994 1105=item mg_find
1106
1107Finds the magic pointer for type matching the SV. See C<sv_magic>.
1108
1109 MAGIC* mg_find(SV* sv, int type)
1110
497711e7 1111=for hackers
1112Found in file mg.c
1113
954c1994 1114=item mg_free
1115
1116Free any magic storage used by the SV. See C<sv_magic>.
1117
1118 int mg_free(SV* sv)
1119
497711e7 1120=for hackers
1121Found in file mg.c
1122
954c1994 1123=item mg_get
1124
1125Do magic after a value is retrieved from the SV. See C<sv_magic>.
1126
1127 int mg_get(SV* sv)
1128
497711e7 1129=for hackers
1130Found in file mg.c
1131
954c1994 1132=item mg_length
1133
1134Report on the SV's length. See C<sv_magic>.
1135
1136 U32 mg_length(SV* sv)
1137
497711e7 1138=for hackers
1139Found in file mg.c
1140
954c1994 1141=item mg_magical
1142
1143Turns on the magical status of an SV. See C<sv_magic>.
1144
1145 void mg_magical(SV* sv)
1146
497711e7 1147=for hackers
1148Found in file mg.c
1149
954c1994 1150=item mg_set
1151
1152Do magic after a value is assigned to the SV. See C<sv_magic>.
1153
1154 int mg_set(SV* sv)
1155
497711e7 1156=for hackers
1157Found in file mg.c
1158
954c1994 1159=item Move
1160
1161The XSUB-writer's interface to the C C<memmove> function. The C<src> is the
1162source, C<dest> is the destination, C<nitems> is the number of items, and C<type> is
1163the type. Can do overlapping moves. See also C<Copy>.
1164
1165 void Move(void* src, void* dest, int nitems, type)
1166
497711e7 1167=for hackers
1168Found in file handy.h
1169
954c1994 1170=item New
1171
1172The XSUB-writer's interface to the C C<malloc> function.
1173
1174 void New(int id, void* ptr, int nitems, type)
1175
497711e7 1176=for hackers
1177Found in file handy.h
1178
954c1994 1179=item newAV
1180
1181Creates a new AV. The reference count is set to 1.
1182
1183 AV* newAV()
1184
497711e7 1185=for hackers
1186Found in file av.c
1187
954c1994 1188=item Newc
1189
1190The XSUB-writer's interface to the C C<malloc> function, with
1191cast.
1192
1193 void Newc(int id, void* ptr, int nitems, type, cast)
1194
497711e7 1195=for hackers
1196Found in file handy.h
1197
954c1994 1198=item newCONSTSUB
1199
1200Creates a constant sub equivalent to Perl C<sub FOO () { 123 }> which is
1201eligible for inlining at compile-time.
1202
beab0874 1203 CV* newCONSTSUB(HV* stash, char* name, SV* sv)
954c1994 1204
497711e7 1205=for hackers
35676c7e 1206Found in file op.c
497711e7 1207
954c1994 1208=item newHV
1209
1210Creates a new HV. The reference count is set to 1.
1211
1212 HV* newHV()
1213
497711e7 1214=for hackers
1215Found in file hv.c
1216
954c1994 1217=item newRV_inc
1218
1219Creates an RV wrapper for an SV. The reference count for the original SV is
1220incremented.
1221
1222 SV* newRV_inc(SV* sv)
1223
497711e7 1224=for hackers
1225Found in file sv.h
1226
954c1994 1227=item newRV_noinc
1228
1229Creates an RV wrapper for an SV. The reference count for the original
1230SV is B<not> incremented.
1231
1232 SV* newRV_noinc(SV *sv)
1233
497711e7 1234=for hackers
1235Found in file sv.c
1236
954c1994 1237=item NEWSV
1238
1239Creates a new SV. A non-zero C<len> parameter indicates the number of
1240bytes of preallocated string space the SV should have. An extra byte for a
1241tailing NUL is also reserved. (SvPOK is not set for the SV even if string
444155da 1242space is allocated.) The reference count for the new SV is set to 1.
954c1994 1243C<id> is an integer id between 0 and 1299 (used to identify leaks).
1244
1245 SV* NEWSV(int id, STRLEN len)
1246
497711e7 1247=for hackers
1248Found in file handy.h
1249
954c1994 1250=item newSViv
1251
1252Creates a new SV and copies an integer into it. The reference count for the
1253SV is set to 1.
1254
1255 SV* newSViv(IV i)
1256
497711e7 1257=for hackers
1258Found in file sv.c
1259
954c1994 1260=item newSVnv
1261
1262Creates a new SV and copies a floating point value into it.
1263The reference count for the SV is set to 1.
1264
1265 SV* newSVnv(NV n)
1266
497711e7 1267=for hackers
1268Found in file sv.c
1269
954c1994 1270=item newSVpv
1271
1272Creates a new SV and copies a string into it. The reference count for the
1273SV is set to 1. If C<len> is zero, Perl will compute the length using
1274strlen(). For efficiency, consider using C<newSVpvn> instead.
1275
1276 SV* newSVpv(const char* s, STRLEN len)
1277
497711e7 1278=for hackers
1279Found in file sv.c
1280
954c1994 1281=item newSVpvf
1282
1283Creates a new SV an initialize it with the string formatted like
1284C<sprintf>.
1285
1286 SV* newSVpvf(const char* pat, ...)
1287
497711e7 1288=for hackers
1289Found in file sv.c
1290
954c1994 1291=item newSVpvn
1292
1293Creates a new SV and copies a string into it. The reference count for the
1c846c1f 1294SV is set to 1. Note that if C<len> is zero, Perl will create a zero length
954c1994 1295string. You are responsible for ensuring that the source string is at least
1296C<len> bytes long.
1297
1298 SV* newSVpvn(const char* s, STRLEN len)
1299
497711e7 1300=for hackers
1301Found in file sv.c
1302
1c846c1f 1303=item newSVpvn_share
1304
1305Creates a new SV and populates it with a string from
1306the string table. Turns on READONLY and FAKE.
1307The idea here is that as string table is used for shared hash
1308keys these strings will have SvPVX == HeKEY and hash lookup
1309will avoid string compare.
1310
ae154d6d 1311 SV* newSVpvn_share(const char* s, I32 len, U32 hash)
1c846c1f 1312
1313=for hackers
1314Found in file sv.c
1315
954c1994 1316=item newSVrv
1317
1318Creates a new SV for the RV, C<rv>, to point to. If C<rv> is not an RV then
1319it will be upgraded to one. If C<classname> is non-null then the new SV will
1320be blessed in the specified package. The new SV is returned and its
1321reference count is 1.
1322
1323 SV* newSVrv(SV* rv, const char* classname)
1324
497711e7 1325=for hackers
1326Found in file sv.c
1327
954c1994 1328=item newSVsv
1329
1330Creates a new SV which is an exact duplicate of the original SV.
1331
1332 SV* newSVsv(SV* old)
1333
497711e7 1334=for hackers
1335Found in file sv.c
1336
1a3327fb 1337=item newSVuv
1338
1339Creates a new SV and copies an unsigned integer into it.
1340The reference count for the SV is set to 1.
1341
1342 SV* newSVuv(UV u)
1343
497711e7 1344=for hackers
1345Found in file sv.c
1346
954c1994 1347=item newXS
1348
1349Used by C<xsubpp> to hook up XSUBs as Perl subs.
1350
497711e7 1351=for hackers
35676c7e 1352Found in file op.c
497711e7 1353
954c1994 1354=item newXSproto
1355
1356Used by C<xsubpp> to hook up XSUBs as Perl subs. Adds Perl prototypes to
1357the subs.
1358
497711e7 1359=for hackers
1360Found in file XSUB.h
1361
954c1994 1362=item Newz
1363
1364The XSUB-writer's interface to the C C<malloc> function. The allocated
1365memory is zeroed with C<memzero>.
1366
1367 void Newz(int id, void* ptr, int nitems, type)
1368
497711e7 1369=for hackers
1370Found in file handy.h
1371
954c1994 1372=item Nullav
1373
1374Null AV pointer.
1375
497711e7 1376=for hackers
1377Found in file av.h
1378
954c1994 1379=item Nullch
1380
1381Null character pointer.
1382
497711e7 1383=for hackers
1384Found in file handy.h
1385
954c1994 1386=item Nullcv
1387
1388Null CV pointer.
1389
497711e7 1390=for hackers
1391Found in file cv.h
1392
954c1994 1393=item Nullhv
1394
1395Null HV pointer.
1396
497711e7 1397=for hackers
1398Found in file hv.h
1399
954c1994 1400=item Nullsv
1401
1402Null SV pointer.
1403
497711e7 1404=for hackers
1405Found in file handy.h
1406
954c1994 1407=item ORIGMARK
1408
1409The original stack mark for the XSUB. See C<dORIGMARK>.
1410
497711e7 1411=for hackers
1412Found in file pp.h
1413
954c1994 1414=item perl_alloc
1415
1416Allocates a new Perl interpreter. See L<perlembed>.
1417
1418 PerlInterpreter* perl_alloc()
1419
497711e7 1420=for hackers
1421Found in file perl.c
1422
954c1994 1423=item perl_construct
1424
1425Initializes a new Perl interpreter. See L<perlembed>.
1426
1427 void perl_construct(PerlInterpreter* interp)
1428
497711e7 1429=for hackers
1430Found in file perl.c
1431
954c1994 1432=item perl_destruct
1433
1434Shuts down a Perl interpreter. See L<perlembed>.
1435
1436 void perl_destruct(PerlInterpreter* interp)
1437
497711e7 1438=for hackers
1439Found in file perl.c
1440
954c1994 1441=item perl_free
1442
1443Releases a Perl interpreter. See L<perlembed>.
1444
1445 void perl_free(PerlInterpreter* interp)
1446
497711e7 1447=for hackers
1448Found in file perl.c
1449
954c1994 1450=item perl_parse
1451
1452Tells a Perl interpreter to parse a Perl script. See L<perlembed>.
1453
1454 int perl_parse(PerlInterpreter* interp, XSINIT_t xsinit, int argc, char** argv, char** env)
1455
497711e7 1456=for hackers
1457Found in file perl.c
1458
954c1994 1459=item perl_run
1460
1461Tells a Perl interpreter to run. See L<perlembed>.
1462
1463 int perl_run(PerlInterpreter* interp)
1464
497711e7 1465=for hackers
1466Found in file perl.c
1467
954c1994 1468=item PL_DBsingle
1469
1470When Perl is run in debugging mode, with the B<-d> switch, this SV is a
ae154d6d 1471boolean which indicates whether subs are being single-stepped.
954c1994 1472Single-stepping is automatically turned on after every step. This is the C
1473variable which corresponds to Perl's $DB::single variable. See
1474C<PL_DBsub>.
1475
1476 SV * PL_DBsingle
1477
497711e7 1478=for hackers
1479Found in file intrpvar.h
1480
954c1994 1481=item PL_DBsub
1482
1483When Perl is run in debugging mode, with the B<-d> switch, this GV contains
1484the SV which holds the name of the sub being debugged. This is the C
1485variable which corresponds to Perl's $DB::sub variable. See
1486C<PL_DBsingle>.
1487
1488 GV * PL_DBsub
1489
497711e7 1490=for hackers
1491Found in file intrpvar.h
1492
954c1994 1493=item PL_DBtrace
1494
1495Trace variable used when Perl is run in debugging mode, with the B<-d>
1496switch. This is the C variable which corresponds to Perl's $DB::trace
1497variable. See C<PL_DBsingle>.
1498
1499 SV * PL_DBtrace
1500
497711e7 1501=for hackers
1502Found in file intrpvar.h
1503
954c1994 1504=item PL_dowarn
1505
1506The C variable which corresponds to Perl's $^W warning variable.
1507
1508 bool PL_dowarn
1509
497711e7 1510=for hackers
1511Found in file intrpvar.h
1512
c155e47c 1513=item PL_last_in_gv
1514
1515The GV which was last used for a filehandle input operation. (C<< <FH> >>)
1516
1517 GV* PL_last_in_gv
1518
1519=for hackers
1520Found in file thrdvar.h
1521
954c1994 1522=item PL_modglobal
1523
ae154d6d 1524C<PL_modglobal> is a general purpose, interpreter global HV for use by
954c1994 1525extensions that need to keep information on a per-interpreter basis.
ae154d6d 1526In a pinch, it can also be used as a symbol table for extensions
1527to share data among each other. It is a good idea to use keys
954c1994 1528prefixed by the package name of the extension that owns the data.
1529
1530 HV* PL_modglobal
1531
497711e7 1532=for hackers
1533Found in file intrpvar.h
1534
954c1994 1535=item PL_na
1536
1537A convenience variable which is typically used with C<SvPV> when one
1538doesn't care about the length of the string. It is usually more efficient
1539to either declare a local variable and use that instead or to use the
1540C<SvPV_nolen> macro.
1541
1542 STRLEN PL_na
1543
497711e7 1544=for hackers
1545Found in file thrdvar.h
1546
c155e47c 1547=item PL_ofs_sv
1548
1549The output field separator - C<$,> in Perl space.
1550
1551 SV* PL_ofs_sv
1552
1553=for hackers
1554Found in file thrdvar.h
1555
1556=item PL_rs
1557
1558The input record separator - C<$/> in Perl space.
1559
1560 SV* PL_rs
1561
1562=for hackers
1563Found in file thrdvar.h
1564
954c1994 1565=item PL_sv_no
1566
1567This is the C<false> SV. See C<PL_sv_yes>. Always refer to this as
1568C<&PL_sv_no>.
1569
1570 SV PL_sv_no
1571
497711e7 1572=for hackers
1573Found in file intrpvar.h
1574
954c1994 1575=item PL_sv_undef
1576
1577This is the C<undef> SV. Always refer to this as C<&PL_sv_undef>.
1578
1579 SV PL_sv_undef
1580
497711e7 1581=for hackers
1582Found in file intrpvar.h
1583
954c1994 1584=item PL_sv_yes
1585
1586This is the C<true> SV. See C<PL_sv_no>. Always refer to this as
1587C<&PL_sv_yes>.
1588
1589 SV PL_sv_yes
1590
497711e7 1591=for hackers
1592Found in file intrpvar.h
1593
954c1994 1594=item POPi
1595
1596Pops an integer off the stack.
1597
1598 IV POPi
1599
497711e7 1600=for hackers
1601Found in file pp.h
1602
954c1994 1603=item POPl
1604
1605Pops a long off the stack.
1606
1607 long POPl
1608
497711e7 1609=for hackers
1610Found in file pp.h
1611
954c1994 1612=item POPn
1613
1614Pops a double off the stack.
1615
1616 NV POPn
1617
497711e7 1618=for hackers
1619Found in file pp.h
1620
954c1994 1621=item POPp
1622
1623Pops a string off the stack.
1624
1625 char* POPp
1626
497711e7 1627=for hackers
1628Found in file pp.h
1629
954c1994 1630=item POPs
1631
1632Pops an SV off the stack.
1633
1634 SV* POPs
1635
497711e7 1636=for hackers
1637Found in file pp.h
1638
954c1994 1639=item PUSHi
1640
1641Push an integer onto the stack. The stack must have room for this element.
1642Handles 'set' magic. See C<XPUSHi>.
1643
1644 void PUSHi(IV iv)
1645
497711e7 1646=for hackers
1647Found in file pp.h
1648
954c1994 1649=item PUSHMARK
1650
1651Opening bracket for arguments on a callback. See C<PUTBACK> and
1652L<perlcall>.
1653
1654 PUSHMARK;
1655
497711e7 1656=for hackers
1657Found in file pp.h
1658
954c1994 1659=item PUSHn
1660
1661Push a double onto the stack. The stack must have room for this element.
1662Handles 'set' magic. See C<XPUSHn>.
1663
1664 void PUSHn(NV nv)
1665
497711e7 1666=for hackers
1667Found in file pp.h
1668
954c1994 1669=item PUSHp
1670
1671Push a string onto the stack. The stack must have room for this element.
1672The C<len> indicates the length of the string. Handles 'set' magic. See
1673C<XPUSHp>.
1674
1675 void PUSHp(char* str, STRLEN len)
1676
497711e7 1677=for hackers
1678Found in file pp.h
1679
954c1994 1680=item PUSHs
1681
1c846c1f 1682Push an SV onto the stack. The stack must have room for this element.
954c1994 1683Does not handle 'set' magic. See C<XPUSHs>.
1684
1685 void PUSHs(SV* sv)
1686
497711e7 1687=for hackers
1688Found in file pp.h
1689
954c1994 1690=item PUSHu
1691
1692Push an unsigned integer onto the stack. The stack must have room for this
1693element. See C<XPUSHu>.
1694
1695 void PUSHu(UV uv)
1696
497711e7 1697=for hackers
1698Found in file pp.h
1699
954c1994 1700=item PUTBACK
1701
1702Closing bracket for XSUB arguments. This is usually handled by C<xsubpp>.
1703See C<PUSHMARK> and L<perlcall> for other uses.
1704
1705 PUTBACK;
1706
497711e7 1707=for hackers
1708Found in file pp.h
1709
954c1994 1710=item Renew
1711
1712The XSUB-writer's interface to the C C<realloc> function.
1713
1714 void Renew(void* ptr, int nitems, type)
1715
497711e7 1716=for hackers
1717Found in file handy.h
1718
954c1994 1719=item Renewc
1720
1721The XSUB-writer's interface to the C C<realloc> function, with
1722cast.
1723
1724 void Renewc(void* ptr, int nitems, type, cast)
1725
497711e7 1726=for hackers
1727Found in file handy.h
1728
954c1994 1729=item require_pv
1730
1731Tells Perl to C<require> a module.
1732
1733NOTE: the perl_ form of this function is deprecated.
1734
1735 void require_pv(const char* pv)
1736
497711e7 1737=for hackers
1738Found in file perl.c
1739
954c1994 1740=item RETVAL
1741
1742Variable which is setup by C<xsubpp> to hold the return value for an
1743XSUB. This is always the proper type for the XSUB. See
1744L<perlxs/"The RETVAL Variable">.
1745
1746 (whatever) RETVAL
1747
497711e7 1748=for hackers
1749Found in file XSUB.h
1750
954c1994 1751=item Safefree
1752
1753The XSUB-writer's interface to the C C<free> function.
1754
49b8b560 1755 void Safefree(void* ptr)
954c1994 1756
497711e7 1757=for hackers
1758Found in file handy.h
1759
954c1994 1760=item savepv
1761
1762Copy a string to a safe spot. This does not use an SV.
1763
1764 char* savepv(const char* sv)
1765
497711e7 1766=for hackers
1767Found in file util.c
1768
954c1994 1769=item savepvn
1770
1771Copy a string to a safe spot. The C<len> indicates number of bytes to
1772copy. This does not use an SV.
1773
1774 char* savepvn(const char* sv, I32 len)
1775
497711e7 1776=for hackers
1777Found in file util.c
1778
954c1994 1779=item SAVETMPS
1780
1781Opening bracket for temporaries on a callback. See C<FREETMPS> and
1782L<perlcall>.
1783
1784 SAVETMPS;
1785
497711e7 1786=for hackers
1787Found in file scope.h
1788
954c1994 1789=item SP
1790
1791Stack pointer. This is usually handled by C<xsubpp>. See C<dSP> and
1792C<SPAGAIN>.
1793
497711e7 1794=for hackers
1795Found in file pp.h
1796
954c1994 1797=item SPAGAIN
1798
1799Refetch the stack pointer. Used after a callback. See L<perlcall>.
1800
1801 SPAGAIN;
1802
497711e7 1803=for hackers
1804Found in file pp.h
1805
954c1994 1806=item ST
1807
1808Used to access elements on the XSUB's stack.
1809
1810 SV* ST(int ix)
1811
497711e7 1812=for hackers
1813Found in file XSUB.h
1814
954c1994 1815=item strEQ
1816
1817Test two strings to see if they are equal. Returns true or false.
1818
1819 bool strEQ(char* s1, char* s2)
1820
497711e7 1821=for hackers
1822Found in file handy.h
1823
954c1994 1824=item strGE
1825
1826Test two strings to see if the first, C<s1>, is greater than or equal to
1827the second, C<s2>. Returns true or false.
1828
1829 bool strGE(char* s1, char* s2)
1830
497711e7 1831=for hackers
1832Found in file handy.h
1833
954c1994 1834=item strGT
1835
1836Test two strings to see if the first, C<s1>, is greater than the second,
1837C<s2>. Returns true or false.
1838
1839 bool strGT(char* s1, char* s2)
1840
497711e7 1841=for hackers
1842Found in file handy.h
1843
954c1994 1844=item strLE
1845
1846Test two strings to see if the first, C<s1>, is less than or equal to the
1847second, C<s2>. Returns true or false.
1848
1849 bool strLE(char* s1, char* s2)
1850
497711e7 1851=for hackers
1852Found in file handy.h
1853
954c1994 1854=item strLT
1855
1856Test two strings to see if the first, C<s1>, is less than the second,
1857C<s2>. Returns true or false.
1858
1859 bool strLT(char* s1, char* s2)
1860
497711e7 1861=for hackers
1862Found in file handy.h
1863
954c1994 1864=item strNE
1865
1866Test two strings to see if they are different. Returns true or
1867false.
1868
1869 bool strNE(char* s1, char* s2)
1870
497711e7 1871=for hackers
1872Found in file handy.h
1873
954c1994 1874=item strnEQ
1875
1876Test two strings to see if they are equal. The C<len> parameter indicates
1877the number of bytes to compare. Returns true or false. (A wrapper for
1878C<strncmp>).
1879
1880 bool strnEQ(char* s1, char* s2, STRLEN len)
1881
497711e7 1882=for hackers
1883Found in file handy.h
1884
954c1994 1885=item strnNE
1886
1887Test two strings to see if they are different. The C<len> parameter
1888indicates the number of bytes to compare. Returns true or false. (A
1889wrapper for C<strncmp>).
1890
1891 bool strnNE(char* s1, char* s2, STRLEN len)
1892
497711e7 1893=for hackers
1894Found in file handy.h
1895
954c1994 1896=item StructCopy
1897
4375e838 1898This is an architecture-independent macro to copy one structure to another.
954c1994 1899
1900 void StructCopy(type src, type dest, type)
1901
497711e7 1902=for hackers
1903Found in file handy.h
1904
954c1994 1905=item SvCUR
1906
1907Returns the length of the string which is in the SV. See C<SvLEN>.
1908
1909 STRLEN SvCUR(SV* sv)
1910
497711e7 1911=for hackers
1912Found in file sv.h
1913
954c1994 1914=item SvCUR_set
1915
1916Set the length of the string which is in the SV. See C<SvCUR>.
1917
1918 void SvCUR_set(SV* sv, STRLEN len)
1919
497711e7 1920=for hackers
1921Found in file sv.h
1922
954c1994 1923=item SvEND
1924
1925Returns a pointer to the last character in the string which is in the SV.
1926See C<SvCUR>. Access the character as *(SvEND(sv)).
1927
1928 char* SvEND(SV* sv)
1929
497711e7 1930=for hackers
1931Found in file sv.h
1932
954c1994 1933=item SvGETMAGIC
1934
1935Invokes C<mg_get> on an SV if it has 'get' magic. This macro evaluates its
1936argument more than once.
1937
1938 void SvGETMAGIC(SV* sv)
1939
497711e7 1940=for hackers
1941Found in file sv.h
1942
954c1994 1943=item SvGROW
1944
1945Expands the character buffer in the SV so that it has room for the
1946indicated number of bytes (remember to reserve space for an extra trailing
1947NUL character). Calls C<sv_grow> to perform the expansion if necessary.
1948Returns a pointer to the character buffer.
1949
1950 void SvGROW(SV* sv, STRLEN len)
1951
497711e7 1952=for hackers
1953Found in file sv.h
1954
954c1994 1955=item SvIOK
1956
1957Returns a boolean indicating whether the SV contains an integer.
1958
1959 bool SvIOK(SV* sv)
1960
497711e7 1961=for hackers
1962Found in file sv.h
1963
954c1994 1964=item SvIOKp
1965
1966Returns a boolean indicating whether the SV contains an integer. Checks
1967the B<private> setting. Use C<SvIOK>.
1968
1969 bool SvIOKp(SV* sv)
1970
497711e7 1971=for hackers
1972Found in file sv.h
1973
e331fc52 1974=item SvIOK_notUV
1975
1976Returns a boolean indicating whether the SV contains an signed integer.
1977
1978 void SvIOK_notUV(SV* sv)
1979
1980=for hackers
1981Found in file sv.h
1982
954c1994 1983=item SvIOK_off
1984
1985Unsets the IV status of an SV.
1986
1987 void SvIOK_off(SV* sv)
1988
497711e7 1989=for hackers
1990Found in file sv.h
1991
954c1994 1992=item SvIOK_on
1993
1994Tells an SV that it is an integer.
1995
1996 void SvIOK_on(SV* sv)
1997
497711e7 1998=for hackers
1999Found in file sv.h
2000
954c1994 2001=item SvIOK_only
2002
2003Tells an SV that it is an integer and disables all other OK bits.
2004
2005 void SvIOK_only(SV* sv)
2006
497711e7 2007=for hackers
2008Found in file sv.h
2009
e331fc52 2010=item SvIOK_only_UV
2011
2012Tells and SV that it is an unsigned integer and disables all other OK bits.
2013
2014 void SvIOK_only_UV(SV* sv)
2015
2016=for hackers
2017Found in file sv.h
2018
2019=item SvIOK_UV
2020
2021Returns a boolean indicating whether the SV contains an unsigned integer.
2022
2023 void SvIOK_UV(SV* sv)
2024
2025=for hackers
2026Found in file sv.h
2027
954c1994 2028=item SvIV
2029
2030Coerces the given SV to an integer and returns it.
2031
2032 IV SvIV(SV* sv)
2033
497711e7 2034=for hackers
2035Found in file sv.h
2036
954c1994 2037=item SvIVX
2038
2039Returns the integer which is stored in the SV, assuming SvIOK is
2040true.
2041
2042 IV SvIVX(SV* sv)
2043
497711e7 2044=for hackers
2045Found in file sv.h
2046
954c1994 2047=item SvLEN
2048
91e74348 2049Returns the size of the string buffer in the SV, not including any part
2050attributable to C<SvOOK>. See C<SvCUR>.
954c1994 2051
2052 STRLEN SvLEN(SV* sv)
2053
497711e7 2054=for hackers
2055Found in file sv.h
2056
954c1994 2057=item SvNIOK
2058
2059Returns a boolean indicating whether the SV contains a number, integer or
2060double.
2061
2062 bool SvNIOK(SV* sv)
2063
497711e7 2064=for hackers
2065Found in file sv.h
2066
954c1994 2067=item SvNIOKp
2068
2069Returns a boolean indicating whether the SV contains a number, integer or
2070double. Checks the B<private> setting. Use C<SvNIOK>.
2071
2072 bool SvNIOKp(SV* sv)
2073
497711e7 2074=for hackers
2075Found in file sv.h
2076
954c1994 2077=item SvNIOK_off
2078
2079Unsets the NV/IV status of an SV.
2080
2081 void SvNIOK_off(SV* sv)
2082
497711e7 2083=for hackers
2084Found in file sv.h
2085
954c1994 2086=item SvNOK
2087
2088Returns a boolean indicating whether the SV contains a double.
2089
2090 bool SvNOK(SV* sv)
2091
497711e7 2092=for hackers
2093Found in file sv.h
2094
954c1994 2095=item SvNOKp
2096
2097Returns a boolean indicating whether the SV contains a double. Checks the
2098B<private> setting. Use C<SvNOK>.
2099
2100 bool SvNOKp(SV* sv)
2101
497711e7 2102=for hackers
2103Found in file sv.h
2104
954c1994 2105=item SvNOK_off
2106
2107Unsets the NV status of an SV.
2108
2109 void SvNOK_off(SV* sv)
2110
497711e7 2111=for hackers
2112Found in file sv.h
2113
954c1994 2114=item SvNOK_on
2115
2116Tells an SV that it is a double.
2117
2118 void SvNOK_on(SV* sv)
2119
497711e7 2120=for hackers
2121Found in file sv.h
2122
954c1994 2123=item SvNOK_only
2124
2125Tells an SV that it is a double and disables all other OK bits.
2126
2127 void SvNOK_only(SV* sv)
2128
497711e7 2129=for hackers
2130Found in file sv.h
2131
954c1994 2132=item SvNV
2133
2134Coerce the given SV to a double and return it.
2135
2136 NV SvNV(SV* sv)
2137
497711e7 2138=for hackers
2139Found in file sv.h
2140
954c1994 2141=item SvNVX
2142
2143Returns the double which is stored in the SV, assuming SvNOK is
2144true.
2145
2146 NV SvNVX(SV* sv)
2147
497711e7 2148=for hackers
2149Found in file sv.h
2150
954c1994 2151=item SvOK
2152
2153Returns a boolean indicating whether the value is an SV.
2154
2155 bool SvOK(SV* sv)
2156
497711e7 2157=for hackers
2158Found in file sv.h
2159
954c1994 2160=item SvOOK
2161
2162Returns a boolean indicating whether the SvIVX is a valid offset value for
2163the SvPVX. This hack is used internally to speed up removal of characters
2164from the beginning of a SvPV. When SvOOK is true, then the start of the
2165allocated string buffer is really (SvPVX - SvIVX).
2166
2167 bool SvOOK(SV* sv)
2168
497711e7 2169=for hackers
2170Found in file sv.h
2171
954c1994 2172=item SvPOK
2173
2174Returns a boolean indicating whether the SV contains a character
2175string.
2176
2177 bool SvPOK(SV* sv)
2178
497711e7 2179=for hackers
2180Found in file sv.h
2181
954c1994 2182=item SvPOKp
2183
2184Returns a boolean indicating whether the SV contains a character string.
2185Checks the B<private> setting. Use C<SvPOK>.
2186
2187 bool SvPOKp(SV* sv)
2188
497711e7 2189=for hackers
2190Found in file sv.h
2191
954c1994 2192=item SvPOK_off
2193
2194Unsets the PV status of an SV.
2195
2196 void SvPOK_off(SV* sv)
2197
497711e7 2198=for hackers
2199Found in file sv.h
2200
954c1994 2201=item SvPOK_on
2202
2203Tells an SV that it is a string.
2204
2205 void SvPOK_on(SV* sv)
2206
497711e7 2207=for hackers
2208Found in file sv.h
2209
954c1994 2210=item SvPOK_only
2211
2212Tells an SV that it is a string and disables all other OK bits.
2213
2214 void SvPOK_only(SV* sv)
2215
497711e7 2216=for hackers
2217Found in file sv.h
2218
914184e1 2219=item SvPOK_only_UTF8
2220
2221Tells an SV that it is a UTF8 string (do not use frivolously)
2222and disables all other OK bits.
2223
2224 void SvPOK_only_UTF8(SV* sv)
2225
2226=for hackers
2227Found in file sv.h
2228
954c1994 2229=item SvPV
2230
2231Returns a pointer to the string in the SV, or a stringified form of the SV
2232if the SV does not contain a string. Handles 'get' magic.
2233
2234 char* SvPV(SV* sv, STRLEN len)
2235
497711e7 2236=for hackers
2237Found in file sv.h
2238
954c1994 2239=item SvPVX
2240
2241Returns a pointer to the string in the SV. The SV must contain a
2242string.
2243
2244 char* SvPVX(SV* sv)
2245
497711e7 2246=for hackers
2247Found in file sv.h
2248
954c1994 2249=item SvPV_force
2250
2251Like <SvPV> but will force the SV into becoming a string (SvPOK). You want
2252force if you are going to update the SvPVX directly.
2253
2254 char* SvPV_force(SV* sv, STRLEN len)
2255
497711e7 2256=for hackers
2257Found in file sv.h
2258
954c1994 2259=item SvPV_nolen
2260
2261Returns a pointer to the string in the SV, or a stringified form of the SV
2262if the SV does not contain a string. Handles 'get' magic.
2263
2264 char* SvPV_nolen(SV* sv)
2265
497711e7 2266=for hackers
2267Found in file sv.h
2268
954c1994 2269=item SvREFCNT
2270
2271Returns the value of the object's reference count.
2272
2273 U32 SvREFCNT(SV* sv)
2274
497711e7 2275=for hackers
2276Found in file sv.h
2277
954c1994 2278=item SvREFCNT_dec
2279
2280Decrements the reference count of the given SV.
2281
2282 void SvREFCNT_dec(SV* sv)
2283
497711e7 2284=for hackers
2285Found in file sv.h
2286
954c1994 2287=item SvREFCNT_inc
2288
2289Increments the reference count of the given SV.
2290
2291 SV* SvREFCNT_inc(SV* sv)
2292
497711e7 2293=for hackers
2294Found in file sv.h
2295
954c1994 2296=item SvROK
2297
2298Tests if the SV is an RV.
2299
2300 bool SvROK(SV* sv)
2301
497711e7 2302=for hackers
2303Found in file sv.h
2304
954c1994 2305=item SvROK_off
2306
2307Unsets the RV status of an SV.
2308
2309 void SvROK_off(SV* sv)
2310
497711e7 2311=for hackers
2312Found in file sv.h
2313
954c1994 2314=item SvROK_on
2315
2316Tells an SV that it is an RV.
2317
2318 void SvROK_on(SV* sv)
2319
497711e7 2320=for hackers
2321Found in file sv.h
2322
954c1994 2323=item SvRV
2324
2325Dereferences an RV to return the SV.
2326
2327 SV* SvRV(SV* sv)
2328
497711e7 2329=for hackers
2330Found in file sv.h
2331
954c1994 2332=item SvSETMAGIC
2333
2334Invokes C<mg_set> on an SV if it has 'set' magic. This macro evaluates its
2335argument more than once.
2336
2337 void SvSETMAGIC(SV* sv)
2338
497711e7 2339=for hackers
2340Found in file sv.h
2341
954c1994 2342=item SvSetSV
2343
2344Calls C<sv_setsv> if dsv is not the same as ssv. May evaluate arguments
2345more than once.
2346
2347 void SvSetSV(SV* dsb, SV* ssv)
2348
497711e7 2349=for hackers
2350Found in file sv.h
2351
954c1994 2352=item SvSetSV_nosteal
2353
2354Calls a non-destructive version of C<sv_setsv> if dsv is not the same as
2355ssv. May evaluate arguments more than once.
2356
2357 void SvSetSV_nosteal(SV* dsv, SV* ssv)
2358
497711e7 2359=for hackers
2360Found in file sv.h
2361
954c1994 2362=item SvSTASH
2363
2364Returns the stash of the SV.
2365
2366 HV* SvSTASH(SV* sv)
2367
497711e7 2368=for hackers
2369Found in file sv.h
2370
954c1994 2371=item SvTAINT
2372
2373Taints an SV if tainting is enabled
2374
2375 void SvTAINT(SV* sv)
2376
497711e7 2377=for hackers
2378Found in file sv.h
2379
954c1994 2380=item SvTAINTED
2381
2382Checks to see if an SV is tainted. Returns TRUE if it is, FALSE if
2383not.
2384
2385 bool SvTAINTED(SV* sv)
2386
497711e7 2387=for hackers
2388Found in file sv.h
2389
954c1994 2390=item SvTAINTED_off
2391
2392Untaints an SV. Be I<very> careful with this routine, as it short-circuits
2393some of Perl's fundamental security features. XS module authors should not
2394use this function unless they fully understand all the implications of
2395unconditionally untainting the value. Untainting should be done in the
2396standard perl fashion, via a carefully crafted regexp, rather than directly
2397untainting variables.
2398
2399 void SvTAINTED_off(SV* sv)
2400
497711e7 2401=for hackers
2402Found in file sv.h
2403
954c1994 2404=item SvTAINTED_on
2405
2406Marks an SV as tainted.
2407
2408 void SvTAINTED_on(SV* sv)
2409
497711e7 2410=for hackers
2411Found in file sv.h
2412
954c1994 2413=item SvTRUE
2414
2415Returns a boolean indicating whether Perl would evaluate the SV as true or
2416false, defined or undefined. Does not handle 'get' magic.
2417
2418 bool SvTRUE(SV* sv)
2419
497711e7 2420=for hackers
2421Found in file sv.h
2422
eebe1485 2423=item svtype
c155e47c 2424
eebe1485 2425An enum of flags for Perl types. These are found in the file B<sv.h>
2426in the C<svtype> enum. Test these flags with the C<SvTYPE> macro.
34f7a5fe 2427
497711e7 2428=for hackers
2429Found in file sv.h
2430
eebe1485 2431=item SvTYPE
840a7b70 2432
eebe1485 2433Returns the type of the SV. See C<svtype>.
2434
2435 svtype SvTYPE(SV* sv)
954c1994 2436
497711e7 2437=for hackers
2438Found in file sv.h
2439
954c1994 2440=item SVt_IV
2441
2442Integer type flag for scalars. See C<svtype>.
2443
497711e7 2444=for hackers
2445Found in file sv.h
2446
954c1994 2447=item SVt_NV
2448
2449Double type flag for scalars. See C<svtype>.
2450
497711e7 2451=for hackers
2452Found in file sv.h
2453
954c1994 2454=item SVt_PV
2455
2456Pointer type flag for scalars. See C<svtype>.
2457
497711e7 2458=for hackers
2459Found in file sv.h
2460
954c1994 2461=item SVt_PVAV
2462
2463Type flag for arrays. See C<svtype>.
2464
497711e7 2465=for hackers
2466Found in file sv.h
2467
954c1994 2468=item SVt_PVCV
2469
2470Type flag for code refs. See C<svtype>.
2471
497711e7 2472=for hackers
2473Found in file sv.h
2474
954c1994 2475=item SVt_PVHV
2476
2477Type flag for hashes. See C<svtype>.
2478
497711e7 2479=for hackers
2480Found in file sv.h
2481
954c1994 2482=item SVt_PVMG
2483
2484Type flag for blessed scalars. See C<svtype>.
2485
497711e7 2486=for hackers
2487Found in file sv.h
2488
a8586c98 2489=item SvUOK
2490
2491Returns a boolean indicating whether the SV contains an unsigned integer.
2492
2493 void SvUOK(SV* sv)
2494
2495=for hackers
2496Found in file sv.h
2497
954c1994 2498=item SvUPGRADE
2499
2500Used to upgrade an SV to a more complex form. Uses C<sv_upgrade> to
2501perform the upgrade if necessary. See C<svtype>.
2502
2503 void SvUPGRADE(SV* sv, svtype type)
2504
497711e7 2505=for hackers
2506Found in file sv.h
2507
914184e1 2508=item SvUTF8
2509
2510Returns a boolean indicating whether the SV contains UTF-8 encoded data.
2511
2512 void SvUTF8(SV* sv)
2513
2514=for hackers
2515Found in file sv.h
2516
2517=item SvUTF8_off
2518
2519Unsets the UTF8 status of an SV.
2520
2521 void SvUTF8_off(SV *sv)
2522
2523=for hackers
2524Found in file sv.h
2525
2526=item SvUTF8_on
2527
2528Tells an SV that it is a string and encoded in UTF8. Do not use frivolously.
2529
2530 void SvUTF8_on(SV *sv)
2531
2532=for hackers
2533Found in file sv.h
2534
954c1994 2535=item SvUV
2536
2537Coerces the given SV to an unsigned integer and returns it.
2538
2539 UV SvUV(SV* sv)
2540
497711e7 2541=for hackers
2542Found in file sv.h
2543
954c1994 2544=item SvUVX
2545
2546Returns the unsigned integer which is stored in the SV, assuming SvIOK is
2547true.
2548
2549 UV SvUVX(SV* sv)
2550
497711e7 2551=for hackers
2552Found in file sv.h
2553
954c1994 2554=item sv_2mortal
2555
2556Marks an SV as mortal. The SV will be destroyed when the current context
2557ends.
2558
2559 SV* sv_2mortal(SV* sv)
2560
497711e7 2561=for hackers
2562Found in file sv.c
2563
954c1994 2564=item sv_bless
2565
2566Blesses an SV into a specified package. The SV must be an RV. The package
2567must be designated by its stash (see C<gv_stashpv()>). The reference count
2568of the SV is unaffected.
2569
2570 SV* sv_bless(SV* sv, HV* stash)
2571
497711e7 2572=for hackers
2573Found in file sv.c
2574
954c1994 2575=item sv_catpv
2576
2577Concatenates the string onto the end of the string which is in the SV.
2578Handles 'get' magic, but not 'set' magic. See C<sv_catpv_mg>.
2579
2580 void sv_catpv(SV* sv, const char* ptr)
2581
497711e7 2582=for hackers
2583Found in file sv.c
2584
954c1994 2585=item sv_catpvf
2586
2587Processes its arguments like C<sprintf> and appends the formatted output
2588to an SV. Handles 'get' magic, but not 'set' magic. C<SvSETMAGIC()> must
2589typically be called after calling this function to handle 'set' magic.
2590
2591 void sv_catpvf(SV* sv, const char* pat, ...)
2592
497711e7 2593=for hackers
2594Found in file sv.c
2595
954c1994 2596=item sv_catpvf_mg
2597
2598Like C<sv_catpvf>, but also handles 'set' magic.
2599
2600 void sv_catpvf_mg(SV *sv, const char* pat, ...)
2601
497711e7 2602=for hackers
2603Found in file sv.c
2604
954c1994 2605=item sv_catpvn
2606
2607Concatenates the string onto the end of the string which is in the SV. The
2608C<len> indicates number of bytes to copy. Handles 'get' magic, but not
2609'set' magic. See C<sv_catpvn_mg>.
2610
2611 void sv_catpvn(SV* sv, const char* ptr, STRLEN len)
2612
497711e7 2613=for hackers
2614Found in file sv.c
2615
954c1994 2616=item sv_catpvn_mg
2617
2618Like C<sv_catpvn>, but also handles 'set' magic.
2619
2620 void sv_catpvn_mg(SV *sv, const char *ptr, STRLEN len)
2621
497711e7 2622=for hackers
2623Found in file sv.c
2624
954c1994 2625=item sv_catpv_mg
2626
2627Like C<sv_catpv>, but also handles 'set' magic.
2628
2629 void sv_catpv_mg(SV *sv, const char *ptr)
2630
497711e7 2631=for hackers
2632Found in file sv.c
2633
954c1994 2634=item sv_catsv
2635
1aa99e6b 2636Concatenates the string from SV C<ssv> onto the end of the string in
2637SV C<dsv>. Modifies C<dsv> but not C<ssv>. Handles 'get' magic, but
2638not 'set' magic. See C<sv_catsv_mg>.
954c1994 2639
2640 void sv_catsv(SV* dsv, SV* ssv)
2641
497711e7 2642=for hackers
2643Found in file sv.c
2644
954c1994 2645=item sv_catsv_mg
2646
2647Like C<sv_catsv>, but also handles 'set' magic.
2648
2649 void sv_catsv_mg(SV *dstr, SV *sstr)
2650
497711e7 2651=for hackers
2652Found in file sv.c
2653
954c1994 2654=item sv_chop
2655
1c846c1f 2656Efficient removal of characters from the beginning of the string buffer.
954c1994 2657SvPOK(sv) must be true and the C<ptr> must be a pointer to somewhere inside
2658the string buffer. The C<ptr> becomes the first character of the adjusted
2659string.
2660
2661 void sv_chop(SV* sv, char* ptr)
2662
497711e7 2663=for hackers
2664Found in file sv.c
2665
c461cf8f 2666=item sv_clear
2667
2668Clear an SV, making it empty. Does not free the memory used by the SV
2669itself.
2670
2671 void sv_clear(SV* sv)
2672
2673=for hackers
2674Found in file sv.c
2675
954c1994 2676=item sv_cmp
2677
2678Compares the strings in two SVs. Returns -1, 0, or 1 indicating whether the
2679string in C<sv1> is less than, equal to, or greater than the string in
2680C<sv2>.
2681
2682 I32 sv_cmp(SV* sv1, SV* sv2)
2683
497711e7 2684=for hackers
2685Found in file sv.c
2686
c461cf8f 2687=item sv_cmp_locale
2688
2689Compares the strings in two SVs in a locale-aware manner. See
2690L</sv_cmp_locale>
2691
2692 I32 sv_cmp_locale(SV* sv1, SV* sv2)
2693
2694=for hackers
2695Found in file sv.c
2696
954c1994 2697=item sv_dec
2698
2699Auto-decrement of the value in the SV.
2700
2701 void sv_dec(SV* sv)
2702
497711e7 2703=for hackers
2704Found in file sv.c
2705
954c1994 2706=item sv_derived_from
2707
2708Returns a boolean indicating whether the SV is derived from the specified
2709class. This is the function that implements C<UNIVERSAL::isa>. It works
2710for class names as well as for objects.
2711
2712 bool sv_derived_from(SV* sv, const char* name)
2713
497711e7 2714=for hackers
2715Found in file universal.c
2716
954c1994 2717=item sv_eq
2718
2719Returns a boolean indicating whether the strings in the two SVs are
2720identical.
2721
2722 I32 sv_eq(SV* sv1, SV* sv2)
2723
497711e7 2724=for hackers
2725Found in file sv.c
2726
c461cf8f 2727=item sv_free
2728
2729Free the memory used by an SV.
2730
2731 void sv_free(SV* sv)
2732
2733=for hackers
2734Found in file sv.c
2735
2736=item sv_gets
2737
2738Get a line from the filehandle and store it into the SV, optionally
2739appending to the currently-stored string.
2740
2741 char* sv_gets(SV* sv, PerlIO* fp, I32 append)
2742
2743=for hackers
2744Found in file sv.c
2745
954c1994 2746=item sv_grow
2747
2748Expands the character buffer in the SV. This will use C<sv_unref> and will
2749upgrade the SV to C<SVt_PV>. Returns a pointer to the character buffer.
2750Use C<SvGROW>.
2751
2752 char* sv_grow(SV* sv, STRLEN newlen)
2753
497711e7 2754=for hackers
2755Found in file sv.c
2756
954c1994 2757=item sv_inc
2758
2759Auto-increment of the value in the SV.
2760
2761 void sv_inc(SV* sv)
2762
497711e7 2763=for hackers
2764Found in file sv.c
2765
954c1994 2766=item sv_insert
2767
2768Inserts a string at the specified offset/length within the SV. Similar to
2769the Perl substr() function.
2770
2771 void sv_insert(SV* bigsv, STRLEN offset, STRLEN len, char* little, STRLEN littlelen)
2772
497711e7 2773=for hackers
2774Found in file sv.c
2775
954c1994 2776=item sv_isa
2777
2778Returns a boolean indicating whether the SV is blessed into the specified
2779class. This does not check for subtypes; use C<sv_derived_from> to verify
2780an inheritance relationship.
2781
2782 int sv_isa(SV* sv, const char* name)
2783
497711e7 2784=for hackers
2785Found in file sv.c
2786
954c1994 2787=item sv_isobject
2788
2789Returns a boolean indicating whether the SV is an RV pointing to a blessed
2790object. If the SV is not an RV, or if the object is not blessed, then this
2791will return false.
2792
2793 int sv_isobject(SV* sv)
2794
497711e7 2795=for hackers
2796Found in file sv.c
2797
954c1994 2798=item sv_len
2799
2800Returns the length of the string in the SV. See also C<SvCUR>.
2801
2802 STRLEN sv_len(SV* sv)
2803
497711e7 2804=for hackers
2805Found in file sv.c
2806
c461cf8f 2807=item sv_len_utf8
2808
2809Returns the number of characters in the string in an SV, counting wide
2810UTF8 bytes as a single character.
2811
2812 STRLEN sv_len_utf8(SV* sv)
2813
2814=for hackers
2815Found in file sv.c
2816
954c1994 2817=item sv_magic
2818
2819Adds magic to an SV.
2820
2821 void sv_magic(SV* sv, SV* obj, int how, const char* name, I32 namlen)
2822
497711e7 2823=for hackers
2824Found in file sv.c
2825
954c1994 2826=item sv_mortalcopy
2827
2828Creates a new SV which is a copy of the original SV. The new SV is marked
2829as mortal.
2830
2831 SV* sv_mortalcopy(SV* oldsv)
2832
497711e7 2833=for hackers
2834Found in file sv.c
2835
954c1994 2836=item sv_newmortal
2837
2838Creates a new SV which is mortal. The reference count of the SV is set to 1.
2839
2840 SV* sv_newmortal()
2841
497711e7 2842=for hackers
2843Found in file sv.c
2844
c461cf8f 2845=item sv_pvn_force
2846
2847Get a sensible string out of the SV somehow.
2848
2849 char* sv_pvn_force(SV* sv, STRLEN* lp)
2850
2851=for hackers
2852Found in file sv.c
2853
2854=item sv_pvutf8n_force
2855
2856Get a sensible UTF8-encoded string out of the SV somehow. See
2857L</sv_pvn_force>.
2858
2859 char* sv_pvutf8n_force(SV* sv, STRLEN* lp)
2860
2861=for hackers
2862Found in file sv.c
2863
2864=item sv_reftype
2865
2866Returns a string describing what the SV is a reference to.
2867
2868 char* sv_reftype(SV* sv, int ob)
2869
2870=for hackers
2871Found in file sv.c
2872
2873=item sv_replace
2874
2875Make the first argument a copy of the second, then delete the original.
2876
2877 void sv_replace(SV* sv, SV* nsv)
2878
2879=for hackers
2880Found in file sv.c
2881
2882=item sv_rvweaken
2883
2884Weaken a reference.
2885
2886 SV* sv_rvweaken(SV *sv)
2887
2888=for hackers
2889Found in file sv.c
2890
954c1994 2891=item sv_setiv
2892
2893Copies an integer into the given SV. Does not handle 'set' magic. See
2894C<sv_setiv_mg>.
2895
2896 void sv_setiv(SV* sv, IV num)
2897
497711e7 2898=for hackers
2899Found in file sv.c
2900
954c1994 2901=item sv_setiv_mg
2902
2903Like C<sv_setiv>, but also handles 'set' magic.
2904
2905 void sv_setiv_mg(SV *sv, IV i)
2906
497711e7 2907=for hackers
2908Found in file sv.c
2909
954c1994 2910=item sv_setnv
2911
2912Copies a double into the given SV. Does not handle 'set' magic. See
2913C<sv_setnv_mg>.
2914
2915 void sv_setnv(SV* sv, NV num)
2916
497711e7 2917=for hackers
2918Found in file sv.c
2919
954c1994 2920=item sv_setnv_mg
2921
2922Like C<sv_setnv>, but also handles 'set' magic.
2923
2924 void sv_setnv_mg(SV *sv, NV num)
2925
497711e7 2926=for hackers
2927Found in file sv.c
2928
954c1994 2929=item sv_setpv
2930
2931Copies a string into an SV. The string must be null-terminated. Does not
2932handle 'set' magic. See C<sv_setpv_mg>.
2933
2934 void sv_setpv(SV* sv, const char* ptr)
2935
497711e7 2936=for hackers
2937Found in file sv.c
2938
954c1994 2939=item sv_setpvf
2940
2941Processes its arguments like C<sprintf> and sets an SV to the formatted
2942output. Does not handle 'set' magic. See C<sv_setpvf_mg>.
2943
2944 void sv_setpvf(SV* sv, const char* pat, ...)
2945
497711e7 2946=for hackers
2947Found in file sv.c
2948
954c1994 2949=item sv_setpvf_mg
2950
2951Like C<sv_setpvf>, but also handles 'set' magic.
2952
2953 void sv_setpvf_mg(SV *sv, const char* pat, ...)
2954
497711e7 2955=for hackers
2956Found in file sv.c
2957
954c1994 2958=item sv_setpviv
2959
2960Copies an integer into the given SV, also updating its string value.
2961Does not handle 'set' magic. See C<sv_setpviv_mg>.
2962
2963 void sv_setpviv(SV* sv, IV num)
2964
497711e7 2965=for hackers
2966Found in file sv.c
2967
954c1994 2968=item sv_setpviv_mg
2969
2970Like C<sv_setpviv>, but also handles 'set' magic.
2971
2972 void sv_setpviv_mg(SV *sv, IV iv)
2973
497711e7 2974=for hackers
2975Found in file sv.c
2976
954c1994 2977=item sv_setpvn
2978
2979Copies a string into an SV. The C<len> parameter indicates the number of
2980bytes to be copied. Does not handle 'set' magic. See C<sv_setpvn_mg>.
2981
2982 void sv_setpvn(SV* sv, const char* ptr, STRLEN len)
2983
497711e7 2984=for hackers
2985Found in file sv.c
2986
954c1994 2987=item sv_setpvn_mg
2988
2989Like C<sv_setpvn>, but also handles 'set' magic.
2990
2991 void sv_setpvn_mg(SV *sv, const char *ptr, STRLEN len)
2992
497711e7 2993=for hackers
2994Found in file sv.c
2995
954c1994 2996=item sv_setpv_mg
2997
2998Like C<sv_setpv>, but also handles 'set' magic.
2999
3000 void sv_setpv_mg(SV *sv, const char *ptr)
3001
497711e7 3002=for hackers
3003Found in file sv.c
3004
954c1994 3005=item sv_setref_iv
3006
3007Copies an integer into a new SV, optionally blessing the SV. The C<rv>
3008argument will be upgraded to an RV. That RV will be modified to point to
3009the new SV. The C<classname> argument indicates the package for the
3010blessing. Set C<classname> to C<Nullch> to avoid the blessing. The new SV
3011will be returned and will have a reference count of 1.
3012
3013 SV* sv_setref_iv(SV* rv, const char* classname, IV iv)
3014
497711e7 3015=for hackers
3016Found in file sv.c
3017
954c1994 3018=item sv_setref_nv
3019
3020Copies a double into a new SV, optionally blessing the SV. The C<rv>
3021argument will be upgraded to an RV. That RV will be modified to point to
3022the new SV. The C<classname> argument indicates the package for the
3023blessing. Set C<classname> to C<Nullch> to avoid the blessing. The new SV
3024will be returned and will have a reference count of 1.
3025
3026 SV* sv_setref_nv(SV* rv, const char* classname, NV nv)
3027
497711e7 3028=for hackers
3029Found in file sv.c
3030
954c1994 3031=item sv_setref_pv
3032
3033Copies a pointer into a new SV, optionally blessing the SV. The C<rv>
3034argument will be upgraded to an RV. That RV will be modified to point to
3035the new SV. If the C<pv> argument is NULL then C<PL_sv_undef> will be placed
3036into the SV. The C<classname> argument indicates the package for the
3037blessing. Set C<classname> to C<Nullch> to avoid the blessing. The new SV
3038will be returned and will have a reference count of 1.
3039
3040Do not use with other Perl types such as HV, AV, SV, CV, because those
3041objects will become corrupted by the pointer copy process.
3042
3043Note that C<sv_setref_pvn> copies the string while this copies the pointer.
3044
3045 SV* sv_setref_pv(SV* rv, const char* classname, void* pv)
3046
497711e7 3047=for hackers
3048Found in file sv.c
3049
954c1994 3050=item sv_setref_pvn
3051
3052Copies a string into a new SV, optionally blessing the SV. The length of the
3053string must be specified with C<n>. The C<rv> argument will be upgraded to
3054an RV. That RV will be modified to point to the new SV. The C<classname>
3055argument indicates the package for the blessing. Set C<classname> to
3056C<Nullch> to avoid the blessing. The new SV will be returned and will have
3057a reference count of 1.
3058
3059Note that C<sv_setref_pv> copies the pointer while this copies the string.
3060
3061 SV* sv_setref_pvn(SV* rv, const char* classname, char* pv, STRLEN n)
3062
497711e7 3063=for hackers
3064Found in file sv.c
3065
954c1994 3066=item sv_setsv
3067
3068Copies the contents of the source SV C<ssv> into the destination SV C<dsv>.
3069The source SV may be destroyed if it is mortal. Does not handle 'set'
3070magic. See the macro forms C<SvSetSV>, C<SvSetSV_nosteal> and
3071C<sv_setsv_mg>.
3072
3073 void sv_setsv(SV* dsv, SV* ssv)
3074
497711e7 3075=for hackers
3076Found in file sv.c
3077
954c1994 3078=item sv_setsv_mg
3079
3080Like C<sv_setsv>, but also handles 'set' magic.
3081
3082 void sv_setsv_mg(SV *dstr, SV *sstr)
3083
497711e7 3084=for hackers
3085Found in file sv.c
3086
954c1994 3087=item sv_setuv
3088
3089Copies an unsigned integer into the given SV. Does not handle 'set' magic.
3090See C<sv_setuv_mg>.
3091
3092 void sv_setuv(SV* sv, UV num)
3093
497711e7 3094=for hackers
3095Found in file sv.c
3096
954c1994 3097=item sv_setuv_mg
3098
3099Like C<sv_setuv>, but also handles 'set' magic.
3100
3101 void sv_setuv_mg(SV *sv, UV u)
3102
497711e7 3103=for hackers
3104Found in file sv.c
3105
c461cf8f 3106=item sv_true
3107
3108Returns true if the SV has a true value by Perl's rules.
3109
3110 I32 sv_true(SV *sv)
3111
3112=for hackers
3113Found in file sv.c
3114
3115=item sv_unmagic
3116
3117Removes magic from an SV.
3118
3119 int sv_unmagic(SV* sv, int type)
3120
3121=for hackers
3122Found in file sv.c
3123
954c1994 3124=item sv_unref
3125
3126Unsets the RV status of the SV, and decrements the reference count of
3127whatever was being referenced by the RV. This can almost be thought of
b06226ff 3128as a reversal of C<newSVrv>. This is C<sv_unref_flags> with the C<flag>
ae154d6d 3129being zero. See C<SvROK_off>.
954c1994 3130
3131 void sv_unref(SV* sv)
3132
497711e7 3133=for hackers
3134Found in file sv.c
3135
840a7b70 3136=item sv_unref_flags
3137
3138Unsets the RV status of the SV, and decrements the reference count of
3139whatever was being referenced by the RV. This can almost be thought of
3140as a reversal of C<newSVrv>. The C<cflags> argument can contain
3141C<SV_IMMEDIATE_UNREF> to force the reference count to be decremented
3142(otherwise the decrementing is conditional on the reference count being
3143different from one or the reference being a readonly SV).
ae154d6d 3144See C<SvROK_off>.
840a7b70 3145
3146 void sv_unref_flags(SV* sv, U32 flags)
3147
3148=for hackers
3149Found in file sv.c
3150
954c1994 3151=item sv_upgrade
3152
3153Upgrade an SV to a more complex form. Use C<SvUPGRADE>. See
3154C<svtype>.
3155
3156 bool sv_upgrade(SV* sv, U32 mt)
3157
497711e7 3158=for hackers
3159Found in file sv.c
3160
954c1994 3161=item sv_usepvn
3162
3163Tells an SV to use C<ptr> to find its string value. Normally the string is
1c846c1f 3164stored inside the SV but sv_usepvn allows the SV to use an outside string.
954c1994 3165The C<ptr> should point to memory that was allocated by C<malloc>. The
3166string length, C<len>, must be supplied. This function will realloc the
3167memory pointed to by C<ptr>, so that pointer should not be freed or used by
3168the programmer after giving it to sv_usepvn. Does not handle 'set' magic.
3169See C<sv_usepvn_mg>.
3170
3171 void sv_usepvn(SV* sv, char* ptr, STRLEN len)
3172
497711e7 3173=for hackers
3174Found in file sv.c
3175
954c1994 3176=item sv_usepvn_mg
3177
3178Like C<sv_usepvn>, but also handles 'set' magic.
3179
3180 void sv_usepvn_mg(SV *sv, char *ptr, STRLEN len)
3181
497711e7 3182=for hackers
3183Found in file sv.c
3184
c461cf8f 3185=item sv_utf8_downgrade
3186
3187Attempt to convert the PV of an SV from UTF8-encoded to byte encoding.
3188This may not be possible if the PV contains non-byte encoding characters;
3189if this is the case, either returns false or, if C<fail_ok> is not
3190true, croaks.
3191
3192NOTE: this function is experimental and may change or be
3193removed without notice.
3194
3195 bool sv_utf8_downgrade(SV *sv, bool fail_ok)
3196
3197=for hackers
3198Found in file sv.c
3199
3200=item sv_utf8_encode
3201
3202Convert the PV of an SV to UTF8-encoded, but then turn off the C<SvUTF8>
1c846c1f 3203flag so that it looks like bytes again. Nothing calls this.
c461cf8f 3204
3205NOTE: this function is experimental and may change or be
3206removed without notice.
3207
3208 void sv_utf8_encode(SV *sv)
3209
3210=for hackers
3211Found in file sv.c
3212
3213=item sv_utf8_upgrade
3214
3215Convert the PV of an SV to its UTF8-encoded form.
3216
3217 void sv_utf8_upgrade(SV *sv)
3218
3219=for hackers
3220Found in file sv.c
3221
954c1994 3222=item sv_vcatpvfn
3223
3224Processes its arguments like C<vsprintf> and appends the formatted output
3225to an SV. Uses an array of SVs if the C style variable argument list is
3226missing (NULL). When running with taint checks enabled, indicates via
3227C<maybe_tainted> if results are untrustworthy (often due to the use of
3228locales).
3229
3230 void sv_vcatpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
3231
497711e7 3232=for hackers
3233Found in file sv.c
3234
954c1994 3235=item sv_vsetpvfn
3236
3237Works like C<vcatpvfn> but copies the text into the SV instead of
3238appending it.
3239
3240 void sv_vsetpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
3241
497711e7 3242=for hackers
3243Found in file sv.c
3244
954c1994 3245=item THIS
3246
3247Variable which is setup by C<xsubpp> to designate the object in a C++
3248XSUB. This is always the proper type for the C++ object. See C<CLASS> and
3249L<perlxs/"Using XS With C++">.
3250
3251 (whatever) THIS
3252
497711e7 3253=for hackers
3254Found in file XSUB.h
3255
954c1994 3256=item toLOWER
3257
3258Converts the specified character to lowercase.
3259
3260 char toLOWER(char ch)
3261
497711e7 3262=for hackers
3263Found in file handy.h
3264
954c1994 3265=item toUPPER
3266
3267Converts the specified character to uppercase.
3268
3269 char toUPPER(char ch)
3270
497711e7 3271=for hackers
3272Found in file handy.h
3273
b06226ff 3274=item utf8_distance
3275
3276Returns the number of UTF8 characters between the UTF-8 pointers C<a>
3277and C<b>.
3278
3279WARNING: use only if you *know* that the pointers point inside the
3280same UTF-8 buffer.
3281
3282 IV utf8_distance(U8 *a, U8 *b)
3283
3284=for hackers
3285Found in file utf8.c
3286
3287=item utf8_hop
3288
8850bf83 3289Return the UTF-8 pointer C<s> displaced by C<off> characters, either
3290forward or backward.
b06226ff 3291
3292WARNING: do not use the following unless you *know* C<off> is within
8850bf83 3293the UTF-8 data pointed to by C<s> *and* that on entry C<s> is aligned
3294on the first byte of character or just after the last byte of a character.
b06226ff 3295
3296 U8* utf8_hop(U8 *s, I32 off)
3297
3298=for hackers
3299Found in file utf8.c
3300
3301=item utf8_length
3302
3303Return the length of the UTF-8 char encoded string C<s> in characters.
3304Stops at C<e> (inclusive). If C<e E<lt> s> or if the scan would end
3305up past C<e>, croaks.
3306
3307 STRLEN utf8_length(U8* s, U8 *e)
3308
3309=for hackers
3310Found in file utf8.c
3311
497711e7 3312=item utf8_to_bytes
3313
246fae53 3314Converts a string C<s> of length C<len> from UTF8 into byte encoding.
3315Unlike C<bytes_to_utf8>, this over-writes the original string, and
3316updates len to contain the new length.
67e989fb 3317Returns zero on failure, setting C<len> to -1.
497711e7 3318
eebe1485 3319NOTE: this function is experimental and may change or be
3320removed without notice.
3321
3322 U8* utf8_to_bytes(U8 *s, STRLEN *len)
497711e7 3323
3324=for hackers
3325Found in file utf8.c
3326
b6b716fe 3327=item utf8_to_uv
3328
3329Returns the character value of the first character in the string C<s>
dcad2880 3330which is assumed to be in UTF8 encoding and no longer than C<curlen>;
1aa99e6b 3331C<retlen> will be set to the length, in bytes, of that character.
b6b716fe 3332
dcad2880 3333If C<s> does not point to a well-formed UTF8 character, the behaviour
e9e021e6 3334is dependent on the value of C<flags>: if it contains UTF8_CHECK_ONLY,
3335it is assumed that the caller will raise a warning, and this function
28d3d195 3336will silently just set C<retlen> to C<-1> and return zero. If the
3337C<flags> does not contain UTF8_CHECK_ONLY, warnings about
3338malformations will be given, C<retlen> will be set to the expected
3339length of the UTF-8 character in bytes, and zero will be returned.
3340
3341The C<flags> can also contain various flags to allow deviations from
3342the strict UTF-8 encoding (see F<utf8.h>).
444155da 3343
eebe1485 3344 UV utf8_to_uv(U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags)
444155da 3345
3346=for hackers
3347Found in file utf8.c
3348
dcad2880 3349=item utf8_to_uv_simple
444155da 3350
3351Returns the character value of the first character in the string C<s>
dcad2880 3352which is assumed to be in UTF8 encoding; C<retlen> will be set to the
1aa99e6b 3353length, in bytes, of that character.
444155da 3354
dcad2880 3355If C<s> does not point to a well-formed UTF8 character, zero is
3356returned and retlen is set, if possible, to -1.
b6b716fe 3357
eebe1485 3358 UV utf8_to_uv_simple(U8 *s, STRLEN* retlen)
3359
3360=for hackers
3361Found in file utf8.c
3362
3363=item uv_to_utf8
3364
3365Adds the UTF8 representation of the Unicode codepoint C<uv> to the end
3366of the string C<d>; C<d> should be have at least C<UTF8_MAXLEN+1> free
3367bytes available. The return value is the pointer to the byte after the
3368end of the new character. In other words,
3369
3370 d = uv_to_utf8(d, uv);
3371
3372is the recommended Unicode-aware way of saying
3373
3374 *(d++) = uv;
3375
3376 U8* uv_to_utf8(U8 *d, UV uv)
b6b716fe 3377
3378=for hackers
3379Found in file utf8.c
3380
954c1994 3381=item warn
3382
3383This is the XSUB-writer's interface to Perl's C<warn> function. Use this
3384function the same way you use the C C<printf> function. See
3385C<croak>.
3386
3387 void warn(const char* pat, ...)
3388
497711e7 3389=for hackers
3390Found in file util.c
3391
954c1994 3392=item XPUSHi
3393
3394Push an integer onto the stack, extending the stack if necessary. Handles
3395'set' magic. See C<PUSHi>.
3396
3397 void XPUSHi(IV iv)
3398
497711e7 3399=for hackers
3400Found in file pp.h
3401
954c1994 3402=item XPUSHn
3403
3404Push a double onto the stack, extending the stack if necessary. Handles
3405'set' magic. See C<PUSHn>.
3406
3407 void XPUSHn(NV nv)
3408
497711e7 3409=for hackers
3410Found in file pp.h
3411
954c1994 3412=item XPUSHp
3413
3414Push a string onto the stack, extending the stack if necessary. The C<len>
3415indicates the length of the string. Handles 'set' magic. See
3416C<PUSHp>.
3417
3418 void XPUSHp(char* str, STRLEN len)
3419
497711e7 3420=for hackers
3421Found in file pp.h
3422
954c1994 3423=item XPUSHs
3424
3425Push an SV onto the stack, extending the stack if necessary. Does not
3426handle 'set' magic. See C<PUSHs>.
3427
3428 void XPUSHs(SV* sv)
3429
497711e7 3430=for hackers
3431Found in file pp.h
3432
954c1994 3433=item XPUSHu
3434
1c846c1f 3435Push an unsigned integer onto the stack, extending the stack if necessary.
954c1994 3436See C<PUSHu>.
3437
3438 void XPUSHu(UV uv)
3439
497711e7 3440=for hackers
3441Found in file pp.h
3442
954c1994 3443=item XS
3444
3445Macro to declare an XSUB and its C parameter list. This is handled by
3446C<xsubpp>.
3447
497711e7 3448=for hackers
3449Found in file XSUB.h
3450
954c1994 3451=item XSRETURN
3452
3453Return from XSUB, indicating number of items on the stack. This is usually
3454handled by C<xsubpp>.
3455
3456 void XSRETURN(int nitems)
3457
497711e7 3458=for hackers
3459Found in file XSUB.h
3460
954c1994 3461=item XSRETURN_EMPTY
3462
3463Return an empty list from an XSUB immediately.
3464
3465 XSRETURN_EMPTY;
3466
497711e7 3467=for hackers
3468Found in file XSUB.h
3469
954c1994 3470=item XSRETURN_IV
3471
3472Return an integer from an XSUB immediately. Uses C<XST_mIV>.
3473
3474 void XSRETURN_IV(IV iv)
3475
497711e7 3476=for hackers
3477Found in file XSUB.h
3478
954c1994 3479=item XSRETURN_NO
3480
3481Return C<&PL_sv_no> from an XSUB immediately. Uses C<XST_mNO>.
3482
3483 XSRETURN_NO;
3484
497711e7 3485=for hackers
3486Found in file XSUB.h
3487
954c1994 3488=item XSRETURN_NV
3489
3490Return an double from an XSUB immediately. Uses C<XST_mNV>.
3491
3492 void XSRETURN_NV(NV nv)
3493
497711e7 3494=for hackers
3495Found in file XSUB.h
3496
954c1994 3497=item XSRETURN_PV
3498
3499Return a copy of a string from an XSUB immediately. Uses C<XST_mPV>.
3500
3501 void XSRETURN_PV(char* str)
3502
497711e7 3503=for hackers
3504Found in file XSUB.h
3505
954c1994 3506=item XSRETURN_UNDEF
3507
3508Return C<&PL_sv_undef> from an XSUB immediately. Uses C<XST_mUNDEF>.
3509
3510 XSRETURN_UNDEF;
3511
497711e7 3512=for hackers
3513Found in file XSUB.h
3514
954c1994 3515=item XSRETURN_YES
3516
3517Return C<&PL_sv_yes> from an XSUB immediately. Uses C<XST_mYES>.
3518
3519 XSRETURN_YES;
3520
497711e7 3521=for hackers
3522Found in file XSUB.h
3523
954c1994 3524=item XST_mIV
3525
3526Place an integer into the specified position C<pos> on the stack. The
3527value is stored in a new mortal SV.
3528
3529 void XST_mIV(int pos, IV iv)
3530
497711e7 3531=for hackers
3532Found in file XSUB.h
3533
954c1994 3534=item XST_mNO
3535
3536Place C<&PL_sv_no> into the specified position C<pos> on the
3537stack.
3538
3539 void XST_mNO(int pos)
3540
497711e7 3541=for hackers
3542Found in file XSUB.h
3543
954c1994 3544=item XST_mNV
3545
3546Place a double into the specified position C<pos> on the stack. The value
3547is stored in a new mortal SV.
3548
3549 void XST_mNV(int pos, NV nv)
3550
497711e7 3551=for hackers
3552Found in file XSUB.h
3553
954c1994 3554=item XST_mPV
3555
3556Place a copy of a string into the specified position C<pos> on the stack.
3557The value is stored in a new mortal SV.
3558
3559 void XST_mPV(int pos, char* str)
3560
497711e7 3561=for hackers
3562Found in file XSUB.h
3563
954c1994 3564=item XST_mUNDEF
3565
3566Place C<&PL_sv_undef> into the specified position C<pos> on the
3567stack.
3568
3569 void XST_mUNDEF(int pos)
3570
497711e7 3571=for hackers
3572Found in file XSUB.h
3573
954c1994 3574=item XST_mYES
3575
3576Place C<&PL_sv_yes> into the specified position C<pos> on the
3577stack.
3578
3579 void XST_mYES(int pos)
3580
497711e7 3581=for hackers
3582Found in file XSUB.h
3583
954c1994 3584=item XS_VERSION
3585
3586The version identifier for an XS module. This is usually
3587handled automatically by C<ExtUtils::MakeMaker>. See C<XS_VERSION_BOOTCHECK>.
3588
497711e7 3589=for hackers
3590Found in file XSUB.h
3591
954c1994 3592=item XS_VERSION_BOOTCHECK
3593
3594Macro to verify that a PM module's $VERSION variable matches the XS
3595module's C<XS_VERSION> variable. This is usually handled automatically by
3596C<xsubpp>. See L<perlxs/"The VERSIONCHECK: Keyword">.
3597
3598 XS_VERSION_BOOTCHECK;
3599
497711e7 3600=for hackers
3601Found in file XSUB.h
3602
954c1994 3603=item Zero
3604
3605The XSUB-writer's interface to the C C<memzero> function. The C<dest> is the
3606destination, C<nitems> is the number of items, and C<type> is the type.
3607
3608 void Zero(void* dest, int nitems, type)
3609
497711e7 3610=for hackers
3611Found in file handy.h
3612
954c1994 3613=back
3614
3615=head1 AUTHORS
3616
3617Until May 1997, this document was maintained by Jeff Okamoto
3618<okamoto@corp.hp.com>. It is now maintained as part of Perl itself.
3619
3620With lots of help and suggestions from Dean Roehrich, Malcolm Beattie,
3621Andreas Koenig, Paul Hudson, Ilya Zakharevich, Paul Marquess, Neil
3622Bowers, Matthew Green, Tim Bunce, Spider Boardman, Ulrich Pfeifer,
3623Stephen McCamant, and Gurusamy Sarathy.
3624
3625API Listing originally by Dean Roehrich <roehrich@cray.com>.
3626
3627Updated to be autogenerated from comments in the source by Benjamin Stuhl.
3628
3629=head1 SEE ALSO
3630
3631perlguts(1), perlxs(1), perlxstut(1), perlintern(1)
3632