📄 perlapi.pod
字号:
-*- buffer-read-only: t -*-!!!!!!! DO NOT EDIT THIS FILE !!!!!!!This file is built by autodoc.pl extracting documentation from the C sourcefiles.=head1 NAMEperlapi - autogenerated documentation for the perl public API=head1 DESCRIPTIONX<Perl API> X<API> X<api>This file contains the documentation of the perl public API generated byembed.pl, specifically a listing of functions, macros, flags, and variablesthat may be used by extension writers. The interfaces of any functions thatare not listed here are subject to change without notice. For this reason,blindly using functions listed in proto.h is to be avoided when writingextensions.Note that all Perl API global variables must be referenced with the C<PL_>prefix. Some macros are provided for compatibility with the older,unadorned names, but this support may be disabled in a future release.The listing is alphabetical, case insensitive.=head1 "Gimme" Values=over 8=item GIMMEX<GIMME>A backward-compatible version of C<GIMME_V> which can only returnC<G_SCALAR> or C<G_ARRAY>; in a void context, it returns C<G_SCALAR>.Deprecated. Use C<GIMME_V> instead. U32 GIMME=for hackersFound in file op.h=item GIMME_VX<GIMME_V>The XSUB-writer's equivalent to Perl's C<wantarray>. Returns C<G_VOID>,C<G_SCALAR> or C<G_ARRAY> for void, scalar or list context,respectively. U32 GIMME_V=for hackersFound in file op.h=item G_ARRAYX<G_ARRAY>Used to indicate list context. See C<GIMME_V>, C<GIMME> andL<perlcall>.=for hackersFound in file cop.h=item G_DISCARDX<G_DISCARD>Indicates that arguments returned from a callback should be discarded. SeeL<perlcall>.=for hackersFound in file cop.h=item G_EVALX<G_EVAL>Used to force a Perl C<eval> wrapper around a callback. SeeL<perlcall>.=for hackersFound in file cop.h=item G_NOARGSX<G_NOARGS>Indicates that no arguments are being sent to a callback. SeeL<perlcall>.=for hackersFound in file cop.h=item G_SCALARX<G_SCALAR>Used to indicate scalar context. See C<GIMME_V>, C<GIMME>, andL<perlcall>.=for hackersFound in file cop.h=item G_VOIDX<G_VOID>Used to indicate void context. See C<GIMME_V> and L<perlcall>.=for hackersFound in file cop.h=back=head1 Array Manipulation Functions=over 8=item AvFILLX<AvFILL>Same as C<av_len()>. Deprecated, use C<av_len()> instead. int AvFILL(AV* av)=for hackersFound in file av.h=item av_clearX<av_clear>Clears an array, making it empty. Does not free the memory used by thearray itself. void av_clear(AV* ar)=for hackersFound in file av.c=item av_create_and_pushX<av_create_and_push>Push an SV onto the end of the array, creating the array if necessary.A small internal helper function to remove a commonly duplicated idiom.NOTE: this function is experimental and may change or beremoved without notice. void av_create_and_push(AV **const avp, SV *const val)=for hackersFound in file av.c=item av_create_and_unshift_oneX<av_create_and_unshift_one>Unshifts an SV onto the beginning of the array, creating the array ifnecessary.A small internal helper function to remove a commonly duplicated idiom.NOTE: this function is experimental and may change or beremoved without notice. SV** av_create_and_unshift_one(AV **const avp, SV *const val)=for hackersFound in file av.c=item av_deleteX<av_delete>Deletes the element indexed by C<key> from the array. Returns thedeleted element. If C<flags> equals C<G_DISCARD>, the element is freedand null is returned. SV* av_delete(AV* ar, I32 key, I32 flags)=for hackersFound in file av.c=item av_existsX<av_exists>Returns true if the element indexed by C<key> has been initialized.This relies on the fact that uninitialized array elements are set toC<&PL_sv_undef>. bool av_exists(AV* ar, I32 key)=for hackersFound in file av.c=item av_extendX<av_extend>Pre-extend an array. The C<key> is the index to which the array should beextended. void av_extend(AV* ar, I32 key)=for hackersFound in file av.c=item av_fetchX<av_fetch>Returns the SV at the specified index in the array. The C<key> is theindex. If C<lval> is set then the fetch will be part of a store. Checkthat the return value is non-null before dereferencing it to a C<SV*>.See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> formore information on how to use this function on tied arrays. SV** av_fetch(AV* ar, I32 key, I32 lval)=for hackersFound in file av.c=item av_fillX<av_fill>Set the highest index in the array to the given number, equivalent toPerl's C<$#array = $fill;>.The number of elements in the an array will be C<fill + 1> afterav_fill() returns. If the array was previously shorter then theadditional elements appended are set to C<PL_sv_undef>. If the arraywas longer, then the excess elements are freed. C<av_fill(av, -1)> isthe same as C<av_clear(av)>. void av_fill(AV* ar, I32 fill)=for hackersFound in file av.c=item av_lenX<av_len>Returns the highest index in the array. The number of elements in thearray is C<av_len(av) + 1>. Returns -1 if the array is empty. I32 av_len(const AV* ar)=for hackersFound in file av.c=item av_makeX<av_make>Creates a new AV and populates it with a list of SVs. The SVs are copiedinto the array, so they may be freed after the call to av_make. The new AVwill have a reference count of 1. AV* av_make(I32 size, SV** svp)=for hackersFound in file av.c=item av_popX<av_pop>Pops an SV off the end of the array. Returns C<&PL_sv_undef> if the arrayis empty. SV* av_pop(AV* ar)=for hackersFound in file av.c=item av_pushX<av_push>Pushes an SV onto the end of the array. The array will grow automaticallyto accommodate the addition. void av_push(AV* ar, SV* val)=for hackersFound in file av.c=item av_shiftX<av_shift>Shifts an SV off the beginning of the array. SV* av_shift(AV* ar)=for hackersFound in file av.c=item av_storeX<av_store>Stores an SV in an array. The array index is specified as C<key>. Thereturn value will be NULL if the operation failed or if the value did notneed to be actually stored within the array (as in the case of tiedarrays). Otherwise it can be dereferenced to get the original C<SV*>. Notethat the caller is responsible for suitably incrementing the referencecount of C<val> before the call, and decrementing it if the functionreturned NULL.See L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> formore information on how to use this function on tied arrays. SV** av_store(AV* ar, I32 key, SV* val)=for hackersFound in file av.c=item av_undefX<av_undef>Undefines the array. Frees the memory used by the array itself. void av_undef(AV* ar)=for hackersFound in file av.c=item av_unshiftX<av_unshift>Unshift the given number of C<undef> values onto the beginning of thearray. The array will grow automatically to accommodate the addition. Youmust then use C<av_store> to assign values to these new elements. void av_unshift(AV* ar, I32 num)=for hackersFound in file av.c=item get_avX<get_av>Returns the AV of the specified Perl array. If C<create> is set and thePerl variable does not exist then it will be created. If C<create> is notset and the variable does not exist then NULL is returned.NOTE: the perl_ form of this function is deprecated. AV* get_av(const char* name, I32 create)=for hackersFound in file perl.c=item newAVX<newAV>Creates a new AV. The reference count is set to 1. AV* newAV()=for hackersFound in file av.c=item sortsvX<sortsv>Sort an array. Here is an example: sortsv(AvARRAY(av), av_len(av)+1, Perl_sv_cmp_locale);Currently this always uses mergesort. See sortsv_flags for a moreflexible routine. void sortsv(SV** array, size_t num_elts, SVCOMPARE_t cmp)=for hackersFound in file pp_sort.c=item sortsv_flagsX<sortsv_flags>Sort an array, with various options. void sortsv_flags(SV** array, size_t num_elts, SVCOMPARE_t cmp, U32 flags)=for hackersFound in file pp_sort.c=back=head1 Callback Functions=over 8=item call_argvX<call_argv>Performs a callback to the specified Perl sub. See L<perlcall>.NOTE: the perl_ form of this function is deprecated. I32 call_argv(const char* sub_name, I32 flags, char** argv)=for hackersFound in file perl.c=item call_methodX<call_method>Performs a callback to the specified Perl method. The blessed object mustbe on the stack. See L<perlcall>.NOTE: the perl_ form of this function is deprecated. I32 call_method(const char* methname, I32 flags)=for hackersFound in file perl.c=item call_pvX<call_pv>Performs a callback to the specified Perl sub. See L<perlcall>.NOTE: the perl_ form of this function is deprecated. I32 call_pv(const char* sub_name, I32 flags)=for hackersFound in file perl.c=item call_svX<call_sv>Performs a callback to the Perl sub whose name is in the SV. SeeL<perlcall>.NOTE: the perl_ form of this function is deprecated. I32 call_sv(SV* sv, I32 flags)=for hackersFound in file perl.c=item ENTERX<ENTER>Opening bracket on a callback. See C<LEAVE> and L<perlcall>. ENTER;=for hackersFound in file scope.h=item eval_pvX<eval_pv>Tells Perl to C<eval> the given string and return an SV* result.NOTE: the perl_ form of this function is deprecated. SV* eval_pv(const char* p, I32 croak_on_error)=for hackersFound in file perl.c=item eval_svX<eval_sv>Tells Perl to C<eval> the string in the SV.NOTE: the perl_ form of this function is deprecated. I32 eval_sv(SV* sv, I32 flags)=for hackersFound in file perl.c=item FREETMPSX<FREETMPS>Closing bracket for temporaries on a callback. See C<SAVETMPS> andL<perlcall>. FREETMPS;=for hackersFound in file scope.h=item LEAVEX<LEAVE>Closing bracket on a callback. See C<ENTER> and L<perlcall>. LEAVE;=for hackersFound in file scope.h=item SAVETMPSX<SAVETMPS>Opening bracket for temporaries on a callback. See C<FREETMPS> andL<perlcall>. SAVETMPS;=for hackersFound in file scope.h=back=head1 Character classes=over 8=item isALNUMX<isALNUM>Returns a boolean indicating whether the C C<char> is an ASCII alphanumericcharacter (including underscore) or digit. bool isALNUM(char ch)=for hackersFound in file handy.h=item isALPHAX<isALPHA>Returns a boolean indicating whether the C C<char> is an ASCII alphabeticcharacter. bool isALPHA(char ch)=for hackersFound in file handy.h=item isDIGITX<isDIGIT>Returns a boolean indicating whether the C C<char> is an ASCIIdigit. bool isDIGIT(char ch)=for hackersFound in file handy.h=item isLOWERX<isLOWER>Returns a boolean indicating whether the C C<char> is a lowercasecharacter. bool isLOWER(char ch)=for hackersFound in file handy.h=item isSPACEX<isSPACE>Returns a boolean indicating whether the C C<char> is whitespace. bool isSPACE(char ch)=for hackersFound in file handy.h=item isUPPERX<isUPPER>Returns a boolean indicating whether the C C<char> is an uppercasecharacter. bool isUPPER(char ch)=for hackersFound in file handy.h=item toLOWER
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -