-*- buffer-read-only: t -*- !!!!!!! DO NOT EDIT THIS FILE !!!!!!! This file is built by autodoc.pl extracting documentation from the C source files. =head1 NAME perlapi - autogenerated documentation for the perl public API =head1 DESCRIPTION X X X This file contains the documentation of the perl public API generated by embed.pl, specifically a listing of functions, macros, flags, and variables that may be used by extension writers. L is a list of functions which have yet to be documented. The interfaces of those are subject to change without notice. Any functions not listed here are not part of the public API, and should not be used by extension writers at all. For these reasons, blindly using functions listed in proto.h is to be avoided when writing extensions. Note that all Perl API global variables must be referenced with the C prefix. Some macros are provided for compatibility with the older, unadorned names, but this support may be disabled in a future release. Perl was originally written to handle US-ASCII only (that is characters whose ordinal numbers are in the range 0 - 127). And documentation and comments may still use the term ASCII, when sometimes in fact the entire range from 0 - 255 is meant. Note that Perl can be compiled and run under EBCDIC (See L) or ASCII. Most of the documentation (and even comments in the code) ignore the EBCDIC possibility. For almost all purposes the differences are transparent. As an example, under EBCDIC, instead of UTF-8, UTF-EBCDIC is used to encode Unicode strings, and so whenever this documentation refers to C (and variants of that name, including in function names), it also (essentially transparently) means C. But the ordinals of characters differ between ASCII, EBCDIC, and the UTF- encodings, and a string encoded in UTF-EBCDIC may occupy more bytes than in UTF-8. Also, on some EBCDIC machines, functions that are documented as operating on US-ASCII (or Basic Latin in Unicode terminology) may in fact operate on all 256 characters in the EBCDIC range, not just the subset corresponding to US-ASCII. The listing below is alphabetical, case insensitive. =head1 "Gimme" Values =over 8 =item GIMME X A backward-compatible version of C which can only return C or C; in a void context, it returns C. Deprecated. Use C instead. U32 GIMME =for hackers Found in file op.h =item GIMME_V X The XSUB-writer's equivalent to Perl's C. Returns C, C or C for void, scalar or list context, respectively. See L for a usage example. U32 GIMME_V =for hackers Found in file op.h =item G_ARRAY X Used to indicate list context. See C, C and L. =for hackers Found in file cop.h =item G_DISCARD X Indicates that arguments returned from a callback should be discarded. See L. =for hackers Found in file cop.h =item G_EVAL X Used to force a Perl C wrapper around a callback. See L. =for hackers Found in file cop.h =item G_NOARGS X Indicates that no arguments are being sent to a callback. See L. =for hackers Found in file cop.h =item G_SCALAR X Used to indicate scalar context. See C, C, and L. =for hackers Found in file cop.h =item G_VOID X Used to indicate void context. See C and L. =for hackers Found in file cop.h =back =head1 Array Manipulation Functions =over 8 =item AvFILL X Same as C. Deprecated, use C instead. int AvFILL(AV* av) =for hackers Found in file av.h =item av_clear X Clears an array, making it empty. Does not free the memory used by the array itself. Perl equivalent: C<@myarray = ();>. void av_clear(AV *av) =for hackers Found in file av.c =item av_create_and_push X 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 be removed without notice. void av_create_and_push(AV **const avp, SV *const val) =for hackers Found in file av.c =item av_create_and_unshift_one X Unshifts an SV onto the beginning 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 be removed without notice. SV** av_create_and_unshift_one(AV **const avp, SV *const val) =for hackers Found in file av.c =item av_delete X Deletes the element indexed by C from the array, makes the element mortal, and returns it. If C equals C, the element is freed and null is returned. Perl equivalent: C for the non-C version and a void-context C for the C version. SV* av_delete(AV *av, I32 key, I32 flags) =for hackers Found in file av.c =item av_exists X Returns true if the element indexed by C has been initialized. This relies on the fact that uninitialized array elements are set to C<&PL_sv_undef>. Perl equivalent: C. bool av_exists(AV *av, I32 key) =for hackers Found in file av.c =item av_extend X Pre-extend an array. The C is the index to which the array should be extended. void av_extend(AV *av, I32 key) =for hackers Found in file av.c =item av_fetch X Returns the SV at the specified index in the array. The C is the index. If lval is true, you are guaranteed to get a real SV back (in case it wasn't real before), which you can then modify. Check that the return value is non-null before dereferencing it to a C. See L for more information on how to use this function on tied arrays. The rough perl equivalent is C<$myarray[$idx]>. SV** av_fetch(AV *av, I32 key, I32 lval) =for hackers Found in file av.c =item av_fill X Set the highest index in the array to the given number, equivalent to Perl's C<$#array = $fill;>. The number of elements in the an array will be C after av_fill() returns. If the array was previously shorter, then the additional elements appended are set to C. If the array was longer, then the excess elements are freed. C is the same as C. void av_fill(AV *av, I32 fill) =for hackers Found in file av.c =item av_len X Returns the highest index in the array. The number of elements in the array is C. Returns -1 if the array is empty. The Perl equivalent for this is C<$#myarray>. I32 av_len(AV *av) =for hackers Found in file av.c =item av_make X Creates a new AV and populates it with a list of SVs. The SVs are copied into the array, so they may be freed after the call to av_make. The new AV will have a reference count of 1. Perl equivalent: C AV* av_make(I32 size, SV **strp) =for hackers Found in file av.c =item av_pop X Pops an SV off the end of the array. Returns C<&PL_sv_undef> if the array is empty. SV* av_pop(AV *av) =for hackers Found in file av.c =item av_push X Pushes an SV onto the end of the array. The array will grow automatically to accommodate the addition. This takes ownership of one reference count. void av_push(AV *av, SV *val) =for hackers Found in file av.c =item av_shift X Shifts an SV off the beginning of the array. Returns C<&PL_sv_undef> if the array is empty. SV* av_shift(AV *av) =for hackers Found in file av.c =item av_store X Stores an SV in an array. The array index is specified as C. The return value will be NULL if the operation failed or if the value did not need to be actually stored within the array (as in the case of tied arrays). Otherwise it can be dereferenced to get the original C. Note that the caller is responsible for suitably incrementing the reference count of C before the call, and decrementing it if the function returned NULL. See L for more information on how to use this function on tied arrays. SV** av_store(AV *av, I32 key, SV *val) =for hackers Found in file av.c =item av_undef X Undefines the array. Frees the memory used by the array itself. void av_undef(AV *av) =for hackers Found in file av.c =item av_unshift X Unshift the given number of C values onto the beginning of the array. The array will grow automatically to accommodate the addition. You must then use C to assign values to these new elements. void av_unshift(AV *av, I32 num) =for hackers Found in file av.c =item get_av X Returns the AV of the specified Perl array. C are passed to C. If C is set and the Perl variable does not exist then it will be created. If C is zero 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 flags) =for hackers Found in file perl.c =item newAV X Creates a new AV. The reference count is set to 1. AV* newAV() =for hackers Found in file av.h =item sortsv X 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 more flexible routine. void sortsv(SV** array, size_t num_elts, SVCOMPARE_t cmp) =for hackers Found in file pp_sort.c =item sortsv_flags X Sort an array, with various options. void sortsv_flags(SV** array, size_t num_elts, SVCOMPARE_t cmp, U32 flags) =for hackers Found in file pp_sort.c =back =head1 Callback Functions =over 8 =item call_argv X Performs a callback to the specified Perl sub. See L. NOTE: the perl_ form of this function is deprecated. I32 call_argv(const char* sub_name, I32 flags, char** argv) =for hackers Found in file perl.c =item call_method X Performs a callback to the specified Perl method. The blessed object must be on the stack. See L. NOTE: the perl_ form of this function is deprecated. I32 call_method(const char* methname, I32 flags) =for hackers Found in file perl.c =item call_pv X Performs a callback to the specified Perl sub. See L. NOTE: the perl_ form of this function is deprecated. I32 call_pv(const char* sub_name, I32 flags) =for hackers Found in file perl.c =item call_sv X Performs a callback to the Perl sub whose name is in the SV. See L. NOTE: the perl_ form of this function is deprecated. I32 call_sv(SV* sv, VOL I32 flags) =for hackers Found in file perl.c =item ENTER X Opening bracket on a callback. See C and L. ENTER; =for hackers Found in file scope.h =item eval_pv X Tells Perl to C 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 hackers Found in file perl.c =item eval_sv X Tells Perl to C the string in the SV. It supports the same flags as C, with the obvious exception of G_EVAL. See L. NOTE: the perl_ form of this function is deprecated. I32 eval_sv(SV* sv, I32 flags) =for hackers Found in file perl.c =item FREETMPS X Closing bracket for temporaries on a callback. See C and L. FREETMPS; =for hackers Found in file scope.h =item LEAVE X Closing bracket on a callback. See C and L. LEAVE; =for hackers Found in file scope.h =item SAVETMPS X Opening bracket for temporaries on a callback. See C and L. SAVETMPS; =for hackers Found in file scope.h =back =head1 Character case changing =over 8 =item toLOWER X Converts the specified character to lowercase in the platform's native character set, if possible; otherwise returns the input character itself. char toLOWER(char ch) =for hackers Found in file handy.h =item toUPPER X Converts the specified character to uppercase in the platform's native character set, if possible; otherwise returns the input character itself. char toUPPER(char ch) =for hackers Found in file handy.h =back =head1 Character classes There are three variants for all the functions in this section. The base ones operate using the character set of the platform Perl is running on. The ones with an C<_A> suffix operate on the ASCII character set, and the ones with an C<_L1> suffix operate on the full Latin1 character set. All are unaffected by locale For ASCII platforms, the base function with no suffix and the one with the C<_A> suffix are identical. The function with the C<_L1> suffix imposes the Latin-1 character set onto the platform. That is, the code points that are ASCII are unaffected, since ASCII is a subset of Latin-1. But the non-ASCII code points are treated as if they are Latin-1 characters. For example, C will return true when called with the code point 0xA0, which is the Latin-1 NO-BREAK SPACE. For EBCDIC platforms, the base function with no suffix and the one with the C<_L1> suffix should be identical, since, as of this writing, the EBCDIC code pages that Perl knows about all are equivalent to Latin-1. The function that ends in an C<_A> suffix will not return true unless the specified character also has an ASCII equivalent. =over 8 =item isALPHA X Returns a boolean indicating whether the specified character is an alphabetic character in the platform's native character set. See the L for an explanation of variants C and C. bool isALPHA(char ch) =for hackers Found in file handy.h =item isASCII X Returns a boolean indicating whether the specified character is one of the 128 characters in the ASCII character set. On non-ASCII platforms, it is if this character corresponds to an ASCII character. Variants C and C are identical to C. bool isASCII(char ch) =for hackers Found in file handy.h =item isDIGIT X Returns a boolean indicating whether the specified character is a digit in the platform's native character set. Variants C and C are identical to C. bool isDIGIT(char ch) =for hackers Found in file handy.h =item isLOWER X Returns a boolean indicating whether the specified character is a lowercase character in the platform's native character set. See the L for an explanation of variants C and C. bool isLOWER(char ch) =for hackers Found in file handy.h =item isOCTAL X Returns a boolean indicating whether the specified character is an octal digit, [0-7] in the platform's native character set. Variants C and C are identical to C. bool isOCTAL(char ch) =for hackers Found in file handy.h =item isSPACE X Returns a boolean indicating whether the specified character is a whitespace character in the platform's native character set. This is the same as what C<\s> matches in a regular expression. See the L for an explanation of variants C and C. bool isSPACE(char ch) =for hackers Found in file handy.h =item isUPPER X Returns a boolean indicating whether the specified character is an uppercase character in the platform's native character set. See the L for an explanation of variants C and C. bool isUPPER(char ch) =for hackers Found in file handy.h =item isWORDCHAR X Returns a boolean indicating whether the specified character is a character that is any of: alphabetic, numeric, or an underscore. This is the same as what C<\w> matches in a regular expression. C is a synonym provided for backward compatibility. Note that it does not have the standard C language meaning of alphanumeric, since it matches an underscore and the standard meaning does not. See the L for an explanation of variants C and C. bool isWORDCHAR(char ch) =for hackers Found in file handy.h =item isXDIGIT X Returns a boolean indicating whether the specified character is a hexadecimal digit, [0-9A-Fa-f]. Variants C and C are identical to C. bool isXDIGIT(char ch) =for hackers Found in file handy.h =back =head1 Cloning an interpreter =over 8 =item perl_clone X Create and return a new interpreter by cloning the current one. perl_clone takes these flags as parameters: CLONEf_COPY_STACKS - is used to, well, copy the stacks also, without it we only clone the data and zero the stacks, with it we copy the stacks and the new perl interpreter is ready to run at the exact same point as the previous one. The pseudo-fork code uses COPY_STACKS while the threads->create doesn't. CLONEf_KEEP_PTR_TABLE perl_clone keeps a ptr_table with the pointer of the old variable as a key and the new variable as a value, this allows it to check if something has been cloned and not clone it again but rather just use the value and increase the refcount. If KEEP_PTR_TABLE is not set then perl_clone will kill the ptr_table using the function C, reason to keep it around is if you want to dup some of your own variable who are outside the graph perl scans, example of this code is in threads.xs create CLONEf_CLONE_HOST This is a win32 thing, it is ignored on unix, it tells perls win32host code (which is c++) to clone itself, this is needed on win32 if you want to run two threads at the same time, if you just want to do some stuff in a separate perl interpreter and then throw it away and return to the original one, you don't need to do anything. PerlInterpreter* perl_clone(PerlInterpreter *proto_perl, UV flags) =for hackers Found in file sv.c =back =head1 Compile-time scope hooks =over 8 =item BhkDISABLE X Temporarily disable an entry in this BHK structure, by clearing the appropriate flag. I is a preprocessor token indicating which entry to disable. NOTE: this function is experimental and may change or be removed without notice. void BhkDISABLE(BHK *hk, which) =for hackers Found in file op.h =item BhkENABLE X Re-enable an entry in this BHK structure, by setting the appropriate flag. I is a preprocessor token indicating which entry to enable. This will assert (under -DDEBUGGING) if the entry doesn't contain a valid pointer. NOTE: this function is experimental and may change or be removed without notice. void BhkENABLE(BHK *hk, which) =for hackers Found in file op.h =item BhkENTRY_set X Set an entry in the BHK structure, and set the flags to indicate it is valid. I is a preprocessing token indicating which entry to set. The type of I depends on the entry. NOTE: this function is experimental and may change or be removed without notice. void BhkENTRY_set(BHK *hk, which, void *ptr) =for hackers Found in file op.h =item blockhook_register X Register a set of hooks to be called when the Perl lexical scope changes at compile time. See L. NOTE: this function is experimental and may change or be removed without notice. NOTE: this function must be explicitly called as Perl_blockhook_register with an aTHX_ parameter. void Perl_blockhook_register(pTHX_ BHK *hk) =for hackers Found in file op.c =back =head1 COP Hint Hashes =over 8 =item cophh_2hv X Generates and returns a standard Perl hash representing the full set of key/value pairs in the cop hints hash I. I is currently unused and must be zero. NOTE: this function is experimental and may change or be removed without notice. HV * cophh_2hv(const COPHH *cophh, U32 flags) =for hackers Found in file cop.h =item cophh_copy X Make and return a complete copy of the cop hints hash I. NOTE: this function is experimental and may change or be removed without notice. COPHH * cophh_copy(COPHH *cophh) =for hackers Found in file cop.h =item cophh_delete_pv X Like L, but takes a nul-terminated string instead of a string/length pair. NOTE: this function is experimental and may change or be removed without notice. COPHH * cophh_delete_pv(const COPHH *cophh, const char *key, U32 hash, U32 flags) =for hackers Found in file cop.h =item cophh_delete_pvn X Delete a key and its associated value from the cop hints hash I, and returns the modified hash. The returned hash pointer is in general not the same as the hash pointer that was passed in. The input hash is consumed by the function, and the pointer to it must not be subsequently used. Use L if you need both hashes. The key is specified by I and I. If I has the C bit set, the key octets are interpreted as UTF-8, otherwise they are interpreted as Latin-1. I is a precomputed hash of the key string, or zero if it has not been precomputed. NOTE: this function is experimental and may change or be removed without notice. COPHH * cophh_delete_pvn(COPHH *cophh, const char *keypv, STRLEN keylen, U32 hash, U32 flags) =for hackers Found in file cop.h =item cophh_delete_pvs X Like L, but takes a literal string instead of a string/length pair, and no precomputed hash. NOTE: this function is experimental and may change or be removed without notice. COPHH * cophh_delete_pvs(const COPHH *cophh, const char *key, U32 flags) =for hackers Found in file cop.h =item cophh_delete_sv X Like L, but takes a Perl scalar instead of a string/length pair. NOTE: this function is experimental and may change or be removed without notice. COPHH * cophh_delete_sv(const COPHH *cophh, SV *key, U32 hash, U32 flags) =for hackers Found in file cop.h =item cophh_fetch_pv X Like L, but takes a nul-terminated string instead of a string/length pair. NOTE: this function is experimental and may change or be removed without notice. SV * cophh_fetch_pv(const COPHH *cophh, const char *key, U32 hash, U32 flags) =for hackers Found in file cop.h =item cophh_fetch_pvn X Look up the entry in the cop hints hash I with the key specified by I and I. If I has the C bit set, the key octets are interpreted as UTF-8, otherwise they are interpreted as Latin-1. I is a precomputed hash of the key string, or zero if it has not been precomputed. Returns a mortal scalar copy of the value associated with the key, or C<&PL_sv_placeholder> if there is no value associated with the key. NOTE: this function is experimental and may change or be removed without notice. SV * cophh_fetch_pvn(const COPHH *cophh, const char *keypv, STRLEN keylen, U32 hash, U32 flags) =for hackers Found in file cop.h =item cophh_fetch_pvs X Like L, but takes a literal string instead of a string/length pair, and no precomputed hash. NOTE: this function is experimental and may change or be removed without notice. SV * cophh_fetch_pvs(const COPHH *cophh, const char *key, U32 flags) =for hackers Found in file cop.h =item cophh_fetch_sv X Like L, but takes a Perl scalar instead of a string/length pair. NOTE: this function is experimental and may change or be removed without notice. SV * cophh_fetch_sv(const COPHH *cophh, SV *key, U32 hash, U32 flags) =for hackers Found in file cop.h =item cophh_free X Discard the cop hints hash I, freeing all resources associated with it. NOTE: this function is experimental and may change or be removed without notice. void cophh_free(COPHH *cophh) =for hackers Found in file cop.h =item cophh_new_empty X Generate and return a fresh cop hints hash containing no entries. NOTE: this function is experimental and may change or be removed without notice. COPHH * cophh_new_empty() =for hackers Found in file cop.h =item cophh_store_pv X Like L, but takes a nul-terminated string instead of a string/length pair. NOTE: this function is experimental and may change or be removed without notice. COPHH * cophh_store_pv(const COPHH *cophh, const char *key, U32 hash, SV *value, U32 flags) =for hackers Found in file cop.h =item cophh_store_pvn X Stores a value, associated with a key, in the cop hints hash I, and returns the modified hash. The returned hash pointer is in general not the same as the hash pointer that was passed in. The input hash is consumed by the function, and the pointer to it must not be subsequently used. Use L if you need both hashes. The key is specified by I and I. If I has the C bit set, the key octets are interpreted as UTF-8, otherwise they are interpreted as Latin-1. I is a precomputed hash of the key string, or zero if it has not been precomputed. I is the scalar value to store for this key. I is copied by this function, which thus does not take ownership of any reference to it, and later changes to the scalar will not be reflected in the value visible in the cop hints hash. Complex types of scalar will not be stored with referential integrity, but will be coerced to strings. NOTE: this function is experimental and may change or be removed without notice. COPHH * cophh_store_pvn(COPHH *cophh, const char *keypv, STRLEN keylen, U32 hash, SV *value, U32 flags) =for hackers Found in file cop.h =item cophh_store_pvs X Like L, but takes a literal string instead of a string/length pair, and no precomputed hash. NOTE: this function is experimental and may change or be removed without notice. COPHH * cophh_store_pvs(const COPHH *cophh, const char *key, SV *value, U32 flags) =for hackers Found in file cop.h =item cophh_store_sv X Like L, but takes a Perl scalar instead of a string/length pair. NOTE: this function is experimental and may change or be removed without notice. COPHH * cophh_store_sv(const COPHH *cophh, SV *key, U32 hash, SV *value, U32 flags) =for hackers Found in file cop.h =back =head1 COP Hint Reading =over 8 =item cop_hints_2hv X Generates and returns a standard Perl hash representing the full set of hint entries in the cop I. I is currently unused and must be zero. HV * cop_hints_2hv(const COP *cop, U32 flags) =for hackers Found in file cop.h =item cop_hints_fetch_pv X Like L, but takes a nul-terminated string instead of a string/length pair. SV * cop_hints_fetch_pv(const COP *cop, const char *key, U32 hash, U32 flags) =for hackers Found in file cop.h =item cop_hints_fetch_pvn X Look up the hint entry in the cop I with the key specified by I and I. If I has the C bit set, the key octets are interpreted as UTF-8, otherwise they are interpreted as Latin-1. I is a precomputed hash of the key string, or zero if it has not been precomputed. Returns a mortal scalar copy of the value associated with the key, or C<&PL_sv_placeholder> if there is no value associated with the key. SV * cop_hints_fetch_pvn(const COP *cop, const char *keypv, STRLEN keylen, U32 hash, U32 flags) =for hackers Found in file cop.h =item cop_hints_fetch_pvs X Like L, but takes a literal string instead of a string/length pair, and no precomputed hash. SV * cop_hints_fetch_pvs(const COP *cop, const char *key, U32 flags) =for hackers Found in file cop.h =item cop_hints_fetch_sv X Like L, but takes a Perl scalar instead of a string/length pair. SV * cop_hints_fetch_sv(const COP *cop, SV *key, U32 hash, U32 flags) =for hackers Found in file cop.h =back =head1 Custom Operators =over 8 =item custom_op_register X Register a custom op. See L. NOTE: this function must be explicitly called as Perl_custom_op_register with an aTHX_ parameter. void Perl_custom_op_register(pTHX_ Perl_ppaddr_t ppaddr, const XOP *xop) =for hackers Found in file op.c =item custom_op_xop X Return the XOP structure for a given custom op. This function should be considered internal to OP_NAME and the other access macros: use them instead. NOTE: this function must be explicitly called as Perl_custom_op_xop with an aTHX_ parameter. const XOP * Perl_custom_op_xop(pTHX_ const OP *o) =for hackers Found in file op.c =item XopDISABLE X Temporarily disable a member of the XOP, by clearing the appropriate flag. void XopDISABLE(XOP *xop, which) =for hackers Found in file op.h =item XopENABLE X Reenable a member of the XOP which has been disabled. void XopENABLE(XOP *xop, which) =for hackers Found in file op.h =item XopENTRY X Return a member of the XOP structure. I is a cpp token indicating which entry to return. If the member is not set this will return a default value. The return type depends on I. XopENTRY(XOP *xop, which) =for hackers Found in file op.h =item XopENTRY_set X Set a member of the XOP structure. I is a cpp token indicating which entry to set. See L for details about the available members and how they are used. void XopENTRY_set(XOP *xop, which, value) =for hackers Found in file op.h =item XopFLAGS X Return the XOP's flags. U32 XopFLAGS(XOP *xop) =for hackers Found in file op.h =back =head1 CV Manipulation Functions =over 8 =item CvSTASH X Returns the stash of the CV. HV* CvSTASH(CV* cv) =for hackers Found in file cv.h =item get_cv X Uses C to get the length of C, then calls C. NOTE: the perl_ form of this function is deprecated. CV* get_cv(const char* name, I32 flags) =for hackers Found in file perl.c =item get_cvn_flags X Returns the CV of the specified Perl subroutine. C are passed to C. If C is set and the Perl subroutine does not exist then it will be declared (which has the same effect as saying C). If C is not set and the subroutine does not exist then NULL is returned. NOTE: the perl_ form of this function is deprecated. CV* get_cvn_flags(const char* name, STRLEN len, I32 flags) =for hackers Found in file perl.c =back =head1 Embedding Functions =over 8 =item cv_undef X Clear out all the active components of a CV. This can happen either by an explicit C, or by the reference count going to zero. In the former case, we keep the CvOUTSIDE pointer, so that any anonymous children can still follow the full lexical scope chain. void cv_undef(CV* cv) =for hackers Found in file pad.c =item load_module X Loads the module whose name is pointed to by the string part of name. Note that the actual module name, not its filename, should be given. Eg, "Foo::Bar" instead of "Foo/Bar.pm". flags can be any of PERL_LOADMOD_DENY, PERL_LOADMOD_NOIMPORT, or PERL_LOADMOD_IMPORT_OPS (or 0 for no flags). ver, if specified, provides version semantics similar to C. The optional trailing SV* arguments can be used to specify arguments to the module's import() method, similar to C. They must be terminated with a final NULL pointer. Note that this list can only be omitted when the PERL_LOADMOD_NOIMPORT flag has been used. Otherwise at least a single NULL pointer to designate the default import list is required. void load_module(U32 flags, SV* name, SV* ver, ...) =for hackers Found in file op.c =item nothreadhook X Stub that provides thread hook for perl_destruct when there are no threads. int nothreadhook() =for hackers Found in file perl.c =item pad_findmy X Given a lexical name, try to find its offset, first in the current pad, or failing that, in the pads of any lexically enclosing subs (including the complications introduced by eval). If the name is found in an outer pad, then a fake entry is added to the current pad. Returns the offset in the current pad, or NOT_IN_PAD on failure. NOTE: this function is experimental and may change or be removed without notice. PADOFFSET pad_findmy(const char* name, STRLEN len, U32 flags) =for hackers Found in file pad.c =item pad_sv X Get the value at offset po in the current pad. Use macro PAD_SV instead of calling this function directly. SV* pad_sv(PADOFFSET po) =for hackers Found in file pad.c =item perl_alloc X Allocates a new Perl interpreter. See L. PerlInterpreter* perl_alloc() =for hackers Found in file perl.c =item perl_construct X Initializes a new Perl interpreter. See L. void perl_construct(PerlInterpreter *my_perl) =for hackers Found in file perl.c =item perl_destruct X Shuts down a Perl interpreter. See L. int perl_destruct(PerlInterpreter *my_perl) =for hackers Found in file perl.c =item perl_free X Releases a Perl interpreter. See L. void perl_free(PerlInterpreter *my_perl) =for hackers Found in file perl.c =item perl_parse X Tells a Perl interpreter to parse a Perl script. See L. int perl_parse(PerlInterpreter *my_perl, XSINIT_t xsinit, int argc, char** argv, char** env) =for hackers Found in file perl.c =item perl_run X Tells a Perl interpreter to run. See L. int perl_run(PerlInterpreter *my_perl) =for hackers Found in file perl.c =item require_pv X Tells Perl to C the file named by the string argument. It is analogous to the Perl code C. It's even implemented that way; consider using load_module instead. NOTE: the perl_ form of this function is deprecated. void require_pv(const char* pv) =for hackers Found in file perl.c =back =head1 Functions in file dump.c =over 8 =item pv_display X Similar to pv_escape(dsv,pv,cur,pvlim,PERL_PV_ESCAPE_QUOTE); except that an additional "\0" will be appended to the string when len > cur and pv[cur] is "\0". Note that the final string may be up to 7 chars longer than pvlim. char* pv_display(SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim) =for hackers Found in file dump.c =item pv_escape X Escapes at most the first "count" chars of pv and puts the results into dsv such that the size of the escaped string will not exceed "max" chars and will not contain any incomplete escape sequences. If flags contains PERL_PV_ESCAPE_QUOTE then any double quotes in the string will also be escaped. Normally the SV will be cleared before the escaped string is prepared, but when PERL_PV_ESCAPE_NOCLEAR is set this will not occur. If PERL_PV_ESCAPE_UNI is set then the input string is treated as Unicode, if PERL_PV_ESCAPE_UNI_DETECT is set then the input string is scanned using C to determine if it is Unicode. If PERL_PV_ESCAPE_ALL is set then all input chars will be output using C<\x01F1> style escapes, otherwise if PERL_PV_ESCAPE_NONASCII is set, only chars above 127 will be escaped using this style; otherwise, only chars above 255 will be so escaped; other non printable chars will use octal or common escaped patterns like C<\n>. Otherwise, if PERL_PV_ESCAPE_NOBACKSLASH then all chars below 255 will be treated as printable and will be output as literals. If PERL_PV_ESCAPE_FIRSTCHAR is set then only the first char of the string will be escaped, regardless of max. If the output is to be in hex, then it will be returned as a plain hex sequence. Thus the output will either be a single char, an octal escape sequence, a special escape like C<\n> or a hex value. If PERL_PV_ESCAPE_RE is set then the escape char used will be a '%' and not a '\\'. This is because regexes very often contain backslashed sequences, whereas '%' is not a particularly common character in patterns. Returns a pointer to the escaped text as held by dsv. char* pv_escape(SV *dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags) =for hackers Found in file dump.c =item pv_pretty X Converts a string into something presentable, handling escaping via pv_escape() and supporting quoting and ellipses. If the PERL_PV_PRETTY_QUOTE flag is set then the result will be double quoted with any double quotes in the string escaped. Otherwise if the PERL_PV_PRETTY_LTGT flag is set then the result be wrapped in angle brackets. If the PERL_PV_PRETTY_ELLIPSES flag is set and not all characters in string were output then an ellipsis C<...> will be appended to the string. Note that this happens AFTER it has been quoted. If start_color is non-null then it will be inserted after the opening quote (if there is one) but before the escaped text. If end_color is non-null then it will be inserted after the escaped text but before any quotes or ellipses. Returns a pointer to the prettified text as held by dsv. char* pv_pretty(SV *dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags) =for hackers Found in file dump.c =back =head1 Functions in file mathoms.c =over 8 =item custom_op_desc X Return the description of a given custom op. This was once used by the OP_DESC macro, but is no longer: it has only been kept for compatibility, and should not be used. const char * custom_op_desc(const OP *o) =for hackers Found in file mathoms.c =item custom_op_name X Return the name for a given custom op. This was once used by the OP_NAME macro, but is no longer: it has only been kept for compatibility, and should not be used. const char * custom_op_name(const OP *o) =for hackers Found in file mathoms.c =item gv_fetchmethod X See L. GV* gv_fetchmethod(HV* stash, const char* name) =for hackers Found in file mathoms.c =item pack_cat X The engine implementing pack() Perl function. Note: parameters next_in_list and flags are not used. This call should not be used; use packlist instead. void pack_cat(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags) =for hackers Found in file mathoms.c =item sv_2pvbyte_nolen X Return a pointer to the byte-encoded representation of the SV. May cause the SV to be downgraded from UTF-8 as a side-effect. Usually accessed via the C macro. char* sv_2pvbyte_nolen(SV* sv) =for hackers Found in file mathoms.c =item sv_2pvutf8_nolen X Return a pointer to the UTF-8-encoded representation of the SV. May cause the SV to be upgraded to UTF-8 as a side-effect. Usually accessed via the C macro. char* sv_2pvutf8_nolen(SV* sv) =for hackers Found in file mathoms.c =item sv_2pv_nolen X Like C, but doesn't return the length too. You should usually use the macro wrapper C instead. char* sv_2pv_nolen(SV* sv) =for hackers Found in file mathoms.c =item sv_catpvn_mg X Like C, but also handles 'set' magic. void sv_catpvn_mg(SV *sv, const char *ptr, STRLEN len) =for hackers Found in file mathoms.c =item sv_catsv_mg X Like C, but also handles 'set' magic. void sv_catsv_mg(SV *dsv, SV *ssv) =for hackers Found in file mathoms.c =item sv_force_normal X Undo various types of fakery on an SV: if the PV is a shared string, make a private copy; if we're a ref, stop refing; if we're a glob, downgrade to an xpvmg. See also C. void sv_force_normal(SV *sv) =for hackers Found in file mathoms.c =item sv_iv X A private implementation of the C macro for compilers which can't cope with complex macro expressions. Always use the macro instead. IV sv_iv(SV* sv) =for hackers Found in file mathoms.c =item sv_nolocking X Dummy routine which "locks" an SV when there is no locking module present. Exists to avoid test for a NULL function pointer and because it could potentially warn under some level of strict-ness. "Superseded" by sv_nosharing(). void sv_nolocking(SV *sv) =for hackers Found in file mathoms.c =item sv_nounlocking X Dummy routine which "unlocks" an SV when there is no locking module present. Exists to avoid test for a NULL function pointer and because it could potentially warn under some level of strict-ness. "Superseded" by sv_nosharing(). void sv_nounlocking(SV *sv) =for hackers Found in file mathoms.c =item sv_nv X A private implementation of the C macro for compilers which can't cope with complex macro expressions. Always use the macro instead. NV sv_nv(SV* sv) =for hackers Found in file mathoms.c =item sv_pv X Use the C macro instead char* sv_pv(SV *sv) =for hackers Found in file mathoms.c =item sv_pvbyte X Use C instead. char* sv_pvbyte(SV *sv) =for hackers Found in file mathoms.c =item sv_pvbyten X A private implementation of the C macro for compilers which can't cope with complex macro expressions. Always use the macro instead. char* sv_pvbyten(SV *sv, STRLEN *lp) =for hackers Found in file mathoms.c =item sv_pvn X A private implementation of the C macro for compilers which can't cope with complex macro expressions. Always use the macro instead. char* sv_pvn(SV *sv, STRLEN *lp) =for hackers Found in file mathoms.c =item sv_pvutf8 X Use the C macro instead char* sv_pvutf8(SV *sv) =for hackers Found in file mathoms.c =item sv_pvutf8n X A private implementation of the C macro for compilers which can't cope with complex macro expressions. Always use the macro instead. char* sv_pvutf8n(SV *sv, STRLEN *lp) =for hackers Found in file mathoms.c =item sv_taint X Taint an SV. Use C instead. void sv_taint(SV* sv) =for hackers Found in file mathoms.c =item sv_unref X Unsets the RV status of the SV, and decrements the reference count of whatever was being referenced by the RV. This can almost be thought of as a reversal of C. This is C with the C being zero. See C. void sv_unref(SV* sv) =for hackers Found in file mathoms.c =item sv_usepvn X Tells an SV to use C to find its string value. Implemented by calling C with C of 0, hence does not handle 'set' magic. See C. void sv_usepvn(SV* sv, char* ptr, STRLEN len) =for hackers Found in file mathoms.c =item sv_usepvn_mg X Like C, but also handles 'set' magic. void sv_usepvn_mg(SV *sv, char *ptr, STRLEN len) =for hackers Found in file mathoms.c =item sv_uv X A private implementation of the C macro for compilers which can't cope with complex macro expressions. Always use the macro instead. UV sv_uv(SV* sv) =for hackers Found in file mathoms.c =item unpack_str X The engine implementing unpack() Perl function. Note: parameters strbeg, new_s and ocnt are not used. This call should not be used, use unpackstring instead. I32 unpack_str(const char *pat, const char *patend, const char *s, const char *strbeg, const char *strend, char **new_s, I32 ocnt, U32 flags) =for hackers Found in file mathoms.c =back =head1 Functions in file op.c =over 8 =item op_contextualize X Applies a syntactic context to an op tree representing an expression. I is the op tree, and I must be C, C, or C to specify the context to apply. The modified op tree is returned. OP * op_contextualize(OP *o, I32 context) =for hackers Found in file op.c =back =head1 Functions in file perl.h =over 8 =item PERL_SYS_INIT X Provides system-specific tune up of the C runtime environment necessary to run Perl interpreters. This should be called only once, before creating any Perl interpreters. void PERL_SYS_INIT(int argc, char** argv) =for hackers Found in file perl.h =item PERL_SYS_INIT3 X Provides system-specific tune up of the C runtime environment necessary to run Perl interpreters. This should be called only once, before creating any Perl interpreters. void PERL_SYS_INIT3(int argc, char** argv, char** env) =for hackers Found in file perl.h =item PERL_SYS_TERM X Provides system-specific clean up of the C runtime environment after running Perl interpreters. This should be called only once, after freeing any remaining Perl interpreters. void PERL_SYS_TERM() =for hackers Found in file perl.h =back =head1 Functions in file pp_ctl.c =over 8 =item caller_cx X The XSUB-writer's equivalent of L. The returned C structure can be interrogated to find all the information returned to Perl by C. Note that XSUBs don't get a stack frame, so C will return information for the immediately-surrounding Perl code. This function skips over the automatic calls to C<&DB::sub> made on the behalf of the debugger. If the stack frame requested was a sub called by C, the return value will be the frame for the call to C, since that has the correct line number/etc. for the call site. If I is non-C, it will be set to a pointer to the frame for the sub call itself. const PERL_CONTEXT * caller_cx(I32 level, const PERL_CONTEXT **dbcxp) =for hackers Found in file pp_ctl.c =item find_runcv X Locate the CV corresponding to the currently executing sub or eval. If db_seqp is non_null, skip CVs that are in the DB package and populate *db_seqp with the cop sequence number at the point that the DB:: code was entered. (allows debuggers to eval in the scope of the breakpoint rather than in the scope of the debugger itself). CV* find_runcv(U32 *db_seqp) =for hackers Found in file pp_ctl.c =back =head1 Functions in file pp_pack.c =over 8 =item packlist X The engine implementing pack() Perl function. void packlist(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist) =for hackers Found in file pp_pack.c =item unpackstring X The engine implementing unpack() Perl function. C puts the extracted list items on the stack and returns the number of elements. Issue C before and C after the call to this function. I32 unpackstring(const char *pat, const char *patend, const char *s, const char *strend, U32 flags) =for hackers Found in file pp_pack.c =back =head1 Functions in file pp_sys.c =over 8 =item setdefout X Sets PL_defoutgv, the default file handle for output, to the passed in typeglob. As PL_defoutgv "owns" a reference on its typeglob, the reference count of the passed in typeglob is increased by one, and the reference count of the typeglob that PL_defoutgv points to is decreased by one. void setdefout(GV* gv) =for hackers Found in file pp_sys.c =back =head1 Functions in file utf8.h =over 8 =item ibcmp_utf8 X This is a synonym for (! foldEQ_utf8()) I32 ibcmp_utf8(const char *s1, char **pe1, UV l1, bool u1, const char *s2, char **pe2, UV l2, bool u2) =for hackers Found in file utf8.h =back =head1 Functions in file util.h =over 8 =item ibcmp X This is a synonym for (! foldEQ()) I32 ibcmp(const char* a, const char* b, I32 len) =for hackers Found in file util.h =item ibcmp_locale X This is a synonym for (! foldEQ_locale()) I32 ibcmp_locale(const char* a, const char* b, I32 len) =for hackers Found in file util.h =back =head1 Global Variables =over 8 =item PL_keyword_plugin X Function pointer, pointing at a function used to handle extended keywords. The function should be declared as int keyword_plugin_function(pTHX_ char *keyword_ptr, STRLEN keyword_len, OP **op_ptr) The function is called from the tokeniser, whenever a possible keyword is seen. C points at the word in the parser's input buffer, and C gives its length; it is not null-terminated. The function is expected to examine the word, and possibly other state such as L<%^H|perlvar/%^H>, to decide whether it wants to handle it as an extended keyword. If it does not, the function should return C, and the normal parser process will continue. If the function wants to handle the keyword, it first must parse anything following the keyword that is part of the syntax introduced by the keyword. See L for details. When a keyword is being handled, the plugin function must build a tree of C structures, representing the code that was parsed. The root of the tree must be stored in C<*op_ptr>. The function then returns a constant indicating the syntactic role of the construct that it has parsed: C if it is a complete statement, or C if it is an expression. Note that a statement construct cannot be used inside an expression (except via C and similar), and an expression is not a complete statement (it requires at least a terminating semicolon). When a keyword is handled, the plugin function may also have (compile-time) side effects. It may modify C<%^H>, define functions, and so on. Typically, if side effects are the main purpose of a handler, it does not wish to generate any ops to be included in the normal compilation. In this case it is still required to supply an op tree, but it suffices to generate a single null op. That's how the C<*PL_keyword_plugin> function needs to behave overall. Conventionally, however, one does not completely replace the existing handler function. Instead, take a copy of C before assigning your own function pointer to it. Your handler function should look for keywords that it is interested in and handle those. Where it is not interested, it should call the saved plugin function, passing on the arguments it received. Thus C actually points at a chain of handler functions, all of which have an opportunity to handle keywords, and only the last function in the chain (built into the Perl core) will normally return C. NOTE: this function is experimental and may change or be removed without notice. =for hackers Found in file perlvars.h =back =head1 GV Functions =over 8 =item GvSV X Return the SV from the GV. SV* GvSV(GV* gv) =for hackers Found in file gv.h =item gv_const_sv X If C is a typeglob whose subroutine entry is a constant sub eligible for inlining, or C is a placeholder reference that would be promoted to such a typeglob, then returns the value returned by the sub. Otherwise, returns NULL. SV* gv_const_sv(GV* gv) =for hackers Found in file gv.c =item gv_fetchmeth X Returns the glob with the given C and a defined subroutine or C. The glob lives in the given C, or in the stashes accessible via @ISA and UNIVERSAL::. The argument C should be either 0 or -1. If C, as a side-effect creates a glob with the given C in the given C which in the case of success contains an alias for the subroutine, and sets up caching info for this glob. This function grants C<"SUPER"> token as a postfix of the stash name. The GV returned from C may be a method cache entry, which is not visible to Perl code. So when calling C, you should not use the GV directly; instead, you should use the method's CV, which can be obtained from the GV with the C macro. GV* gv_fetchmeth(HV* stash, const char* name, STRLEN len, I32 level) =for hackers Found in file gv.c =item gv_fetchmethod_autoload X Returns the glob which contains the subroutine to call to invoke the method on the C. In fact in the presence of autoloading this may be the glob for "AUTOLOAD". In this case the corresponding variable $AUTOLOAD is already setup. The third parameter of C determines whether AUTOLOAD lookup is performed if the given method is not present: non-zero means yes, look for AUTOLOAD; zero means no, don't look for AUTOLOAD. Calling C is equivalent to calling C with a non-zero C parameter. These functions grant C<"SUPER"> token as a prefix of the method name. Note that if you want to keep the returned glob for a long time, you need to check for it being "AUTOLOAD", since at the later time the call may load a different subroutine due to $AUTOLOAD changing its value. Use the glob created via a side effect to do this. These functions have the same side-effects and as C with C. C should be writable if contains C<':'> or C<' ''>. The warning against passing the GV returned by C to C apply equally to these functions. GV* gv_fetchmethod_autoload(HV* stash, const char* name, I32 autoload) =for hackers Found in file gv.c =item gv_fetchmeth_autoload X Same as gv_fetchmeth(), but looks for autoloaded subroutines too. Returns a glob for the subroutine. For an autoloaded subroutine without a GV, will create a GV even if C. For an autoloaded subroutine without a stub, GvCV() of the result may be zero. GV* gv_fetchmeth_autoload(HV* stash, const char* name, STRLEN len, I32 level) =for hackers Found in file gv.c =item gv_stashpv X Returns a pointer to the stash for a specified package. Uses C to determine the length of C, then calls C. HV* gv_stashpv(const char* name, I32 flags) =for hackers Found in file gv.c =item gv_stashpvn X Returns a pointer to the stash for a specified package. The C parameter indicates the length of the C, in bytes. C is passed to C, so if set to C then the package will be created if it does not already exist. If the package does not exist and C is 0 (or any other setting that does not create packages) then NULL is returned. HV* gv_stashpvn(const char* name, U32 namelen, I32 flags) =for hackers Found in file gv.c =item gv_stashpvs X Like C, but takes a literal string instead of a string/length pair. HV* gv_stashpvs(const char* name, I32 create) =for hackers Found in file handy.h =item gv_stashsv X Returns a pointer to the stash for a specified package. See C. HV* gv_stashsv(SV* sv, I32 flags) =for hackers Found in file gv.c =back =head1 Handy Values =over 8 =item Nullav X Null AV pointer. (deprecated - use C<(AV *)NULL> instead) =for hackers Found in file av.h =item Nullch X Null character pointer. (No longer available when C is defined.) =for hackers Found in file handy.h =item Nullcv X Null CV pointer. (deprecated - use C<(CV *)NULL> instead) =for hackers Found in file cv.h =item Nullhv X Null HV pointer. (deprecated - use C<(HV *)NULL> instead) =for hackers Found in file hv.h =item Nullsv X Null SV pointer. (No longer available when C is defined.) =for hackers Found in file handy.h =back =head1 Hash Manipulation Functions =over 8 =item get_hv X Returns the HV of the specified Perl hash. C are passed to C. If C is set and the Perl variable does not exist then it will be created. If C is zero and the variable does not exist then NULL is returned. NOTE: the perl_ form of this function is deprecated. HV* get_hv(const char *name, I32 flags) =for hackers Found in file perl.c =item HEf_SVKEY X This flag, used in the length slot of hash entries and magic structures, specifies the structure contains an C pointer where a C pointer is to be expected. (For information only--not to be used). =for hackers Found in file hv.h =item HeHASH X Returns the computed hash stored in the hash entry. U32 HeHASH(HE* he) =for hackers Found in file hv.h =item HeKEY X Returns the actual pointer stored in the key slot of the hash entry. The pointer may be either C or C, depending on the value of C. Can be assigned to. The C or C macros are usually preferable for finding the value of a key. void* HeKEY(HE* he) =for hackers Found in file hv.h =item HeKLEN X If this is negative, and amounts to C, it indicates the entry holds an C key. Otherwise, holds the actual length of the key. Can be assigned to. The C macro is usually preferable for finding key lengths. STRLEN HeKLEN(HE* he) =for hackers Found in file hv.h =item HePV X Returns the key slot of the hash entry as a C value, doing any necessary dereferencing of possibly C keys. The length of the string is placed in C (this is a macro, so do I use C<&len>). If you do not care about what the length of the key is, you may use the global variable C, though this is rather less efficient than using a local variable. Remember though, that hash keys in perl are free to contain embedded nulls, so using C or similar is not a good way to find the length of hash keys. This is very similar to the C macro described elsewhere in this document. See also C. If you are using C to get values to pass to C to create a new SV, you should consider using C as it is more efficient. char* HePV(HE* he, STRLEN len) =for hackers Found in file hv.h =item HeSVKEY X Returns the key as an C, or C if the hash entry does not contain an C key. SV* HeSVKEY(HE* he) =for hackers Found in file hv.h =item HeSVKEY_force X Returns the key as an C. Will create and return a temporary mortal C if the hash entry contains only a C key. SV* HeSVKEY_force(HE* he) =for hackers Found in file hv.h =item HeSVKEY_set X Sets the key to a given C, taking care to set the appropriate flags to indicate the presence of an C key, and returns the same C. SV* HeSVKEY_set(HE* he, SV* sv) =for hackers Found in file hv.h =item HeUTF8 X Returns whether the C value returned by C is encoded in UTF-8, doing any necessary dereferencing of possibly C keys. The value returned will be 0 or non-0, not necessarily 1 (or even a value with any low bits set), so B blindly assign this to a C variable, as C may be a typedef for C. char* HeUTF8(HE* he) =for hackers Found in file hv.h =item HeVAL X Returns the value slot (type C) stored in the hash entry. SV* HeVAL(HE* he) =for hackers Found in file hv.h =item HvENAME X Returns the effective name of a stash, or NULL if there is none. The effective name represents a location in the symbol table where this stash resides. It is updated automatically when packages are aliased or deleted. A stash that is no longer in the symbol table has no effective name. This name is preferable to C for use in MRO linearisations and isa caches. char* HvENAME(HV* stash) =for hackers Found in file hv.h =item HvNAME X Returns the package name of a stash, or NULL if C isn't a stash. See C, C. char* HvNAME(HV* stash) =for hackers Found in file hv.h =item hv_assert X Check that a hash is in an internally consistent state. void hv_assert(HV *hv) =for hackers Found in file hv.c =item hv_clear X Clears a hash, making it empty. void hv_clear(HV *hv) =for hackers Found in file hv.c =item hv_clear_placeholders X Clears any placeholders from a hash. If a restricted hash has any of its keys marked as readonly and the key is subsequently deleted, the key is not actually deleted but is marked by assigning it a value of &PL_sv_placeholder. This tags it so it will be ignored by future operations such as iterating over the hash, but will still allow the hash to have a value reassigned to the key at some future point. This function clears any such placeholder keys from the hash. See Hash::Util::lock_keys() for an example of its use. void hv_clear_placeholders(HV *hv) =for hackers Found in file hv.c =item hv_copy_hints_hv X A specialised version of L for copying C<%^H>. I must be a pointer to a hash (which may have C<%^H> magic, but should be generally non-magical), or C (interpreted as an empty hash). The content of I is copied to a new hash, which has the C<%^H>-specific magic added to it. A pointer to the new hash is returned. HV * hv_copy_hints_hv(HV *ohv) =for hackers Found in file hv.c =item hv_delete X Deletes a key/value pair in the hash. The value's SV is removed from the hash, made mortal, and returned to the caller. The C is the length of the key. The C value will normally be zero; if set to G_DISCARD then NULL will be returned. NULL will also be returned if the key is not found. SV* hv_delete(HV *hv, const char *key, I32 klen, I32 flags) =for hackers Found in file hv.c =item hv_delete_ent X Deletes a key/value pair in the hash. The value SV is removed from the hash, made mortal, and returned to the caller. The C value will normally be zero; if set to G_DISCARD then NULL will be returned. NULL will also be returned if the key is not found. C can be a valid precomputed hash value, or 0 to ask for it to be computed. SV* hv_delete_ent(HV *hv, SV *keysv, I32 flags, U32 hash) =for hackers Found in file hv.c =item hv_exists X Returns a boolean indicating whether the specified hash key exists. The C is the length of the key. bool hv_exists(HV *hv, const char *key, I32 klen) =for hackers Found in file hv.c =item hv_exists_ent X Returns a boolean indicating whether the specified hash key exists. C can be a valid precomputed hash value, or 0 to ask for it to be computed. bool hv_exists_ent(HV *hv, SV *keysv, U32 hash) =for hackers Found in file hv.c =item hv_fetch X Returns the SV which corresponds to the specified key in the hash. The C is the length of the key. If C is set then the fetch will be part of a store. Check that the return value is non-null before dereferencing it to an C. See L for more information on how to use this function on tied hashes. SV** hv_fetch(HV *hv, const char *key, I32 klen, I32 lval) =for hackers Found in file hv.c =item hv_fetchs X Like C, but takes a literal string instead of a string/length pair. SV** hv_fetchs(HV* tb, const char* key, I32 lval) =for hackers Found in file handy.h =item hv_fetch_ent X Returns the hash entry which corresponds to the specified key in the hash. C must be a valid precomputed hash number for the given C, or 0 if you want the function to compute it. IF C is set then the fetch will be part of a store. Make sure the return value is non-null before accessing it. The return value when C is a tied hash is a pointer to a static location, so be sure to make a copy of the structure if you need to store it somewhere. See L for more information on how to use this function on tied hashes. HE* hv_fetch_ent(HV *hv, SV *keysv, I32 lval, U32 hash) =for hackers Found in file hv.c =item hv_fill X Returns the number of hash buckets that happen to be in use. This function is wrapped by the macro C. Previously this value was stored in the HV structure, rather than being calculated on demand. STRLEN hv_fill(HV const *const hv) =for hackers Found in file hv.c =item hv_iterinit X Prepares a starting point to traverse a hash table. Returns the number of keys in the hash (i.e. the same as C). The return value is currently only meaningful for hashes without tie magic. NOTE: Before version 5.004_65, C used to return the number of hash buckets that happen to be in use. If you still need that esoteric value, you can get it through the macro C. I32 hv_iterinit(HV *hv) =for hackers Found in file hv.c =item hv_iterkey X Returns the key from the current position of the hash iterator. See C. char* hv_iterkey(HE* entry, I32* retlen) =for hackers Found in file hv.c =item hv_iterkeysv X Returns the key as an C from the current position of the hash iterator. The return value will always be a mortal copy of the key. Also see C. SV* hv_iterkeysv(HE* entry) =for hackers Found in file hv.c =item hv_iternext X Returns entries from a hash iterator. See C. You may call C or C on the hash entry that the iterator currently points to, without losing your place or invalidating your iterator. Note that in this case the current entry is deleted from the hash with your iterator holding the last reference to it. Your iterator is flagged to free the entry on the next call to C, so you must not discard your iterator immediately else the entry will leak - call C to trigger the resource deallocation. HE* hv_iternext(HV *hv) =for hackers Found in file hv.c =item hv_iternextsv X Performs an C, C, and C in one operation. SV* hv_iternextsv(HV *hv, char **key, I32 *retlen) =for hackers Found in file hv.c =item hv_iternext_flags X Returns entries from a hash iterator. See C and C. The C value will normally be zero; if HV_ITERNEXT_WANTPLACEHOLDERS is set the placeholders keys (for restricted hashes) will be returned in addition to normal keys. By default placeholders are automatically skipped over. Currently a placeholder is implemented with a value that is C<&Perl_sv_placeholder>. Note that the implementation of placeholders and restricted hashes may change, and the implementation currently is insufficiently abstracted for any change to be tidy. NOTE: this function is experimental and may change or be removed without notice. HE* hv_iternext_flags(HV *hv, I32 flags) =for hackers Found in file hv.c =item hv_iterval X Returns the value from the current position of the hash iterator. See C. SV* hv_iterval(HV *hv, HE *entry) =for hackers Found in file hv.c =item hv_magic X Adds magic to a hash. See C. void hv_magic(HV *hv, GV *gv, int how) =for hackers Found in file hv.c =item hv_scalar X Evaluates the hash in scalar context and returns the result. Handles magic when the hash is tied. SV* hv_scalar(HV *hv) =for hackers Found in file hv.c =item hv_store X Stores an SV in a hash. The hash key is specified as C and C is the length of the key. The C parameter is the precomputed hash value; if it is zero then Perl will compute it. The return value will be NULL if the operation failed or if the value did not need to be actually stored within the hash (as in the case of tied hashes). Otherwise it can be dereferenced to get the original C. Note that the caller is responsible for suitably incrementing the reference count of C before the call, and decrementing it if the function returned NULL. Effectively a successful hv_store takes ownership of one reference to C. This is usually what you want; a newly created SV has a reference count of one, so if all your code does is create SVs then store them in a hash, hv_store will own the only reference to the new SV, and your code doesn't need to do anything further to tidy up. hv_store is not implemented as a call to hv_store_ent, and does not create a temporary SV for the key, so if your key data is not already in SV form then use hv_store in preference to hv_store_ent. See L for more information on how to use this function on tied hashes. SV** hv_store(HV *hv, const char *key, I32 klen, SV *val, U32 hash) =for hackers Found in file hv.c =item hv_stores X Like C, but takes a literal string instead of a string/length pair and omits the hash parameter. SV** hv_stores(HV* tb, const char* key, NULLOK SV* val) =for hackers Found in file handy.h =item hv_store_ent X Stores C in a hash. The hash key is specified as C. The C parameter is the precomputed hash value; if it is zero then Perl will compute it. The return value is the new hash entry so created. It will be NULL if the operation failed or if the value did not need to be actually stored within the hash (as in the case of tied hashes). Otherwise the contents of the return value can be accessed using the C macros described here. Note that the caller is responsible for suitably incrementing the reference count of C before the call, and decrementing it if the function returned NULL. Effectively a successful hv_store_ent takes ownership of one reference to C. This is usually what you want; a newly created SV has a reference count of one, so if all your code does is create SVs then store them in a hash, hv_store will own the only reference to the new SV, and your code doesn't need to do anything further to tidy up. Note that hv_store_ent only reads the C; unlike C it does not take ownership of it, so maintaining the correct reference count on C is entirely the caller's responsibility. hv_store is not implemented as a call to hv_store_ent, and does not create a temporary SV for the key, so if your key data is not already in SV form then use hv_store in preference to hv_store_ent. See L for more information on how to use this function on tied hashes. HE* hv_store_ent(HV *hv, SV *key, SV *val, U32 hash) =for hackers Found in file hv.c =item hv_undef X Undefines the hash. void hv_undef(HV *hv) =for hackers Found in file hv.c =item newHV X Creates a new HV. The reference count is set to 1. HV* newHV() =for hackers Found in file hv.h =back =head1 Lexer interface =over 8 =item lex_bufutf8 X Indicates whether the octets in the lexer buffer (Llinestr>) should be interpreted as the UTF-8 encoding of Unicode characters. If not, they should be interpreted as Latin-1 characters. This is analogous to the C flag for scalars. In UTF-8 mode, it is not guaranteed that the lexer buffer actually contains valid UTF-8. Lexing code must be robust in the face of invalid encoding. The actual C flag of the Llinestr> scalar is significant, but not the whole story regarding the input character encoding. Normally, when a file is being read, the scalar contains octets and its C flag is off, but the octets should be interpreted as UTF-8 if the C pragma is in effect. During a string eval, however, the scalar may have the C flag on, and in this case its octets should be interpreted as UTF-8 unless the C pragma is in effect. This logic may change in the future; use this function instead of implementing the logic yourself. NOTE: this function is experimental and may change or be removed without notice. bool lex_bufutf8() =for hackers Found in file toke.c =item lex_discard_to X Discards the first part of the Llinestr> buffer, up to I. The remaining content of the buffer will be moved, and all pointers into the buffer updated appropriately. I must not be later in the buffer than the position of Lbufptr>: it is not permitted to discard text that has yet to be lexed. Normally it is not necessarily to do this directly, because it suffices to use the implicit discarding behaviour of L and things based on it. However, if a token stretches across multiple lines, and the lexing code has kept multiple lines of text in the buffer for that purpose, then after completion of the token it would be wise to explicitly discard the now-unneeded earlier lines, to avoid future multi-line tokens growing the buffer without bound. NOTE: this function is experimental and may change or be removed without notice. void lex_discard_to(char *ptr) =for hackers Found in file toke.c =item lex_grow_linestr X Reallocates the lexer buffer (Llinestr>) to accommodate at least I octets (including terminating NUL). Returns a pointer to the reallocated buffer. This is necessary before making any direct modification of the buffer that would increase its length. L provides a more convenient way to insert text into the buffer. Do not use C or C directly on Clinestr>; this function updates all of the lexer's variables that point directly into the buffer. NOTE: this function is experimental and may change or be removed without notice. char * lex_grow_linestr(STRLEN len) =for hackers Found in file toke.c =item lex_next_chunk X Reads in the next chunk of text to be lexed, appending it to Llinestr>. This should be called when lexing code has looked to the end of the current chunk and wants to know more. It is usual, but not necessary, for lexing to have consumed the entirety of the current chunk at this time. If Lbufptr> is pointing to the very end of the current chunk (i.e., the current chunk has been entirely consumed), normally the current chunk will be discarded at the same time that the new chunk is read in. If I includes C, the current chunk will not be discarded. If the current chunk has not been entirely consumed, then it will not be discarded regardless of the flag. Returns true if some new text was added to the buffer, or false if the buffer has reached the end of the input text. NOTE: this function is experimental and may change or be removed without notice. bool lex_next_chunk(U32 flags) =for hackers Found in file toke.c =item lex_peek_unichar X Looks ahead one (Unicode) character in the text currently being lexed. Returns the codepoint (unsigned integer value) of the next character, or -1 if lexing has reached the end of the input text. To consume the peeked character, use L. If the next character is in (or extends into) the next chunk of input text, the next chunk will be read in. Normally the current chunk will be discarded at the same time, but if I includes C then the current chunk will not be discarded. If the input is being interpreted as UTF-8 and a UTF-8 encoding error is encountered, an exception is generated. NOTE: this function is experimental and may change or be removed without notice. I32 lex_peek_unichar(U32 flags) =for hackers Found in file toke.c =item lex_read_space X Reads optional spaces, in Perl style, in the text currently being lexed. The spaces may include ordinary whitespace characters and Perl-style comments. C<#line> directives are processed if encountered. Lbufptr> is moved past the spaces, so that it points at a non-space character (or the end of the input text). If spaces extend into the next chunk of input text, the next chunk will be read in. Normally the current chunk will be discarded at the same time, but if I includes C then the current chunk will not be discarded. NOTE: this function is experimental and may change or be removed without notice. void lex_read_space(U32 flags) =for hackers Found in file toke.c =item lex_read_to X Consume text in the lexer buffer, from Lbufptr> up to I. This advances Lbufptr> to match I, performing the correct bookkeeping whenever a newline character is passed. This is the normal way to consume lexed text. Interpretation of the buffer's octets can be abstracted out by using the slightly higher-level functions L and L. NOTE: this function is experimental and may change or be removed without notice. void lex_read_to(char *ptr) =for hackers Found in file toke.c =item lex_read_unichar X Reads the next (Unicode) character in the text currently being lexed. Returns the codepoint (unsigned integer value) of the character read, and moves Lbufptr> past the character, or returns -1 if lexing has reached the end of the input text. To non-destructively examine the next character, use L instead. If the next character is in (or extends into) the next chunk of input text, the next chunk will be read in. Normally the current chunk will be discarded at the same time, but if I includes C then the current chunk will not be discarded. If the input is being interpreted as UTF-8 and a UTF-8 encoding error is encountered, an exception is generated. NOTE: this function is experimental and may change or be removed without notice. I32 lex_read_unichar(U32 flags) =for hackers Found in file toke.c =item lex_start X Creates and initialises a new lexer/parser state object, supplying a context in which to lex and parse from a new source of Perl code. A pointer to the new state object is placed in L. An entry is made on the save stack so that upon unwinding the new state object will be destroyed and the former value of L will be restored. Nothing else need be done to clean up the parsing context. The code to be parsed comes from I and I. I, if non-null, provides a string (in SV form) containing code to be parsed. A copy of the string is made, so subsequent modification of I does not affect parsing. I, if non-null, provides an input stream from which code will be read to be parsed. If both are non-null, the code in I comes first and must consist of complete lines of input, and I supplies the remainder of the source. The I parameter is reserved for future use, and must always be zero, except for one flag that is currently reserved for perl's internal use. NOTE: this function is experimental and may change or be removed without notice. void lex_start(SV *line, PerlIO *rsfp, U32 flags) =for hackers Found in file toke.c =item lex_stuff_pv X Insert characters into the lexer buffer (Llinestr>), immediately after the current lexing point (Lbufptr>), reallocating the buffer if necessary. This means that lexing code that runs later will see the characters as if they had appeared in the input. It is not recommended to do this as part of normal parsing, and most uses of this facility run the risk of the inserted characters being interpreted in an unintended manner. The string to be inserted is represented by octets starting at I and continuing to the first nul. These octets are interpreted as either UTF-8 or Latin-1, according to whether the C flag is set in I. The characters are recoded for the lexer buffer, according to how the buffer is currently being interpreted (L). If it is not convenient to nul-terminate a string to be inserted, the L function is more appropriate. NOTE: this function is experimental and may change or be removed without notice. void lex_stuff_pv(const char *pv, U32 flags) =for hackers Found in file toke.c =item lex_stuff_pvn X Insert characters into the lexer buffer (Llinestr>), immediately after the current lexing point (Lbufptr>), reallocating the buffer if necessary. This means that lexing code that runs later will see the characters as if they had appeared in the input. It is not recommended to do this as part of normal parsing, and most uses of this facility run the risk of the inserted characters being interpreted in an unintended manner. The string to be inserted is represented by I octets starting at I. These octets are interpreted as either UTF-8 or Latin-1, according to whether the C flag is set in I. The characters are recoded for the lexer buffer, according to how the buffer is currently being interpreted (L). If a string to be inserted is available as a Perl scalar, the L function is more convenient. NOTE: this function is experimental and may change or be removed without notice. void lex_stuff_pvn(const char *pv, STRLEN len, U32 flags) =for hackers Found in file toke.c =item lex_stuff_pvs X Like L, but takes a literal string instead of a string/length pair. NOTE: this function is experimental and may change or be removed without notice. void lex_stuff_pvs(const char *pv, U32 flags) =for hackers Found in file handy.h =item lex_stuff_sv X Insert characters into the lexer buffer (Llinestr>), immediately after the current lexing point (Lbufptr>), reallocating the buffer if necessary. This means that lexing code that runs later will see the characters as if they had appeared in the input. It is not recommended to do this as part of normal parsing, and most uses of this facility run the risk of the inserted characters being interpreted in an unintended manner. The string to be inserted is the string value of I. The characters are recoded for the lexer buffer, according to how the buffer is currently being interpreted (L). If a string to be inserted is not already a Perl scalar, the L function avoids the need to construct a scalar. NOTE: this function is experimental and may change or be removed without notice. void lex_stuff_sv(SV *sv, U32 flags) =for hackers Found in file toke.c =item lex_unstuff X Discards text about to be lexed, from Lbufptr> up to I. Text following I will be moved, and the buffer shortened. This hides the discarded text from any lexing code that runs later, as if the text had never appeared. This is not the normal way to consume lexed text. For that, use L. NOTE: this function is experimental and may change or be removed without notice. void lex_unstuff(char *ptr) =for hackers Found in file toke.c =item parse_arithexpr X Parse a Perl arithmetic expression. This may contain operators of precedence down to the bit shift operators. The expression must be followed (and thus terminated) either by a comparison or lower-precedence operator or by something that would normally terminate an expression such as semicolon. If I includes C then the expression is optional, otherwise it is mandatory. It is up to the caller to ensure that the dynamic parser state (L et al) is correctly set to reflect the source of the code to be parsed and the lexical context for the expression. The op tree representing the expression is returned. If an optional expression is absent, a null pointer is returned, otherwise the pointer will be non-null. If an error occurs in parsing or compilation, in most cases a valid op tree is returned anyway. The error is reflected in the parser state, normally resulting in a single exception at the top level of parsing which covers all the compilation errors that occurred. Some compilation errors, however, will throw an exception immediately. NOTE: this function is experimental and may change or be removed without notice. OP * parse_arithexpr(U32 flags) =for hackers Found in file toke.c =item parse_barestmt X Parse a single unadorned Perl statement. This may be a normal imperative statement or a declaration that has compile-time effect. It does not include any label or other affixture. It is up to the caller to ensure that the dynamic parser state (L et al) is correctly set to reflect the source of the code to be parsed and the lexical context for the statement. The op tree representing the statement is returned. This may be a null pointer if the statement is null, for example if it was actually a subroutine definition (which has compile-time side effects). If not null, it will be ops directly implementing the statement, suitable to pass to L. It will not normally include a C or equivalent op (except for those embedded in a scope contained entirely within the statement). If an error occurs in parsing or compilation, in most cases a valid op tree (most likely null) is returned anyway. The error is reflected in the parser state, normally resulting in a single exception at the top level of parsing which covers all the compilation errors that occurred. Some compilation errors, however, will throw an exception immediately. The I parameter is reserved for future use, and must always be zero. NOTE: this function is experimental and may change or be removed without notice. OP * parse_barestmt(U32 flags) =for hackers Found in file toke.c =item parse_block X Parse a single complete Perl code block. This consists of an opening brace, a sequence of statements, and a closing brace. The block constitutes a lexical scope, so C variables and various compile-time effects can be contained within it. It is up to the caller to ensure that the dynamic parser state (L et al) is correctly set to reflect the source of the code to be parsed and the lexical context for the statement. The op tree representing the code block is returned. This is always a real op, never a null pointer. It will normally be a C list, including C or equivalent ops. No ops to construct any kind of runtime scope are included by virtue of it being a block. If an error occurs in parsing or compilation, in most cases a valid op tree (most likely null) is returned anyway. The error is reflected in the parser state, normally resulting in a single exception at the top level of parsing which covers all the compilation errors that occurred. Some compilation errors, however, will throw an exception immediately. The I parameter is reserved for future use, and must always be zero. NOTE: this function is experimental and may change or be removed without notice. OP * parse_block(U32 flags) =for hackers Found in file toke.c =item parse_fullexpr X Parse a single complete Perl expression. This allows the full expression grammar, including the lowest-precedence operators such as C. The expression must be followed (and thus terminated) by a token that an expression would normally be terminated by: end-of-file, closing bracketing punctuation, semicolon, or one of the keywords that signals a postfix expression-statement modifier. If I includes C then the expression is optional, otherwise it is mandatory. It is up to the caller to ensure that the dynamic parser state (L et al) is correctly set to reflect the source of the code to be parsed and the lexical context for the expression. The op tree representing the expression is returned. If an optional expression is absent, a null pointer is returned, otherwise the pointer will be non-null. If an error occurs in parsing or compilation, in most cases a valid op tree is returned anyway. The error is reflected in the parser state, normally resulting in a single exception at the top level of parsing which covers all the compilation errors that occurred. Some compilation errors, however, will throw an exception immediately. NOTE: this function is experimental and may change or be removed without notice. OP * parse_fullexpr(U32 flags) =for hackers Found in file toke.c =item parse_fullstmt X Parse a single complete Perl statement. This may be a normal imperative statement or a declaration that has compile-time effect, and may include optional labels. It is up to the caller to ensure that the dynamic parser state (L et al) is correctly set to reflect the source of the code to be parsed and the lexical context for the statement. The op tree representing the statement is returned. This may be a null pointer if the statement is null, for example if it was actually a subroutine definition (which has compile-time side effects). If not null, it will be the result of a L call, normally including a C or equivalent op. If an error occurs in parsing or compilation, in most cases a valid op tree (most likely null) is returned anyway. The error is reflected in the parser state, normally resulting in a single exception at the top level of parsing which covers all the compilation errors that occurred. Some compilation errors, however, will throw an exception immediately. The I parameter is reserved for future use, and must always be zero. NOTE: this function is experimental and may change or be removed without notice. OP * parse_fullstmt(U32 flags) =for hackers Found in file toke.c =item parse_label X Parse a single label, possibly optional, of the type that may prefix a Perl statement. It is up to the caller to ensure that the dynamic parser state (L et al) is correctly set to reflect the source of the code to be parsed. If I includes C then the label is optional, otherwise it is mandatory. The name of the label is returned in the form of a fresh scalar. If an optional label is absent, a null pointer is returned. If an error occurs in parsing, which can only occur if the label is mandatory, a valid label is returned anyway. The error is reflected in the parser state, normally resulting in a single exception at the top level of parsing which covers all the compilation errors that occurred. NOTE: this function is experimental and may change or be removed without notice. SV * parse_label(U32 flags) =for hackers Found in file toke.c =item parse_listexpr X Parse a Perl list expression. This may contain operators of precedence down to the comma operator. The expression must be followed (and thus terminated) either by a low-precedence logic operator such as C or by something that would normally terminate an expression such as semicolon. If I includes C then the expression is optional, otherwise it is mandatory. It is up to the caller to ensure that the dynamic parser state (L et al) is correctly set to reflect the source of the code to be parsed and the lexical context for the expression. The op tree representing the expression is returned. If an optional expression is absent, a null pointer is returned, otherwise the pointer will be non-null. If an error occurs in parsing or compilation, in most cases a valid op tree is returned anyway. The error is reflected in the parser state, normally resulting in a single exception at the top level of parsing which covers all the compilation errors that occurred. Some compilation errors, however, will throw an exception immediately. NOTE: this function is experimental and may change or be removed without notice. OP * parse_listexpr(U32 flags) =for hackers Found in file toke.c =item parse_stmtseq X Parse a sequence of zero or more Perl statements. These may be normal imperative statements, including optional labels, or declarations that have compile-time effect, or any mixture thereof. The statement sequence ends when a closing brace or end-of-file is encountered in a place where a new statement could have validly started. It is up to the caller to ensure that the dynamic parser state (L et al) is correctly set to reflect the source of the code to be parsed and the lexical context for the statements. The op tree representing the statement sequence is returned. This may be a null pointer if the statements were all null, for example if there were no statements or if there were only subroutine definitions (which have compile-time side effects). If not null, it will be a C list, normally including C or equivalent ops. If an error occurs in parsing or compilation, in most cases a valid op tree is returned anyway. The error is reflected in the parser state, normally resulting in a single exception at the top level of parsing which covers all the compilation errors that occurred. Some compilation errors, however, will throw an exception immediately. The I parameter is reserved for future use, and must always be zero. NOTE: this function is experimental and may change or be removed without notice. OP * parse_stmtseq(U32 flags) =for hackers Found in file toke.c =item parse_termexpr X Parse a Perl term expression. This may contain operators of precedence down to the assignment operators. The expression must be followed (and thus terminated) either by a comma or lower-precedence operator or by something that would normally terminate an expression such as semicolon. If I includes C then the expression is optional, otherwise it is mandatory. It is up to the caller to ensure that the dynamic parser state (L et al) is correctly set to reflect the source of the code to be parsed and the lexical context for the expression. The op tree representing the expression is returned. If an optional expression is absent, a null pointer is returned, otherwise the pointer will be non-null. If an error occurs in parsing or compilation, in most cases a valid op tree is returned anyway. The error is reflected in the parser state, normally resulting in a single exception at the top level of parsing which covers all the compilation errors that occurred. Some compilation errors, however, will throw an exception immediately. NOTE: this function is experimental and may change or be removed without notice. OP * parse_termexpr(U32 flags) =for hackers Found in file toke.c =item PL_parser X Pointer to a structure encapsulating the state of the parsing operation currently in progress. The pointer can be locally changed to perform a nested parse without interfering with the state of an outer parse. Individual members of C have their own documentation. =for hackers Found in file toke.c =item PL_parser-Ebufend Xbufend> Direct pointer to the end of the chunk of text currently being lexed, the end of the lexer buffer. This is equal to Clinestr) + SvCUR(PL_parser-Elinestr)>. A NUL character (zero octet) is always located at the end of the buffer, and does not count as part of the buffer's contents. NOTE: this function is experimental and may change or be removed without notice. =for hackers Found in file toke.c =item PL_parser-Ebufptr Xbufptr> Points to the current position of lexing inside the lexer buffer. Characters around this point may be freely examined, within the range delimited by Clinestr>)> and Lbufend>. The octets of the buffer may be intended to be interpreted as either UTF-8 or Latin-1, as indicated by L. Lexing code (whether in the Perl core or not) moves this pointer past the characters that it consumes. It is also expected to perform some bookkeeping whenever a newline character is consumed. This movement can be more conveniently performed by the function L, which handles newlines appropriately. Interpretation of the buffer's octets can be abstracted out by using the slightly higher-level functions L and L. NOTE: this function is experimental and may change or be removed without notice. =for hackers Found in file toke.c =item PL_parser-Elinestart Xlinestart> Points to the start of the current line inside the lexer buffer. This is useful for indicating at which column an error occurred, and not much else. This must be updated by any lexing code that consumes a newline; the function L handles this detail. NOTE: this function is experimental and may change or be removed without notice. =for hackers Found in file toke.c =item PL_parser-Elinestr Xlinestr> Buffer scalar containing the chunk currently under consideration of the text currently being lexed. This is always a plain string scalar (for which C is true). It is not intended to be used as a scalar by normal scalar means; instead refer to the buffer directly by the pointer variables described below. The lexer maintains various C pointers to things in the Clinestr> buffer. If Clinestr> is ever reallocated, all of these pointers must be updated. Don't attempt to do this manually, but rather use L if you need to reallocate the buffer. The content of the text chunk in the buffer is commonly exactly one complete line of input, up to and including a newline terminator, but there are situations where it is otherwise. The octets of the buffer may be intended to be interpreted as either UTF-8 or Latin-1. The function L tells you which. Do not use the C flag on this scalar, which may disagree with it. For direct examination of the buffer, the variable Lbufend> points to the end of the buffer. The current lexing position is pointed to by Lbufptr>. Direct use of these pointers is usually preferable to examination of the scalar through normal scalar means. NOTE: this function is experimental and may change or be removed without notice. =for hackers Found in file toke.c =back =head1 Magical Functions =over 8 =item mg_clear X Clear something magical that the SV represents. See C. int mg_clear(SV* sv) =for hackers Found in file mg.c =item mg_copy X Copies the magic from one SV to another. See C. int mg_copy(SV *sv, SV *nsv, const char *key, I32 klen) =for hackers Found in file mg.c =item mg_find X Finds the magic pointer for type matching the SV. See C. MAGIC* mg_find(const SV* sv, int type) =for hackers Found in file mg.c =item mg_findext X Finds the magic pointer of C with the given C for the C. See C. MAGIC* mg_findext(const SV* sv, int type, const MGVTBL *vtbl) =for hackers Found in file mg.c =item mg_free X Free any magic storage used by the SV. See C. int mg_free(SV* sv) =for hackers Found in file mg.c =item mg_free_type X Remove any magic of type I from the SV I. See L. void mg_free_type(SV *sv, int how) =for hackers Found in file mg.c =item mg_get X Do magic after a value is retrieved from the SV. See C. int mg_get(SV* sv) =for hackers Found in file mg.c =item mg_length X Report on the SV's length. See C. U32 mg_length(SV* sv) =for hackers Found in file mg.c =item mg_magical X Turns on the magical status of an SV. See C. void mg_magical(SV* sv) =for hackers Found in file mg.c =item mg_set X Do magic after a value is assigned to the SV. See C. int mg_set(SV* sv) =for hackers Found in file mg.c =item SvGETMAGIC X Invokes C on an SV if it has 'get' magic. This macro evaluates its argument more than once. void SvGETMAGIC(SV* sv) =for hackers Found in file sv.h =item SvLOCK X Arranges for a mutual exclusion lock to be obtained on sv if a suitable module has been loaded. void SvLOCK(SV* sv) =for hackers Found in file sv.h =item SvSETMAGIC X Invokes C on an SV if it has 'set' magic. This macro evaluates its argument more than once. void SvSETMAGIC(SV* sv) =for hackers Found in file sv.h =item SvSetMagicSV X Like C, but does any set magic required afterwards. void SvSetMagicSV(SV* dsb, SV* ssv) =for hackers Found in file sv.h =item SvSetMagicSV_nosteal X Like C, but does any set magic required afterwards. void SvSetMagicSV_nosteal(SV* dsv, SV* ssv) =for hackers Found in file sv.h =item SvSetSV X Calls C if dsv is not the same as ssv. May evaluate arguments more than once. void SvSetSV(SV* dsb, SV* ssv) =for hackers Found in file sv.h =item SvSetSV_nosteal X Calls a non-destructive version of C if dsv is not the same as ssv. May evaluate arguments more than once. void SvSetSV_nosteal(SV* dsv, SV* ssv) =for hackers Found in file sv.h =item SvSHARE X Arranges for sv to be shared between threads if a suitable module has been loaded. void SvSHARE(SV* sv) =for hackers Found in file sv.h =item SvUNLOCK X Releases a mutual exclusion lock on sv if a suitable module has been loaded. void SvUNLOCK(SV* sv) =for hackers Found in file sv.h =back =head1 Memory Management =over 8 =item Copy X The XSUB-writer's interface to the C C function. The C is the source, C is the destination, C is the number of items, and C is the type. May fail on overlapping copies. See also C. void Copy(void* src, void* dest, int nitems, type) =for hackers Found in file handy.h =item CopyD X Like C but returns dest. Useful for encouraging compilers to tail-call optimise. void * CopyD(void* src, void* dest, int nitems, type) =for hackers Found in file handy.h =item Move X The XSUB-writer's interface to the C C function. The C is the source, C is the destination, C is the number of items, and C is the type. Can do overlapping moves. See also C. void Move(void* src, void* dest, int nitems, type) =for hackers Found in file handy.h =item MoveD X Like C but returns dest. Useful for encouraging compilers to tail-call optimise. void * MoveD(void* src, void* dest, int nitems, type) =for hackers Found in file handy.h =item Newx X The XSUB-writer's interface to the C C function. In 5.9.3, Newx() and friends replace the older New() API, and drops the first parameter, I, a debug aid which allowed callers to identify themselves. This aid has been superseded by a new build option, PERL_MEM_LOG (see L). The older API is still there for use in XS modules supporting older perls. void Newx(void* ptr, int nitems, type) =for hackers Found in file handy.h =item Newxc X The XSUB-writer's interface to the C C function, with cast. See also C. void Newxc(void* ptr, int nitems, type, cast) =for hackers Found in file handy.h =item Newxz X The XSUB-writer's interface to the C C function. The allocated memory is zeroed with C. See also C. void Newxz(void* ptr, int nitems, type) =for hackers Found in file handy.h =item Poison X PoisonWith(0xEF) for catching access to freed memory. void Poison(void* dest, int nitems, type) =for hackers Found in file handy.h =item PoisonFree X PoisonWith(0xEF) for catching access to freed memory. void PoisonFree(void* dest, int nitems, type) =for hackers Found in file handy.h =item PoisonNew X PoisonWith(0xAB) for catching access to allocated but uninitialized memory. void PoisonNew(void* dest, int nitems, type) =for hackers Found in file handy.h =item PoisonWith X Fill up memory with a byte pattern (a byte repeated over and over again) that hopefully catches attempts to access uninitialized memory. void PoisonWith(void* dest, int nitems, type, U8 byte) =for hackers Found in file handy.h =item Renew X The XSUB-writer's interface to the C C function. void Renew(void* ptr, int nitems, type) =for hackers Found in file handy.h =item Renewc X The XSUB-writer's interface to the C C function, with cast. void Renewc(void* ptr, int nitems, type, cast) =for hackers Found in file handy.h =item Safefree X The XSUB-writer's interface to the C C function. void Safefree(void* ptr) =for hackers Found in file handy.h =item savepv X Perl's version of C. Returns a pointer to a newly allocated string which is a duplicate of C. The size of the string is determined by C. The memory allocated for the new string can be freed with the C function. char* savepv(const char* pv) =for hackers Found in file util.c =item savepvn X Perl's version of what C would be if it existed. Returns a pointer to a newly allocated string which is a duplicate of the first C bytes from C, plus a trailing NUL byte. The memory allocated for the new string can be freed with the C function. char* savepvn(const char* pv, I32 len) =for hackers Found in file util.c =item savepvs X Like C, but takes a literal string instead of a string/length pair. char* savepvs(const char* s) =for hackers Found in file handy.h =item savesharedpv X A version of C which allocates the duplicate string in memory which is shared between threads. char* savesharedpv(const char* pv) =for hackers Found in file util.c =item savesharedpvn X A version of C which allocates the duplicate string in memory which is shared between threads. (With the specific difference that a NULL pointer is not acceptable) char* savesharedpvn(const char *const pv, const STRLEN len) =for hackers Found in file util.c =item savesharedpvs X A version of C which allocates the duplicate string in memory which is shared between threads. char* savesharedpvs(const char* s) =for hackers Found in file handy.h =item savesharedsvpv X A version of C which allocates the duplicate string in memory which is shared between threads. char* savesharedsvpv(SV *sv) =for hackers Found in file util.c =item savesvpv X A version of C/C which gets the string to duplicate from the passed in SV using C char* savesvpv(SV* sv) =for hackers Found in file util.c =item StructCopy X This is an architecture-independent macro to copy one structure to another. void StructCopy(type src, type dest, type) =for hackers Found in file handy.h =item Zero X The XSUB-writer's interface to the C C function. The C is the destination, C is the number of items, and C is the type. void Zero(void* dest, int nitems, type) =for hackers Found in file handy.h =item ZeroD X Like C but returns dest. Useful for encouraging compilers to tail-call optimise. void * ZeroD(void* dest, int nitems, type) =for hackers Found in file handy.h =back =head1 Miscellaneous Functions =over 8 =item fbm_compile X Analyses the string in order to make fast searches on it using fbm_instr() -- the Boyer-Moore algorithm. void fbm_compile(SV* sv, U32 flags) =for hackers Found in file util.c =item fbm_instr X Returns the location of the SV in the string delimited by C and C. It returns C if the string can't be found. The C does not have to be fbm_compiled, but the search will not be as fast then. char* fbm_instr(unsigned char* big, unsigned char* bigend, SV* littlestr, U32 flags) =for hackers Found in file util.c =item foldEQ X Returns true if the leading len bytes of the strings s1 and s2 are the same case-insensitively; false otherwise. Uppercase and lowercase ASCII range bytes match themselves and their opposite case counterparts. Non-cased and non-ASCII range bytes match only themselves. I32 foldEQ(const char* a, const char* b, I32 len) =for hackers Found in file util.c =item foldEQ_locale X Returns true if the leading len bytes of the strings s1 and s2 are the same case-insensitively in the current locale; false otherwise. I32 foldEQ_locale(const char* a, const char* b, I32 len) =for hackers Found in file util.c =item form X
Takes a sprintf-style format pattern and conventional (non-SV) arguments and returns the formatted string. (char *) Perl_form(pTHX_ const char* pat, ...) can be used any place a string (char *) is required: char * s = Perl_form("%d.%d",major,minor); Uses a single private buffer so if you want to format several strings you must explicitly copy the earlier strings away (and free the copies when you are done). char* form(const char* pat, ...) =for hackers Found in file util.c =item getcwd_sv X Fill the sv with current working directory int getcwd_sv(SV* sv) =for hackers Found in file util.c =item mess X Take a sprintf-style format pattern and argument list. These are used to generate a string message. If the message does not end with a newline, then it will be extended with some indication of the current location in the code, as described for L. Normally, the resulting message is returned in a new mortal SV. During global destruction a single SV may be shared between uses of this function. SV * mess(const char *pat, ...) =for hackers Found in file util.c =item mess_sv X Expands a message, intended for the user, to include an indication of the current location in the code, if the message does not already appear to be complete. C is the initial message or object. If it is a reference, it will be used as-is and will be the result of this function. Otherwise it is used as a string, and if it already ends with a newline, it is taken to be complete, and the result of this function will be the same string. If the message does not end with a newline, then a segment such as C will be appended, and possibly other clauses indicating the current state of execution. The resulting message will end with a dot and a newline. Normally, the resulting message is returned in a new mortal SV. During global destruction a single SV may be shared between uses of this function. If C is true, then the function is permitted (but not required) to modify and return C instead of allocating a new SV. SV * mess_sv(SV *basemsg, bool consume) =for hackers Found in file util.c =item my_snprintf X The C library C functionality, if available and standards-compliant (uses C, actually). However, if the C is not available, will unfortunately use the unsafe C which can overrun the buffer (there is an overrun check, but that may be too late). Consider using C instead, or getting C. int my_snprintf(char *buffer, const Size_t len, const char *format, ...) =for hackers Found in file util.c =item my_sprintf X The C library C, wrapped if necessary, to ensure that it will return the length of the string written to the buffer. Only rare pre-ANSI systems need the wrapper function - usually this is a direct call to C. int my_sprintf(char *buffer, const char *pat, ...) =for hackers Found in file util.c =item my_vsnprintf X The C library C if available and standards-compliant. However, if if the C is not available, will unfortunately use the unsafe C which can overrun the buffer (there is an overrun check, but that may be too late). Consider using C instead, or getting C. int my_vsnprintf(char *buffer, const Size_t len, const char *format, va_list ap) =for hackers Found in file util.c =item new_version X Returns a new version object based on the passed in SV: SV *sv = new_version(SV *ver); Does not alter the passed in ver SV. See "upg_version" if you want to upgrade the SV. SV* new_version(SV *ver) =for hackers Found in file util.c =item prescan_version X Validate that a given string can be parsed as a version object, but doesn't actually perform the parsing. Can use either strict or lax validation rules. Can optionally set a number of hint variables to save the parsing code some time when tokenizing. const char* prescan_version(const char *s, bool strict, const char** errstr, bool *sqv, int *ssaw_decimal, int *swidth, bool *salpha) =for hackers Found in file util.c =item scan_version X Returns a pointer to the next character after the parsed version string, as well as upgrading the passed in SV to an RV. Function must be called with an already existing SV like sv = newSV(0); s = scan_version(s, SV *sv, bool qv); Performs some preprocessing to the string to ensure that it has the correct characteristics of a version. Flags the object if it contains an underscore (which denotes this is an alpha version). The boolean qv denotes that the version should be interpreted as if it had multiple decimals, even if it doesn't. const char* scan_version(const char *s, SV *rv, bool qv) =for hackers Found in file util.c =item strEQ X Test two strings to see if they are equal. Returns true or false. bool strEQ(char* s1, char* s2) =for hackers Found in file handy.h =item strGE X Test two strings to see if the first, C, is greater than or equal to the second, C. Returns true or false. bool strGE(char* s1, char* s2) =for hackers Found in file handy.h =item strGT X Test two strings to see if the first, C, is greater than the second, C. Returns true or false. bool strGT(char* s1, char* s2) =for hackers Found in file handy.h =item strLE X Test two strings to see if the first, C, is less than or equal to the second, C. Returns true or false. bool strLE(char* s1, char* s2) =for hackers Found in file handy.h =item strLT X Test two strings to see if the first, C, is less than the second, C. Returns true or false. bool strLT(char* s1, char* s2) =for hackers Found in file handy.h =item strNE X Test two strings to see if they are different. Returns true or false. bool strNE(char* s1, char* s2) =for hackers Found in file handy.h =item strnEQ X Test two strings to see if they are equal. The C parameter indicates the number of bytes to compare. Returns true or false. (A wrapper for C). bool strnEQ(char* s1, char* s2, STRLEN len) =for hackers Found in file handy.h =item strnNE X Test two strings to see if they are different. The C parameter indicates the number of bytes to compare. Returns true or false. (A wrapper for C). bool strnNE(char* s1, char* s2, STRLEN len) =for hackers Found in file handy.h =item sv_destroyable X Dummy routine which reports that object can be destroyed when there is no sharing module present. It ignores its single SV argument, and returns 'true'. Exists to avoid test for a NULL function pointer and because it could potentially warn under some level of strict-ness. bool sv_destroyable(SV *sv) =for hackers Found in file util.c =item sv_nosharing X Dummy routine which "shares" an SV when there is no sharing module present. Or "locks" it. Or "unlocks" it. In other words, ignores its single SV argument. Exists to avoid test for a NULL function pointer and because it could potentially warn under some level of strict-ness. void sv_nosharing(SV *sv) =for hackers Found in file util.c =item upg_version X In-place upgrade of the supplied SV to a version object. SV *sv = upg_version(SV *sv, bool qv); Returns a pointer to the upgraded SV. Set the boolean qv if you want to force this SV to be interpreted as an "extended" version. SV* upg_version(SV *ver, bool qv) =for hackers Found in file util.c =item vcmp X Version object aware cmp. Both operands must already have been converted into version objects. int vcmp(SV *lhv, SV *rhv) =for hackers Found in file util.c =item vmess X C and C are a sprintf-style format pattern and encapsulated argument list. These are used to generate a string message. If the message does not end with a newline, then it will be extended with some indication of the current location in the code, as described for L. Normally, the resulting message is returned in a new mortal SV. During global destruction a single SV may be shared between uses of this function. SV * vmess(const char *pat, va_list *args) =for hackers Found in file util.c =item vnormal X Accepts a version object and returns the normalized string representation. Call like: sv = vnormal(rv); NOTE: you can pass either the object directly or the SV contained within the RV. The SV returned has a refcount of 1. SV* vnormal(SV *vs) =for hackers Found in file util.c =item vnumify X Accepts a version object and returns the normalized floating point representation. Call like: sv = vnumify(rv); NOTE: you can pass either the object directly or the SV contained within the RV. The SV returned has a refcount of 1. SV* vnumify(SV *vs) =for hackers Found in file util.c =item vstringify X In order to maintain maximum compatibility with earlier versions of Perl, this function will return either the floating point notation or the multiple dotted notation, depending on whether the original version contained 1 or more dots, respectively. The SV returned has a refcount of 1. SV* vstringify(SV *vs) =for hackers Found in file util.c =item vverify X Validates that the SV contains valid internal structure for a version object. It may be passed either the version object (RV) or the hash itself (HV). If the structure is valid, it returns the HV. If the structure is invalid, it returns NULL. SV *hv = vverify(sv); Note that it only confirms the bare minimum structure (so as not to get confused by derived classes which may contain additional hash entries): SV* vverify(SV *vs) =for hackers Found in file util.c =back =head1 MRO Functions =over 8 =item mro_get_linear_isa X Returns either C or C for the given stash, dependant upon which MRO is in effect for that stash. The return value is a read-only AV*. You are responsible for C on the return value if you plan to store it anywhere semi-permanently (otherwise it might be deleted out from under you the next time the cache is invalidated). AV* mro_get_linear_isa(HV* stash) =for hackers Found in file mro.c =item mro_method_changed_in X Invalidates method caching on any child classes of the given stash, so that they might notice the changes in this one. Ideally, all instances of C in perl source outside of C should be replaced by calls to this. Perl automatically handles most of the common ways a method might be redefined. However, there are a few ways you could change a method in a stash without the cache code noticing, in which case you need to call this method afterwards: 1) Directly manipulating the stash HV entries from XS code. 2) Assigning a reference to a readonly scalar constant into a stash entry in order to create a constant subroutine (like constant.pm does). This same method is available from pure perl via, C. void mro_method_changed_in(HV* stash) =for hackers Found in file mro.c =back =head1 Multicall Functions =over 8 =item dMULTICALL X Declare local variables for a multicall. See L. dMULTICALL; =for hackers Found in file cop.h =item MULTICALL X Make a lightweight callback. See L. MULTICALL; =for hackers Found in file cop.h =item POP_MULTICALL X Closing bracket for a lightweight callback. See L. POP_MULTICALL; =for hackers Found in file cop.h =item PUSH_MULTICALL X Opening bracket for a lightweight callback. See L. PUSH_MULTICALL; =for hackers Found in file cop.h =back =head1 Numeric functions =over 8 =item grok_bin X converts a string representing a binary number to numeric form. On entry I and I<*len> give the string to scan, I<*flags> gives conversion flags, and I should be NULL or a pointer to an NV. The scan stops at the end of the string, or the first invalid character. Unless C is set in I<*flags>, encountering an invalid character will also trigger a warning. On return I<*len> is set to the length of the scanned string, and I<*flags> gives output flags. If the value is <= C it is returned as a UV, the output flags are clear, and nothing is written to I<*result>. If the value is > UV_MAX C returns UV_MAX, sets C in the output flags, and writes the value to I<*result> (or the value is discarded if I is NULL). The binary number may optionally be prefixed with "0b" or "b" unless C is set in I<*flags> on entry. If C is set in I<*flags> then the binary number may use '_' characters to separate digits. UV grok_bin(const char* start, STRLEN* len_p, I32* flags, NV *result) =for hackers Found in file numeric.c =item grok_hex X converts a string representing a hex number to numeric form. On entry I and I<*len> give the string to scan, I<*flags> gives conversion flags, and I should be NULL or a pointer to an NV. The scan stops at the end of the string, or the first invalid character. Unless C is set in I<*flags>, encountering an invalid character will also trigger a warning. On return I<*len> is set to the length of the scanned string, and I<*flags> gives output flags. If the value is <= UV_MAX it is returned as a UV, the output flags are clear, and nothing is written to I<*result>. If the value is > UV_MAX C returns UV_MAX, sets C in the output flags, and writes the value to I<*result> (or the value is discarded if I is NULL). The hex number may optionally be prefixed with "0x" or "x" unless C is set in I<*flags> on entry. If C is set in I<*flags> then the hex number may use '_' characters to separate digits. UV grok_hex(const char* start, STRLEN* len_p, I32* flags, NV *result) =for hackers Found in file numeric.c =item grok_number X Recognise (or not) a number. The type of the number is returned (0 if unrecognised), otherwise it is a bit-ORed combination of IS_NUMBER_IN_UV, IS_NUMBER_GREATER_THAN_UV_MAX, IS_NUMBER_NOT_INT, IS_NUMBER_NEG, IS_NUMBER_INFINITY, IS_NUMBER_NAN (defined in perl.h). If the value of the number can fit an in UV, it is returned in the *valuep IS_NUMBER_IN_UV will be set to indicate that *valuep is valid, IS_NUMBER_IN_UV will never be set unless *valuep is valid, but *valuep may have been assigned to during processing even though IS_NUMBER_IN_UV is not set on return. If valuep is NULL, IS_NUMBER_IN_UV will be set for the same cases as when valuep is non-NULL, but no actual assignment (or SEGV) will occur. IS_NUMBER_NOT_INT will be set with IS_NUMBER_IN_UV if trailing decimals were seen (in which case *valuep gives the true value truncated to an integer), and IS_NUMBER_NEG if the number is negative (in which case *valuep holds the absolute value). IS_NUMBER_IN_UV is not set if e notation was used or the number is larger than a UV. int grok_number(const char *pv, STRLEN len, UV *valuep) =for hackers Found in file numeric.c =item grok_numeric_radix X Scan and skip for a numeric decimal separator (radix). bool grok_numeric_radix(const char **sp, const char *send) =for hackers Found in file numeric.c =item grok_oct X converts a string representing an octal number to numeric form. On entry I and I<*len> give the string to scan, I<*flags> gives conversion flags, and I should be NULL or a pointer to an NV. The scan stops at the end of the string, or the first invalid character. Unless C is set in I<*flags>, encountering an 8 or 9 will also trigger a warning. On return I<*len> is set to the length of the scanned string, and I<*flags> gives output flags. If the value is <= UV_MAX it is returned as a UV, the output flags are clear, and nothing is written to I<*result>. If the value is > UV_MAX C returns UV_MAX, sets C in the output flags, and writes the value to I<*result> (or the value is discarded if I is NULL). If C is set in I<*flags> then the octal number may use '_' characters to separate digits. UV grok_oct(const char* start, STRLEN* len_p, I32* flags, NV *result) =for hackers Found in file numeric.c =item Perl_signbit X Return a non-zero integer if the sign bit on an NV is set, and 0 if it is not. If Configure detects this system has a signbit() that will work with our NVs, then we just use it via the #define in perl.h. Otherwise, fall back on this implementation. As a first pass, this gets everything right except -0.0. Alas, catching -0.0 is the main use for this function, so this is not too helpful yet. Still, at least we have the scaffolding in place to support other systems, should that prove useful. Configure notes: This function is called 'Perl_signbit' instead of a plain 'signbit' because it is easy to imagine a system having a signbit() function or macro that doesn't happen to work with our particular choice of NVs. We shouldn't just re-#define signbit as Perl_signbit and expect the standard system headers to be happy. Also, this is a no-context function (no pTHX_) because Perl_signbit() is usually re-#defined in perl.h as a simple macro call to the system's signbit(). Users should just always call Perl_signbit(). NOTE: this function is experimental and may change or be removed without notice. int Perl_signbit(NV f) =for hackers Found in file numeric.c =item scan_bin X For backwards compatibility. Use C instead. NV scan_bin(const char* start, STRLEN len, STRLEN* retlen) =for hackers Found in file numeric.c =item scan_hex X For backwards compatibility. Use C instead. NV scan_hex(const char* start, STRLEN len, STRLEN* retlen) =for hackers Found in file numeric.c =item scan_oct X For backwards compatibility. Use C instead. NV scan_oct(const char* start, STRLEN len, STRLEN* retlen) =for hackers Found in file numeric.c =back =head1 Optree construction =over 8 =item newASSIGNOP X Constructs, checks, and returns an assignment op. I and I supply the parameters of the assignment; they are consumed by this function and become part of the constructed op tree. If I is C, C, or C, then a suitable conditional optree is constructed. If I is the opcode of a binary operator, such as C, then an op is constructed that performs the binary operation and assigns the result to the left argument. Either way, if I is non-zero then I has no effect. If I is zero, then a plain scalar or list assignment is constructed. Which type of assignment it is is automatically determined. I gives the eight bits of C, except that C will be set automatically, and, shifted up eight bits, the eight bits of C, except that the bit with value 1 or 2 is automatically set as required. OP * newASSIGNOP(I32 flags, OP *left, I32 optype, OP *right) =for hackers Found in file op.c =item newBINOP X Constructs, checks, and returns an op of any binary type. I is the opcode. I gives the eight bits of C, except that C will be set automatically, and, shifted up eight bits, the eight bits of C, except that the bit with value 1 or 2 is automatically set as required. I and I supply up to two ops to be the direct children of the binary op; they are consumed by this function and become part of the constructed op tree. OP * newBINOP(I32 type, I32 flags, OP *first, OP *last) =for hackers Found in file op.c =item newCONDOP X Constructs, checks, and returns a conditional-expression (C) op. I gives the eight bits of C, except that C will be set automatically, and, shifted up eight bits, the eight bits of C, except that the bit with value 1 is automatically set. I supplies the expression selecting between the two branches, and I and I supply the branches; they are consumed by this function and become part of the constructed op tree. OP * newCONDOP(I32 flags, OP *first, OP *trueop, OP *falseop) =for hackers Found in file op.c =item newFOROP X Constructs, checks, and returns an op tree expressing a C loop (iteration through a list of values). This is a heavyweight loop, with structure that allows exiting the loop by C and suchlike. I optionally supplies the variable that will be aliased to each item in turn; if null, it defaults to C<$_> (either lexical or global). I supplies the list of values to iterate over. I supplies the main body of the loop, and I optionally supplies a C block that operates as a second half of the body. All of these optree inputs are consumed by this function and become part of the constructed op tree. I gives the eight bits of C for the C op and, shifted up eight bits, the eight bits of C for the C op, except that (in both cases) some bits will be set automatically. OP * newFOROP(I32 flags, OP *sv, OP *expr, OP *block, OP *cont) =for hackers Found in file op.c =item newGIVENOP X Constructs, checks, and returns an op tree expressing a C block. I supplies the expression that will be locally assigned to a lexical variable, and I supplies the body of the C construct; they are consumed by this function and become part of the constructed op tree. I is the pad offset of the scalar lexical variable that will be affected. OP * newGIVENOP(OP *cond, OP *block, PADOFFSET defsv_off) =for hackers Found in file op.c =item newGVOP X Constructs, checks, and returns an op of any type that involves an embedded reference to a GV. I is the opcode. I gives the eight bits of C. I identifies the GV that the op should reference; calling this function does not transfer ownership of any reference to it. OP * newGVOP(I32 type, I32 flags, GV *gv) =for hackers Found in file op.c =item newLISTOP X Constructs, checks, and returns an op of any list type. I is the opcode. I gives the eight bits of C, except that C will be set automatically if required. I and I supply up to two ops to be direct children of the list op; they are consumed by this function and become part of the constructed op tree. OP * newLISTOP(I32 type, I32 flags, OP *first, OP *last) =for hackers Found in file op.c =item newLOGOP X Constructs, checks, and returns a logical (flow control) op. I is the opcode. I gives the eight bits of C, except that C will be set automatically, and, shifted up eight bits, the eight bits of C, except that the bit with value 1 is automatically set. I supplies the expression controlling the flow, and I supplies the side (alternate) chain of ops; they are consumed by this function and become part of the constructed op tree. OP * newLOGOP(I32 type, I32 flags, OP *first, OP *other) =for hackers Found in file op.c =item newLOOPEX X Constructs, checks, and returns a loop-exiting op (such as C or C). I is the opcode. I